Buggy code:
public abstract class AbstractDateTimeDV extends TypeValidator { private static final boolean DEBUG = false ; protected static final int YEAR = 2000 ; protected static final int MONTH = 1 ; protected static final int DAY = 1 ; protected static final DatatypeFactory datatypeFactory = new DatatypeFactoryImpl ( ) ; public short getAllowedFacets ( ) { } public boolean isIdentical ( Object value1 , Object value2 ) { } public int compare ( Object value1 , Object value2 ) { } protected short compareDates ( AbstractDateTimeDV . DateTimeData date1 , AbstractDateTimeDV . DateTimeData date2 , boolean strict ) { } protected short compareOrder ( AbstractDateTimeDV . DateTimeData date1 , AbstractDateTimeDV . DateTimeData date2 ) { } protected void getTime ( String buffer , int start , int end , AbstractDateTimeDV . DateTimeData data ) throws RuntimeException { } protected int getDate ( String buffer , int start , int end , AbstractDateTimeDV . DateTimeData date ) throws RuntimeException { } protected int getYearMonth ( String buffer , int start , int end , AbstractDateTimeDV . DateTimeData date ) throws RuntimeException { } protected void parseTimeZone ( String buffer , int start , int end , AbstractDateTimeDV . DateTimeData date ) throws RuntimeException { } protected void getTimeZone ( String buffer , AbstractDateTimeDV . DateTimeData data , int sign , int end ) throws RuntimeException { } protected int indexOf ( String buffer , int start , int end , char ch ) { } protected void validateDateTime ( AbstractDateTimeDV . DateTimeData data ) { } protected int findUTCSign ( String buffer , int start , int end ) { } protected final boolean isNextCharUTCSign ( String buffer , int start , int end ) { } protected int parseInt ( String buffer , int start , int end ) throws NumberFormatException { } protected int parseIntYear ( String buffer , int end ) { } protected void normalize ( AbstractDateTimeDV . DateTimeData date ) { } protected void saveUnnormalized ( AbstractDateTimeDV . DateTimeData date ) { } protected void resetDateObj ( AbstractDateTimeDV . DateTimeData data ) { } protected int maxDayInMonthFor ( int year , int month ) { } private boolean isLeapYear ( int year ) { } protected int mod ( int a , int b , int quotient ) { } protected int fQuotient ( int a , int b ) { } protected int modulo ( int temp , int low , int high ) { } protected int fQuotient ( int temp , int low , int high ) { } protected String dateToString ( AbstractDateTimeDV . DateTimeData date ) { } protected final void append ( StringBuffer message , int value , int nch ) { if ( value == ( Integer . MIN_VALUE ) ) { message . append ( value ) ; return ; } if ( value < 0 ) { message . append ( '-' ) ; value = - value ; } if ( nch == 4 ) { if ( value < 10 ) message . append ( "000" ) ; else if ( value < 100 ) message . append ( "00" ) ; else if ( value < 1000 ) <START_BUG> message . append ( "0" ) ; <END_BUG> message . append ( value ) ; } else if ( nch == 2 ) { if ( value < 10 ) message . append ( '0' ) ; message . append ( value ) ; } else { if ( value != 0 ) message . append ( ( ( char ) ( value ) ) ) ; } } protected final void append ( StringBuffer message , double value ) { } protected final void append2 ( StringBuffer message , double value ) { } private void append3 ( StringBuffer message , double value ) { } protected double parseSecond ( String buffer , int start , int end ) throws NumberFormatException { } private void cloneDate ( AbstractDateTimeDV . DateTimeData finalValue , AbstractDateTimeDV . DateTimeData tempDate ) { } static final class DateTimeData implements XSDateTime { int year ; int month ; int day ; int hour ; int minute ; int utc ; double second ; int timezoneHr ; int timezoneMin ; private String originalValue ; boolean normalized = true ; int unNormYear ; int unNormMonth ; int unNormDay ; int unNormHour ; int unNormMinute ; double unNormSecond ; int position ; final AbstractDateTimeDV type ; private String canonical ; public DateTimeData ( String originalValue , AbstractDateTimeDV type ) { } public DateTimeData ( int year , int month , int day , int hour , int minute , double second , int utc , String originalValue , boolean normalized , AbstractDateTimeDV type ) { } public boolean equals ( Object obj ) { } public synchronized String toString ( ) { } public int getYears ( ) { } public int getMonths ( ) { } public int getDays ( ) { } public int getHours ( ) { } public int getMinutes ( ) { } public double getSeconds ( ) { } public boolean hasTimeZone ( ) { } public int getTimeZoneHours ( ) { } public int getTimeZoneMinutes ( ) { } public String getLexicalValue ( ) { } public XSDateTime normalize ( ) { } public boolean isNormalized ( ) { } public Object clone ( ) { } public XMLGregorianCalendar getXMLGregorianCalendar ( ) { } public Duration getDuration ( ) { } } protected XMLGregorianCalendar getXMLGregorianCalendar ( AbstractDateTimeDV . DateTimeData data ) { } protected Duration getDuration ( AbstractDateTimeDV . DateTimeData data ) { } protected final BigDecimal getFractionalSecondsAsBigDecimal ( AbstractDateTimeDV . DateTimeData data ) { } }

Fix:
message . append ( '0' ) ;