Author: remy.maucherat(a)jboss.com
Date: 2011-05-31 06:00:57 -0400 (Tue, 31 May 2011)
New Revision: 1729
Modified:
trunk/java/org/apache/catalina/core/StandardWrapper.java
trunk/java/org/apache/jasper/servlet/JasperLoader.java
trunk/webapps/docs/changelog.xml
Log:
- Code cleanup (instance is now never null even for STM).
- Remove a print stack trace in Jasper code I looked at.
Modified: trunk/java/org/apache/catalina/core/StandardWrapper.java
===================================================================
--- trunk/java/org/apache/catalina/core/StandardWrapper.java 2011-05-27 16:12:11 UTC (rev
1728)
+++ trunk/java/org/apache/catalina/core/StandardWrapper.java 2011-05-31 10:00:57 UTC (rev
1729)
@@ -944,29 +944,23 @@
throw new ServletException
(sm.getString("standardWrapper.unloading", getName()));
- // If not SingleThreadedModel, return the same instance every time
- if (!singleThreadModel) {
-
- // Load and initialize our instance if necessary
- if (instance == null) {
- synchronized (this) {
- if (instance == null) {
- try {
- instance = loadServlet();
- } catch (ServletException e) {
- throw e;
- } catch (Throwable e) {
- throw new ServletException
- (sm.getString("standardWrapper.allocate"), e);
- }
+ // Load and initialize our instance if necessary
+ if (instance == null) {
+ synchronized (this) {
+ if (instance == null) {
+ try {
+ instance = loadServlet();
+ } catch (ServletException e) {
+ throw e;
+ } catch (Throwable e) {
+ throw new
ServletException(sm.getString("standardWrapper.allocate"), e);
}
}
}
+ }
- if (!singleThreadModel) {
- return (instance);
- }
-
+ if (!singleThreadModel) {
+ return (instance);
}
synchronized (instancePool) {
Modified: trunk/java/org/apache/jasper/servlet/JasperLoader.java
===================================================================
--- trunk/java/org/apache/jasper/servlet/JasperLoader.java 2011-05-27 16:12:11 UTC (rev
1728)
+++ trunk/java/org/apache/jasper/servlet/JasperLoader.java 2011-05-31 10:00:57 UTC (rev
1729)
@@ -92,49 +92,50 @@
*
* @exception ClassNotFoundException if the class was not found
*/
- public Class loadClass(final String name, boolean resolve)
- throws ClassNotFoundException {
+ public Class<?> loadClass(final String name, boolean resolve)
+ throws ClassNotFoundException {
- Class clazz = null;
-
+ Class<?> clazz = null;
+
// (0) Check our previously loaded class cache
- clazz = findLoadedClass(name);
- if (clazz != null) {
- if (resolve)
- resolveClass(clazz);
- return (clazz);
- }
-
+ clazz = findLoadedClass(name);
+ if (clazz != null) {
+ if (resolve)
+ resolveClass(clazz);
+ return (clazz);
+ }
+
// (.5) Permission to access this class when using a SecurityManager
- if (securityManager != null) {
+ if (securityManager != null) {
int dot = name.lastIndexOf('.');
- if (dot >= 0) {
- try {
- // Do not call the security manager since by default, we grant that
package.
- if
(!"org.apache.jasper.runtime".equalsIgnoreCase(name.substring(0,dot))){
- securityManager.checkPackageAccess(name.substring(0,dot));
+ if (dot >= 0) {
+ try {
+ // Do not call the security manager since by default, we
+ // grant that package.
+ if (!"org.apache.jasper.runtime".equalsIgnoreCase(name
+ .substring(0, dot))) {
+ securityManager.checkPackageAccess(name.substring(0,
+ dot));
}
} catch (SecurityException se) {
- String error = "Security Violation, attempt to use " +
- "Restricted Class: " + name;
- se.printStackTrace();
- throw new ClassNotFoundException(error);
- }
- }
+ String error = "Security Violation, attempt to use "
+ + "Restricted Class: " + name;
+ throw new ClassNotFoundException(error, se);
+ }
+ }
}
- if( !name.startsWith(JSP_PACKAGE_PREFIX) ) {
+ if (!name.startsWith(JSP_PACKAGE_PREFIX)) {
// Class is not in org.apache.jsp, therefore, have our
// parent load it
- clazz = parent.loadClass(name);
- if( resolve )
- resolveClass(clazz);
- return clazz;
- }
+ clazz = parent.loadClass(name);
+ if (resolve)
+ resolveClass(clazz);
+ return clazz;
+ }
- return findClass(name);
+ return findClass(name);
}
-
/**
* Delegate to parent
Modified: trunk/webapps/docs/changelog.xml
===================================================================
--- trunk/webapps/docs/changelog.xml 2011-05-27 16:12:11 UTC (rev 1728)
+++ trunk/webapps/docs/changelog.xml 2011-05-31 10:00:57 UTC (rev 1729)
@@ -16,6 +16,16 @@
<body>
+<section name="JBoss Web 7.0.0.CR2 (remm)">
+ <subsection name="Catalina">
+ <changelog>
+ <fix>
+ SingleThreadModel handling was not properly implemented following a filter chain
simplification. (remm)
+ </fix>
+ </changelog>
+ </subsection>
+</section>
+
<section name="JBoss Web 7.0.0.CR1 (remm)">
<subsection name="Catalina">
<changelog>
@@ -29,9 +39,6 @@
Low memory default for session manager (with low max amount of sessions), and
disable
session persistence by default. (remm)
</fix>
- <fix>
- SingleThreadModel handling was not properly implemented following a filter chain
simplification. (remm)
- </fix>
</changelog>
</subsection>
<subsection name="Jasper">
Show replies by date