Index: src/main/org/jboss/axis/encoding/DeserializationContextImpl.java =================================================================== RCS file: /cvsroot/jboss/jaxrpc/src/main/org/jboss/axis/encoding/DeserializationContextImpl.java,v retrieving revision 1.1.2.1 diff -u -r1.1.2.1 DeserializationContextImpl.java --- src/main/org/jboss/axis/encoding/DeserializationContextImpl.java 2 Mar 2005 14:29:04 -0000 1.1.2.1 +++ src/main/org/jboss/axis/encoding/DeserializationContextImpl.java 24 May 2005 11:27:46 -0000 @@ -259,7 +259,7 @@ try { // cleanup - so that the parser can be reused. - parser.setProperty("http://xml.org/sax/properties/lexical-handler", null); + parser.setProperty("http://xml.org/sax/properties/lexical-handler", nullLexicalHandler); } catch (SAXException se) { @@ -1383,5 +1383,25 @@ { return XMLUtils.getEmptyInputSource(); } + + /** We only need one instance of this dummy handler to set into the parsers. */ + private static final NullLexicalHandler nullLexicalHandler = new NullLexicalHandler(); + + /** + * It is illegal to set the lexical-handler property to null. To facilitate + * discarding the heavily loaded instance of DeserializationContextImpl from + * the SAXParser instance that is kept in the Stack maintained by XMLUtils + * we use this class. + */ + private static class NullLexicalHandler implements LexicalHandler + { + public void startDTD(String arg0, String arg1, String arg2) throws SAXException {} + public void endDTD() throws SAXException {} + public void startEntity(String arg0) throws SAXException {} + public void endEntity(String arg0) throws SAXException {} + public void startCDATA() throws SAXException {} + public void endCDATA() throws SAXException {} + public void comment(char[] arg0, int arg1, int arg2) throws SAXException {} + } }