Fixed the CS error of camel-ftp

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

Branch: refs/heads/master
Commit: ef1df28fec1c9c1322c52b3040b7a6411410c535
Parents: 4da7883
Author: Willem Jiang <willem.ji...@gmail.com>
Authored: Fri May 8 19:29:59 2015 +0800
Committer: Willem Jiang <willem.ji...@gmail.com>
Committed: Fri May 8 19:43:25 2015 +0800

----------------------------------------------------------------------
 .../remote/FtpBadLoginConnectionLeakTest.java   | 12 ++++++-----
 ...FtpBadLoginInProducerConnectionLeakTest.java | 14 +++++++------
 .../FtpBadLoginMockNoopConnectionLeakTest.java  | 21 ++++++++++----------
 3 files changed, 26 insertions(+), 21 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/camel/blob/ef1df28f/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..8cbd434 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
@@ -37,8 +37,8 @@ public class FtpBadLoginConnectionLeakTest extends 
FtpServerTestSupport {
     private Map<Integer, boolean[]> socketAudits = new HashMap<>();
 
     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,15 @@ 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[] value = socketAudits.get(System.identityHashCode(this));
+            value[0] = true;
         }
 
         @Override
         public synchronized void close() throws IOException {
             super.close();
-            socketAudits.get(System.identityHashCode(this))[1] = true;
+            boolean[] value = socketAudits.get(System.identityHashCode(this));
+            value[1] = true;
         }
     }
 

http://git-wip-us.apache.org/repos/asf/camel/blob/ef1df28f/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..db0ef36 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
@@ -36,8 +36,8 @@ public class FtpBadLoginInProducerConnectionLeakTest extends 
FtpServerTestSuppor
     private Map<Integer, boolean[]> socketAudits = new HashMap<>();
 
     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,15 @@ 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[] value = socketAudits.get(System.identityHashCode(this));
+            value[0] = true;
         }
 
         @Override
         public synchronized void close() throws IOException {
             super.close();
-            socketAudits.get(System.identityHashCode(this))[1] = true;
+            boolean[] value = socketAudits.get(System.identityHashCode(this));
+            value[1] = true;
         }
     }
 

http://git-wip-us.apache.org/repos/asf/camel/blob/ef1df28f/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..6206bfa 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
@@ -34,10 +34,14 @@ import org.junit.Test;
  * Test which checks leaking connections when FTP server returns correct 
status for NOOP operation.
  */
 public class FtpBadLoginMockNoopConnectionLeakTest extends 
FtpServerTestSupport {
+    /**
+     * Mapping of socket hashcode to two element tab ([connect() called, 
close() called])
+     */
+    private Map<Integer, boolean[]> socketAudits = new HashMap<>();
 
     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 +58,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 +118,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 +137,16 @@ 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[] value = socketAudits.get(System.identityHashCode(this));
+            value[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[] value = socketAudits.get(System.identityHashCode(this));
+            value[1] = true;
         }
     }
 

Reply via email to