Uploaded image for project: 'Spring Roo'
  1. Spring Roo
  2. ROO-1374

NullPointerException adding a method using JavaParserMethodMetadata.addMethod

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Minor
    • Resolution: Complete
    • Affects Version/s: 1.1.0.M1
    • Fix Version/s: 1.1.0.RC1
    • Component/s: @ CORE
    • Labels:
      None
    • Environment:
      SUN JDK 1.5.0_07
      Ubuntu 10.04
      Eclipse 3.5.1

      Description

      Hi!

      I found a NullPointerException adding a method to a class using JavaParserMethodMetadata.

      java.lang.NullPointerException
          at org.springframework.roo.classpath.javaparser.details.JavaParserMethodMetadata.addMethod(JavaParserMethodMetadata.java:320)
      

      Roo throws the Exception when I call JavaParserMethodMetadata.addMethod and checks if there's any method with the same method name and input parameter size. The problem is when there's a method in the class with the same method name but has no input parameters:

      JavaParserMethodMetadata.java
      md.getName().equals(d.getName()) && md.getParameters().size() == d.getParameters().size()
      

      This doesn't check if md.getParameters() is null before get the size and throws NullPointerException:

      Thanks!

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              stewarta Alan Stewart
              Reporter:
              ricardogarfe Ricardo GarcĂ­a
              Votes:
              3 Vote for this issue
              Watchers:
              1 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved: