You are viewing a plain text version of this content. The canonical link for it is here.
Posted to axis-cvs@ws.apache.org by di...@apache.org on 2004/09/14 08:14:01 UTC
cvs commit: ws-axis/java/src/org/apache/axis/encoding DeserializationContext.java
dims 2004/09/13 23:14:01
Modified: java/src/org/apache/axis/encoding
DeserializationContext.java
Log:
Fix for Volanis, Alexander <av...@rsasecurity.com> for memory leaks
Revision Changes Path
1.59 +21 -1 ws-axis/java/src/org/apache/axis/encoding/DeserializationContext.java
Index: DeserializationContext.java
===================================================================
RCS file: /home/cvs/ws-axis/java/src/org/apache/axis/encoding/DeserializationContext.java,v
retrieving revision 1.58
retrieving revision 1.59
diff -u -r1.58 -r1.59
--- DeserializationContext.java 17 Aug 2004 13:18:52 -0000 1.58
+++ DeserializationContext.java 14 Sep 2004 06:14:01 -0000 1.59
@@ -226,7 +226,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 (Exception e){
// Ignore.
}
@@ -1201,6 +1201,26 @@
public InputSource resolveEntity(String publicId, String systemId)
{
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 {}
}
}