harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Davanum Srinivas (JIRA)" <j...@apache.org>
Subject [jira] Created: (HARMONY-5780) NPE in ParameterizedTypeImpl.equals
Date Wed, 23 Apr 2008 09:59:21 GMT
NPE in ParameterizedTypeImpl.equals
-----------------------------------

                 Key: HARMONY-5780
                 URL: https://issues.apache.org/jira/browse/HARMONY-5780
             Project: Harmony
          Issue Type: Bug
            Reporter: Davanum Srinivas


This problem causes a failure in axis2 jaxbri maven module test case.

============== Diagnostic Patch =============

Index: vm/vmcore/src/kernel_classes/javasrc/org/apache/harmony/lang/reflect/implementation/ParameterizedTypeImpl.java
===================================================================
--- vm/vmcore/src/kernel_classes/javasrc/org/apache/harmony/lang/reflect/implementation/ParameterizedTypeImpl.java
     (revision 650806)
+++ vm/vmcore/src/kernel_classes/javasrc/org/apache/harmony/lang/reflect/implementation/ParameterizedTypeImpl.java
     (working copy)
@@ -48,6 +48,12 @@
                 return false;
             }
         }
+        System.out.println("equals 1: " + rawType);
+        System.out.println("equals 2: " + typeOwner);
+        System.out.println("equals 3: " + other);
+        System.out.println("equals 4: " + ((ParameterizedType)other).getRawType());
+        System.out.println("equals 5: " + ((ParameterizedType)other).getOwnerType());
+
         return rawType.equals(((ParameterizedType)other).getRawType()) && typeOwner.equals(((ParameterizedType)other).getOwnerType());
     }

@@ -102,4 +108,4 @@
         }
         return sb.toString();
     }
-}
\ No newline at end of file
+}

===================== Stack Trace ========================
[dims@dims-desktop test]$java -cp . Main
equals 1: class JAXBElement
equals 2: null
equals 3: JAXBElement<CalendarStringArray>
equals 4: class JAXBElement
equals 5: null
Uncaught exception in main:
java.lang.NullPointerException
        at org.apache.harmony.lang.reflect.implementation.ParameterizedTypeImpl.equals(ParameterizedTypeImpl.java:57)
        at Main.main(Main.java:24)

========================= Test Case =======================

import java.lang.reflect.Method;
import java.lang.reflect.Type;

public class Main {
    public static void main(String[] args) throws Exception {
        Method[] methods = CalendarStringArray.class.getDeclaredMethods();
        for (int i = 0; i < methods.length; i++) {
            Method method = methods[i];
            for (int j = 0; j < methods.length; j++) {
                Method method2 = methods[j];
                Type[] types = method.getGenericParameterTypes();
                if (types.length <= 0)
                    continue;
                Type parameterType = types[0];
                Type returnType = method2.getGenericReturnType();
                if (parameterType.equals(returnType)) {
                    System.out.println(" Method : " + method.getName() + " Method2 : " + method2.getName());
                    System.out.println(" Type : " + parameterType);
                }
            }
        }
    }
}

class JAXBElement<T> {
}

class CalendarStringArray {

    protected JAXBElement<CalendarStringArray> calendarStringArray;

    public JAXBElement<CalendarStringArray> getCalendarStringArray() {
        return calendarStringArray;
    }

    public void setCalendarStringArray(JAXBElement<CalendarStringArray> value) {
        this.calendarStringArray = ((JAXBElement<CalendarStringArray>) value);
    }
}


-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


Mime
View raw message