Author: markt
Date: Tue Mar  1 09:33:57 2011
New Revision: 1075742

URL: http://svn.apache.org/viewvc?rev=1075742&view=rev
Log:
Clear remainder of current FindBugs issues in unit tests

Modified:
    tomcat/trunk/res/findbugs/filter-false-positives.xml
    tomcat/trunk/test/org/apache/catalina/tribes/demos/CoordinationDemo.java
    tomcat/trunk/test/org/apache/tomcat/util/net/TesterSupport.java

Modified: tomcat/trunk/res/findbugs/filter-false-positives.xml
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/res/findbugs/filter-false-positives.xml?rev=1075742&r1=1075741&r2=1075742&view=diff
==============================================================================
--- tomcat/trunk/res/findbugs/filter-false-positives.xml (original)
+++ tomcat/trunk/res/findbugs/filter-false-positives.xml Tue Mar  1 09:33:57 
2011
@@ -217,6 +217,15 @@
     <Bug code="ST" />
   </Match>
   <Match>
+    <Class 
name="org.apache.catalina.startup.TestTomcatClassLoader$ClassLoaderReport"/>
+    <Bug code="Se"/>
+  </Match>
+  <Match>
+    <Class name="org.apache.catalina.tribes.demos.EchoRpcTest" />
+    <Method name="run"/>
+    <Bug code="REC" />
+  </Match>
+  <Match>
     <Class name="org.apache.catalina.tribes.demos.EchoRpcTest$SystemExit" />
     <Bug code="Dm" />
   </Match>
@@ -226,6 +235,23 @@
     <Bug code="NP" />
   </Match>
   <Match>
+    <Class name="org.apache.catalina.tribes.demos.LoadTest" />
+    <Method name="memberAdded"/>
+    <Bug code="NN" />
+  </Match>
+  <Match>
+    <Class name="org.apache.catalina.tribes.demos.LoadTest" />
+    <Method name="run"/>
+    <Or>
+      <Bug code="REC" />
+      <Bug code="UW" />
+    </Or>
+  </Match>
+  <Match>
+    <Class name="org.apache.catalina.tribes.demos.LoadTest$SystemExit" />
+    <Bug code="Dm" />
+  </Match>
+  <Match>
     <Class name="org.apache.catalina.tribes.demos.MapDemo$SystemExit" />
     <Bug code="Dm" />
   </Match>

Modified: 
tomcat/trunk/test/org/apache/catalina/tribes/demos/CoordinationDemo.java
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/test/org/apache/catalina/tribes/demos/CoordinationDemo.java?rev=1075742&r1=1075741&r2=1075742&view=diff
==============================================================================
--- tomcat/trunk/test/org/apache/catalina/tribes/demos/CoordinationDemo.java 
(original)
+++ tomcat/trunk/test/org/apache/catalina/tribes/demos/CoordinationDemo.java 
Tue Mar  1 09:33:57 2011
@@ -113,7 +113,12 @@ public class CoordinationDemo {
         for ( int i=0; i<status.length; i++ ) status[i] = new Status(this);
         printScreen();
         String l = reader.readLine();
-        String[] args = tokenize(l);
+        String[] args;
+        if (l == null) {
+            args = new String[] {};
+        } else {
+            args = tokenize(l);
+        }
         while ( args.length >= 1 && (!"quit".equalsIgnoreCase(args[0]))) {
             if ("start".equalsIgnoreCase(args[0])) {
                 cmdStart(args);
@@ -123,7 +128,9 @@ public class CoordinationDemo {
             }
             printScreen();
             l = reader.readLine();
-            args = tokenize(l);
+            if (l != null) {
+                args = tokenize(l);
+            }
         }
         for ( int i=0; i<status.length; i++ ) status[i].stop();
     }
@@ -275,8 +282,10 @@ public class CoordinationDemo {
                 Member lm = channel.getLocalMember(false);
                 local = lm!=null?lm.getName():"";
                 coord = interceptor!=null && 
interceptor.getCoordinator()!=null?interceptor.getCoordinator().getName():"";
-                viewId = 
getByteString(interceptor.getViewId()!=null?interceptor.getViewId().getBytes():new
 byte[0]);
-                count = String.valueOf(interceptor.getView().length);
+                if (interceptor != null) {
+                    viewId = 
getByteString(interceptor.getViewId()!=null?interceptor.getViewId().getBytes():new
 byte[0]);
+                    count = String.valueOf(interceptor.getView().length);
+                }
             }
             buf.append(leftfill(local,30," "));
             buf.append(leftfill(startstatus, 10, " "));

Modified: tomcat/trunk/test/org/apache/tomcat/util/net/TesterSupport.java
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/test/org/apache/tomcat/util/net/TesterSupport.java?rev=1075742&r1=1075741&r2=1075742&view=diff
==============================================================================
--- tomcat/trunk/test/org/apache/tomcat/util/net/TesterSupport.java (original)
+++ tomcat/trunk/test/org/apache/tomcat/util/net/TesterSupport.java Tue Mar  1 
09:33:57 2011
@@ -18,6 +18,7 @@ package org.apache.tomcat.util.net;
 
 import java.io.File;
 import java.io.FileInputStream;
+import java.io.IOException;
 import java.io.InputStream;
 import java.security.KeyManagementException;
 import java.security.KeyStore;
@@ -102,9 +103,20 @@ public final class TesterSupport {
 
     private static KeyStore getKeyStore(String keystore) throws Exception {
         File keystoreFile = new File(keystore);
-        InputStream is = new FileInputStream(keystoreFile);
         KeyStore ks = KeyStore.getInstance("JKS");
-        ks.load(is, "changeit".toCharArray());
+        InputStream is = null;
+        try {
+            is = new FileInputStream(keystoreFile);
+            ks.load(is, "changeit".toCharArray());
+        } finally {
+            if (is != null) {
+                try {
+                    is.close();
+                } catch (IOException ioe) {
+                    // Ignore
+                }
+            }
+        }
         return ks;
     }
 }



---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org

Reply via email to