Uploaded image for project: 'Directory Client API'
  1. Directory Client API
  2. DIRAPI-241

new GeneralizedTime(String) fails for fraction close to one

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: 1.0.0-M30
    • Fix Version/s: 1.0.0-M32
    • Labels:
      None

      Description

      When parsing a time with a resolution of nanos (like generated by the openldap ppolicy overlay) it results in a Time that fails to be parsed by org.apache.directory.api.util.GeneralizedTime.GeneralizedTime(String)

      Test:

      Test.java
          static DateFormat FORMAT = new SimpleDateFormat( "dd/MM/yyyy HH:mm:ss.SSSS z" );
          
          @Test
          public void fractionCloseToOne() throws ParseException
          {
              GeneralizedTime close = new GeneralizedTime( "20000101000000.9994Z" );
              
              assertThat( close.getDate(), is( equalTo( FORMAT.parse( "01/01/2000 00:00:00.999 GMT" ) ) ) );
              
              GeneralizedTime closer = new GeneralizedTime( "20000101000000.9995Z" );
              
              assertThat( closer.getDate(), is( equalTo( FORMAT.parse( "01/01/2000 00:00:01 GMT" ) ) ) );
          }
      

        Attachments

          Activity

            People

            • Assignee:
              Unassigned
              Reporter:
              MaxFichtelmann Max Fichtelmann
            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: