Buggy code:
public class Writer extends DefaultHandler implements LexicalHandler { protected static final String NAMESPACES_FEATURE_ID = "http:////xml.org//sax//features//namespaces" ; protected static final String NAMESPACE_PREFIXES_FEATURE_ID = "http:////xml.org//sax//features//namespace-prefixes" ; 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" ; protected static final String DYNAMIC_VALIDATION_FEATURE_ID = "http:////apache.org//xml//features//validation//dynamic" ; protected static final String LOAD_EXTERNAL_DTD_FEATURE_ID = "http:////apache.org//xml//features//nonvalidating//load-external-dtd" ; protected static final String LEXICAL_HANDLER_PROPERTY_ID = "http:////xml.org//sax//properties//lexical-handler" ; protected static final String DEFAULT_PARSER_NAME = "org.apache.xerces.parsers.SAXParser" ; protected static final boolean DEFAULT_NAMESPACES = true ; protected static final boolean DEFAULT_NAMESPACE_PREFIXES = false ; protected static final boolean DEFAULT_VALIDATION = false ; protected static final boolean DEFAULT_LOAD_EXTERNAL_DTD = true ; protected static final boolean DEFAULT_SCHEMA_VALIDATION = false ; protected static final boolean DEFAULT_SCHEMA_FULL_CHECKING = false ; protected static final boolean DEFAULT_DYNAMIC_VALIDATION = false ; protected static final boolean DEFAULT_CANONICAL = false ; protected PrintWriter fOut ; protected boolean fCanonical ; protected int fElementDepth ; protected Locator fLocator ; protected boolean fXML11 ; protected boolean fInCDATA ; public Writer ( ) { } public void setCanonical ( boolean canonical ) { } public void setOutput ( OutputStream stream , String encoding ) throws UnsupportedEncodingException { } public void setOutput ( java . io . Writer writer ) { } public void setDocumentLocator ( Locator locator ) { } public void startDocument ( ) throws SAXException { } public void processingInstruction ( String target , String data ) throws SAXException { } public void startElement ( String uri , String local , String raw , Attributes attrs ) throws SAXException { } public void characters ( char [ ] ch , int start , int length ) throws SAXException { } public void ignorableWhitespace ( char [ ] ch , int start , int length ) throws SAXException { } public void endElement ( String uri , String local , String raw ) throws SAXException { } public void warning ( SAXParseException ex ) throws SAXException { } public void error ( SAXParseException ex ) throws SAXException { } public void fatalError ( SAXParseException ex ) throws SAXException { } public void startDTD ( String name , String publicId , String systemId ) throws SAXException { } public void endDTD ( ) throws SAXException { } public void startEntity ( String name ) throws SAXException { } public void endEntity ( String name ) throws SAXException { } public void startCDATA ( ) throws SAXException { } public void endCDATA ( ) throws SAXException { } public void comment ( char [ ] ch , int start , int length ) throws SAXException { } protected Attributes sortAttributes ( Attributes attrs ) { } protected void normalizeAndPrint ( String s , boolean isAttValue ) { } protected void normalizeAndPrint ( char [ ] ch , int offset , int length , boolean isAttValue ) { } protected void normalizeAndPrint ( char c , boolean isAttValue ) { } protected void printError ( String type , SAXParseException ex ) { } protected String getVersion ( ) { if ( ( fLocator ) == null ) { return null ; } String version = null ; Method getXMLVersion = null ; try { getXMLVersion = fLocator . getClass ( ) . getMethod ( "getXMLVersion" , new Class [ ] { } ) ; if ( getXMLVersion != null ) { <START_BUG> version = ( ( String ) ( getXMLVersion . invoke ( fLocator , null ) ) ) ; <END_BUG> } } catch ( Exception e ) { } return version ; } public static void main ( String [ ] argv ) { } private static void printUsage ( ) { } }

Fix:
version = ( ( String ) ( getXMLVersion . invoke ( fLocator , ( ( Object [ ] ) ( null ) ) ) ) ) ;