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

NullPointerException in AnnotationDeclaration.validateNamedValue

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Done
    • Icon: Blocker Blocker
    • 4.1.0.Alpha1
    • 4.0.0.Beta2
    • cdi, common
    • None
    • 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
            jjankovi Jaroslav Jankovič (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: