You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by jf...@apache.org on 2003/02/26 18:50:33 UTC
cvs commit: jakarta-tomcat-connectors/coyote/src/java/org/apache/coyote/tomcat5 OutputBuffer.java
jfarcand 2003/02/26 09:50:33
Modified: coyote/src/java/org/apache/coyote/tomcat5 OutputBuffer.java
Log:
Fix a package protection issue when running the security manager.
Revision Changes Path
1.7 +28 -1 jakarta-tomcat-connectors/coyote/src/java/org/apache/coyote/tomcat5/OutputBuffer.java
Index: OutputBuffer.java
===================================================================
RCS file: /home/cvs/jakarta-tomcat-connectors/coyote/src/java/org/apache/coyote/tomcat5/OutputBuffer.java,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- OutputBuffer.java 29 Jan 2003 15:35:22 -0000 1.6
+++ OutputBuffer.java 26 Feb 2003 17:50:33 -0000 1.7
@@ -59,10 +59,14 @@
package org.apache.coyote.tomcat5;
+
import java.io.IOException;
import java.io.OutputStream;
import java.io.UnsupportedEncodingException;
import java.io.Writer;
+import java.security.AccessController;
+import java.security.PrivilegedExceptionAction;
+import java.security.PrivilegedActionException;
import java.util.HashMap;
import org.apache.tomcat.util.buf.ByteChunk;
@@ -604,7 +608,30 @@
enc = DEFAULT_ENCODING;
conv = (C2BConverter) encoders.get(enc);
if (conv == null) {
- conv = new C2BConverter(bb, enc);
+
+ if (System.getSecurityManager() != null){
+ try{
+ conv = (C2BConverter)AccessController.doPrivileged(
+ new PrivilegedExceptionAction(){
+
+ public Object run() throws IOException{
+ return new C2BConverter(bb, enc);
+ }
+
+ }
+ );
+ }catch(PrivilegedActionException ex){
+ Exception e = ex.getException();
+ if (e instanceof IOException)
+ throw (IOException)e;
+
+ if (debug > 0)
+ log("setConverter: " + ex.getMessage());
+ }
+ } else {
+ conv = new C2BConverter(bb, enc);
+ }
+
encoders.put(enc, conv);
/*
try {
---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-dev-help@jakarta.apache.org