[ https://issues.apache.org/jira/browse/MNG-5877?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14742052#comment-14742052 ]
ASF GitHub Bot commented on MNG-5877: ------------------------------------- GitHub user josephw opened a pull request: https://github.com/apache/maven/pull/65 MNG-5877: Ensure that snapshot versions use the Gregorian calendar. Snapshot versioning should use the Gregorian calendar for consistency across systems. Apply the fix reported by Anders Forsell to make that explicit, and include a somewhat overengineered test to confirm that it's working. You can merge this pull request into a Git repository by running: $ git pull https://github.com/josephw/maven MNG-5877-use-gregorian-calendar-for-snapshot-versions Alternatively you can review and apply these changes as the patch at: https://github.com/apache/maven/pull/65.patch To close this pull request, make a commit to your master/trunk branch with (at least) the following in the commit message: This closes #65 ---- commit f3485c628a31fec38e0cf646942ec31f6a939015 Author: Joseph Walton <j...@kafsemo.org> Date: 2015-09-12T13:20:21Z MNG-5877: Ensure that snapshot versions use the Gregorian calendar. Snapshot versioning should use the Gregorian calendar for consistency across systems. Apply the fix reported by Anders Forsell to make that explicit, and include a somewhat overengineered test to confirm that it's working. ---- > maven-aether-provider does not always generate snapshot versions using > Gregorian calendar year > ----------------------------------------------------------------------------------------------- > > Key: MNG-5877 > URL: https://issues.apache.org/jira/browse/MNG-5877 > Project: Maven > Issue Type: Bug > Reporter: Anders Forsell > > I am using the maven-aether-provider in my software and have an issue when > Thailand users are publishing their snapshot versions get the Buddhist > calendar year (offset of 543 years). > I have located the problem to be in the RemoteSnapShotMetaData class: > {code:title=RemoteSnapShotMetaData.java|borderStyle=solid} > DateFormat utcDateFormatter = new SimpleDateFormat( > "yyyyMMdd.HHmmss" ); > utcDateFormatter.setTimeZone( TimeZone.getTimeZone( "UTC" ) ); > snapshot = new Snapshot(); > snapshot.setBuildNumber( getBuildNumber( recessive ) + 1 ); > snapshot.setTimestamp( utcDateFormatter.format( new Date() ) ); > {code} > The fix should be to explicitly set the calendar to be Gregorian: > {code:title=RemoteSnapShotMetaData.java|borderStyle=solid} > DateFormat utcDateFormatter = new SimpleDateFormat( > "yyyyMMdd.HHmmss" ); > utcDateFormatter.setTimeZone( TimeZone.getTimeZone( "UTC" ) ); > utcDateFormatter.setCalendar(new GregorianCalendar()); > snapshot = new Snapshot(); > snapshot.setBuildNumber( getBuildNumber( recessive ) + 1 ); > snapshot.setTimestamp( utcDateFormatter.format( new Date() ) ); > {code} -- This message was sent by Atlassian JIRA (v6.3.4#6332)