private static GeneralizedTime finishDecodingFraction(final String value,final int startPos,final int year,final int month,final int day,final int hour,final int minute,final int second,final int multiplier){
  final int length=value.length();
  final StringBuilder fractionBuffer=new StringBuilder((2 + length) - startPos);
  fractionBuffer.append("0.");
  TimeZone timeZone=null;
  outerLoop:   for (int i=startPos; i < length; i++) {
    final char c=value.charAt(i);
switch (c) {
case '0':
case '1':
case '2':
case '3':
case '4':
case '5':
case '6':
case '7':
case '8':
case '9':
      fractionBuffer.append(c);
    break;
case 'Z':
case 'z':
  if (i != (value.length() - 1)) {
    final LocalizableMessage message=WARN_ATTR_SYNTAX_GENERALIZED_TIME_ILLEGAL_FRACTION_CHAR.get(value,String.valueOf(c));
    throw new LocalizedIllegalArgumentException(message);
  }
timeZone=TIME_ZONE_UTC_OBJ;
break outerLoop;
case '+':
case '-':
timeZone=getTimeZoneForOffset(value,i);
break outerLoop;
default :
final LocalizableMessage message=WARN_ATTR_SYNTAX_GENERALIZED_TIME_ILLEGAL_FRACTION_CHAR.get(value,String.valueOf(c));
throw new LocalizedIllegalArgumentException(message);
}
}
if (fractionBuffer.length() == 2) {
final LocalizableMessage message=WARN_ATTR_SYNTAX_GENERALIZED_TIME_EMPTY_FRACTION.get(value);
throw new LocalizedIllegalArgumentException(message);
}
if (timeZone == null) {
final LocalizableMessage message=WARN_ATTR_SYNTAX_GENERALIZED_TIME_NO_TIME_ZONE_INFO.get(value);
throw new LocalizedIllegalArgumentException(message);
}
final Double fractionValue=Double.parseDouble(fractionBuffer.toString());
final int additionalMilliseconds=(int)Math.round(fractionValue * multiplier);
try {
final GregorianCalendar calendar=new GregorianCalendar();
calendar.setLenient(false);
calendar.setTimeZone(timeZone);
calendar.set(year,month,day,hour,minute,second);
calendar.set(Calendar.MILLISECOND,additionalMilliseconds);
return new GeneralizedTime(calendar,null,Long.MIN_VALUE,value);
}
 catch (final Exception e) {
final LocalizableMessage message=WARN_ATTR_SYNTAX_GENERALIZED_TIME_ILLEGAL_TIME.get(value,String.valueOf(e));
throw new LocalizedIllegalArgumentException(message,e);
}
}

private static GeneralizedTime finishDecodingFraction ( final String value , final int startPos , final int year , final int month , final int day , final int hour , final int minute , final int second , final int multiplier ) { final int length = value . length ( ) ; final StringBuilder fractionBuffer = new StringBuilder ( ( 2 + length ) - startPos ) ; fractionBuffer . append ( "0." ) ; TimeZone timeZone = null ; outerLoop : for ( int i = startPos ; i < length ; i ++ ) { final char c = value . charAt ( i ) ; switch ( c ) { case '0' : case '1' : case '2' : case '3' : case '4' : case '5' : case '6' : case '7' : case '8' : case '9' : fractionBuffer . append ( c ) ; break ; case 'Z' : case 'z' : if ( i != ( value . length ( ) - 1 ) ) { final LocalizableMessage message = WARN_ATTR_SYNTAX_GENERALIZED_TIME_ILLEGAL_FRACTION_CHAR . get ( value , String . valueOf ( c ) ) ; throw new LocalizedIllegalArgumentException ( message ) ; } timeZone = TIME_ZONE_UTC_OBJ ; break outerLoop ; case '+' : case '-' : timeZone = getTimeZoneForOffset ( value , i ) ; break outerLoop ; default : final LocalizableMessage message = WARN_ATTR_SYNTAX_GENERALIZED_TIME_ILLEGAL_FRACTION_CHAR . get ( value , String . valueOf ( c ) ) ; throw new LocalizedIllegalArgumentException ( message ) ; } } if ( fractionBuffer . length ( ) == 2 ) { final LocalizableMessage message = WARN_ATTR_SYNTAX_GENERALIZED_TIME_EMPTY_FRACTION . get ( value ) ; throw new LocalizedIllegalArgumentException ( message ) ; } if ( timeZone == null ) { final LocalizableMessage message = WARN_ATTR_SYNTAX_GENERALIZED_TIME_NO_TIME_ZONE_INFO . get ( value ) ; throw new LocalizedIllegalArgumentException ( message ) ; } final Double fractionValue = Double . parseDouble ( fractionBuffer . toString ( ) ) ; final int additionalMilliseconds = ( int ) Math . round ( fractionValue * multiplier ) ; try { final GregorianCalendar calendar = new GregorianCalendar ( ) ; calendar . setLenient ( false ) ; calendar . setTimeZone ( timeZone ) ; calendar . set ( year , month , day , hour , minute , second ) ; calendar . set ( Calendar . MILLISECOND , additionalMilliseconds ) ; return new GeneralizedTime ( calendar , null , Long . MIN_VALUE , value ) ; } catch ( final Exception e ) { final LocalizableMessage message = WARN_ATTR_SYNTAX_GENERALIZED_TIME_ILLEGAL_TIME . get ( value , String . valueOf ( e ) ) ; throw new LocalizedIllegalArgumentException ( message , e ) ; } }
completes decoding the generalized time value containing a fractional component . it will also decode the trailing ' z ' or offset .
