Skip to content

Commit

Permalink
Merge pull request #1387 from flowlogix/PAYARA-1462
Browse files Browse the repository at this point in the history
PAYARA-1462 class loader leakage
  • Loading branch information
Pandrex247 authored Feb 20, 2017
2 parents a650e94 + 6221ef6 commit 3dee7e0
Showing 1 changed file with 10 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
// Portions Copyright [2016-2017] [Payara Foundation and/or its affiliates]

package org.apache.catalina.core;

Expand Down Expand Up @@ -98,7 +99,6 @@
* @author Remy Maucherat
* @version $Revision: 1.12.2.1 $ $Date: 2008/04/17 18:37:09 $
*/
// Portions Copyright [2016] [Payara Foundation and/or its affiliates]
public class StandardWrapper
extends ContainerBase
implements ServletConfig, Wrapper {
Expand All @@ -107,14 +107,13 @@ public class StandardWrapper
"GET", "HEAD", "POST" };

private final RequestTracingService requestTracing;
private final ThreadLocal<Boolean> isInSuppressFFNFThread = new ThreadLocal<Boolean>() {
private static final ThreadLocal<Boolean> isInSuppressFFNFThread = new ThreadLocal<Boolean>() {
@Override
protected Boolean initialValue() {
return false;
}
};


@LogMessageInfo(
message = "Parent container of a Wrapper must be a Context",
level = "WARNING"
Expand Down Expand Up @@ -232,7 +231,9 @@ public StandardWrapper() {

// suppress PWC6117 file not found errors
java.util.logging.Logger jspLog = java.util.logging.Logger.getLogger("org.apache.jasper.servlet.JspServlet");
jspLog.setFilter(new NotFoundErrorSupressionFilter(jspLog.getFilter()));
if(!(jspLog.getFilter() instanceof NotFoundErrorSupressionFilter)) {
jspLog.setFilter(new NotFoundErrorSupressionFilter(jspLog.getFilter()));
}
}


Expand Down Expand Up @@ -1689,7 +1690,9 @@ void service(ServletRequest request, ServletResponse response,
}
}
try {
isInSuppressFFNFThread.set(true);
if(isJspServlet) {
isInSuppressFFNFThread.set(true);
}
serv.service((HttpServletRequest) request,
(HttpServletResponse) response);
}
Expand Down Expand Up @@ -2342,7 +2345,7 @@ public boolean isStatisticsProvider() {
return false;
}

private class NotFoundErrorSupressionFilter implements java.util.logging.Filter {
private static class NotFoundErrorSupressionFilter implements java.util.logging.Filter {
private final java.util.logging.Filter oldFilter;

public NotFoundErrorSupressionFilter(java.util.logging.Filter oldFilter) {
Expand All @@ -2352,7 +2355,7 @@ public NotFoundErrorSupressionFilter(java.util.logging.Filter oldFilter) {
@Override
public boolean isLoggable(LogRecord record) {
boolean rv = true;
if(StandardWrapper.this.isJspServlet && StandardWrapper.this.isInSuppressFFNFThread.get()) {
if(isInSuppressFFNFThread.get()) {
rv = !record.getMessage().startsWith("PWC6117: File");
}
if(oldFilter != null) {
Expand Down

0 comments on commit 3dee7e0

Please sign in to comment.