hc-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ggreg...@apache.org
Subject svn commit: r1698068 - in /httpcomponents/httpcore/trunk/httpcore-nio/src/main/java/org/apache/http: impl/nio/ impl/nio/codecs/ impl/nio/reactor/ nio/pool/ nio/protocol/ nio/reactor/ssl/ nio/util/
Date Thu, 27 Aug 2015 04:48:47 GMT
Author: ggregory
Date: Thu Aug 27 04:48:47 2015
New Revision: 1698068

URL: http://svn.apache.org/r1698068
Log:
Statement unnecessarily nested within else clause.

Modified:
    httpcomponents/httpcore/trunk/httpcore-nio/src/main/java/org/apache/http/impl/nio/NHttpConnectionBase.java
    httpcomponents/httpcore/trunk/httpcore-nio/src/main/java/org/apache/http/impl/nio/codecs/AbstractContentEncoder.java
    httpcomponents/httpcore/trunk/httpcore-nio/src/main/java/org/apache/http/impl/nio/codecs/AbstractMessageParser.java
    httpcomponents/httpcore/trunk/httpcore-nio/src/main/java/org/apache/http/impl/nio/codecs/ChunkDecoder.java
    httpcomponents/httpcore/trunk/httpcore-nio/src/main/java/org/apache/http/impl/nio/codecs/LengthDelimitedDecoder.java
    httpcomponents/httpcore/trunk/httpcore-nio/src/main/java/org/apache/http/impl/nio/reactor/ChannelEntry.java
    httpcomponents/httpcore/trunk/httpcore-nio/src/main/java/org/apache/http/impl/nio/reactor/DefaultListeningIOReactor.java
    httpcomponents/httpcore/trunk/httpcore-nio/src/main/java/org/apache/http/impl/nio/reactor/IOSessionImpl.java
    httpcomponents/httpcore/trunk/httpcore-nio/src/main/java/org/apache/http/impl/nio/reactor/InterestOpEntry.java
    httpcomponents/httpcore/trunk/httpcore-nio/src/main/java/org/apache/http/impl/nio/reactor/SessionInputBufferImpl.java
    httpcomponents/httpcore/trunk/httpcore-nio/src/main/java/org/apache/http/nio/pool/AbstractNIOConnPool.java
    httpcomponents/httpcore/trunk/httpcore-nio/src/main/java/org/apache/http/nio/pool/RouteSpecificPool.java
    httpcomponents/httpcore/trunk/httpcore-nio/src/main/java/org/apache/http/nio/protocol/HttpAsyncService.java
    httpcomponents/httpcore/trunk/httpcore-nio/src/main/java/org/apache/http/nio/reactor/ssl/SSLIOSession.java
    httpcomponents/httpcore/trunk/httpcore-nio/src/main/java/org/apache/http/nio/util/SharedInputBuffer.java

Modified: httpcomponents/httpcore/trunk/httpcore-nio/src/main/java/org/apache/http/impl/nio/NHttpConnectionBase.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore-nio/src/main/java/org/apache/http/impl/nio/NHttpConnectionBase.java?rev=1698068&r1=1698067&r2=1698068&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore-nio/src/main/java/org/apache/http/impl/nio/NHttpConnectionBase.java
(original)
+++ httpcomponents/httpcore/trunk/httpcore-nio/src/main/java/org/apache/http/impl/nio/NHttpConnectionBase.java
Thu Aug 27 04:48:47 2015
@@ -336,18 +336,16 @@ class NHttpConnectionBase implements NHt
             buffer.append("<->");
             NetUtils.formatAddress(buffer, remoteAddress);
             return buffer.toString();
-        } else {
-            return "[Not bound]";
         }
+        return "[Not bound]";
     }
 
     @Override
     public Socket getSocket() {
         if (this.session instanceof SocketAccessor) {
             return ((SocketAccessor) this.session).getSocket();
-        } else {
-            return null;
         }
+        return null;
     }
 
 }

Modified: httpcomponents/httpcore/trunk/httpcore-nio/src/main/java/org/apache/http/impl/nio/codecs/AbstractContentEncoder.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore-nio/src/main/java/org/apache/http/impl/nio/codecs/AbstractContentEncoder.java?rev=1698068&r1=1698067&r2=1698068&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore-nio/src/main/java/org/apache/http/impl/nio/codecs/AbstractContentEncoder.java
(original)
+++ httpcomponents/httpcore/trunk/httpcore-nio/src/main/java/org/apache/http/impl/nio/codecs/AbstractContentEncoder.java
Thu Aug 27 04:48:47 2015
@@ -184,11 +184,10 @@ public abstract class AbstractContentEnc
                 this.metrics.incrementBytesTransferred(bytesWritten);
             }
             return bytesWritten;
