[HTTPCLIENT-1365] NPE when ManagedHttpClientConnectionFactory.create(ConnectionConfig) is called with null. Contributed by Gary Gregory <ggregory at apache.org>
git-svn-id: https://svn.apache.org/repos/asf/httpcomponents/httpclient/trunk@1490299 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
531ac65cc9
commit
52ddef91fa
|
@ -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>
|
||||
|
|
|
@ -104,8 +104,8 @@ public class ManagedHttpClientConnectionFactory implements HttpConnectionFactory
|
|||
log,
|
||||
headerlog,
|
||||
wirelog,
|
||||
config.getBufferSize(),
|
||||
config.getFragmentSizeHint(),
|
||||
cconfig.getBufferSize(),
|
||||
cconfig.getFragmentSizeHint(),
|
||||
chardecoder,
|
||||
charencoder,
|
||||
cconfig.getMessageConstraints(),
|
||||
|
|
|
@ -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));
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue