You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@ant.apache.org by ma...@apache.org on 2013/01/31 23:38:21 UTC

svn commit: r1441235 - in /ant/ivy/core/trunk: CHANGES.txt src/java/org/apache/ivy/util/url/HttpClientHandler.java

Author: maartenc
Date: Thu Jan 31 22:38:20 2013
New Revision: 1441235

URL: http://svn.apache.org/viewvc?rev=1441235&view=rev
Log:
FIX: NullPointerException when using httpclient and server doesn't return content-type header (IVY-1400) (thanks to Frederic Riviere)

Modified:
    ant/ivy/core/trunk/CHANGES.txt
    ant/ivy/core/trunk/src/java/org/apache/ivy/util/url/HttpClientHandler.java

Modified: ant/ivy/core/trunk/CHANGES.txt
URL: http://svn.apache.org/viewvc/ant/ivy/core/trunk/CHANGES.txt?rev=1441235&r1=1441234&r2=1441235&view=diff
==============================================================================
--- ant/ivy/core/trunk/CHANGES.txt (original)
+++ ant/ivy/core/trunk/CHANGES.txt Thu Jan 31 22:38:20 2013
@@ -105,6 +105,7 @@ for detailed view of each issue, please 
 	Geoff Reedy
 	Torkild U. Resheim
 	Christian Riege
+	Frederic Riviere
 	Jens Rohloff
 	Andreas Sahlbach
 	Brian Sanders
@@ -142,6 +143,7 @@ for detailed view of each issue, please 
 - IMPROVEMENT: add support for source bundles from p2 repositories
 - IMPROVEMENT: add support for source URI from OBR repositories
 
+- FIX: NullPointerException when using httpclient and server doesn't return content-type header (IVY-1400) (thanks to Frederic Riviere)
 - FIX: Properly handle evicted nodes in ResolveReport
 
    2.3.0

Modified: ant/ivy/core/trunk/src/java/org/apache/ivy/util/url/HttpClientHandler.java
URL: http://svn.apache.org/viewvc/ant/ivy/core/trunk/src/java/org/apache/ivy/util/url/HttpClientHandler.java?rev=1441235&r1=1441234&r2=1441235&view=diff
==============================================================================
--- ant/ivy/core/trunk/src/java/org/apache/ivy/util/url/HttpClientHandler.java (original)
+++ ant/ivy/core/trunk/src/java/org/apache/ivy/util/url/HttpClientHandler.java Thu Jan 31 22:38:20 2013
@@ -153,9 +153,8 @@ public class HttpClientHandler extends A
                 method = doGet(url, timeout);
             }
             if (checkStatusCode(url, method)) {
-                String contentType = method.getResponseHeader("content-type").getValue();
-                String bodyCharset = BasicURLHandler.getCharSetFromContentType(contentType);
-                return new URLInfo(true, getResponseContentLength(method), getLastModified(method), bodyCharset);
+                return new URLInfo(true, getResponseContentLength(method), 
+                        getLastModified(method), method.getRequestCharSet());
             }
         } catch (HttpException e) {
             Message.error("HttpClientHandler: " + e.getMessage() + ":" + e.getReasonCode() + "="