-        } else {
-            final int chunk = src.remaining();
-            this.buffer.write(src);
-            return chunk;
         }
+        final int chunk = src.remaining();
+        this.buffer.write(src);
+        return chunk;
     }
 
 }

Modified: httpcomponents/httpcore/trunk/httpcore-nio/src/main/java/org/apache/http/impl/nio/codecs/AbstractMessageParser.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore-nio/src/main/java/org/apache/http/impl/nio/codecs/AbstractMessageParser.java?rev=1698068&r1=1698067&r2=1698068&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore-nio/src/main/java/org/apache/http/impl/nio/codecs/AbstractMessageParser.java
(original)
+++ httpcomponents/httpcore/trunk/httpcore-nio/src/main/java/org/apache/http/impl/nio/codecs/AbstractMessageParser.java
Thu Aug 27 04:48:47 2015
@@ -113,9 +113,8 @@ public abstract class AbstractMessagePar
                 throw new MessageConstraintException("Maximum empty line limit exceeded");
             }
             return null;
-        } else {
-            return createMessage(this.lineBuf);
         }
+        return createMessage(this.lineBuf);
     }
 
     private void parseHeader() throws IOException {
@@ -194,9 +193,8 @@ public abstract class AbstractMessagePar
                 this.message.addHeader(this.lineParser.parseHeader(buffer));
             }
             return this.message;
-        } else {
-            return null;
         }
+        return null;
     }
 
 }

Modified: httpcomponents/httpcore/trunk/httpcore-nio/src/main/java/org/apache/http/impl/nio/codecs/ChunkDecoder.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore-nio/src/main/java/org/apache/http/impl/nio/codecs/ChunkDecoder.java?rev=1698068&r1=1698067&r2=1698068&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore-nio/src/main/java/org/apache/http/impl/nio/codecs/ChunkDecoder.java
(original)
+++ httpcomponents/httpcore/trunk/httpcore-nio/src/main/java/org/apache/http/impl/nio/codecs/ChunkDecoder.java
Thu Aug 27 04:48:47 2015
@@ -274,9 +274,8 @@ public class ChunkDecoder extends Abstra
     public Header[] getFooters() {
         if (this.footers != null) {
             return this.footers.clone();
-        } else {
-            return new Header[] {};
         }
+        return new Header[] {};
     }
 
     @Override

Modified: httpcomponents/httpcore/trunk/httpcore-nio/src/main/java/org/apache/http/impl/nio/codecs/LengthDelimitedDecoder.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore-nio/src/main/java/org/apache/http/impl/nio/codecs/LengthDelimitedDecoder.java?rev=1698068&r1=1698067&r2=1698068&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore-nio/src/main/java/org/apache/http/impl/nio/codecs/LengthDelimitedDecoder.java
(original)
+++ httpcomponents/httpcore/trunk/httpcore-nio/src/main/java/org/apache/http/impl/nio/codecs/LengthDelimitedDecoder.java
Thu Aug 27 04:48:47 2015
@@ -98,9 +98,8 @@ public class LengthDelimitedDecoder exte
         }
         if (this.completed && bytesRead == 0) {
             return -1;
-        } else {
-            return bytesRead;
         }
+        return bytesRead;
     }
 
     @Override

