hc-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ol...@apache.org
Subject svn commit: r1493831 - in /httpcomponents/httpcore/trunk: httpcore-nio/src/main/java/org/apache/http/impl/nio/codecs/ httpcore-nio/src/main/java/org/apache/http/impl/nio/reactor/ httpcore-nio/src/main/java/org/apache/http/nio/util/ httpcore/src/main/ja...
Date Mon, 17 Jun 2013 16:15:12 GMT
Author: olegk
Date: Mon Jun 17 16:15:11 2013
New Revision: 1493831

URL: http://svn.apache.org/r1493831
Log:
Made all method parameters final

Modified:
    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/AbstractMultiworkerIOReactor.java
    httpcomponents/httpcore/trunk/httpcore-nio/src/main/java/org/apache/http/nio/util/SharedOutputBuffer.java
    httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/entity/StringEntity.java
    httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/impl/io/AbstractMessageParser.java
    httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/impl/io/AbstractSessionInputBuffer.java
    httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/impl/io/ChunkedInputStream.java
    httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/impl/io/ContentLengthInputStream.java
    httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/impl/io/ContentLengthOutputStream.java
    httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/impl/io/SessionInputBufferImpl.java
    httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/impl/io/SocketInputBuffer.java
    httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/impl/io/SocketOutputBuffer.java
    httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/message/BasicHeaderIterator.java
    httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/message/BasicHeaderValueFormatter.java
    httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/message/BasicHeaderValueParser.java
    httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/message/BasicLineFormatter.java
    httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/message/BasicLineParser.java
    httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/message/BasicListHeaderIterator.java
    httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/message/BasicTokenIterator.java
    httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/util/ByteArrayBuffer.java
    httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/util/CharArrayBuffer.java
    httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/util/VersionInfo.java

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=1493831&r1=1493830&r2=1493831&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 Mon Jun 17 16:15:11 2013
@@ -106,7 +106,7 @@ public class LengthDelimitedDecoder exte
     public long transfer(
             final FileChannel dst,
             final long position,
-            long count) throws IOException {
+            final long count) throws IOException {
 
         if (dst == null) {
             return 0;
@@ -123,15 +123,12 @@ public class LengthDelimitedDecoder exte
             dst.position(position);
             bytesRead = this.buffer.read(dst, maxLen);
         } else {
-            if (count > chunk) {
-                count = chunk;
-            }
             if (this.channel.isOpen()) {
                 if (position > dst.size()) {
                     throw new IOException("Position past end of file [" + position +
                             " > " + dst.size() + "]");
                 }
-                bytesRead = dst.transferFrom(this.channel, position, count);
+                bytesRead = dst.transferFrom(this.channel, position, count < chunk ? count : chunk);
             } else {
                 bytesRead = -1;
             }

Modified: httpcomponents/httpcore/trunk/httpcore-nio/src/main/java/org/apache/http/impl/nio/reactor/AbstractMultiworkerIOReactor.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore-nio/src/main/java/org/apache/http/impl/nio/reactor/AbstractMultiworkerIOReactor.java?rev=1493831&r1=1493830&r2=1493831&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore-nio/src/main/java/org/apache/http/impl/nio/reactor/AbstractMultiworkerIOReactor.java (original)
+++ httpcomponents/httpcore/trunk/httpcore-nio/src/main/java/org/apache/http/impl/nio/reactor/AbstractMultiworkerIOReactor.java Mon Jun 17 16:15:11 2013
@@ -230,17 +230,14 @@ public abstract class AbstractMultiworke
      * @param timestamp the time stamp of the exception. Can be
      * <code>null</code> in which case the current date / time will be used.
      */
-    protected synchronized void addExceptionEvent(final Throwable ex, Date timestamp) {
+    protected synchronized void addExceptionEvent(final Throwable ex, final Date timestamp) {
         if (ex == null) {
             return;
         }
-        if (timestamp == null) {
-            timestamp = new Date();
-        }
         if (this.auditLog == null) {
             this.auditLog = new ArrayList<ExceptionEvent>();
         }
-        this.auditLog.add(new ExceptionEvent(ex, timestamp));
+        this.auditLog.add(new ExceptionEvent(ex, timestamp != null ? timestamp : new Date()));
     }
 
     /**

Modified: httpcomponents/httpcore/trunk/httpcore-nio/src/main/java/org/apache/http/nio/util/SharedOutputBuffer.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore-nio/src/main/java/org/apache/http/nio/util/SharedOutputBuffer.java?rev=1493831&r1=1493830&r2=1493831&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore-nio/src/main/java/org/apache/http/nio/util/SharedOutputBuffer.java (original)
+++ httpcomponents/httpcore/trunk/httpcore-nio/src/main/java/org/apache/http/nio/util/SharedOutputBuffer.java Mon Jun 17 16:15:11 2013
@@ -209,10 +209,11 @@ public class SharedOutputBuffer extends 
         }
     }
 
-    public void write(final byte[] b, int off, final int len) throws IOException {
+    public void write(final byte[] b, final int off, final int len) throws IOException {
         if (b == null) {
             return;
         }
+        int pos = off;
         this.lock.lock();
         try {
             Asserts.check(!this.shutdown && !this.endOfStream, "Buffer already closed for writing");
@@ -224,9 +225,9 @@ public class SharedOutputBuffer extends 
                     setInputMode();
                 }
                 final int chunk = Math.min(remaining, this.buffer.remaining());
-                this.buffer.put(b, off, chunk);
+                this.buffer.put(b, pos, chunk);
                 remaining -= chunk;
-                off += chunk;
+                pos += chunk;
             }
         } finally {
             this.lock.unlock();

Modified: httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/entity/StringEntity.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/entity/StringEntity.java?rev=1493831&r1=1493830&r2=1493831&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/entity/StringEntity.java (original)
+++ httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/entity/StringEntity.java Mon Jun 17 16:15:11 2013
@@ -94,18 +94,14 @@ public class StringEntity extends Abstra
      * @deprecated (4.1.3) use {@link #StringEntity(String, ContentType)}
      */
     @Deprecated
-    public StringEntity(final String string, String mimeType, String charset)
-            throws UnsupportedEncodingException {
+    public StringEntity(
+            final String string, final String mimeType, final String charset) throws UnsupportedEncodingException {
         super();
         Args.notNull(string, "Source string");
-        if (mimeType == null) {
-            mimeType = HTTP.PLAIN_TEXT_TYPE;
-        }
-        if (charset == null) {
-            charset = HTTP.DEFAULT_CONTENT_CHARSET;
-        }
-        this.content = string.getBytes(charset);
-        setContentType(mimeType + HTTP.CHARSET_PARAM + charset);
+        final String mt = mimeType != null ? mimeType : HTTP.PLAIN_TEXT_TYPE;
+        final String cs = charset != null ? charset :HTTP.DEFAULT_CONTENT_CHARSET;
+        this.content = string.getBytes(cs);
+        setContentType(mt + HTTP.CHARSET_PARAM + cs);
     }
 
     /**

Modified: httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/impl/io/AbstractMessageParser.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/impl/io/AbstractMessageParser.java?rev=1493831&r1=1493830&r2=1493831&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/impl/io/AbstractMessageParser.java (original)
+++ httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/impl/io/AbstractMessageParser.java Mon Jun 17 16:15:11 2013
@@ -140,13 +140,11 @@ public abstract class AbstractMessagePar
             final SessionInputBuffer inbuffer,
             final int maxHeaderCount,
             final int maxLineLen,
-            LineParser parser)
-        throws HttpException, IOException {
-        if (parser == null) {
-            parser = BasicLineParser.INSTANCE;
-        }
+            final LineParser parser) throws HttpException, IOException {
         final List<CharArrayBuffer> headerLines = new ArrayList<CharArrayBuffer>();
-        return parseHeaders(inbuffer, maxHeaderCount, maxLineLen, parser, headerLines);
+        return parseHeaders(inbuffer, maxHeaderCount, maxLineLen,
+                parser != null ? parser : BasicLineParser.INSTANCE,
+                headerLines);
     }
 
     /**

Modified: httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/impl/io/AbstractSessionInputBuffer.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/impl/io/AbstractSessionInputBuffer.java?rev=1493831&r1=1493830&r2=1493831&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/impl/io/AbstractSessionInputBuffer.java (original)
+++ httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/impl/io/AbstractSessionInputBuffer.java Mon Jun 17 16:15:11 2013
@@ -324,16 +324,16 @@ public abstract class AbstractSessionInp
         return len;
     }
 
-    private int lineFromReadBuffer(final CharArrayBuffer charbuffer, int pos)
+    private int lineFromReadBuffer(final CharArrayBuffer charbuffer, final int position)
             throws IOException {
         final int off = this.bufferpos;
-        int len;
-        this.bufferpos = pos + 1;
-        if (pos > off && this.buffer[pos - 1] == HTTP.CR) {
+        int i = position;
+        this.bufferpos = i + 1;
+        if (i > off && this.buffer[i - 1] == HTTP.CR) {
             // skip CR if found
-            pos--;
+            i--;
         }
-        len = pos - off;
+        int len = i - off;
         if (this.ascii) {
             charbuffer.append(this.buffer, off, len);
         } else {

Modified: httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/impl/io/ChunkedInputStream.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/impl/io/ChunkedInputStream.java?rev=1493831&r1=1493830&r2=1493831&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/impl/io/ChunkedInputStream.java (original)
+++ httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/impl/io/ChunkedInputStream.java Mon Jun 17 16:15:11 2013
@@ -156,7 +156,7 @@ public class ChunkedInputStream extends 
      * @throws IOException in case of an I/O error
      */
     @Override
-    public int read (final byte[] b, final int off, int len) throws IOException {
+    public int read (final byte[] b, final int off, final int len) throws IOException {
 
         if (closed) {
             throw new IOException("Attempted read from closed stream.");
@@ -171,8 +171,7 @@ public class ChunkedInputStream extends 
                 return -1;
             }
         }
-        len = Math.min(len, chunkSize - pos);
-        final int bytesRead = in.read(b, off, len);
+        final int bytesRead = in.read(b, off, Math.min(len, chunkSize - pos));
         if (bytesRead != -1) {
             pos += bytesRead;
             if (pos >= chunkSize) {
@@ -226,8 +225,8 @@ public class ChunkedInputStream extends 
         switch (st) {
         case CHUNK_CRLF:
             this.buffer.clear();
-            int i = this.in.readLine(this.buffer);
-            if (i == -1) {
+            final int bytesRead1 = this.in.readLine(this.buffer);
+            if (bytesRead1 == -1) {
                 return 0;
             }
             if (!this.buffer.isEmpty()) {
@@ -238,8 +237,8 @@ public class ChunkedInputStream extends 
             //$FALL-THROUGH$
         case CHUNK_LEN:
             this.buffer.clear();
-            i = this.in.readLine(this.buffer);
-            if (i == -1) {
+            final int bytesRead2 = this.in.readLine(this.buffer);
+            if (bytesRead2 == -1) {
                 return 0;
             }
             int separator = this.buffer.indexOf(';');

Modified: httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/impl/io/ContentLengthInputStream.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/impl/io/ContentLengthInputStream.java?rev=1493831&r1=1493830&r2=1493831&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/impl/io/ContentLengthInputStream.java (original)
+++ httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/impl/io/ContentLengthInputStream.java Mon Jun 17 16:15:11 2013
@@ -162,7 +162,7 @@ public class ContentLengthInputStream ex
      * @throws java.io.IOException Should an error occur on the wrapped stream.
      */
     @Override
-    public int read (final byte[] b, final int off, int len) throws java.io.IOException {
+    public int read (final byte[] b, final int off, final int len) throws java.io.IOException {
         if (closed) {
             throw new IOException("Attempted read from closed stream.");
         }
@@ -171,10 +171,11 @@ public class ContentLengthInputStream ex
             return -1;
         }
 
+        int chunk = len;
         if (pos + len > contentLength) {
-            len = (int) (contentLength - pos);
+            chunk = (int) (contentLength - pos);
         }
-        final int count = this.in.read(b, off, len);
+        final int count = this.in.read(b, off, chunk);
         if (count == -1 && pos < contentLength) {
             throw new ConnectionClosedException(
                     "Premature end of Content-Length delimited message body (expected: "

Modified: httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/impl/io/ContentLengthOutputStream.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/impl/io/ContentLengthOutputStream.java?rev=1493831&r1=1493830&r2=1493831&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/impl/io/ContentLengthOutputStream.java (original)
+++ httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/impl/io/ContentLengthOutputStream.java Mon Jun 17 16:15:11 2013
@@ -102,17 +102,18 @@ public class ContentLengthOutputStream e
     }
 
     @Override
-    public void write(final byte[] b, final int off, int len) throws IOException {
+    public void write(final byte[] b, final int off, final int len) throws IOException {
         if (this.closed) {
             throw new IOException("Attempted write to closed stream.");
         }
         if (this.total < this.contentLength) {
             final long max = this.contentLength - this.total;
-            if (len > max) {
-                len = (int) max;
+            int chunk = len;
+            if (chunk > max) {
+                chunk = (int) max;
             }
-            this.out.write(b, off, len);
-            this.total += len;
+            this.out.write(b, off, chunk);
+            this.total += chunk;
         }
     }
 

Modified: httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/impl/io/SessionInputBufferImpl.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/impl/io/SessionInputBufferImpl.java?rev=1493831&r1=1493830&r2=1493831&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/impl/io/SessionInputBufferImpl.java (original)
+++ httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/impl/io/SessionInputBufferImpl.java Mon Jun 17 16:15:11 2013
@@ -316,8 +316,9 @@ public class SessionInputBufferImpl impl
         return len;
     }
 
-    private int lineFromReadBuffer(final CharArrayBuffer charbuffer, int pos)
+    private int lineFromReadBuffer(final CharArrayBuffer charbuffer, final int position)
             throws IOException {
+        int pos = position;
         final int off = this.bufferpos;
         int len;
         this.bufferpos = pos + 1;

Modified: httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/impl/io/SocketInputBuffer.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/impl/io/SocketInputBuffer.java?rev=1493831&r1=1493830&r2=1493831&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/impl/io/SocketInputBuffer.java (original)
+++ httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/impl/io/SocketInputBuffer.java Mon Jun 17 16:15:11 2013
@@ -63,19 +63,20 @@ public class SocketInputBuffer extends A
      */
     public SocketInputBuffer(
             final Socket socket,
-            int buffersize,
+            final int buffersize,
             final HttpParams params) throws IOException {
         super();
         Args.notNull(socket, "Socket");
         this.socket = socket;
         this.eof = false;
-        if (buffersize < 0) {
-            buffersize = socket.getReceiveBufferSize();
+        int n = buffersize;
+        if (n < 0) {
+            n = socket.getReceiveBufferSize();
         }
-        if (buffersize < 1024) {
-            buffersize = 1024;
+        if (n < 1024) {
+            n = 1024;
         }
-        init(socket.getInputStream(), buffersize, params);
+        init(socket.getInputStream(), n, params);
     }
 
     @Override

Modified: httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/impl/io/SocketOutputBuffer.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/impl/io/SocketOutputBuffer.java?rev=1493831&r1=1493830&r2=1493831&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/impl/io/SocketOutputBuffer.java (original)
+++ httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/impl/io/SocketOutputBuffer.java Mon Jun 17 16:15:11 2013
@@ -58,17 +58,18 @@ public class SocketOutputBuffer extends 
      */
     public SocketOutputBuffer(
             final Socket socket,
-            int buffersize,
+            final int buffersize,
             final HttpParams params) throws IOException {
         super();
         Args.notNull(socket, "Socket");
-        if (buffersize < 0) {
-            buffersize = socket.getSendBufferSize();
+        int n = buffersize;
+        if (n < 0) {
+            n = socket.getSendBufferSize();
         }
-        if (buffersize < 1024) {
-            buffersize = 1024;
+        if (n < 1024) {
+            n = 1024;
         }
-        init(socket.getOutputStream(), buffersize, params);
+        init(socket.getOutputStream(), n, params);
     }
 
 }

Modified: httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/message/BasicHeaderIterator.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/message/BasicHeaderIterator.java?rev=1493831&r1=1493830&r2=1493831&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/message/BasicHeaderIterator.java (original)
+++ httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/message/BasicHeaderIterator.java Mon Jun 17 16:15:11 2013
@@ -84,13 +84,14 @@ public class BasicHeaderIterator impleme
     /**
      * Determines the index of the next header.
      *
-     * @param from      one less than the index to consider first,
+     * @param pos      one less than the index to consider first,
      *                  -1 to search for the first header
      *
      * @return  the index of the next header that matches the filter name,
      *          or negative if there are no more headers
      */
-    protected int findNext(int from) {
+    protected int findNext(final int pos) {
+        int from = pos;
         if (from < -1) {
             return -1;
         }

Modified: httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/message/BasicHeaderValueFormatter.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/message/BasicHeaderValueFormatter.java?rev=1493831&r1=1493830&r2=1493831&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/message/BasicHeaderValueFormatter.java (original)
+++ httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/message/BasicHeaderValueFormatter.java Mon Jun 17 16:15:11 2013
@@ -88,20 +88,19 @@ public class BasicHeaderValueFormatter i
     public static
         String formatElements(final HeaderElement[] elems,
                               final boolean quote,
-                              HeaderValueFormatter formatter) {
-        if (formatter == null) {
-            formatter = BasicHeaderValueFormatter.INSTANCE;
-        }
-        return formatter.formatElements(null, elems, quote).toString();
+                              final HeaderValueFormatter formatter) {
+        return (formatter != null ? formatter : BasicHeaderValueFormatter.INSTANCE)
+                .formatElements(null, elems, quote).toString();
     }
 
 
     // non-javadoc, see interface HeaderValueFormatter
-    public CharArrayBuffer formatElements(CharArrayBuffer buffer,
+    public CharArrayBuffer formatElements(final CharArrayBuffer charBuffer,
                                           final HeaderElement[] elems,
                                           final boolean quote) {
         Args.notNull(elems, "Header element array");
         final int len = estimateElementsLen(elems);
+        CharArrayBuffer buffer = charBuffer;
         if (buffer == null) {
             buffer = new CharArrayBuffer(len);
         } else {
@@ -155,20 +154,19 @@ public class BasicHeaderValueFormatter i
     public static
         String formatHeaderElement(final HeaderElement elem,
                                    final boolean quote,
-                                   HeaderValueFormatter formatter) {
-        if (formatter == null) {
-            formatter = BasicHeaderValueFormatter.INSTANCE;
-        }
-        return formatter.formatHeaderElement(null, elem, quote).toString();
+                                   final HeaderValueFormatter formatter) {
+        return (formatter != null ? formatter : BasicHeaderValueFormatter.INSTANCE)
+                .formatHeaderElement(null, elem, quote).toString();
     }
 
 
     // non-javadoc, see interface HeaderValueFormatter
-    public CharArrayBuffer formatHeaderElement(CharArrayBuffer buffer,
+    public CharArrayBuffer formatHeaderElement(final CharArrayBuffer charBuffer,
                                                final HeaderElement elem,
                                                final boolean quote) {
         Args.notNull(elem, "Header element");
         final int len = estimateHeaderElementLen(elem);
+        CharArrayBuffer buffer = charBuffer;
         if (buffer == null) {
             buffer = new CharArrayBuffer(len);
         } else {
@@ -241,20 +239,19 @@ public class BasicHeaderValueFormatter i
     public static
         String formatParameters(final NameValuePair[] nvps,
                                 final boolean quote,
-                                HeaderValueFormatter formatter) {
-        if (formatter == null) {
-            formatter = BasicHeaderValueFormatter.INSTANCE;
-        }
-        return formatter.formatParameters(null, nvps, quote).toString();
+                                final HeaderValueFormatter formatter) {
+        return (formatter != null ? formatter : BasicHeaderValueFormatter.INSTANCE)
+                .formatParameters(null, nvps, quote).toString();
     }
 
 
     // non-javadoc, see interface HeaderValueFormatter
-    public CharArrayBuffer formatParameters(CharArrayBuffer buffer,
+    public CharArrayBuffer formatParameters(final CharArrayBuffer charBuffer,
                                             final NameValuePair[] nvps,
                                             final boolean quote) {
         Args.notNull(nvps, "Header parameter array");
         final int len = estimateParametersLen(nvps);
+        CharArrayBuffer buffer = charBuffer;
         if (buffer == null) {
             buffer = new CharArrayBuffer(len);
         } else {
@@ -307,20 +304,19 @@ public class BasicHeaderValueFormatter i
     public static
         String formatNameValuePair(final NameValuePair nvp,
                                    final boolean quote,
-                                   HeaderValueFormatter formatter) {
-        if (formatter == null) {
-            formatter = BasicHeaderValueFormatter.INSTANCE;
-        }
-        return formatter.formatNameValuePair(null, nvp, quote).toString();
+                                   final HeaderValueFormatter formatter) {
+        return (formatter != null ? formatter : BasicHeaderValueFormatter.INSTANCE)
+                .formatNameValuePair(null, nvp, quote).toString();
     }
 
 
     // non-javadoc, see interface HeaderValueFormatter
-    public CharArrayBuffer formatNameValuePair(CharArrayBuffer buffer,
+    public CharArrayBuffer formatNameValuePair(final CharArrayBuffer charBuffer,
                                                final NameValuePair nvp,
                                                final boolean quote) {
         Args.notNull(nvp, "Name / value pair");
         final int len = estimateNameValuePairLen(nvp);
+        CharArrayBuffer buffer = charBuffer;
         if (buffer == null) {
             buffer = new CharArrayBuffer(len);
         } else {
@@ -372,15 +368,16 @@ public class BasicHeaderValueFormatter i
      */
     protected void doFormatValue(final CharArrayBuffer buffer,
                                  final String value,
-                                 boolean quote) {
+                                 final boolean quote) {
 
-        if (!quote) {
-            for (int i = 0; (i < value.length()) && !quote; i++) {
-                quote = isSeparator(value.charAt(i));
+        boolean quoteFlag = quote;
+        if (!quoteFlag) {
+            for (int i = 0; (i < value.length()) && !quoteFlag; i++) {
+                quoteFlag = isSeparator(value.charAt(i));
             }
         }
 
-        if (quote) {
+        if (quoteFlag) {
             buffer.append('"');
         }
         for (int i = 0; i < value.length(); i++) {
@@ -390,7 +387,7 @@ public class BasicHeaderValueFormatter i
             }
             buffer.append(ch);
         }
-        if (quote) {
+        if (quoteFlag) {
             buffer.append('"');
         }
     }

Modified: httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/message/BasicHeaderValueParser.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/message/BasicHeaderValueParser.java?rev=1493831&r1=1493830&r2=1493831&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/message/BasicHeaderValueParser.java (original)
+++ httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/message/BasicHeaderValueParser.java Mon Jun 17 16:15:11 2013
@@ -83,16 +83,14 @@ public class BasicHeaderValueParser impl
      */
     public static
         HeaderElement[] parseElements(final String value,
-                                      HeaderValueParser parser) throws ParseException {
+                                      final HeaderValueParser parser) throws ParseException {
         Args.notNull(value, "Value");
-        if (parser == null) {
-            parser = BasicHeaderValueParser.INSTANCE;
-        }
 
         final CharArrayBuffer buffer = new CharArrayBuffer(value.length());
         buffer.append(value);
         final ParserCursor cursor = new ParserCursor(0, value.length());
-        return parser.parseElements(buffer, cursor);
+        return (parser != null ? parser : BasicHeaderValueParser.INSTANCE)
+            .parseElements(buffer, cursor);
     }
 
 
@@ -122,16 +120,14 @@ public class BasicHeaderValueParser impl
      */
     public static
         HeaderElement parseHeaderElement(final String value,
-                                         HeaderValueParser parser) throws ParseException {
+                                         final HeaderValueParser parser) throws ParseException {
         Args.notNull(value, "Value");
-        if (parser == null) {
-            parser = BasicHeaderValueParser.INSTANCE;
-        }
 
         final CharArrayBuffer buffer = new CharArrayBuffer(value.length());
         buffer.append(value);
         final ParserCursor cursor = new ParserCursor(0, value.length());
-        return parser.parseHeaderElement(buffer, cursor);
+        return (parser != null ? parser : BasicHeaderValueParser.INSTANCE)
+                .parseHeaderElement(buffer, cursor);
     }
 
 
@@ -176,16 +172,14 @@ public class BasicHeaderValueParser impl
      */
     public static
         NameValuePair[] parseParameters(final String value,
-                                        HeaderValueParser parser) throws ParseException {
+                                        final HeaderValueParser parser) throws ParseException {
         Args.notNull(value, "Value");
-        if (parser == null) {
-            parser = BasicHeaderValueParser.INSTANCE;
-        }
 
         final CharArrayBuffer buffer = new CharArrayBuffer(value.length());
         buffer.append(value);
         final ParserCursor cursor = new ParserCursor(0, value.length());
-        return parser.parseParameters(buffer, cursor);
+        return (parser != null ? parser : BasicHeaderValueParser.INSTANCE)
+                .parseParameters(buffer, cursor);
     }
 
 
@@ -234,16 +228,14 @@ public class BasicHeaderValueParser impl
      */
     public static
        NameValuePair parseNameValuePair(final String value,
-                                        HeaderValueParser parser) throws ParseException {
+                                        final HeaderValueParser parser) throws ParseException {
         Args.notNull(value, "Value");
-        if (parser == null) {
-            parser = BasicHeaderValueParser.INSTANCE;
-        }
 
         final CharArrayBuffer buffer = new CharArrayBuffer(value.length());
         buffer.append(value);
         final ParserCursor cursor = new ParserCursor(0, value.length());
-        return parser.parseNameValuePair(buffer, cursor);
+        return (parser != null ? parser : BasicHeaderValueParser.INSTANCE)
+                .parseNameValuePair(buffer, cursor);
     }
 
 

Modified: httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/message/BasicLineFormatter.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/message/BasicLineFormatter.java?rev=1493831&r1=1493830&r2=1493831&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/message/BasicLineFormatter.java (original)
+++ httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/message/BasicLineFormatter.java Mon Jun 17 16:15:11 2013
@@ -71,12 +71,13 @@ public class BasicLineFormatter implemen
     /**
      * Obtains a buffer for formatting.
      *
-     * @param buffer    a buffer already available, or <code>null</code>
+     * @param charBuffer a buffer already available, or <code>null</code>
      *
      * @return  the cleared argument buffer if there is one, or
      *          a new empty buffer that can be used for formatting
      */
-    protected CharArrayBuffer initBuffer(CharArrayBuffer buffer) {
+    protected CharArrayBuffer initBuffer(final CharArrayBuffer charBuffer) {
+        CharArrayBuffer buffer = charBuffer;
         if (buffer != null) {
             buffer.clear();
         } else {
@@ -98,11 +99,9 @@ public class BasicLineFormatter implemen
      */
     public static
         String formatProtocolVersion(final ProtocolVersion version,
-                                     LineFormatter formatter) {
-        if (formatter == null) {
-            formatter = BasicLineFormatter.INSTANCE;
-        }
-        return formatter.appendProtocolVersion(null, version).toString();
+                                     final LineFormatter formatter) {
+        return (formatter != null ? formatter : BasicLineFormatter.INSTANCE)
+                .appendProtocolVersion(null, version).toString();
     }
 
 
@@ -154,11 +153,9 @@ public class BasicLineFormatter implemen
      * @return  the formatted request line
      */
     public static String formatRequestLine(final RequestLine reqline,
-                                                 LineFormatter formatter) {
-        if (formatter == null) {
-            formatter = BasicLineFormatter.INSTANCE;
-        }
-        return formatter.formatRequestLine(null, reqline).toString();
+                                           final LineFormatter formatter) {
+        return (formatter != null ? formatter : BasicLineFormatter.INSTANCE)
+                .formatRequestLine(null, reqline).toString();
     }
 
 
@@ -211,11 +208,9 @@ public class BasicLineFormatter implemen
      * @return  the formatted status line
      */
     public static String formatStatusLine(final StatusLine statline,
-                                                LineFormatter formatter) {
-        if (formatter == null) {
-            formatter = BasicLineFormatter.INSTANCE;
-        }
-        return formatter.formatStatusLine(null, statline).toString();
+                                          final LineFormatter formatter) {
+        return (formatter != null ? formatter : BasicLineFormatter.INSTANCE)
+                .formatStatusLine(null, statline).toString();
     }
 
 
@@ -270,11 +265,9 @@ public class BasicLineFormatter implemen
      * @return  the formatted header
      */
     public static String formatHeader(final Header header,
-                                            LineFormatter formatter) {
-        if (formatter == null) {
-            formatter = BasicLineFormatter.INSTANCE;
-        }
-        return formatter.formatHeader(null, header).toString();
+                                      final LineFormatter formatter) {
+        return (formatter != null ? formatter : BasicLineFormatter.INSTANCE)
+                .formatHeader(null, header).toString();
     }
 
 

Modified: httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/message/BasicLineParser.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/message/BasicLineParser.java?rev=1493831&r1=1493830&r2=1493831&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/message/BasicLineParser.java (original)
+++ httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/message/BasicLineParser.java Mon Jun 17 16:15:11 2013
@@ -86,11 +86,8 @@ public class BasicLineParser implements 
      *                  <code>null</code> for HTTP. The actual version
      *                  is not relevant, only the protocol name.
      */
-    public BasicLineParser(ProtocolVersion proto) {
-        if (proto == null) {
-            proto = HttpVersion.HTTP_1_1;
-        }
-        this.protocol = proto;
+    public BasicLineParser(final ProtocolVersion proto) {
+        this.protocol = proto != null? proto : HttpVersion.HTTP_1_1;
     }
 
 
@@ -104,16 +101,14 @@ public class BasicLineParser implements 
 
     public static
         ProtocolVersion parseProtocolVersion(final String value,
-                                             LineParser parser) throws ParseException {
+                                             final LineParser parser) throws ParseException {
         Args.notNull(value, "Value");
-        if (parser == null) {
-            parser = BasicLineParser.INSTANCE;
-        }
 
         final CharArrayBuffer buffer = new CharArrayBuffer(value.length());
         buffer.append(value);
         final ParserCursor cursor = new ParserCursor(0, value.length());
-        return parser.parseProtocolVersion(buffer, cursor);
+        return (parser != null ? parser : BasicLineParser.INSTANCE)
+                .parseProtocolVersion(buffer, cursor);
     }
 
 
@@ -255,16 +250,14 @@ public class BasicLineParser implements 
 
     public static
         RequestLine parseRequestLine(final String value,
-                                     LineParser parser) throws ParseException {
+                                     final LineParser parser) throws ParseException {
         Args.notNull(value, "Value");
-        if (parser == null) {
-            parser = BasicLineParser.INSTANCE;
-        }
 
         final CharArrayBuffer buffer = new CharArrayBuffer(value.length());
         buffer.append(value);
         final ParserCursor cursor = new ParserCursor(0, value.length());
-        return parser.parseRequestLine(buffer, cursor);
+        return (parser != null ? parser : BasicLineParser.INSTANCE)
+            .parseRequestLine(buffer, cursor);
     }
 
 
@@ -344,16 +337,14 @@ public class BasicLineParser implements 
 
     public static
         StatusLine parseStatusLine(final String value,
-                                   LineParser parser) throws ParseException {
+                                   final LineParser parser) throws ParseException {
         Args.notNull(value, "Value");
-        if (parser == null) {
-            parser = BasicLineParser.INSTANCE;
-        }
 
         final CharArrayBuffer buffer = new CharArrayBuffer(value.length());
         buffer.append(value);
         final ParserCursor cursor = new ParserCursor(0, value.length());
-        return parser.parseStatusLine(buffer, cursor);
+        return (parser != null ? parser : BasicLineParser.INSTANCE)
+                .parseStatusLine(buffer, cursor);
     }
 
 
@@ -430,15 +421,13 @@ public class BasicLineParser implements 
 
     public static
         Header parseHeader(final String value,
-                           LineParser parser) throws ParseException {
+                           final LineParser parser) throws ParseException {
         Args.notNull(value, "Value");
-        if (parser == null) {
-            parser = BasicLineParser.INSTANCE;
-        }
 
         final CharArrayBuffer buffer = new CharArrayBuffer(value.length());
         buffer.append(value);
-        return parser.parseHeader(buffer);
+        return (parser != null ? parser : BasicLineParser.INSTANCE)
+                .parseHeader(buffer);
     }
 
 

Modified: httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/message/BasicListHeaderIterator.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/message/BasicListHeaderIterator.java?rev=1493831&r1=1493830&r2=1493831&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/message/BasicListHeaderIterator.java (original)
+++ httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/message/BasicListHeaderIterator.java Mon Jun 17 16:15:11 2013
@@ -93,13 +93,14 @@ public class BasicListHeaderIterator imp
     /**
      * Determines the index of the next header.
      *
-     * @param from      one less than the index to consider first,
+     * @param pos       one less than the index to consider first,
      *                  -1 to search for the first header
      *
      * @return  the index of the next header that matches the filter name,
      *          or negative if there are no more headers
      */
-    protected int findNext(int from) {
+    protected int findNext(final int pos) {
+        int from = pos;
         if (from < -1) {
             return -1;
         }

Modified: httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/message/BasicTokenIterator.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/message/BasicTokenIterator.java?rev=1493831&r1=1493830&r2=1493831&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/message/BasicTokenIterator.java (original)
+++ httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/message/BasicTokenIterator.java Mon Jun 17 16:15:11 2013
@@ -152,7 +152,7 @@ public class BasicTokenIterator implemen
      * will be obtained from {@link #headerIt}.
      * If not found, {@link #currentToken} is set to <code>null</code>.
      *
-     * @param from      the position in the current header at which to
+     * @param pos       the position in the current header at which to
      *                  start the search, -1 to search in the first header
      *
      * @return  the position after the found token in the current header, or
@@ -160,9 +160,8 @@ public class BasicTokenIterator implemen
      *
      * @throws ParseException   if an invalid header value is encountered
      */
-    protected int findNext(int from)
-        throws ParseException {
-
+    protected int findNext(final int pos) throws ParseException {
+        int from = pos;
         if (from < 0) {
             // called from the constructor, initialize the first header
             if (!this.headerIt.hasNext()) {
@@ -216,14 +215,14 @@ public class BasicTokenIterator implemen
      * Determines the starting position of the next token.
      * This method will iterate over headers if necessary.
      *
-     * @param from      the position in the current header at which to
+     * @param pos       the position in the current header at which to
      *                  start the search
      *
      * @return  the position of the token start in the current header,
      *          negative if no token start could be found
      */
-    protected int findTokenStart(int from) {
-        Args.notNegative(from, "Search position");
+    protected int findTokenStart(final int pos) {
+        int from = Args.notNegative(pos, "Search position");
         boolean found = false;
         while (!found && (this.currentHeader != null)) {
 
@@ -263,7 +262,7 @@ public class BasicTokenIterator implemen
      * header value is a token separator. This method does
      * therefore not need to iterate over headers.
      *
-     * @param from      the position in the current header at which to
+     * @param pos       the position in the current header at which to
      *                  start the search
      *
      * @return  the position of a token separator in the current header,
@@ -274,8 +273,8 @@ public class BasicTokenIterator implemen
      *         RFC 2616, section 2.1 explicitly requires a comma between
      *         tokens for <tt>#</tt>.
      */
-    protected int findTokenSeparator(int from) {
-        Args.notNegative(from, "Search position");
+    protected int findTokenSeparator(final int pos) {
+        int from = Args.notNegative(pos, "Search position");
         boolean found = false;
         final int to = this.currentHeader.length();
         while (!found && (from < to)) {

Modified: httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/util/ByteArrayBuffer.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/util/ByteArrayBuffer.java?rev=1493831&r1=1493830&r2=1493831&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/util/ByteArrayBuffer.java (original)
+++ httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/util/ByteArrayBuffer.java Mon Jun 17 16:15:11 2013
@@ -301,18 +301,20 @@ public final class ByteArrayBuffer imple
      * the <code>endIndex</code>, <code>-1</code> is returned.
      *
      * @param   b            the byte to search for.
-     * @param   beginIndex   the index to start the search from.
-     * @param   endIndex     the index to finish the search at.
+     * @param   from         the index to start the search from.
+     * @param   to           the index to finish the search at.
      * @return  the index of the first occurrence of the byte in the buffer
      *   within the given bounds, or <code>-1</code> if the byte does
      *   not occur.
      *
      * @since 4.1
      */
-    public int indexOf(final byte b, int beginIndex, int endIndex) {
+    public int indexOf(final byte b, final int from, final int to) {
+        int beginIndex = from;
         if (beginIndex < 0) {
             beginIndex = 0;
         }
+        int endIndex = to;
         if (endIndex > this.len) {
             endIndex = this.len;
         }

Modified: httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/util/CharArrayBuffer.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/util/CharArrayBuffer.java?rev=1493831&r1=1493830&r2=1493831&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/util/CharArrayBuffer.java (original)
+++ httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/util/CharArrayBuffer.java Mon Jun 17 16:15:11 2013
@@ -100,16 +100,14 @@ public final class CharArrayBuffer imple
      *
      * @param str    the string.
      */
-    public void append(String str) {
-        if (str == null) {
-            str = "null";
-        }
-        final int strlen = str.length();
+    public void append(final String str) {
+        final String s = str != null ? str : "null";
+        final int strlen = s.length();
         final int newlen = this.len + strlen;
         if (newlen > this.buffer.length) {
             expand(newlen);
         }
-        str.getChars(0, strlen, this.buffer, this.len);
+        s.getChars(0, strlen, this.buffer, this.len);
         this.len = newlen;
     }
 
@@ -362,17 +360,19 @@ public final class CharArrayBuffer imple
      * {@link #length()}. If the <code>beginIndex</code> is greater than
      * the <code>endIndex</code>, <code>-1</code> is returned.
      *
-     * @param   ch          the char to search for.
-     * @param   beginIndex   the index to start the search from.
-     * @param   endIndex   the index to finish the search at.
+     * @param   ch     the char to search for.
+     * @param   from   the index to start the search from.
+     * @param   to     the index to finish the search at.
      * @return  the index of the first occurrence of the character in the buffer
      *   within the given bounds, or <code>-1</code> if the character does
      *   not occur.
      */
-    public int indexOf(final int ch, int beginIndex, int endIndex) {
+    public int indexOf(final int ch, final int from, final int to) {
+        int beginIndex = from;
         if (beginIndex < 0) {
             beginIndex = 0;
         }
+        int endIndex = to;
         if (endIndex > this.len) {
             endIndex = this.len;
         }
@@ -426,8 +426,8 @@ public final class CharArrayBuffer imple
      * non-whitespace character with the index lesser than
      * <code>endIndex</code>.
      *
-     * @param      beginIndex   the beginning index, inclusive.
-     * @param      endIndex     the ending index, exclusive.
+     * @param      from   the beginning index, inclusive.
+     * @param      to     the ending index, exclusive.
      * @return     the specified substring.
      * @exception  IndexOutOfBoundsException  if the
      *             <code>beginIndex</code> is negative, or
@@ -435,7 +435,9 @@ public final class CharArrayBuffer imple
      *             buffer, or <code>beginIndex</code> is larger than
      *             <code>endIndex</code>.
      */
-    public String substringTrimmed(int beginIndex, int endIndex) {
+    public String substringTrimmed(final int from, final int to) {
+        int beginIndex = from;
+        int endIndex = to;
         if (beginIndex < 0) {
             throw new IndexOutOfBoundsException("Negative beginIndex: "+beginIndex);
         }

Modified: httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/util/VersionInfo.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/util/VersionInfo.java?rev=1493831&r1=1493830&r2=1493831&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/util/VersionInfo.java (original)
+++ httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/util/VersionInfo.java Mon Jun 17 16:15:11 2013
@@ -221,17 +221,15 @@ public class VersionInfo {
      *          <code>null</code> if not available
      */
     public static VersionInfo loadVersionInfo(final String pckg,
-                                                    ClassLoader clsldr) {
+                                              final ClassLoader clsldr) {
         Args.notNull(pckg, "Package identifier");
-        if (clsldr == null) {
-            clsldr = Thread.currentThread().getContextClassLoader();
-        }
+        final ClassLoader cl = clsldr != null ? clsldr : Thread.currentThread().getContextClassLoader();
 
         Properties vip = null; // version info properties, if available
         try {
             // org.apache.http      becomes
             // org/apache/http/version.properties
-            final InputStream is = clsldr.getResourceAsStream
+            final InputStream is = cl.getResourceAsStream
                 (pckg.replace('.', '/') + "/" + VERSION_PROPERTY_FILE);
             if (is != null) {
                 try {
@@ -248,7 +246,7 @@ public class VersionInfo {
 
         VersionInfo result = null;
         if (vip != null) {
-            result = fromMap(pckg, vip, clsldr);
+            result = fromMap(pckg, vip, cl);
         }
 
         return result;



Mime
View raw message