Author: lindner
Date: Mon Nov 16 19:53:25 2009
New Revision: 880933
URL: http://svn.apache.org/viewvc?rev=880933&view=rev
Log:
SHINDIG-1132 | Patch from Jed Wesley-Smith | ClassLoader memory leak caused by
XmlUtil ThreadLocal
Modified:
incubator/shindig/trunk/java/common/src/main/java/org/apache/shindig/common/xml/XmlUtil.java
Modified:
incubator/shindig/trunk/java/common/src/main/java/org/apache/shindig/common/xml/XmlUtil.java
URL:
http://svn.apache.org/viewvc/incubator/shindig/trunk/java/common/src/main/java/org/apache/shindig/common/xml/XmlUtil.java?rev=880933&r1=880932&r2=880933&view=diff
==============================================================================
---
incubator/shindig/trunk/java/common/src/main/java/org/apache/shindig/common/xml/XmlUtil.java
(original)
+++
incubator/shindig/trunk/java/common/src/main/java/org/apache/shindig/common/xml/XmlUtil.java
Mon Nov 16 19:53:25 2009
@@ -290,8 +290,9 @@
* @throws XmlException if a parse error occured.
*/
public static Element parse(String xml) throws XmlException {
+ DocumentBuilder builder = null;
try {
- DocumentBuilder builder = getBuilder();
+ builder = getBuilder();
InputSource is = new InputSource(new StringReader(xml.trim()));
return builder.parse(is).getDocumentElement();
} catch (SAXParseException e) {
@@ -303,6 +304,11 @@
throw new XmlException(e);
} catch (IOException e) {
throw new XmlException(e);
+ } finally {
+ // Remove reference to XmlUtils class to insure classes can be unloaded
+ if (builder != null) {
+ builder.setErrorHandler(null);
+ }
}
}