Uploaded image for project: 'Maven'
  1. Maven
  2. MNG-5877

maven-aether-provider/maven-compat does not always generate snapshot versions using Gregorian calendar year

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • None
    • 3.3.9
    • None
    • None

    Description

      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:

      RemoteSnapShotMetaData.java
                  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() ) );
      

      The fix should be to explicitly set the calendar to be Gregorian:

      RemoteSnapShotMetaData.java
                  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() ) );
      

      Attachments

        Activity

          People

            michael-o Michael Osipov
            aforsell Anders Forsell
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: