Buggy code:
public XSAnnotation fractionDigitsAnnotation ; public XSObjectListImpl patternAnnotations ; public XSObjectList enumerationAnnotations ; public XSAnnotation maxInclusiveAnnotation ; public XSAnnotation maxExclusiveAnnotation ; public XSAnnotation minInclusiveAnnotation ; public XSAnnotation minExclusiveAnnotation ; private XSObjectListImpl fFacets ; private XSObjectListImpl fMultiValueFacets ; private XSObjectList fAnnotations = null ; private short fPatternType = XSSimpleTypeDecl . SPECIAL_PATTERN_NONE ; private short fOrdered ; private boolean fFinite ; private boolean fBounded ; private boolean fNumeric ; public XSSimpleTypeDecl ( ) { } protected XSSimpleTypeDecl ( XSSimpleTypeDecl base , String name , short validateDV , short ordered , boolean bounded , boolean finite , boolean numeric , boolean isImmutable , short builtInKind ) { } protected XSSimpleTypeDecl ( XSSimpleTypeDecl base , String name , String uri , short finalSet , boolean isImmutable , XSObjectList annotations , short builtInKind ) { } protected XSSimpleTypeDecl ( XSSimpleTypeDecl base , String name , String uri , short finalSet , boolean isImmutable , XSObjectList annotations ) { } protected XSSimpleTypeDecl ( String name , String uri , short finalSet , XSSimpleTypeDecl itemType , boolean isImmutable , XSObjectList annotations ) { } protected XSSimpleTypeDecl ( String name , String uri , short finalSet , XSSimpleTypeDecl [ ] memberTypes , XSObjectList annotations ) { } protected XSSimpleTypeDecl setRestrictionValues ( XSSimpleTypeDecl base , String name , String uri , short finalSet , XSObjectList annotations ) { } protected XSSimpleTypeDecl setListValues ( String name , String uri , short finalSet , XSSimpleTypeDecl itemType , XSObjectList annotations ) { } protected XSSimpleTypeDecl setUnionValues ( String name , String uri , short finalSet , XSSimpleTypeDecl [ ] memberTypes , XSObjectList annotations ) { } public short getType ( ) { } public short getTypeCategory ( ) { } public String getName ( ) { } public String getTypeName ( ) { } public String getNamespace ( ) { } public short getFinal ( ) { } public boolean isFinal ( short derivation ) { } public XSTypeDefinition getBaseType ( ) { } public boolean getAnonymous ( ) { } public short getVariety ( ) { } public boolean isIDType ( ) { } public short getWhitespace ( ) throws DatatypeException { } public short getPrimitiveKind ( ) { } public short getBuiltInKind ( ) { } public XSSimpleTypeDefinition getPrimitiveType ( ) { } public XSSimpleTypeDefinition getItemType ( ) { } public XSObjectList getMemberTypes ( ) { } public void applyFacets ( XSFacets facets , short presentFacet , short fixedFacet , ValidationContext context ) throws InvalidDatatypeFacetException { } void applyFacets1 ( XSFacets facets , short presentFacet , short fixedFacet ) { } void applyFacets1 ( XSFacets facets , short presentFacet , short fixedFacet , short patternType ) { } void applyFacets ( XSFacets facets , short presentFacet , short fixedFacet , short patternType , ValidationContext context ) throws InvalidDatatypeFacetException { } public Object validate ( String content , ValidationContext context , ValidatedInfo validatedInfo ) throws InvalidDatatypeValueException { } public ValidatedInfo validateWithInfo ( String content , ValidationContext context , ValidatedInfo validatedInfo ) throws InvalidDatatypeValueException { } public Object validate ( Object content , ValidationContext context , ValidatedInfo validatedInfo ) throws InvalidDatatypeValueException { } public void validate ( ValidationContext context , ValidatedInfo validatedInfo ) throws InvalidDatatypeValueException { } private void checkFacets ( ValidatedInfo validatedInfo ) throws InvalidDatatypeValueException { } private void checkExtraRules ( ValidationContext context , ValidatedInfo validatedInfo ) throws InvalidDatatypeValueException { } private Object getActualValue ( Object content , ValidationContext context , ValidatedInfo validatedInfo , boolean needNormalize ) throws InvalidDatatypeValueException { } public boolean isEqual ( Object value1 , Object value2 ) { } public boolean isIdentical ( Object value1 , Object value2 ) { } public static String normalize ( String content , short ws ) { } protected String normalize ( Object content , short ws ) { if ( content == null ) return null ; if ( ( ( fFacetsDefined ) & ( FACET_PATTERN ) ) == 0 ) { short norm_type = XSSimpleTypeDecl . fDVNormalizeType [ fValidationDV ] ; if ( norm_type == ( XSSimpleTypeDecl . NORMALIZE_NONE ) ) { return content . toString ( ) ; } else if ( norm_type == ( XSSimpleTypeDecl . NORMALIZE_TRIM ) ) { <START_BUG> return content . toString ( ) . trim ( ) ; <END_BUG> } } if ( ! ( content instanceof StringBuffer ) ) { String strContent = content . toString ( ) ; return XSSimpleTypeDecl . normalize ( strContent , ws ) ; } StringBuffer sb = ( ( StringBuffer ) ( content ) ) ; int len = sb . length ( ) ; if ( len == 0 ) return "" ; if ( ws == ( WS_PRESERVE ) ) return sb . toString ( ) ; if ( ws == ( WS_REPLACE ) ) { char ch ; for ( int i = 0 ; i < len ; i ++ ) { ch = sb . charAt ( i ) ; if ( ( ( ch == 9 ) || ( ch == 10 ) ) || ( ch == 13 ) ) sb . setCharAt ( i , ( ( char ) ( 32 ) ) ) ; } } else { char ch ; int i ; int j = 0 ; boolean isLeading = true ; for ( i = 0 ; i < len ; i ++ ) { ch = sb . charAt ( i ) ; if ( ( ( ( ch != 9 ) && ( ch != 10 ) ) && ( ch != 13 ) ) && ( ch != 32 ) ) { sb . setCharAt ( ( j ++ ) , ch ) ; isLeading = false ; } else { for ( ; i < ( len - 1 ) ; i ++ ) { ch = sb . charAt ( ( i + 1 ) ) ; if ( ( ( ( ch != 9 ) && ( ch != 10 ) ) && ( ch != 13 ) ) && ( ch != 32 ) ) break ;

Fix:
return XMLChar . trim ( content . toString ( ) ) ;