You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by ma...@apache.org on 2017/04/05 14:15:24 UTC
svn commit: r1790273 - in /tomcat/trunk/java/org/apache/catalina:
connector/OutputBuffer.java security/SecurityClassLoad.java
Author: markt
Date: Wed Apr 5 14:15:24 2017
New Revision: 1790273
URL: http://svn.apache.org/viewvc?rev=1790273&view=rev
Log:
Partial fix for https://bz.apache.org/bugzilla/show_bug.cgi?id=47214
Replace explicitly referenced anonymous inner classes in OutputBuffer with named inner classes.
Modified:
tomcat/trunk/java/org/apache/catalina/connector/OutputBuffer.java
tomcat/trunk/java/org/apache/catalina/security/SecurityClassLoad.java
Modified: tomcat/trunk/java/org/apache/catalina/connector/OutputBuffer.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/connector/OutputBuffer.java?rev=1790273&r1=1790272&r2=1790273&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/catalina/connector/OutputBuffer.java (original)
+++ tomcat/trunk/java/org/apache/catalina/connector/OutputBuffer.java Wed Apr 5 14:15:24 2017
@@ -564,12 +564,7 @@ public class OutputBuffer extends Writer
private static Charset getCharset(final String encoding) throws IOException {
if (Globals.IS_SECURITY_ENABLED) {
try {
- return AccessController.doPrivileged(new PrivilegedExceptionAction<Charset>() {
- @Override
- public Charset run() throws IOException {
- return B2CConverter.getCharset(encoding);
- }
- });
+ return AccessController.doPrivileged(new PrivilegedGetCharset(encoding));
} catch (PrivilegedActionException ex) {
Exception e = ex.getException();
if (e instanceof IOException) {
@@ -587,12 +582,7 @@ public class OutputBuffer extends Writer
private static C2BConverter createConverter(final Charset charset) throws IOException {
if (Globals.IS_SECURITY_ENABLED) {
try {
- return AccessController.doPrivileged(new PrivilegedExceptionAction<C2BConverter>() {
- @Override
- public C2BConverter run() throws IOException {
- return new C2BConverter(charset);
- }
- });
+ return AccessController.doPrivileged(new PrivilegedCreateConverter(charset));
} catch (PrivilegedActionException ex) {
Exception e = ex.getException();
if (e instanceof IOException) {
@@ -872,4 +862,35 @@ public class OutputBuffer extends Writer
.position(buffer.limit())
.limit(buffer.capacity());
}
+
+
+ private static class PrivilegedCreateConverter
+ implements PrivilegedExceptionAction<C2BConverter> {
+
+ private final Charset charset;
+
+ public PrivilegedCreateConverter(Charset charset) {
+ this.charset = charset;
+ }
+
+ @Override
+ public C2BConverter run() throws IOException {
+ return new C2BConverter(charset);
+ }
+ }
+
+
+ private static class PrivilegedGetCharset implements PrivilegedExceptionAction<Charset> {
+
+ private final String encoding;
+
+ public PrivilegedGetCharset(String encoding) {
+ this.encoding = encoding;
+ }
+
+ @Override
+ public Charset run() throws IOException {
+ return B2CConverter.getCharset(encoding);
+ }
+ }
}
Modified: tomcat/trunk/java/org/apache/catalina/security/SecurityClassLoad.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/security/SecurityClassLoad.java?rev=1790273&r1=1790272&r2=1790273&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/catalina/security/SecurityClassLoad.java (original)
+++ tomcat/trunk/java/org/apache/catalina/security/SecurityClassLoad.java Wed Apr 5 14:15:24 2017
@@ -233,10 +233,10 @@ public final class SecurityClassLoad {
"ResponseFacade$FlushBufferPrivilegedAction");
loader.loadClass
(basePackage +
- "OutputBuffer$1");
+ "OutputBuffer$PrivilegedCreateConverter");
loader.loadClass
(basePackage +
- "OutputBuffer$2");
+ "OutputBuffer$PrivilegedGetCharset");
loader.loadClass
(basePackage +
"CoyoteInputStream$1");
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org