tomee-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rmannibu...@apache.org
Subject tomee git commit: tolerate not fully escaped uri params + making kahadbtest using a more random folder
Date Wed, 11 May 2016 06:42:16 GMT
Repository: tomee
Updated Branches:
  refs/heads/master 297ec2724 -> 65a382cdf


tolerate not fully escaped uri params + making kahadbtest using a more random folder


Project: http://git-wip-us.apache.org/repos/asf/tomee/repo
Commit: http://git-wip-us.apache.org/repos/asf/tomee/commit/65a382cd
Tree: http://git-wip-us.apache.org/repos/asf/tomee/tree/65a382cd
Diff: http://git-wip-us.apache.org/repos/asf/tomee/diff/65a382cd

Branch: refs/heads/master
Commit: 65a382cdfcc240061b302adecb78639369220ebb
Parents: 297ec27
Author: Romain manni-Bucau <rmannibucau@gmail.com>
Authored: Wed May 11 08:41:55 2016 +0200
Committer: Romain manni-Bucau <rmannibucau@gmail.com>
Committed: Wed May 11 08:41:55 2016 +0200

----------------------------------------------------------------------
 .../apache/openejb/resource/activemq/ActiveMQ5Factory.java   | 8 ++++++--
 .../java/org/apache/openejb/activemq/KahaDBSupportTest.java  | 5 +++--
 2 files changed, 9 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tomee/blob/65a382cd/container/openejb-core/src/main/java/org/apache/openejb/resource/activemq/ActiveMQ5Factory.java
----------------------------------------------------------------------
diff --git a/container/openejb-core/src/main/java/org/apache/openejb/resource/activemq/ActiveMQ5Factory.java
b/container/openejb-core/src/main/java/org/apache/openejb/resource/activemq/ActiveMQ5Factory.java
index 50faca6..19836c6 100644
--- a/container/openejb-core/src/main/java/org/apache/openejb/resource/activemq/ActiveMQ5Factory.java
+++ b/container/openejb-core/src/main/java/org/apache/openejb/resource/activemq/ActiveMQ5Factory.java
@@ -344,8 +344,12 @@ public class ActiveMQ5Factory implements BrokerFactoryHandler {
         String uri = schemeSpecificPart;
         for (final Map.Entry<String, String> entry : parameters.entrySet()) {
             if (!params.containsKey(entry.getKey())) {
-                final String kv = entry.getKey() + "=" + encodeURI(entry.getValue());
-                final int idx = uri.indexOf(kv);
+                String kv = entry.getKey() + "=" + encodeURI(entry.getValue());
+                int idx = uri.indexOf(kv);
+                if (idx < 0) {
+                    kv = entry.getKey() + "=" + entry.getValue();
+                    idx = uri.indexOf(kv);
+                }
                 if (idx >= 0) {
                     final int andIdx = idx + kv.length();
                     if (andIdx < uri.length() && uri.charAt(andIdx) == '&')
{

http://git-wip-us.apache.org/repos/asf/tomee/blob/65a382cd/container/openejb-core/src/test/java/org/apache/openejb/activemq/KahaDBSupportTest.java
----------------------------------------------------------------------
diff --git a/container/openejb-core/src/test/java/org/apache/openejb/activemq/KahaDBSupportTest.java
b/container/openejb-core/src/test/java/org/apache/openejb/activemq/KahaDBSupportTest.java
index 5664afb..5b10bf6 100644
--- a/container/openejb-core/src/test/java/org/apache/openejb/activemq/KahaDBSupportTest.java
+++ b/container/openejb-core/src/test/java/org/apache/openejb/activemq/KahaDBSupportTest.java
@@ -32,11 +32,12 @@ import static org.junit.Assert.assertEquals;
 public class KahaDBSupportTest {
     @Test
     public void create() throws Exception {
-        final BrokerService broker = BrokerFactory.createBroker(new URI("openejb:broker:(tcp://localhost:"
+ NetworkUtil.getNextAvailablePort() + ")?usekahadb=true&kahadb.directory=target/kahatest"));
+        final String path = "target/kahatest" + System.currentTimeMillis();
+        final BrokerService broker = BrokerFactory.createBroker(new URI("openejb:broker:(tcp://localhost:"
+ NetworkUtil.getNextAvailablePort() + ")?usekahadb=true&kahadb.directory=" + path));
         try {
             assertThat(broker.getPersistenceAdapter(), instanceOf(KahaDBPersistenceAdapter.class));
             final KahaDBPersistenceAdapter adapter = KahaDBPersistenceAdapter.class.cast(broker.getPersistenceAdapter());
-            assertEquals(new File("target/kahatest"), adapter.getDirectory());
+            assertEquals(new File(path), adapter.getDirectory());
         } finally {
             broker.stop();
         }


Mime
View raw message