camel-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From davscl...@apache.org
Subject svn commit: r793814 - in /camel/trunk/camel-core/src: main/java/org/apache/camel/util/URISupport.java test/java/org/apache/camel/util/URISupportTest.java
Date Tue, 14 Jul 2009 08:23:19 GMT
Author: davsclaus
Date: Tue Jul 14 08:23:19 2009
New Revision: 793814

URL: http://svn.apache.org/viewvc?rev=793814&view=rev
Log:
Fixed NPE in URISupport if URI parameter did not contain a value.

Modified:
    camel/trunk/camel-core/src/main/java/org/apache/camel/util/URISupport.java
    camel/trunk/camel-core/src/test/java/org/apache/camel/util/URISupportTest.java

Modified: camel/trunk/camel-core/src/main/java/org/apache/camel/util/URISupport.java
URL: http://svn.apache.org/viewvc/camel/trunk/camel-core/src/main/java/org/apache/camel/util/URISupport.java?rev=793814&r1=793813&r2=793814&view=diff
==============================================================================
--- camel/trunk/camel-core/src/main/java/org/apache/camel/util/URISupport.java (original)
+++ camel/trunk/camel-core/src/main/java/org/apache/camel/util/URISupport.java Tue Jul 14
08:23:19 2009
@@ -286,8 +286,11 @@
                     String key = (String) o;
                     String value = (String) options.get(key);
                     rc.append(URLEncoder.encode(key, "UTF-8"));
-                    rc.append("=");
-                    rc.append(URLEncoder.encode(value, "UTF-8"));
+                    // only append if value is not null
+                    if (value != null) {
+                        rc.append("=");
+                        rc.append(URLEncoder.encode(value, "UTF-8"));
+                    }
                 }
                 return rc.toString();
             } else {

Modified: camel/trunk/camel-core/src/test/java/org/apache/camel/util/URISupportTest.java
URL: http://svn.apache.org/viewvc/camel/trunk/camel-core/src/test/java/org/apache/camel/util/URISupportTest.java?rev=793814&r1=793813&r2=793814&view=diff
==============================================================================
--- camel/trunk/camel-core/src/test/java/org/apache/camel/util/URISupportTest.java (original)
+++ camel/trunk/camel-core/src/test/java/org/apache/camel/util/URISupportTest.java Tue Jul
14 08:23:19 2009
@@ -85,4 +85,9 @@
         assertTrue("Should have //", out2.startsWith("http://"));
     }
 
+    public void testNormalizeUriWhereParamererIsFaulty() throws Exception {
+        String out = URISupport.normalizeUri("stream:uri?file:///d:/temp/data/log/quickfix.log&scanStream=true");
+        assertNotNull(out);
+    }
+
 }



Mime
View raw message