You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hc.apache.org by gg...@apache.org on 2013/06/06 16:31:08 UTC

svn commit: r1490299 - in /httpcomponents/httpclient/trunk: ./ httpclient/src/main/java/org/apache/http/impl/conn/ httpclient/src/test/java/org/apache/http/impl/conn/

Author: ggregory
Date: Thu Jun  6 14:31:08 2013
New Revision: 1490299

URL: http://svn.apache.org/r1490299
Log:
[HTTPCLIENT-1365] NPE when ManagedHttpClientConnectionFactory.create(ConnectionConfig) is called with null. Contributed by Gary Gregory <ggregory at apache.org>

Added:
    httpcomponents/httpclient/trunk/httpclient/src/test/java/org/apache/http/impl/conn/TestManagedHttpClientConnectionFactory.java   (with props)
Modified:
    httpcomponents/httpclient/trunk/RELEASE_NOTES.txt
    httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/impl/conn/ManagedHttpClientConnectionFactory.java

Modified: httpcomponents/httpclient/trunk/RELEASE_NOTES.txt
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient/trunk/RELEASE_NOTES.txt?rev=1490299&r1=1490298&r2=1490299&view=diff
==============================================================================
--- httpcomponents/httpclient/trunk/RELEASE_NOTES.txt (original)
+++ httpcomponents/httpclient/trunk/RELEASE_NOTES.txt Thu Jun  6 14:31:08 2013
@@ -1,6 +1,9 @@
 Changes since release 4.3 BETA2
 -------------------
 
+* [HTTPCLIENT-1365] NPE when ManagedHttpClientConnectionFactory.create(ConnectionConfig) is called with null.
+  Contributed by Gary Gregory <ggregory at apache.org>
+
 * [HTTPCLIENT-1362] Better error messages for connect timed out and connection refused 
   exceptions.
   Contributed by Oleg Kalnichevski <olegk at apache.org>

Modified: httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/impl/conn/ManagedHttpClientConnectionFactory.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/impl/conn/ManagedHttpClientConnectionFactory.java?rev=1490299&r1=1490298&r2=1490299&view=diff
==============================================================================
--- httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/impl/conn/ManagedHttpClientConnectionFactory.java (original)
+++ httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/impl/conn/ManagedHttpClientConnectionFactory.java Thu Jun  6 14:31:08 2013
@@ -104,8 +104,8 @@ public class ManagedHttpClientConnection
                 log,
                 headerlog,
                 wirelog,
-                config.getBufferSize(),
-                config.getFragmentSizeHint(),
+                cconfig.getBufferSize(),
+                cconfig.getFragmentSizeHint(),
                 chardecoder,
                 charencoder,
                 cconfig.getMessageConstraints(),

Added: httpcomponents/httpclient/trunk/httpclient/src/test/java/org/apache/http/impl/conn/TestManagedHttpClientConnectionFactory.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient/trunk/httpclient/src/test/java/org/apache/http/impl/conn/TestManagedHttpClientConnectionFactory.java?rev=1490299&view=auto
==============================================================================
--- httpcomponents/httpclient/trunk/httpclient/src/test/java/org/apache/http/impl/conn/TestManagedHttpClientConnectionFactory.java (added)
+++ httpcomponents/httpclient/trunk/httpclient/src/test/java/org/apache/http/impl/conn/TestManagedHttpClientConnectionFactory.java Thu Jun  6 14:31:08 2013
@@ -0,0 +1,52 @@
+/*
+ * ====================================================================
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ * ====================================================================
+ *
+ * This software consists of voluntary contributions made by many
+ * individuals on behalf of the Apache Software Foundation.  For more
+ * information on the Apache Software Foundation, please see
+ * <http://www.apache.org/>.
+ *
+ */
+package org.apache.http.impl.conn;
+
+import junit.framework.Assert;
+
+import org.apache.http.config.ConnectionConfig;
+import org.apache.http.conn.ManagedHttpClientConnection;
+import org.junit.Test;
+
+public class TestManagedHttpClientConnectionFactory {
+
+    @Test
+    public void testDefaultConnectionConfig() throws Exception {
+        validateDefault(ManagedHttpClientConnectionFactory.INSTANCE.create(ConnectionConfig.DEFAULT));
+    }
+
+    private void validateDefault(ManagedHttpClientConnection managedHttpClientConnection) {
+        // Nothing really interesting to check here
+        Assert.assertNotNull(managedHttpClientConnection.getId());
+    }
+
+    @Test
+    public void testNullConnectionConfig() throws Exception {
+        // Should not NPE
+        validateDefault(ManagedHttpClientConnectionFactory.INSTANCE.create(null));
+    }
+}

Propchange: httpcomponents/httpclient/trunk/httpclient/src/test/java/org/apache/http/impl/conn/TestManagedHttpClientConnectionFactory.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: httpcomponents/httpclient/trunk/httpclient/src/test/java/org/apache/http/impl/conn/TestManagedHttpClientConnectionFactory.java
------------------------------------------------------------------------------
    svn:keywords = Id