Buggy code:
public class XMLGrammarBuilder { public static final String SYMBOL_TABLE = ( Constants . XERCES_PROPERTY_PREFIX ) + ( Constants . SYMBOL_TABLE_PROPERTY ) ; public static final String GRAMMAR_POOL = ( Constants . XERCES_PROPERTY_PREFIX ) + ( Constants . XMLGRAMMAR_POOL_PROPERTY ) ; protected static final String NAMESPACES_FEATURE_ID = "http:////xml.org//sax//features//namespaces" ; protected static final String VALIDATION_FEATURE_ID = "http:////xml.org//sax//features//validation" ; protected static final String SCHEMA_VALIDATION_FEATURE_ID = "http:////apache.org//xml//features//validation//schema" ; protected static final String SCHEMA_FULL_CHECKING_FEATURE_ID = "http:////apache.org//xml//features//validation//schema-full-checking" ; public static final int BIG_PRIME = 2039 ; protected static final boolean DEFAULT_SCHEMA_FULL_CHECKING = false ; public static void main ( String [ ] argv ) { if ( ( argv . length ) < 2 ) { XMLGrammarBuilder . printUsage ( ) ; System . exit ( 1 ) ; } XMLParserConfiguration parserConfiguration = null ; String arg = null ; int i = 0 ; arg = argv [ i ] ; if ( arg . equals ( "-p" ) ) { i ++ ; String parserName = argv [ i ] ; try { ClassLoader cl = ObjectFactory . findClassLoader ( ) ; <START_BUG> parserConfiguration = ( ( XMLParserConfiguration ) ( ObjectFactory . newInstance ( parserName , cl ) ) ) ; <END_BUG> } catch ( Exception e ) { parserConfiguration = null ; System . err . println ( ( ( "error:<seq2seq4repair_space>Unable<seq2seq4repair_space>to<seq2seq4repair_space>instantiate<seq2seq4repair_space>parser<seq2seq4repair_space>configuration<seq2seq4repair_space>(" + parserName ) + ")" ) ) ; } i ++ ; } arg = argv [ i ] ; Vector externalDTDs = null ; if ( arg . equals ( "-d" ) ) { externalDTDs = new Vector ( ) ; i ++ ; while ( ( i < ( argv . length ) ) && ( ! ( ( arg = argv [ i ] ) . startsWith ( "-" ) ) ) ) { externalDTDs . addElement ( arg ) ; i ++ ; } if ( ( externalDTDs . size ( ) ) == 0 ) { XMLGrammarBuilder . printUsage ( ) ; System . exit ( 1 ) ; } } Vector schemas = null ; boolean schemaFullChecking = XMLGrammarBuilder . DEFAULT_SCHEMA_FULL_CHECKING ; if ( i < ( argv . length ) ) { arg = argv [ i ] ; if ( arg . equals ( "-f" ) ) { schemaFullChecking = true ; i ++ ; arg = argv [ i ] ; } else if ( arg . equals ( "-F" ) ) { schemaFullChecking = false ; i ++ ; arg = argv [ i ] ; } if ( arg . equals ( "-a" ) ) { if ( externalDTDs != null ) { XMLGrammarBuilder . printUsage ( ) ; System . exit ( 1 ) ; } schemas = new Vector ( ) ; i ++ ; while ( ( i < ( argv . length ) ) && ( ! ( ( arg = argv [ i ] ) . startsWith ( "-" ) ) ) ) { schemas . addElement ( arg ) ; i ++ ; } if ( ( schemas . size ( ) ) == 0 ) { XMLGrammarBuilder . printUsage ( ) ; System . exit ( 1 ) ; } } } Vector ifiles = null ; if ( i < ( argv . length ) ) { if ( ! ( arg . equals ( "-i" ) ) ) { XMLGrammarBuilder . printUsage ( ) ; System . exit ( 1 ) ; } i ++ ; ifiles = new Vector ( ) ; while ( ( i < ( argv . length ) ) && ( ! ( ( arg = argv [ i ] ) . startsWith ( "-" ) ) ) ) { ifiles . addElement ( arg ) ; i ++ ; } if ( ( ( ifiles . size ( ) ) == 0 ) || ( i != ( argv . length ) ) ) { XMLGrammarBuilder . printUsage ( ) ; System . exit ( 1 ) ; } } SymbolTable sym = new SymbolTable ( XMLGrammarBuilder . BIG_PRIME ) ; XMLGrammarPreparser preparser = new XMLGrammarPreparser ( sym ) ; XMLGrammarPoolImpl grammarPool = new XMLGrammarPoolImpl ( ) ; boolean isDTD = false ; if ( externalDTDs != null ) { preparser . registerPreparser ( XML_DTD , null ) ; isDTD = true ; } else if ( schemas != null ) { preparser . registerPreparser ( XML_SCHEMA , null ) ; isDTD = false ; } else { System . err . println ( "No<seq2seq4repair_space>schema<seq2seq4repair_space>or<seq2seq4repair_space>DTD<seq2seq4repair_space>specified!" ) ; System . exit ( 1 ) ; } preparser . setProperty ( XMLGrammarBuilder . GRAMMAR_POOL , grammarPool ) ; preparser . setFeature ( XMLGrammarBuilder . NAMESPACES_FEATURE_ID , true ) ; preparser . setFeature ( XMLGrammarBuilder . VALIDATION_FEATURE_ID , true ) ; preparser . setFeature ( XMLGrammarBuilder . SCHEMA_VALIDATION_FEATURE_ID , true ) ; preparser . setFeature ( XMLGrammarBuilder . SCHEMA_FULL_CHECKING_FEATURE_ID , schemaFullChecking ) ; try { if ( isDTD ) { for ( i = 0 ; i < ( externalDTDs . size ( ) ) ; i ++ ) { Grammar g = preparser . preparseGrammar ( XML_DTD , XMLGrammarBuilder . stringToXIS ( ( ( String ) ( externalDTDs . elementAt ( i ) ) ) ) ) ; } } else { for ( i = 0 ; i < ( schemas . size ( ) ) ; i ++ ) { Grammar g = preparser . preparseGrammar ( XML_SCHEMA , XMLGrammarBuilder . stringToXIS ( ( ( String ) ( schemas . elementAt ( i ) ) ) ) ) ; } } } catch ( Exception e ) { e . printStackTrace ( ) ; System . exit ( 1 ) ; } if ( parserConfiguration == null ) { parserConfiguration = new org . apache . xerces . parsers . StandardParserConfiguration ( sym , grammarPool ) ; } else { parserConfiguration . setProperty ( XMLGrammarBuilder . SYMBOL_TABLE , sym ) ; parserConfiguration . setProperty ( XMLGrammarBuilder . GRAMMAR_POOL , grammarPool ) ; }

Fix:
parserConfiguration = ( ( XMLParserConfiguration ) ( ObjectFactory . newInstance ( parserName , cl , true ) ) ) ;