Return-Path: X-Original-To: apmail-camel-commits-archive@www.apache.org Delivered-To: apmail-camel-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 85BAD7AC1 for ; Fri, 2 Sep 2011 02:36:38 +0000 (UTC) Received: (qmail 57450 invoked by uid 500); 2 Sep 2011 02:36:38 -0000 Delivered-To: apmail-camel-commits-archive@camel.apache.org Received: (qmail 57390 invoked by uid 500); 2 Sep 2011 02:36:36 -0000 Mailing-List: contact commits-help@camel.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@camel.apache.org Delivered-To: mailing list commits@camel.apache.org Received: (qmail 57381 invoked by uid 99); 2 Sep 2011 02:36:35 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 02 Sep 2011 02:36:35 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=5.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 02 Sep 2011 02:36:32 +0000 Received: from eris.apache.org (localhost [127.0.0.1]) by eris.apache.org (Postfix) with ESMTP id AC2F32388A19 for ; Fri, 2 Sep 2011 02:36:12 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r1164334 - in /camel/trunk/components: camel-cache/src/test/java/org/apache/camel/component/cache/ camel-exec/src/main/java/org/apache/camel/component/exec/ camel-exec/src/test/java/org/apache/camel/component/exec/ Date: Fri, 02 Sep 2011 02:36:12 -0000 To: commits@camel.apache.org From: hadrian@apache.org X-Mailer: svnmailer-1.0.8 Message-Id: <20110902023612.AC2F32388A19@eris.apache.org> Author: hadrian Date: Fri Sep 2 02:36:12 2011 New Revision: 1164334 URL: http://svn.apache.org/viewvc?rev=1164334&view=rev Log: More URI encoding fixes Modified: camel/trunk/components/camel-cache/src/test/java/org/apache/camel/component/cache/CacheProducerTest.java camel/trunk/components/camel-exec/src/main/java/org/apache/camel/component/exec/ExecComponent.java camel/trunk/components/camel-exec/src/test/java/org/apache/camel/component/exec/ExecEndpointTest.java Modified: camel/trunk/components/camel-cache/src/test/java/org/apache/camel/component/cache/CacheProducerTest.java URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-cache/src/test/java/org/apache/camel/component/cache/CacheProducerTest.java?rev=1164334&r1=1164333&r2=1164334&view=diff ============================================================================== --- camel/trunk/components/camel-cache/src/test/java/org/apache/camel/component/cache/CacheProducerTest.java (original) +++ camel/trunk/components/camel-cache/src/test/java/org/apache/camel/component/cache/CacheProducerTest.java Fri Sep 2 02:36:12 2011 @@ -133,7 +133,7 @@ public class CacheProducerTest extends C public void configure() { onException(CacheException.class). handled(true). - to("log:*** LOGGER"). + to("log:LOGGER"). to("mock:CacheProducerTest.cacheException"); from("direct:a"). @@ -185,7 +185,7 @@ public class CacheProducerTest extends C public void configure() { onException(CacheException.class). handled(true). - to("log:*** LOGGER"). + to("log:LOGGER"). to("mock:CacheProducerTest.cacheException"); from("direct:a"). @@ -222,7 +222,7 @@ public class CacheProducerTest extends C public void configure() { onException(CacheException.class). handled(true). - to("log:*** LOGGER"). + to("log:LOGGER"). to("mock:CacheProducerTest.cacheException"); from("direct:a"). @@ -258,7 +258,7 @@ public class CacheProducerTest extends C public void configure() { onException(CacheException.class). handled(true). - to("log:*** LOGGER"). + to("log:LOGGER"). to("mock:CacheProducerTest.cacheException"); from("direct:a"). @@ -279,7 +279,7 @@ public class CacheProducerTest extends C public void configure() { onException(CacheException.class). handled(true). - to("log:*** LOGGER"). + to("log:LOGGER"). to("mock:CacheProducerTest.cacheException"); from("direct:a"). @@ -305,7 +305,7 @@ public class CacheProducerTest extends C onException(CacheException.class). handled(true). choice().when(exceptionMessage().isEqualTo(CacheConstants.CACHE_OPERATION + " UNKNOWN is not supported.")). - to("log:*** LOGGER"). + to("log:LOGGER"). to("mock:CacheProducerTest.cacheException").end(); from("direct:a"). @@ -332,7 +332,7 @@ public class CacheProducerTest extends C public void configure() { onException(CacheException.class). handled(true). - to("log:*** LOGGER"). + to("log:LOGGER"). to("mock:CacheProducerTest.cacheException"); from("direct:a"). @@ -360,7 +360,7 @@ public class CacheProducerTest extends C public void configure() { onException(CacheException.class). handled(true). - to("log:*** LOGGER"). + to("log:LOGGER"). to("mock:CacheProducerTest.cacheException"); from("direct:a"). @@ -388,7 +388,7 @@ public class CacheProducerTest extends C public void configure() { onException(CacheException.class). handled(true). - to("log:*** LOGGER"). + to("log:LOGGER"). to("mock:CacheProducerTest.cacheException"); from("direct:a"). Modified: camel/trunk/components/camel-exec/src/main/java/org/apache/camel/component/exec/ExecComponent.java URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-exec/src/main/java/org/apache/camel/component/exec/ExecComponent.java?rev=1164334&r1=1164333&r2=1164334&view=diff ============================================================================== --- camel/trunk/components/camel-exec/src/main/java/org/apache/camel/component/exec/ExecComponent.java (original) +++ camel/trunk/components/camel-exec/src/main/java/org/apache/camel/component/exec/ExecComponent.java Fri Sep 2 02:36:12 2011 @@ -16,6 +16,7 @@ */ package org.apache.camel.component.exec; +import java.net.URLDecoder; import java.util.Map; import org.apache.camel.Endpoint; @@ -31,7 +32,7 @@ public class ExecComponent extends Defau protected Endpoint createEndpoint(String uri, String remaining, Map parameters) throws Exception { ExecEndpoint endpoint = new ExecEndpoint(uri, this); setProperties(endpoint, parameters); - endpoint.setExecutable(remaining); + endpoint.setExecutable(URLDecoder.decode(remaining, "UTF-8")); return endpoint; } } Modified: camel/trunk/components/camel-exec/src/test/java/org/apache/camel/component/exec/ExecEndpointTest.java URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-exec/src/test/java/org/apache/camel/component/exec/ExecEndpointTest.java?rev=1164334&r1=1164333&r2=1164334&view=diff ============================================================================== --- camel/trunk/components/camel-exec/src/test/java/org/apache/camel/component/exec/ExecEndpointTest.java (original) +++ camel/trunk/components/camel-exec/src/test/java/org/apache/camel/component/exec/ExecEndpointTest.java Fri Sep 2 02:36:12 2011 @@ -18,6 +18,7 @@ package org.apache.camel.component.exec; import org.apache.camel.CamelContext; import org.apache.camel.Component; +import org.apache.camel.util.UnsafeUriCharactersEncoder; import org.junit.Before; import org.junit.Test; @@ -102,7 +103,8 @@ public class ExecEndpointTest extends Ab @DirtiesContext public void testCreateEndpointWithArgs() throws Exception { String args = "arg1 arg2 arg3"; - ExecEndpoint e = createExecEndpoint("exec:test?args=" + args); + // Need to properly encode the URI + ExecEndpoint e = createExecEndpoint("exec:test?args=" + args.replaceAll(" ", "+")); assertEquals(args, e.getArgs()); } @@ -110,7 +112,7 @@ public class ExecEndpointTest extends Ab @DirtiesContext public void testCreateEndpointWithArgs2() throws Exception { String args = "arg1 \"arg2 \" arg3"; - ExecEndpoint e = createExecEndpoint("exec:test?args=" + args); + ExecEndpoint e = createExecEndpoint("exec:test?args=" + UnsafeUriCharactersEncoder.encode(args)); assertEquals(args, e.getArgs()); } @@ -145,7 +147,7 @@ public class ExecEndpointTest extends Ab String dir = "\"c:/program files/wokr/temp\""; String uri = "exec:" + cmd + "?workingDir=" + dir; - ExecEndpoint endpoint = createExecEndpoint(uri); + ExecEndpoint endpoint = createExecEndpoint(UnsafeUriCharactersEncoder.encode(uri)); assertEquals(cmd, endpoint.getExecutable()); assertNull(endpoint.getArgs()); assertNotNull(endpoint.getCommandExecutor()); @@ -159,7 +161,7 @@ public class ExecEndpointTest extends Ab String executable = "C:/Program Files/test/text.exe"; String uri = "exec:" + executable; - ExecEndpoint endpoint = createExecEndpoint(uri); + ExecEndpoint endpoint = createExecEndpoint(UnsafeUriCharactersEncoder.encode(uri)); assertNull(endpoint.getArgs()); assertNull(endpoint.getWorkingDir()); @@ -175,7 +177,8 @@ public class ExecEndpointTest extends Ab String argsEscaped = "arg1 arg2 \"arg 3\""; long timeout = 10000L; - ExecEndpoint e = createExecEndpoint("exec:executable.exe?workingDir=" + workingDir + "&timeout=" + timeout + "&args=" + argsEscaped); + String uri = "exec:executable.exe?workingDir=" + workingDir + "&timeout=" + timeout + "&args=" + argsEscaped; + ExecEndpoint e = createExecEndpoint(UnsafeUriCharactersEncoder.encode(uri)); assertEquals(workingDir, e.getWorkingDir()); assertEquals(argsEscaped, e.getArgs()); assertEquals(timeout, e.getTimeout()); @@ -192,7 +195,7 @@ public class ExecEndpointTest extends Ab builder.append("&outFile=" + outFile); builder.append("&commandExecutor=#customExecutor&binding=#customBinding"); - ExecEndpoint e = createExecEndpoint(builder.toString()); + ExecEndpoint e = createExecEndpoint(UnsafeUriCharactersEncoder.encode(builder.toString())); assertEquals(workingDir, e.getWorkingDir()); assertEquals(timeout, e.getTimeout()); assertEquals(outFile, e.getOutFile());