You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by re...@apache.org on 2003/05/01 17:02:01 UTC
cvs commit: jakarta-tomcat-catalina/catalina/src/share/org/apache/coyote/tomcat5 CoyoteRequest.java InputBuffer.java
remm 2003/05/01 08:02:01
Modified: catalina/src/share/org/apache/coyote/tomcat5
CoyoteRequest.java InputBuffer.java
Log:
- Fix bug 18202: mirror what the output buffer does and throw
an unsupported encoding exception. Also wrap using a PA (not sure if
that's really useful, though).
Revision Changes Path
1.2 +5 -4 jakarta-tomcat-catalina/catalina/src/share/org/apache/coyote/tomcat5/CoyoteRequest.java
Index: CoyoteRequest.java
===================================================================
RCS file: /home/cvs/jakarta-tomcat-catalina/catalina/src/share/org/apache/coyote/tomcat5/CoyoteRequest.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- CoyoteRequest.java 19 Apr 2003 18:49:10 -0000 1.1
+++ CoyoteRequest.java 1 May 2003 15:02:00 -0000 1.2
@@ -1128,6 +1128,7 @@
(sm.getString("coyoteRequest.getReader.ise"));
usingReader = true;
+ inputBuffer.checkConverter();
return reader;
}
1.2 +35 -13 jakarta-tomcat-catalina/catalina/src/share/org/apache/coyote/tomcat5/InputBuffer.java
Index: InputBuffer.java
===================================================================
RCS file: /home/cvs/jakarta-tomcat-catalina/catalina/src/share/org/apache/coyote/tomcat5/InputBuffer.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- InputBuffer.java 19 Apr 2003 18:49:10 -0000 1.1
+++ InputBuffer.java 1 May 2003 15:02:01 -0000 1.2
@@ -63,6 +63,9 @@
import java.io.IOException;
import java.io.Reader;
import java.io.UnsupportedEncodingException;
+import java.security.AccessController;
+import java.security.PrivilegedExceptionAction;
+import java.security.PrivilegedActionException;
import java.util.HashMap;
import org.apache.tomcat.util.buf.B2CConverter;
@@ -471,7 +474,17 @@
}
- protected void setConverter() {
+ public void checkConverter()
+ throws IOException {
+
+ if (!gotEnc)
+ setConverter();
+
+ }
+
+
+ protected void setConverter()
+ throws IOException {
if (coyoteRequest != null)
enc = coyoteRequest.getCharacterEncoding();
@@ -484,20 +497,29 @@
enc = DEFAULT_ENCODING;
conv = (B2CConverter) encoders.get(enc);
if (conv == null) {
- try {
- conv = new B2CConverter(enc);
- encoders.put(enc, conv);
- } catch (IOException e) {
- conv = (B2CConverter) encoders.get(DEFAULT_ENCODING);
- if (conv == null) {
- try {
- conv = new B2CConverter(DEFAULT_ENCODING);
- encoders.put(DEFAULT_ENCODING, conv);
- } catch (IOException ex) {
- // Ignore
- }
+ if (System.getSecurityManager() != null){
+ try{
+ conv = (B2CConverter)AccessController.doPrivileged(
+ new PrivilegedExceptionAction(){
+
+ public Object run() throws IOException{
+ return new B2CConverter(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 B2CConverter(enc);
}
+ encoders.put(enc, conv);
}
}
---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-dev-help@jakarta.apache.org