camel-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jans...@apache.org
Subject svn commit: r790972 - in /camel/trunk/components/camel-irc/src/main/java/org/apache/camel/component/irc: IrcComponent.java IrcConfiguration.java
Date Fri, 03 Jul 2009 17:46:12 GMT
Author: janstey
Date: Fri Jul  3 17:46:11 2009
New Revision: 790972

URL: http://svn.apache.org/viewvc?rev=790972&view=rev
Log:
Fix issue with having multiple # characters in IRC URI

Modified:
    camel/trunk/components/camel-irc/src/main/java/org/apache/camel/component/irc/IrcComponent.java
    camel/trunk/components/camel-irc/src/main/java/org/apache/camel/component/irc/IrcConfiguration.java

Modified: camel/trunk/components/camel-irc/src/main/java/org/apache/camel/component/irc/IrcComponent.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-irc/src/main/java/org/apache/camel/component/irc/IrcComponent.java?rev=790972&r1=790971&r2=790972&view=diff
==============================================================================
--- camel/trunk/components/camel-irc/src/main/java/org/apache/camel/component/irc/IrcComponent.java
(original)
+++ camel/trunk/components/camel-irc/src/main/java/org/apache/camel/component/irc/IrcComponent.java
Fri Jul  3 17:46:11 2009
@@ -55,7 +55,7 @@
     protected IrcEndpoint createEndpoint(String uri, String remaining, Map parameters) throws
Exception {
         // lets make sure we copy the configuration as each endpoint can customize its own
version
         IrcConfiguration config = getConfiguration().copy();
-        config.configure(new URI(uri));
+        config.configure(uri);
 
         IrcEndpoint endpoint = new IrcEndpoint(uri, this, config);
         setProperties(endpoint.getConfiguration(), parameters);

Modified: camel/trunk/components/camel-irc/src/main/java/org/apache/camel/component/irc/IrcConfiguration.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-irc/src/main/java/org/apache/camel/component/irc/IrcConfiguration.java?rev=790972&r1=790971&r2=790972&view=diff
==============================================================================
--- camel/trunk/components/camel-irc/src/main/java/org/apache/camel/component/irc/IrcConfiguration.java
(original)
+++ camel/trunk/components/camel-irc/src/main/java/org/apache/camel/component/irc/IrcConfiguration.java
Fri Jul  3 17:46:11 2009
@@ -17,6 +17,7 @@
 package org.apache.camel.component.irc;
 
 import java.net.URI;
+import java.net.URISyntaxException;
 import java.util.Arrays;
 
 import org.apache.camel.RuntimeCamelException;
@@ -78,20 +79,22 @@
         return hostname + ":" + nickname;
     }
 
-    public void configure(URI uri) {
+    public void configure(String uriStr) throws URISyntaxException {
         // fix provided URI and handle that we can use # to indicate the IRC room
-        String fixedUri = uri.toString();
-
-        if (fixedUri.startsWith("ircs")) {
+        if (uriStr.startsWith("ircs")) {
             setUsingSSL(true);
-            if (!fixedUri.startsWith("ircs://")) {
-                fixedUri = fixedUri.replace("ircs:", "ircs://");
+            if (!uriStr.startsWith("ircs://")) {
+                uriStr = uriStr.replace("ircs:", "ircs://");
             }
-        } else if (!fixedUri.startsWith("irc://")) {
-            fixedUri = fixedUri.replace("irc:", "irc://");
+        } else if (!uriStr.startsWith("irc://")) {
+            uriStr = uriStr.replace("irc:", "irc://");
         }
-
-        uri = uri.resolve(fixedUri);
+        
+        if (uriStr.contains("?")) {
+            uriStr = ObjectHelper.before(uriStr, "?");
+        }
+        
+        URI uri = new URI(uriStr);
 
         setNickname(uri.getUserInfo());
         setUsername(uri.getUserInfo());
@@ -104,11 +107,6 @@
 
         String channel = uri.getFragment();
 
-        if ( channel.contains("?")) {
-            //Need to strip off the query string from this fragment
-            channel = ObjectHelper.before(uri.getFragment(), "?");
-        }
-
         setTarget("#" + channel);
     }
 



Mime
View raw message