Author: kkolinko Date: Mon Dec 13 00:58:11 2010 New Revision: 1044987 URL: http://svn.apache.org/viewvc?rev=1044987&view=rev Log: Fix https://issues.apache.org/bugzilla/show_bug.cgi?id=50460 Avoid leak caused by using a cached exception instance
Modified: tomcat/trunk/java/org/apache/jasper/compiler/JspDocumentParser.java tomcat/trunk/java/org/apache/naming/resources/ImmutableNameNotFoundException.java Modified: tomcat/trunk/java/org/apache/jasper/compiler/JspDocumentParser.java URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/jasper/compiler/JspDocumentParser.java?rev=1044987&r1=1044986&r2=1044987&view=diff ============================================================================== --- tomcat/trunk/java/org/apache/jasper/compiler/JspDocumentParser.java (original) +++ tomcat/trunk/java/org/apache/jasper/compiler/JspDocumentParser.java Mon Dec 13 00:58:11 2010 @@ -58,11 +58,6 @@ class JspDocumentParser "http://xml.org/sax/properties/lexical-handler"; private static final String JSP_URI = "http://java.sun.com/JSP/Page"; - private static final EnableDTDValidationException ENABLE_DTD_VALIDATION_EXCEPTION = - new EnableDTDValidationException( - "jsp.error.enable_dtd_validation", - null); - private ParserController parserController; private JspCompilationContext ctxt; private PageInfo pageInfo; @@ -757,7 +752,8 @@ class JspDocumentParser public void startDTD(String name, String publicId, String systemId) throws SAXException { if (!isValidating) { - fatalError(ENABLE_DTD_VALIDATION_EXCEPTION); + fatalError(new EnableDTDValidationException( + "jsp.error.enable_dtd_validation", null)); } inDTD = true; @@ -1459,6 +1455,12 @@ class JspDocumentParser EnableDTDValidationException(String message, Locator loc) { super(message, loc); } + + @Override + public synchronized Throwable fillInStackTrace() { + // This class does not provide a stack trace + return this; + } } private static String getBodyType(Node.CustomTag custom) { Modified: tomcat/trunk/java/org/apache/naming/resources/ImmutableNameNotFoundException.java URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/naming/resources/ImmutableNameNotFoundException.java?rev=1044987&r1=1044986&r2=1044987&view=diff ============================================================================== --- tomcat/trunk/java/org/apache/naming/resources/ImmutableNameNotFoundException.java (original) +++ tomcat/trunk/java/org/apache/naming/resources/ImmutableNameNotFoundException.java Mon Dec 13 00:58:11 2010 @@ -44,4 +44,9 @@ public class ImmutableNameNotFoundExcept @Override public void setRootCause(Throwable e) {/*NOOP*/} + @Override + public synchronized Throwable fillInStackTrace() { + // This class does not provide a stack trace + return this; + } } --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org