Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PAYARA-1462 class loader leakage #1387

Merged
merged 1 commit into from
Feb 20, 2017
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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