camel-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From hadr...@apache.org
Subject svn commit: r1206660 - in /camel/trunk/camel-core/src: main/java/org/apache/camel/util/URISupport.java test/java/org/apache/camel/util/URISupportTest.java
Date Sun, 27 Nov 2011 03:26:47 GMT
Author: hadrian
Date: Sun Nov 27 03:26:46 2011
New Revision: 1206660

URL: http://svn.apache.org/viewvc?rev=1206660&view=rev
Log:
CAMEL-4601. Patch applied with thank to Bilgin

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=1206660&r1=1206659&r2=1206660&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 Sun Nov 27
03:26:46 2011
@@ -152,7 +152,7 @@ public final class URISupport {
         if (query != null) {
             s = s + "?" + query;
         }
-        if (uri.getFragment() != null) {
+        if ((!s.contains("#")) && (uri.getFragment() != null)) {
             s = s + "#" + uri.getFragment();
         }
 

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=1206660&r1=1206659&r2=1206660&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 Sun Nov
27 03:26:46 2011
@@ -106,6 +106,13 @@ public class URISupportTest extends Cont
         assertEquals("http://camel.apache.org?foo=123", s);
     }
 
+    public void testCreateURIWithQueryHasOneFragment() throws Exception {
+        URI uri = new URI("smtp://localhost#fragmentOne");
+        URI resultUri = URISupport.createURIWithQuery(uri, null);
+        assertNotNull(resultUri);
+        assertEquals("smtp://localhost#fragmentOne", resultUri.toString());
+    }
+
     public void testNormalizeEndpointWithEqualSignInParameter() throws Exception {
         String out = URISupport.normalizeUri("jms:queue:foo?selector=somekey='somevalue'&foo=bar");
         assertNotNull(out);



Mime
View raw message