Author: markt
Date: Thu Sep 3 19:48:51 2015
New Revision: 1701118
URL: http://svn.apache.org/r1701118
Log:
Refactor. Move B2CConverter creation into a dedicated method.
Modified:
tomcat/trunk/java/org/apache/catalina/connector/InputBuffer.java
Modified: tomcat/trunk/java/org/apache/catalina/connector/InputBuffer.java
URL:
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/connector/InputBuffer.java?rev=1701118&r1=1701117&r2=1701118&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/catalina/connector/InputBuffer.java (original)
+++ tomcat/trunk/java/org/apache/catalina/connector/InputBuffer.java Thu Sep 3
19:48:51 2015
@@ -558,27 +558,35 @@ public class InputBuffer extends Reader
conv = encoders.get(charset);
if (conv == null) {
- if (SecurityUtil.isPackageProtectionEnabled()){
- try {
- conv = AccessController.doPrivileged(
- new PrivilegedExceptionAction<B2CConverter>(){
+ conv = createConverter(charset);
+ encoders.put(charset, conv);
+ }
+ }
+
- @Override
- public B2CConverter run() throws IOException {
- return new B2CConverter(charset);
- }
+ private static B2CConverter createConverter(Charset charset) throws
IOException {
+ if (SecurityUtil.isPackageProtectionEnabled()){
+ try {
+ return AccessController.doPrivileged(
+ new PrivilegedExceptionAction<B2CConverter>(){
+
+ @Override
+ public B2CConverter run() throws IOException {
+ return new B2CConverter(charset);
}
- );
- } catch (PrivilegedActionException ex) {
- Exception e = ex.getException();
- if (e instanceof IOException) {
- throw (IOException)e;
- }
+ }
+ );
+ } catch (PrivilegedActionException ex) {
+ Exception e = ex.getException();
+ if (e instanceof IOException) {
+ throw (IOException) e;
+ } else {
+ throw new IOException(e);
}
- } else {
- conv = new B2CConverter(charset);
}
- encoders.put(charset, conv);
+ } else {
+ return new B2CConverter(charset);
}
+
}
}
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]