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

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 3.3.9
    • Component/s: None
    • Labels:
      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

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

              Dates

              • Created:
                Updated:
                Resolved: