[jbosstools-commits] JBoss Tools SVN: r43773 - trunk/common/plugins/org.jboss.tools.common.model/src/org/jboss/tools/common/model/loaders.

jbosstools-commits at lists.jboss.org jbosstools-commits at lists.jboss.org
Mon Sep 17 18:03:40 EDT 2012


Author: scabanovich
Date: 2012-09-17 18:03:40 -0400 (Mon, 17 Sep 2012)
New Revision: 43773

Modified:
   trunk/common/plugins/org.jboss.tools.common.model/src/org/jboss/tools/common/model/loaders/XMLRecognizerContext.java
Log:
JBIDE-12479
https://issues.jboss.org/browse/JBIDE-12479
Dispose reference to char[] of entire text of file in a cached substring.


Modified: trunk/common/plugins/org.jboss.tools.common.model/src/org/jboss/tools/common/model/loaders/XMLRecognizerContext.java
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.model/src/org/jboss/tools/common/model/loaders/XMLRecognizerContext.java	2012-09-17 21:08:29 UTC (rev 43772)
+++ trunk/common/plugins/org.jboss.tools.common.model/src/org/jboss/tools/common/model/loaders/XMLRecognizerContext.java	2012-09-17 22:03:40 UTC (rev 43773)
@@ -121,7 +121,11 @@
 				doctypeInfo.publicId = dt.getPublicId();
 				doctypeInfo.systemId = dt.getSystemId();
 				doctypeInfo.name = dt.getName();
-				doctypes.put(docTypeString, doctypeInfo);
+				//'docTypeString' is a substring of the complete text of the file,
+				//which can be very long; and this substring keeps reference to
+				//char[] of the entire text. Adding an empty string ensures
+				//that the result will not keep the reference. 
+				doctypes.put("" + docTypeString, doctypeInfo);
 				// doctypeInfo.publicId + " " + doctypeInfo.systemId + " " +
 				// doctypeInfo.name);
 				return doctypeInfo;
@@ -136,7 +140,8 @@
 			} catch (IOException e) {
 			}
 		}
-		doctypes.put(docTypeString, NULL_INFO);
+		//See comment to 'docTypeString' above.
+		doctypes.put("" + docTypeString, NULL_INFO);
 		return NULL_INFO;
 	}
 



More information about the jbosstools-commits mailing list