Fixed CS
Project: http://git-wip-us.apache.org/repos/asf/camel/repo Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/23fc3a53 Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/23fc3a53 Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/23fc3a53 Branch: refs/heads/camel-2.15.x Commit: 23fc3a53057bede363f4dd939750a49b8d239959 Parents: 6998e85 Author: Grzegorz Grzybek <[email protected]> Authored: Tue Jul 21 11:23:33 2015 +0200 Committer: Grzegorz Grzybek <[email protected]> Committed: Tue Jul 21 11:23:33 2015 +0200 ---------------------------------------------------------------------- .../properties/DefaultPropertiesParser.java | 4 ++-- .../apache/camel/util/CamelVersionHelper.java | 3 +++ .../remote/FtpBadLoginConnectionLeakTest.java | 12 ++++++------ ...FtpBadLoginInProducerConnectionLeakTest.java | 14 +++++++------- .../FtpBadLoginMockNoopConnectionLeakTest.java | 20 ++++++++++---------- .../CamelSpringBootApplicationController.java | 4 ++-- .../test/blueprint/CamelBlueprintHelper.java | 4 +++- .../blueprint/CamelBlueprintTestSupport.java | 14 +++++++------- .../org/apache/camel/test/blueprint/Main.java | 2 +- 9 files changed, 41 insertions(+), 36 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/camel/blob/23fc3a53/camel-core/src/main/java/org/apache/camel/component/properties/DefaultPropertiesParser.java ---------------------------------------------------------------------- diff --git a/camel-core/src/main/java/org/apache/camel/component/properties/DefaultPropertiesParser.java b/camel-core/src/main/java/org/apache/camel/component/properties/DefaultPropertiesParser.java index a3bbc8d..c19f165 100644 --- a/camel-core/src/main/java/org/apache/camel/component/properties/DefaultPropertiesParser.java +++ b/camel-core/src/main/java/org/apache/camel/component/properties/DefaultPropertiesParser.java @@ -20,12 +20,12 @@ import java.util.HashSet; import java.util.Properties; import java.util.Set; +import static java.lang.String.format; + import org.apache.camel.util.ObjectHelper; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import static java.lang.String.format; - /** * A parser to parse a string which contains property placeholders. */ http://git-wip-us.apache.org/repos/asf/camel/blob/23fc3a53/camel-core/src/main/java/org/apache/camel/util/CamelVersionHelper.java ---------------------------------------------------------------------- diff --git a/camel-core/src/main/java/org/apache/camel/util/CamelVersionHelper.java b/camel-core/src/main/java/org/apache/camel/util/CamelVersionHelper.java index 368b4c7..f502d03 100644 --- a/camel-core/src/main/java/org/apache/camel/util/CamelVersionHelper.java +++ b/camel-core/src/main/java/org/apache/camel/util/CamelVersionHelper.java @@ -21,6 +21,9 @@ package org.apache.camel.util; */ public final class CamelVersionHelper { + private CamelVersionHelper() { + } + /** * Checks whether other >= base * http://git-wip-us.apache.org/repos/asf/camel/blob/23fc3a53/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FtpBadLoginConnectionLeakTest.java ---------------------------------------------------------------------- diff --git a/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FtpBadLoginConnectionLeakTest.java b/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FtpBadLoginConnectionLeakTest.java index ff430ee..7c26bd6 100644 --- a/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FtpBadLoginConnectionLeakTest.java +++ b/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FtpBadLoginConnectionLeakTest.java @@ -34,11 +34,11 @@ public class FtpBadLoginConnectionLeakTest extends FtpServerTestSupport { /** * Mapping of socket hashcode to two element tab ([connect() called, close() called]) */ - private Map<Integer, boolean[]> socketAudits = new HashMap<>(); + private Map<Integer, boolean[]> socketAudits = new HashMap<Integer, boolean[]>(); private String getFtpUrl() { - return "ftp://dummy@localhost:" + getPort() + "/badlogin?password=cantremeber" + - "&throwExceptionOnConnectFailed=false&ftpClient.socketFactory=#sf"; + return "ftp://dummy@localhost:" + getPort() + "/badlogin?password=cantremeber" + + "&throwExceptionOnConnectFailed=false&ftpClient.socketFactory=#sf"; } @Override @@ -101,7 +101,7 @@ public class FtpBadLoginConnectionLeakTest extends FtpServerTestSupport { @Override public Socket createSocket() throws IOException { AuditingSocket socket = new AuditingSocket(); - socketAudits.put(System.identityHashCode(socket), new boolean[] { false, false }); + socketAudits.put(System.identityHashCode(socket), new boolean[] {false, false}); return socket; } @@ -119,13 +119,13 @@ public class FtpBadLoginConnectionLeakTest extends FtpServerTestSupport { @Override public void connect(SocketAddress endpoint, int timeout) throws IOException { super.connect(endpoint, timeout); - socketAudits.get(System.identityHashCode(this))[0] = true; + ((boolean[])socketAudits.get(System.identityHashCode(this)))[0] = true; } @Override public synchronized void close() throws IOException { super.close(); - socketAudits.get(System.identityHashCode(this))[1] = true; + ((boolean[])socketAudits.get(System.identityHashCode(this)))[1] = true; } } http://git-wip-us.apache.org/repos/asf/camel/blob/23fc3a53/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FtpBadLoginInProducerConnectionLeakTest.java ---------------------------------------------------------------------- diff --git a/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FtpBadLoginInProducerConnectionLeakTest.java b/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FtpBadLoginInProducerConnectionLeakTest.java index e3314d0..0bb5e3e 100644 --- a/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FtpBadLoginInProducerConnectionLeakTest.java +++ b/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FtpBadLoginInProducerConnectionLeakTest.java @@ -33,11 +33,11 @@ public class FtpBadLoginInProducerConnectionLeakTest extends FtpServerTestSuppor /** * Mapping of socket hashcode to two element tab ([connect() called, close() called]) */ - private Map<Integer, boolean[]> socketAudits = new HashMap<>(); + private Map<Integer, boolean[]> socketAudits = new HashMap<Integer, boolean[]>(); private String getFtpUrl() { - return "ftp://dummy@localhost:" + getPort() + "/badlogin?password=cantremeber&maximumReconnectAttempts=3" + - "&throwExceptionOnConnectFailed=false&ftpClient.socketFactory=#sf"; + return "ftp://dummy@localhost:" + getPort() + "/badlogin?password=cantremeber&maximumReconnectAttempts=3" + + "&throwExceptionOnConnectFailed=false&ftpClient.socketFactory=#sf"; } @Override @@ -51,7 +51,7 @@ public class FtpBadLoginInProducerConnectionLeakTest extends FtpServerTestSuppor @Test public void testConnectionLeak() throws Exception { - for (String filename : new String[] { "claus.txt", "grzegorz.txt" }) { + for (String filename : new String[] {"claus.txt", "grzegorz.txt"}) { try { sendFile(getFtpUrl(), "Hello World", filename); } catch (Exception ignored) { @@ -93,7 +93,7 @@ public class FtpBadLoginInProducerConnectionLeakTest extends FtpServerTestSuppor @Override public Socket createSocket() throws IOException { AuditingSocket socket = new AuditingSocket(); - socketAudits.put(System.identityHashCode(socket), new boolean[] { false, false }); + socketAudits.put(System.identityHashCode(socket), new boolean[] {false, false}); return socket; } @@ -111,13 +111,13 @@ public class FtpBadLoginInProducerConnectionLeakTest extends FtpServerTestSuppor @Override public void connect(SocketAddress endpoint, int timeout) throws IOException { super.connect(endpoint, timeout); - socketAudits.get(System.identityHashCode(this))[0] = true; + ((boolean[])socketAudits.get(System.identityHashCode(this)))[0] = true; } @Override public synchronized void close() throws IOException { super.close(); - socketAudits.get(System.identityHashCode(this))[1] = true; + ((boolean[])socketAudits.get(System.identityHashCode(this)))[1] = true; } } http://git-wip-us.apache.org/repos/asf/camel/blob/23fc3a53/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FtpBadLoginMockNoopConnectionLeakTest.java ---------------------------------------------------------------------- diff --git a/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FtpBadLoginMockNoopConnectionLeakTest.java b/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FtpBadLoginMockNoopConnectionLeakTest.java index 0b895f5..9c80c89 100644 --- a/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FtpBadLoginMockNoopConnectionLeakTest.java +++ b/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FtpBadLoginMockNoopConnectionLeakTest.java @@ -35,9 +35,14 @@ import org.junit.Test; */ public class FtpBadLoginMockNoopConnectionLeakTest extends FtpServerTestSupport { + /** + * Mapping of socket hashcode to two element tab ([connect() called, close() called]) + */ + private Map<Integer, boolean[]> socketAudits = new HashMap<Integer, boolean[]>(); + private String getFtpUrl() { - return "ftp://dummy@localhost:" + getPort() + "/badlogin?password=cantremeber&maximumReconnectAttempts=3" + - "&throwExceptionOnConnectFailed=false&ftpClient.socketFactory=#sf"; + return "ftp://dummy@localhost:" + getPort() + "/badlogin?password=cantremeber&maximumReconnectAttempts=3" + + "&throwExceptionOnConnectFailed=false&ftpClient.socketFactory=#sf"; } @Override @@ -54,11 +59,6 @@ public class FtpBadLoginMockNoopConnectionLeakTest extends FtpServerTestSupport }); } - /** - * Mapping of socket hashcode to two element tab ([connect() called, close() called]) - */ - private Map<Integer, boolean[]> socketAudits = new HashMap<>(); - @Override protected JndiRegistry createRegistry() throws Exception { JndiRegistry jndi = super.createRegistry(); @@ -119,7 +119,7 @@ public class FtpBadLoginMockNoopConnectionLeakTest extends FtpServerTestSupport @Override public Socket createSocket() throws IOException { AuditingSocket socket = new AuditingSocket(); - socketAudits.put(System.identityHashCode(socket), new boolean[] { false, false }); + socketAudits.put(System.identityHashCode(socket), new boolean[] {false, false}); return socket; } @@ -138,14 +138,14 @@ public class FtpBadLoginMockNoopConnectionLeakTest extends FtpServerTestSupport public void connect(SocketAddress endpoint, int timeout) throws IOException { log.info("Connecting socket {}", System.identityHashCode(this)); super.connect(endpoint, timeout); - socketAudits.get(System.identityHashCode(this))[0] = true; + ((boolean[])socketAudits.get(System.identityHashCode(this)))[0] = true; } @Override public synchronized void close() throws IOException { log.info("Disconnecting socket {}", System.identityHashCode(this)); super.close(); - socketAudits.get(System.identityHashCode(this))[1] = true; + ((boolean[])socketAudits.get(System.identityHashCode(this)))[1] = true; } } http://git-wip-us.apache.org/repos/asf/camel/blob/23fc3a53/components/camel-spring-boot/src/main/java/org/apache/camel/spring/boot/CamelSpringBootApplicationController.java ---------------------------------------------------------------------- diff --git a/components/camel-spring-boot/src/main/java/org/apache/camel/spring/boot/CamelSpringBootApplicationController.java b/components/camel-spring-boot/src/main/java/org/apache/camel/spring/boot/CamelSpringBootApplicationController.java index cd516e7..067edc9 100644 --- a/components/camel-spring-boot/src/main/java/org/apache/camel/spring/boot/CamelSpringBootApplicationController.java +++ b/components/camel-spring-boot/src/main/java/org/apache/camel/spring/boot/CamelSpringBootApplicationController.java @@ -19,13 +19,13 @@ package org.apache.camel.spring.boot; import java.util.Collections; import java.util.Map; +import javax.annotation.PreDestroy; + import org.apache.camel.CamelContext; import org.apache.camel.ProducerTemplate; import org.apache.camel.main.MainSupport; import org.springframework.context.ApplicationContext; -import javax.annotation.PreDestroy; - public class CamelSpringBootApplicationController { private final MainSupport mainSupport; http://git-wip-us.apache.org/repos/asf/camel/blob/23fc3a53/components/camel-test-blueprint/src/main/java/org/apache/camel/test/blueprint/CamelBlueprintHelper.java ---------------------------------------------------------------------- diff --git a/components/camel-test-blueprint/src/main/java/org/apache/camel/test/blueprint/CamelBlueprintHelper.java b/components/camel-test-blueprint/src/main/java/org/apache/camel/test/blueprint/CamelBlueprintHelper.java index f6f1b46..4074376 100644 --- a/components/camel-test-blueprint/src/main/java/org/apache/camel/test/blueprint/CamelBlueprintHelper.java +++ b/components/camel-test-blueprint/src/main/java/org/apache/camel/test/blueprint/CamelBlueprintHelper.java @@ -275,7 +275,9 @@ public final class CamelBlueprintHelper { /** * Synchronization method to wait for particular state of BlueprintContainer under test. */ - public static void waitForBlueprintContainer(final Set<Long> eventHistory, BundleContext context, final String symbolicName, final int bpEvent, final Runnable runAndWait) throws InterruptedException { + public static void waitForBlueprintContainer(final Set<Long> eventHistory, BundleContext context, + final String symbolicName, final int bpEvent, final Runnable runAndWait) + throws InterruptedException { final CountDownLatch latch = new CountDownLatch(1); ServiceRegistration<BlueprintListener> registration = context.registerService(BlueprintListener.class, new BlueprintListener() { @Override http://git-wip-us.apache.org/repos/asf/camel/blob/23fc3a53/components/camel-test-blueprint/src/main/java/org/apache/camel/test/blueprint/CamelBlueprintTestSupport.java ---------------------------------------------------------------------- diff --git a/components/camel-test-blueprint/src/main/java/org/apache/camel/test/blueprint/CamelBlueprintTestSupport.java b/components/camel-test-blueprint/src/main/java/org/apache/camel/test/blueprint/CamelBlueprintTestSupport.java index 1839789..0361ce8 100644 --- a/components/camel-test-blueprint/src/main/java/org/apache/camel/test/blueprint/CamelBlueprintTestSupport.java +++ b/components/camel-test-blueprint/src/main/java/org/apache/camel/test/blueprint/CamelBlueprintTestSupport.java @@ -18,7 +18,6 @@ package org.apache.camel.test.blueprint; import java.io.File; import java.io.IOException; -import java.util.ArrayList; import java.util.Arrays; import java.util.Dictionary; import java.util.HashSet; @@ -31,6 +30,11 @@ import java.util.Set; import javax.xml.parsers.DocumentBuilder; import javax.xml.parsers.DocumentBuilderFactory; +import org.w3c.dom.Document; +import org.w3c.dom.Element; +import org.w3c.dom.Node; +import org.w3c.dom.NodeList; + import org.apache.aries.blueprint.compendium.cm.CmNamespaceHandler; import org.apache.camel.CamelContext; import org.apache.camel.component.properties.PropertiesComponent; @@ -45,10 +49,6 @@ import org.osgi.framework.ServiceRegistration; import org.osgi.service.blueprint.container.BlueprintEvent; import org.osgi.service.cm.Configuration; import org.osgi.service.cm.ConfigurationAdmin; -import org.w3c.dom.Document; -import org.w3c.dom.Element; -import org.w3c.dom.Node; -import org.w3c.dom.NodeList; /** * Base class for OSGi Blueprint unit tests with Camel. @@ -138,7 +138,7 @@ public abstract class CamelBlueprintTestSupport extends CamelTestSupport { // we will gather timestamps of BP events. We don't want to be fooled but repeated events related // to the same state of BP container - Set<Long> bpEvents = new HashSet<>(); + Set<Long> bpEvents = new HashSet<Long>(); CamelBlueprintHelper.waitForBlueprintContainer(bpEvents, answer, symbolicName, BlueprintEvent.CREATED, null); @@ -231,7 +231,7 @@ public abstract class CamelBlueprintTestSupport extends CamelTestSupport { dbf.setNamespaceAware(true); try { // cm-1.0 doesn't define update-strategy attribute - Set<String> cmNamesaces = new HashSet<>(Arrays.asList( + Set<String> cmNamesaces = new HashSet<String>(Arrays.asList( CmNamespaceHandler.BLUEPRINT_CM_NAMESPACE_1_1, CmNamespaceHandler.BLUEPRINT_CM_NAMESPACE_1_2, CmNamespaceHandler.BLUEPRINT_CM_NAMESPACE_1_3 http://git-wip-us.apache.org/repos/asf/camel/blob/23fc3a53/components/camel-test-blueprint/src/main/java/org/apache/camel/test/blueprint/Main.java ---------------------------------------------------------------------- diff --git a/components/camel-test-blueprint/src/main/java/org/apache/camel/test/blueprint/Main.java b/components/camel-test-blueprint/src/main/java/org/apache/camel/test/blueprint/Main.java index 404844f..49e64b5 100644 --- a/components/camel-test-blueprint/src/main/java/org/apache/camel/test/blueprint/Main.java +++ b/components/camel-test-blueprint/src/main/java/org/apache/camel/test/blueprint/Main.java @@ -103,7 +103,7 @@ public class Main extends MainSupport { } LOG.debug("Starting Blueprint XML file: " + descriptors); bundleContext = createBundleContext(bundleName); - Set<Long> eventHistory = new HashSet<>(); + Set<Long> eventHistory = new HashSet<Long>(); CamelBlueprintHelper.waitForBlueprintContainer(eventHistory, bundleContext, bundleName, BlueprintEvent.CREATED, null); CamelBlueprintHelper.setPersistentFileForConfigAdmin(bundleContext, configAdminPid, configAdminFileName, new Properties(), bundleName, eventHistory, true);
