Author: violetagg
Date: Thu Sep 8 08:23:13 2016
New Revision: 1759757
URL: http://svn.apache.org/viewvc?rev=1759757&view=rev
Log:
Format the code. No functional changes.
Modified:
tomcat/trunk/java/org/apache/catalina/connector/CoyoteInputStream.java
tomcat/trunk/java/org/apache/catalina/connector/InputBuffer.java
Modified: tomcat/trunk/java/org/apache/catalina/connector/CoyoteInputStream.java
URL:
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/connector/CoyoteInputStream.java?rev=1759757&r1=1759756&r2=1759757&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/catalina/connector/CoyoteInputStream.java
(original)
+++ tomcat/trunk/java/org/apache/catalina/connector/CoyoteInputStream.java Thu
Sep 8 08:23:13 2016
@@ -66,25 +66,24 @@ public class CoyoteInputStream extends S
public int read() throws IOException {
checkNonBlockingRead();
- if (SecurityUtil.isPackageProtectionEnabled()){
+ if (SecurityUtil.isPackageProtectionEnabled()) {
- try{
- Integer result =
- AccessController.doPrivileged(
- new PrivilegedExceptionAction<Integer>(){
+ try {
+ Integer result = AccessController
+ .doPrivileged(new PrivilegedExceptionAction<Integer>()
{
@Override
- public Integer run() throws IOException{
+ public Integer run() throws IOException {
Integer integer =
Integer.valueOf(ib.readByte());
return integer;
}
- });
+ });
return result.intValue();
- } catch(PrivilegedActionException pae){
+ } catch (PrivilegedActionException pae) {
Exception e = pae.getException();
- if (e instanceof IOException){
- throw (IOException)e;
+ if (e instanceof IOException) {
+ throw (IOException) e;
} else {
throw new RuntimeException(e.getMessage(), e);
}
@@ -97,30 +96,29 @@ public class CoyoteInputStream extends S
@Override
public int available() throws IOException {
- if (SecurityUtil.isPackageProtectionEnabled()){
- try{
- Integer result =
- AccessController.doPrivileged(
- new PrivilegedExceptionAction<Integer>(){
+ if (SecurityUtil.isPackageProtectionEnabled()) {
+ try {
+ Integer result = AccessController
+ .doPrivileged(new PrivilegedExceptionAction<Integer>()
{
@Override
- public Integer run() throws IOException{
+ public Integer run() throws IOException {
Integer integer =
Integer.valueOf(ib.available());
return integer;
}
- });
+ });
return result.intValue();
- } catch(PrivilegedActionException pae){
+ } catch (PrivilegedActionException pae) {
Exception e = pae.getException();
- if (e instanceof IOException){
- throw (IOException)e;
+ if (e instanceof IOException) {
+ throw (IOException) e;
} else {
throw new RuntimeException(e.getMessage(), e);
}
}
} else {
- return ib.available();
+ return ib.available();
}
}
@@ -128,59 +126,54 @@ public class CoyoteInputStream extends S
public int read(final byte[] b) throws IOException {
checkNonBlockingRead();
- if (SecurityUtil.isPackageProtectionEnabled()){
- try{
- Integer result =
- AccessController.doPrivileged(
- new PrivilegedExceptionAction<Integer>(){
+ if (SecurityUtil.isPackageProtectionEnabled()) {
+ try {
+ Integer result = AccessController
+ .doPrivileged(new PrivilegedExceptionAction<Integer>()
{
@Override
- public Integer run() throws IOException{
- Integer integer =
- Integer.valueOf(ib.read(b, 0, b.length));
+ public Integer run() throws IOException {
+ Integer integer = Integer.valueOf(ib.read(b,
0, b.length));
return integer;
}
- });
+ });
return result.intValue();
- } catch(PrivilegedActionException pae){
+ } catch (PrivilegedActionException pae) {
Exception e = pae.getException();
- if (e instanceof IOException){
- throw (IOException)e;
+ if (e instanceof IOException) {
+ throw (IOException) e;
} else {
- throw new RuntimeException(e.getMessage() ,e);
+ throw new RuntimeException(e.getMessage(), e);
}
}
} else {
return ib.read(b, 0, b.length);
- }
+ }
}
@Override
- public int read(final byte[] b, final int off, final int len)
- throws IOException {
+ public int read(final byte[] b, final int off, final int len) throws
IOException {
checkNonBlockingRead();
- if (SecurityUtil.isPackageProtectionEnabled()){
- try{
- Integer result =
- AccessController.doPrivileged(
- new PrivilegedExceptionAction<Integer>(){
+ if (SecurityUtil.isPackageProtectionEnabled()) {
+ try {
+ Integer result = AccessController
+ .doPrivileged(new PrivilegedExceptionAction<Integer>()
{
@Override
- public Integer run() throws IOException{
- Integer integer =
- Integer.valueOf(ib.read(b, off, len));
+ public Integer run() throws IOException {
+ Integer integer = Integer.valueOf(ib.read(b,
off, len));
return integer;
}
- });
+ });
return result.intValue();
- } catch(PrivilegedActionException pae){
+ } catch (PrivilegedActionException pae) {
Exception e = pae.getException();
- if (e instanceof IOException){
- throw (IOException)e;
+ if (e instanceof IOException) {
+ throw (IOException) e;
} else {
throw new RuntimeException(e.getMessage(), e);
}
@@ -205,28 +198,27 @@ public class CoyoteInputStream extends S
@Override
public void close() throws IOException {
- if (SecurityUtil.isPackageProtectionEnabled()){
- try{
- AccessController.doPrivileged(
- new PrivilegedExceptionAction<Void>(){
-
- @Override
- public Void run() throws IOException{
- ib.close();
- return null;
- }
+ if (SecurityUtil.isPackageProtectionEnabled()) {
+ try {
+ AccessController.doPrivileged(new
PrivilegedExceptionAction<Void>() {
+
+ @Override
+ public Void run() throws IOException {
+ ib.close();
+ return null;
+ }
});
- } catch(PrivilegedActionException pae){
+ } catch (PrivilegedActionException pae) {
Exception e = pae.getException();
- if (e instanceof IOException){
- throw (IOException)e;
+ if (e instanceof IOException) {
+ throw (IOException) e;
} else {
throw new RuntimeException(e.getMessage(), e);
}
}
} else {
- ib.close();
+ ib.close();
}
}
@@ -250,8 +242,7 @@ public class CoyoteInputStream extends S
private void checkNonBlockingRead() {
if (!ib.isBlocking() && !ib.isReady()) {
- throw new IllegalStateException(
- sm.getString("coyoteInputStream.nbNotready"));
+ throw new
IllegalStateException(sm.getString("coyoteInputStream.nbNotready"));
}
}
}
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=1759757&r1=1759756&r2=1759757&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/catalina/connector/InputBuffer.java (original)
+++ tomcat/trunk/java/org/apache/catalina/connector/InputBuffer.java Thu Sep 8
08:23:13 2016
@@ -54,7 +54,7 @@ public class InputBuffer extends Reader
*/
protected static final StringManager sm =
StringManager.getManager(InputBuffer.class);
- public static final int DEFAULT_BUFFER_SIZE = 8*1024;
+ public static final int DEFAULT_BUFFER_SIZE = 8 * 1024;
// The buffer can be used for byte[] and char[] reading
// ( this is needed to support ServletInputStream and BufferedReader )
@@ -66,9 +66,7 @@ public class InputBuffer extends Reader
/**
* Encoder cache.
*/
- private static final Map<Charset,SynchronizedStack<B2CConverter>> encoders
=
- new ConcurrentHashMap<>();
-
+ private static final Map<Charset, SynchronizedStack<B2CConverter>>
encoders = new ConcurrentHashMap<>();
// ----------------------------------------------------- Instance Variables
@@ -211,8 +209,7 @@ public class InputBuffer extends Reader
* @throws IOException An underlying IOException occurred
*/
@Override
- public void close()
- throws IOException {
+ public void close() throws IOException {
closed = true;
}
@@ -225,7 +222,8 @@ public class InputBuffer extends Reader
available = cb.getLength();
}
if (available == 0) {
- coyoteRequest.action(ActionCode.AVAILABLE,
Boolean.valueOf(coyoteRequest.getReadListener() != null));
+ coyoteRequest.action(ActionCode.AVAILABLE,
+ Boolean.valueOf(coyoteRequest.getReadListener() != null));
available = (coyoteRequest.getAvailable() > 0) ? 1 : 0;
}
return available;
@@ -311,7 +309,7 @@ public class InputBuffer extends Reader
return -1;
}
- if(state == INITIAL_STATE) {
+ if (state == INITIAL_STATE) {
state = BYTE_STATE;
}
@@ -400,8 +398,7 @@ public class InputBuffer extends Reader
@Override
- public int read()
- throws IOException {
+ public int read() throws IOException {
if (closed) {
throw new IOException(sm.getString("inputBuffer.streamClosed"));
@@ -412,8 +409,7 @@ public class InputBuffer extends Reader
@Override
- public int read(char[] cbuf)
- throws IOException {
+ public int read(char[] cbuf) throws IOException {
if (closed) {
throw new IOException(sm.getString("inputBuffer.streamClosed"));
@@ -424,8 +420,7 @@ public class InputBuffer extends Reader
@Override
- public int read(char[] cbuf, int off, int len)
- throws IOException {
+ public int read(char[] cbuf, int off, int len) throws IOException {
if (closed) {
throw new IOException(sm.getString("inputBuffer.streamClosed"));
@@ -482,8 +477,7 @@ public class InputBuffer extends Reader
@Override
- public void mark(int readAheadLimit)
- throws IOException {
+ public void mark(int readAheadLimit) throws IOException {
if (closed) {
throw new IOException(sm.getString("inputBuffer.streamClosed"));
@@ -493,10 +487,8 @@ public class InputBuffer extends Reader
cb.setOffset(0);
cb.setEnd(0);
} else {
- if ((cb.getBuffer().length > (2 * size))
- && (cb.getLength()) < (cb.getStart())) {
- System.arraycopy(cb.getBuffer(), cb.getStart(),
- cb.getBuffer(), 0, cb.getLength());
+ if ((cb.getBuffer().length > (2 * size)) && (cb.getLength()) <
(cb.getStart())) {
+ System.arraycopy(cb.getBuffer(), cb.getStart(),
cb.getBuffer(), 0, cb.getLength());
cb.setEnd(cb.getLength());
cb.setOffset(0);
}
@@ -507,8 +499,7 @@ public class InputBuffer extends Reader
@Override
- public void reset()
- throws IOException {
+ public void reset() throws IOException {
if (closed) {
throw new IOException(sm.getString("inputBuffer.streamClosed"));
@@ -560,17 +551,15 @@ public class InputBuffer extends Reader
private static B2CConverter createConverter(Charset charset) throws
IOException {
- if (SecurityUtil.isPackageProtectionEnabled()){
+ if (SecurityUtil.isPackageProtectionEnabled()) {
try {
- return AccessController.doPrivileged(
- new PrivilegedExceptionAction<B2CConverter>(){
+ return AccessController.doPrivileged(new
PrivilegedExceptionAction<B2CConverter>() {
- @Override
- public B2CConverter run() throws IOException {
- return new B2CConverter(charset);
- }
- }
- );
+ @Override
+ public B2CConverter run() throws IOException {
+ return new B2CConverter(charset);
+ }
+ });
} catch (PrivilegedActionException ex) {
Exception e = ex.getException();
if (e instanceof IOException) {
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]