You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by ma...@apache.org on 2010/12/17 23:01:59 UTC

svn commit: r1050500 - in /tomcat/trunk/test/org/apache/catalina: filters/TesterResponse.java tribes/demos/IntrospectionUtils.java tribes/demos/MapDemo.java tribes/demos/MembersWithProperties.java

Author: markt
Date: Fri Dec 17 22:01:59 2010
New Revision: 1050500

URL: http://svn.apache.org/viewvc?rev=1050500&view=rev
Log:
Fix remaining warnings in unit tests (with recently documented settings)

Modified:
    tomcat/trunk/test/org/apache/catalina/filters/TesterResponse.java
    tomcat/trunk/test/org/apache/catalina/tribes/demos/IntrospectionUtils.java
    tomcat/trunk/test/org/apache/catalina/tribes/demos/MapDemo.java
    tomcat/trunk/test/org/apache/catalina/tribes/demos/MembersWithProperties.java

Modified: tomcat/trunk/test/org/apache/catalina/filters/TesterResponse.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/test/org/apache/catalina/filters/TesterResponse.java?rev=1050500&r1=1050499&r2=1050500&view=diff
==============================================================================
--- tomcat/trunk/test/org/apache/catalina/filters/TesterResponse.java (original)
+++ tomcat/trunk/test/org/apache/catalina/filters/TesterResponse.java Fri Dec 17 22:01:59 2010
@@ -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

Modified: tomcat/trunk/test/org/apache/catalina/tribes/demos/IntrospectionUtils.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/test/org/apache/catalina/tribes/demos/IntrospectionUtils.java?rev=1050500&r1=1050499&r2=1050500&view=diff
==============================================================================
--- tomcat/trunk/test/org/apache/catalina/tribes/demos/IntrospectionUtils.java (original)
+++ tomcat/trunk/test/org/apache/catalina/tribes/demos/IntrospectionUtils.java Fri Dec 17 22:01:59 2010
@@ -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) {

Modified: tomcat/trunk/test/org/apache/catalina/tribes/demos/MapDemo.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/test/org/apache/catalina/tribes/demos/MapDemo.java?rev=1050500&r1=1050499&r2=1050500&view=diff
==============================================================================
--- tomcat/trunk/test/org/apache/catalina/tribes/demos/MapDemo.java (original)
+++ tomcat/trunk/test/org/apache/catalina/tribes/demos/MapDemo.java Fri Dec 17 22:01:59 2010
@@ -137,6 +137,7 @@ public class MapDemo implements ChannelL
      * @param args
      * @throws Exception
      */
+    @SuppressWarnings("unused")
     public static void main(String[] args) throws Exception {
         long start = System.currentTimeMillis();
         //create a channel object

Modified: tomcat/trunk/test/org/apache/catalina/tribes/demos/MembersWithProperties.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/test/org/apache/catalina/tribes/demos/MembersWithProperties.java?rev=1050500&r1=1050499&r2=1050500&view=diff
==============================================================================
--- tomcat/trunk/test/org/apache/catalina/tribes/demos/MembersWithProperties.java (original)
+++ tomcat/trunk/test/org/apache/catalina/tribes/demos/MembersWithProperties.java Fri Dec 17 22:01:59 2010
@@ -86,6 +86,7 @@ public class MembersWithProperties imple
                            "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();



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