Fix remaining warnings in unit tests (with recently documented settings)
authormarkt <markt@13f79535-47bb-0310-9956-ffa450edef68>
Fri, 17 Dec 2010 22:01:59 +0000 (22:01 +0000)
committermarkt <markt@13f79535-47bb-0310-9956-ffa450edef68>
Fri, 17 Dec 2010 22:01:59 +0000 (22:01 +0000)
git-svn-id: https://svn.apache.org/repos/asf/tomcat/trunk@1050500 13f79535-47bb-0310-9956-ffa450edef68

test/org/apache/catalina/filters/TesterResponse.java
test/org/apache/catalina/tribes/demos/IntrospectionUtils.java
test/org/apache/catalina/tribes/demos/MapDemo.java
test/org/apache/catalina/tribes/demos/MembersWithProperties.java

index 715f053..f784c4f 100644 (file)
@@ -105,7 +105,7 @@ public class TesterResponse
      * @param b
      * @throws IOException
      */
-    public void write(@SuppressWarnings("unused") int b) throws IOException {
+    public void write(int b) throws IOException {
         // NOOP
     }
     /**
@@ -113,8 +113,8 @@ public class TesterResponse
      * @param b
      * @throws IOException
      */
-    public void write(@SuppressWarnings("unused") byte b[]) throws IOException {
-     // NOOP
+    public void write(byte b[]) throws IOException {
+        // NOOP
     }
     /**
      * 
@@ -123,9 +123,9 @@ public class TesterResponse
      * @param len
      * @throws IOException
      */
-    public void write(@SuppressWarnings("unused") byte b[],
-            @SuppressWarnings("unused") int off,
-            @SuppressWarnings("unused") int len) throws IOException {/* NOOP */}
+    public void write(byte b[], int off, int len) throws IOException {
+        // NOOP
+    }
     @Override
     public void flushBuffer() throws IOException {/* NOOP */}
     @Override
index 8118b99..3ab087c 100644 (file)
@@ -258,6 +258,7 @@ public final class IntrospectionUtils {
      * int or boolean we'll convert value to the right type before) - that means
      * you can have setDebug(1).
      */
+    @SuppressWarnings("null")
     public static boolean setProperty(Object o, String name, String value) {
         if (log.isDebugEnabled())
             log.debug("IntrospectionUtils: setProperty(" +
@@ -355,7 +356,8 @@ public final class IntrospectionUtils {
                 params[1] = value;
                 if (setPropertyMethodBool != null) {
                     try {
-                        return (Boolean) setPropertyMethodBool.invoke(o, params);
+                        return ((Boolean) setPropertyMethodBool.invoke(o,
+                                params)).booleanValue();
                     }catch (IllegalArgumentException biae) {
                         //the boolean method had the wrong
                         //parameter types. lets try the other
@@ -712,6 +714,7 @@ public final class IntrospectionUtils {
         return methods;
     }
 
+    @SuppressWarnings("null")
     public static Method findMethod(Class<?> c, String name,
             Class<?> params[]) {
         Method methods[] = findMethods(c);
@@ -777,30 +780,6 @@ public final class IntrospectionUtils {
         m.invoke(c, new Object[] { args });
     }
 
-    public static Object callMethod1(Object target, String methodN,
-            Object param1, String typeParam1, ClassLoader cl) throws Exception {
-        if (target == null || param1 == null) {
-            if (log.isDebugEnabled())
-                log.debug("IntrospectionUtils: Assert: Illegal params " +
-                        target + " " + param1);
-        }
-        if (log.isDebugEnabled())
-            log.debug("IntrospectionUtils: callMethod1 " +
-                    target.getClass().getName() + " " +
-                    param1.getClass().getName() + " " + typeParam1);
-
-        Class<?> params[] = new Class[1];
-        if (typeParam1 == null)
-            params[0] = param1.getClass();
-        else
-            params[0] = cl.loadClass(typeParam1);
-        Method m = findMethod(target.getClass(), methodN, params);
-        if (m == null)
-            throw new NoSuchMethodException(target.getClass().getName() + " "
-                    + methodN);
-        return m.invoke(target, new Object[] { param1 });
-    }
-
     public static Object callMethod0(Object target, String methodN)
             throws Exception {
         if (target == null) {
index 5ecc4c9..0a49a84 100644 (file)
@@ -137,6 +137,7 @@ public class MapDemo implements ChannelListener, MembershipListener{
      * @param args
      * @throws Exception
      */
+    @SuppressWarnings("unused")
     public static void main(String[] args) throws Exception {
         long start = System.currentTimeMillis();
         //create a channel object
index 85d0e79..488854e 100644 (file)
@@ -86,6 +86,7 @@ public class MembersWithProperties implements MembershipListener{
                            "java MembersWithProperties -bind 192.168.0.45 -port 4005 -mbind 192.168.0.45 -count 100 -stats 10\n");
     }
 
+    @SuppressWarnings("unused")
     public static void main(String[] args) throws Exception {
         if (args.length==0) usage();
         main = Thread.currentThread();