ant-notifications mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From hi...@apache.org
Subject svn commit: r1398334 - /ant/ivy/core/trunk/src/java/org/apache/ivy/util/url/BasicURLHandler.java
Date Mon, 15 Oct 2012 15:26:27 GMT
Author: hibou
Date: Mon Oct 15 15:26:27 2012
New Revision: 1398334

URL: http://svn.apache.org/viewvc?rev=1398334&view=rev
Log:
fix NPE: some server seems to not return any content type

Modified:
    ant/ivy/core/trunk/src/java/org/apache/ivy/util/url/BasicURLHandler.java

Modified: ant/ivy/core/trunk/src/java/org/apache/ivy/util/url/BasicURLHandler.java
URL: http://svn.apache.org/viewvc/ant/ivy/core/trunk/src/java/org/apache/ivy/util/url/BasicURLHandler.java?rev=1398334&r1=1398333&r2=1398334&view=diff
==============================================================================
--- ant/ivy/core/trunk/src/java/org/apache/ivy/util/url/BasicURLHandler.java (original)
+++ ant/ivy/core/trunk/src/java/org/apache/ivy/util/url/BasicURLHandler.java Mon Oct 15 15:26:27
2012
@@ -108,11 +108,13 @@ public class BasicURLHandler extends Abs
 
         String charSet = null;
 
-        String[] elements = contentType.split(";");
-        for (int i = 0; i < elements.length; i++) {
-            String element = elements[i].trim();
-            if (element.toLowerCase().startsWith("charset=")) {
-                charSet = element.substring("charset=".length());
+        if (contentType != null) {
+            String[] elements = contentType.split(";");
+            for (int i = 0; i < elements.length; i++) {
+                String element = elements[i].trim();
+                if (element.toLowerCase().startsWith("charset=")) {
+                    charSet = element.substring("charset=".length());
+                }
             }
         }
 



Mime
View raw message