Modified: httpcomponents/httpcore/trunk/httpcore-nio/src/main/java/org/apache/http/impl/nio/reactor/ChannelEntry.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore-nio/src/main/java/org/apache/http/impl/nio/reactor/ChannelEntry.java?rev=1698068&r1=1698067&r2=1698068&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore-nio/src/main/java/org/apache/http/impl/nio/reactor/ChannelEntry.java
(original)
+++ httpcomponents/httpcore/trunk/httpcore-nio/src/main/java/org/apache/http/impl/nio/reactor/ChannelEntry.java
Thu Aug 27 04:48:47 2015
@@ -89,9 +89,8 @@ public class ChannelEntry {
     public Object getAttachment() {
         if (this.sessionRequest != null) {
             return this.sessionRequest.getAttachment();
-        } else {
-            return null;
         }
+        return null;
     }
 
     /**

Modified: httpcomponents/httpcore/trunk/httpcore-nio/src/main/java/org/apache/http/impl/nio/reactor/DefaultListeningIOReactor.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore-nio/src/main/java/org/apache/http/impl/nio/reactor/DefaultListeningIOReactor.java?rev=1698068&r1=1698067&r2=1698068&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore-nio/src/main/java/org/apache/http/impl/nio/reactor/DefaultListeningIOReactor.java
(original)
+++ httpcomponents/httpcore/trunk/httpcore-nio/src/main/java/org/apache/http/impl/nio/reactor/DefaultListeningIOReactor.java
Thu Aug 27 04:48:47 2015
@@ -226,9 +226,8 @@ public class DefaultListeningIOReactor e
                 if (this.exceptionHandler == null || !this.exceptionHandler.handle(ex)) {
                     throw new IOReactorException("Failure binding socket to address "
                             + address, ex);
-                } else {
-                    return;
                 }
+                return;
             }
             try {
                 final SelectionKey key = serverChannel.register(this.selector, SelectionKey.OP_ACCEPT);

Modified: httpcomponents/httpcore/trunk/httpcore-nio/src/main/java/org/apache/http/impl/nio/reactor/IOSessionImpl.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore-nio/src/main/java/org/apache/http/impl/nio/reactor/IOSessionImpl.java?rev=1698068&r1=1698067&r2=1698068&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore-nio/src/main/java/org/apache/http/impl/nio/reactor/IOSessionImpl.java
(original)
+++ httpcomponents/httpcore/trunk/httpcore-nio/src/main/java/org/apache/http/impl/nio/reactor/IOSessionImpl.java
Thu Aug 27 04:48:47 2015
@@ -120,18 +120,16 @@ public class IOSessionImpl implements IO
     public SocketAddress getLocalAddress() {
         if (this.channel instanceof SocketChannel) {
             return ((SocketChannel)this.channel).socket().getLocalSocketAddress();
-        } else {
-            return null;
         }
+        return null;
     }
 
     @Override
     public SocketAddress getRemoteAddress() {
         if (this.channel instanceof SocketChannel) {
             return ((SocketChannel)this.channel).socket().getRemoteSocketAddress();
-        } else {
-            return null;
         }
+        return null;
     }
 
     @Override
@@ -374,9 +372,8 @@ public class IOSessionImpl implements IO
     public Socket getSocket() {
         if (this.channel instanceof SocketChannel) {
             return ((SocketChannel) this.channel).socket();
-        } else {
-            return null;
         }
+        return null;
     }
 
 }

Modified: httpcomponents/httpcore/trunk/httpcore-nio/src/main/java/org/apache/http/impl/nio/reactor/InterestOpEntry.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore-nio/src/main/java/org/apache/http/impl/nio/reactor/InterestOpEntry.java?rev=1698068&r1=1698067&r2=1698068&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore-nio/src/main/java/org/apache/http/impl/nio/reactor/InterestOpEntry.java
(original)
+++ httpcomponents/httpcore/trunk/httpcore-nio/src/main/java/org/apache/http/impl/nio/reactor/InterestOpEntry.java
Thu Aug 27 04:48:47 2015
@@ -65,9 +65,8 @@ class InterestOpEntry {
         if (obj instanceof InterestOpEntry) {
             final InterestOpEntry that = (InterestOpEntry) obj;
             return this.key.equals(that.key);
-        } else {
-            return false;
         }
+        return false;
     }
 
     @Override

Modified: httpcomponents/httpcore/trunk/httpcore-nio/src/main/java/org/apache/http/impl/nio/reactor/SessionInputBufferImpl.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore-nio/src/main/java/org/apache/http/impl/nio/reactor/SessionInputBufferImpl.java?rev=1698068&r1=1698067&r2=1698068&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore-nio/src/main/java/org/apache/http/impl/nio/reactor/SessionInputBufferImpl.java
(original)
+++ httpcomponents/httpcore/trunk/httpcore-nio/src/main/java/org/apache/http/impl/nio/reactor/SessionInputBufferImpl.java
Thu Aug 27 04:48:47 2015
@@ -180,9 +180,8 @@ public class SessionInputBufferImpl exte
             dst.put(buffer());
             buffer().limit(oldLimit);
             return len;
-        } else {
-            dst.put(buffer());
         }
+        dst.put(buffer());
         return chunk;
     }
 

Modified: httpcomponents/httpcore/trunk/httpcore-nio/src/main/java/org/apache/http/nio/pool/AbstractNIOConnPool.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore-nio/src/main/java/org/apache/http/nio/pool/AbstractNIOConnPool.java?rev=1698068&r1=1698067&r2=1698068&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore-nio/src/main/java/org/apache/http/nio/pool/AbstractNIOConnPool.java
(original)
+++ httpcomponents/httpcore/trunk/httpcore-nio/src/main/java/org/apache/http/nio/pool/AbstractNIOConnPool.java
Thu Aug 27 04:48:47 2015
@@ -378,9 +378,8 @@ public abstract class AbstractNIOConnPoo
             this.pending.add(sessionRequest);
             pool.addPending(sessionRequest, request.getFuture());
             return true;
-        } else {
-            return false;
         }
+        return false;
     }
 
     private void fireCallbacks() {
@@ -509,9 +508,8 @@ public abstract class AbstractNIOConnPoo
         final Integer v = this.maxPerRoute.get(route);
         if (v != null) {
             return v.intValue();
-        } else {
-            return this.defaultMaxPerRoute;
         }
+        return this.defaultMaxPerRoute;
     }
 
     @Override

Modified: httpcomponents/httpcore/trunk/httpcore-nio/src/main/java/org/apache/http/nio/pool/RouteSpecificPool.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore-nio/src/main/java/org/apache/http/nio/pool/RouteSpecificPool.java?rev=1698068&r1=1698067&r2=1698068&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore-nio/src/main/java/org/apache/http/nio/pool/RouteSpecificPool.java
(original)
+++ httpcomponents/httpcore/trunk/httpcore-nio/src/main/java/org/apache/http/nio/pool/RouteSpecificPool.java
Thu Aug 27 04:48:47 2015
@@ -108,9 +108,8 @@ abstract class RouteSpecificPool<T, C, E
     public E getLastUsed() {
         if (!this.available.isEmpty()) {
             return this.available.getLast();
-        } else {
-            return null;
         }
+        return null;
     }
 
     public boolean remove(final E entry) {

Modified: httpcomponents/httpcore/trunk/httpcore-nio/src/main/java/org/apache/http/nio/protocol/HttpAsyncService.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore-nio/src/main/java/org/apache/http/nio/protocol/HttpAsyncService.java?rev=1698068&r1=1698067&r2=1698068&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore-nio/src/main/java/org/apache/http/nio/protocol/HttpAsyncService.java
(original)
+++ httpcomponents/httpcore/trunk/httpcore-nio/src/main/java/org/apache/http/nio/protocol/HttpAsyncService.java
Thu Aug 27 04:48:47 2015
@@ -256,9 +256,8 @@ public class HttpAsyncService implements
                 closeHandlers(state);
                 if (ex instanceof RuntimeException) {
                     throw (RuntimeException) ex;
-                } else {
-                    log(ex);
                 }
+                log(ex);
             }
         }
     }

Modified: httpcomponents/httpcore/trunk/httpcore-nio/src/main/java/org/apache/http/nio/reactor/ssl/SSLIOSession.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore-nio/src/main/java/org/apache/http/nio/reactor/ssl/SSLIOSession.java?rev=1698068&r1=1698067&r2=1698068&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore-nio/src/main/java/org/apache/http/nio/reactor/ssl/SSLIOSession.java
(original)
+++ httpcomponents/httpcore/trunk/httpcore-nio/src/main/java/org/apache/http/nio/reactor/ssl/SSLIOSession.java
Thu Aug 27 04:48:47 2015
@@ -577,9 +577,8 @@ public class SSLIOSession implements IOS
                 this.status = CLOSED;
             }
             return result.bytesConsumed();
-        } else {
-            return 0;
         }
+        return 0;
     }
 
     private synchronized int readPlain(final ByteBuffer dst) {
@@ -602,13 +601,11 @@ public class SSLIOSession implements IOS
                 inPlainBuf = null;
             }
             return n;
-        } else {
-            if (this.endOfStream) {
-                return -1;
-            } else {
-                return 0;
-            }
         }
+        if (this.endOfStream) {
+            return -1;
+        }
+        return 0;
     }
 
     @Override
@@ -785,9 +782,8 @@ public class SSLIOSession implements IOS
     public Socket getSocket(){
         if (this.session instanceof SocketAccessor){
             return ((SocketAccessor) this.session).getSocket();
-        } else {
-            return null;
         }
+        return null;
     }
 
     private class InternalByteChannel implements ByteChannel {

Modified: httpcomponents/httpcore/trunk/httpcore-nio/src/main/java/org/apache/http/nio/util/SharedInputBuffer.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore-nio/src/main/java/org/apache/http/nio/util/SharedInputBuffer.java?rev=1698068&r1=1698067&r2=1698068&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore-nio/src/main/java/org/apache/http/nio/util/SharedInputBuffer.java
(original)
+++ httpcomponents/httpcore/trunk/httpcore-nio/src/main/java/org/apache/http/nio/util/SharedInputBuffer.java
Thu Aug 27 04:48:47 2015
@@ -122,13 +122,11 @@ public class SharedInputBuffer extends E
 
             if (totalRead > 0) {
                 return totalRead;
-            } else {
-                if (this.endOfStream) {
-                    return -1;
-                } else {
-                    return 0;
-                }
             }
+            if (this.endOfStream) {
+                return -1;
+            }
+            return 0;
         } finally {
             this.lock.unlock();
         }



Mime
View raw message