Uploaded image for project: 'Harmony'
  1. Harmony
  2. HARMONY-5780

[drlvm][kernel] NPE in ParameterizedTypeImpl.equals

    XMLWordPrintableJSON

Details

    Description

      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); }

      }

      Attachments

        Activity

          People

            varlax Alexey Varlamov
            dims Davanum Srinivas
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: