Uploaded image for project: 'Tools (JBoss Tools)'
  1. Tools (JBoss Tools)
  2. JBIDE-13252

NullPointerException in AnnotationDeclaration.validateNamedValue

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Done
    • Icon: Blocker Blocker
    • 4.0.0.CR1
    • 4.0.0.Beta2
    • cdi, common
    • Hide

      Create an annotation type

      @Target({ElementType.TYPE})
      public @interface MyAnnotation {
          String[] value();
      }
      

      and add it to a type with null element

      @MyAnnotation({null})
      public class C {
      }
      

      In this case, method validateNamedValue gets parameter value=null and fails at line

      String stringValue = value.toString();

      Show
      Create an annotation type @Target({ElementType.TYPE}) public @ interface MyAnnotation { String [] value(); } and add it to a type with null element @MyAnnotation({ null }) public class C { } In this case, method validateNamedValue gets parameter value=null and fails at line String stringValue = value.toString();
    • Hide

      If the issue is caused by an error in annotation, fix it.

      Show
      If the issue is caused by an error in annotation, fix it.

      https://community.jboss.org/message/780126

      Comment to method IMemberValuePair.getValue() says that it may return null.
      There is no check for null in AnnotationDeclaration.validateNamedValue.

              manderse@redhat.com Max Andersen
              scabanovich Viacheslav Kabanovich (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              7 Start watching this issue

                Created:
                Updated:
                Resolved: