java.lang.NullPointerException

There are no available Samebug tips for this exception. Do you have an idea how to solve this issue? A short tip would help users who saw this issue last week.

  • Hi! The method *getOutput* in *JavaParserMutableClassOrInterfaceTypeDetails* adds null into *typeParameters* field when creates the constructors for a class: {code:title=JavaParserMutableClassOrInterfaceTypeDetails.java|borderStyle=solid} // Add constructors for (ConstructorMetadata candidate : cit.getDeclaredConstructors()) { JavaParserConstructorMetadata.addConstructor(compilationUnitServices, typeDeclaration.getMembers(), candidate, false, null); } {code} This throws a *NullPointerException* when you create a class with more than one constructor with the same *number* of input parameters: {noformat} java.lang.NullPointerException at java.util.AbstractCollection.addAll(AbstractCollection.java:316) at org.springframework.roo.classpath.javaparser.details.JavaParserConstructorMetadata.<init>(JavaParserConstructorMetadata.java:65) at org.springframework.roo.classpath.javaparser.details.JavaParserConstructorMetadata.addConstructor(JavaParserConstructorMetadata.java:249) at org.springframework.roo.classpath.javaparser.JavaParserMutableClassOrInterfaceTypeDetails.getOutput(JavaParserMutableClassOrInterfaceTypeDetails.java:516) at org.springframework.roo.classpath.javaparser.JavaParserMutableClassOrInterfaceTypeDetails.createType(JavaParserMutableClassOrInterfaceTypeDetails.java:532) at org.springframework.roo.classpath.javaparser.JavaParserMetadataProvider.createPhysicalType(JavaParserMetadataProvider.java:87) at org.springframework.roo.classpath.operations.ClasspathOperationsImpl.generateClassFile(ClasspathOperationsImpl.java:121) ... {noformat} This exception is launched when *JavaParserConstructorMetadata.addConstructor* method is checking if exists a constructor with the same parameter types in line 242: {code:title=JavaParserConstructorMetadata.java|borderStyle=solid} // Locate where to add this constructor; also verify if this method already exists for (BodyDeclaration bd : members) { if (bd instanceof ConstructorDeclaration) { // Next constructor should appear after this current constructor ConstructorDeclaration cd = (ConstructorDeclaration) bd; if (cd.getParameters().size() == d.getParameters().size()) { // Possible match, we need to consider parameter types as well now JavaParserConstructorMetadata jpmm = new JavaParserConstructorMetadata(constructor.getDeclaredByMetadataId(), cd, compilationUnitServices, typeParameters); boolean matchesFully = true; for (AnnotatedJavaType existingParameter : jpmm.getParameterTypes()) { if (!existingParameter.getJavaType().equals(constructor.getParameterTypes().get(index))) { matchesFully = false; break; } } if (matchesFully) { throw new IllegalStateException("Constructor '" + constructor.getParameterNames() + "' already exists with identical parameters"); } } } } {code} Thanks!
    via by Ricardo García,
  • Hi! The method *getOutput* in *JavaParserMutableClassOrInterfaceTypeDetails* adds null into *typeParameters* field when creates the constructors for a class: {code:title=JavaParserMutableClassOrInterfaceTypeDetails.java|borderStyle=solid} // Add constructors for (ConstructorMetadata candidate : cit.getDeclaredConstructors()) { JavaParserConstructorMetadata.addConstructor(compilationUnitServices, typeDeclaration.getMembers(), candidate, false, null); } {code} This throws a *NullPointerException* when you create a class with more than one constructor with the same *number* of input parameters: {noformat} java.lang.NullPointerException at java.util.AbstractCollection.addAll(AbstractCollection.java:316) at org.springframework.roo.classpath.javaparser.details.JavaParserConstructorMetadata.<init>(JavaParserConstructorMetadata.java:65) at org.springframework.roo.classpath.javaparser.details.JavaParserConstructorMetadata.addConstructor(JavaParserConstructorMetadata.java:249) at org.springframework.roo.classpath.javaparser.JavaParserMutableClassOrInterfaceTypeDetails.getOutput(JavaParserMutableClassOrInterfaceTypeDetails.java:516) at org.springframework.roo.classpath.javaparser.JavaParserMutableClassOrInterfaceTypeDetails.createType(JavaParserMutableClassOrInterfaceTypeDetails.java:532) at org.springframework.roo.classpath.javaparser.JavaParserMetadataProvider.createPhysicalType(JavaParserMetadataProvider.java:87) at org.springframework.roo.classpath.operations.ClasspathOperationsImpl.generateClassFile(ClasspathOperationsImpl.java:121) ... {noformat} This exception is launched when *JavaParserConstructorMetadata.addConstructor* method is checking if exists a constructor with the same parameter types in line 242: {code:title=JavaParserConstructorMetadata.java|borderStyle=solid} // Locate where to add this constructor; also verify if this method already exists for (BodyDeclaration bd : members) { if (bd instanceof ConstructorDeclaration) { // Next constructor should appear after this current constructor ConstructorDeclaration cd = (ConstructorDeclaration) bd; if (cd.getParameters().size() == d.getParameters().size()) { // Possible match, we need to consider parameter types as well now JavaParserConstructorMetadata jpmm = new JavaParserConstructorMetadata(constructor.getDeclaredByMetadataId(), cd, compilationUnitServices, typeParameters); boolean matchesFully = true; for (AnnotatedJavaType existingParameter : jpmm.getParameterTypes()) { if (!existingParameter.getJavaType().equals(constructor.getParameterTypes().get(index))) { matchesFully = false; break; } } if (matchesFully) { throw new IllegalStateException("Constructor '" + constructor.getParameterNames() + "' already exists with identical parameters"); } } } } {code} Thanks!
    via by Ricardo García,
  • The new WebDAV plugin contains a servlet filter module. In testing it, I tried to uninstall it. As soon as I did, all requests to Confluence started returning the error (attached.) {code} Dec 10, 2008 11:30:43 AM org.apache.catalina.core.StandardWrapperValve invoke SEVERE: Servlet.service() for servlet css threw exception java.lang.NullPointerException at java.util.AbstractCollection.addAll(AbstractCollection.java:316) at com.atlassian.plugin.servlet.util.DefaultPathMapper.getAll(DefaultPathMapper.java:139) at com.atlassian.plugin.servlet.DefaultServletModuleManager.getFilters(DefaultServletModuleManager.java:129) at com.atlassian.plugin.servlet.filter.ServletFilterModuleContainerFilter.doFilter(ServletFilterModuleContainerFilter.java:52) at com.atlassian.plugin.servlet.filter.ServletFilterModuleContainerFilter.doFilter(ServletFilterModuleContainerFilter.java:40) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206) at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233) at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175) at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128) at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102) at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109) at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:263) at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844) at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:584) at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447) at java.lang.Thread.run(Thread.java:613) {code} I'm also attaching a build of the plugin, in case that helps diagnose the problem.
    via by Jonathan Nolen [Atlassian],
  • The new WebDAV plugin contains a servlet filter module. In testing it, I tried to uninstall it. As soon as I did, all requests to Confluence started returning the error (attached.) {code} Dec 10, 2008 11:30:43 AM org.apache.catalina.core.StandardWrapperValve invoke SEVERE: Servlet.service() for servlet css threw exception java.lang.NullPointerException at java.util.AbstractCollection.addAll(AbstractCollection.java:316) at com.atlassian.plugin.servlet.util.DefaultPathMapper.getAll(DefaultPathMapper.java:139) at com.atlassian.plugin.servlet.DefaultServletModuleManager.getFilters(DefaultServletModuleManager.java:129) at com.atlassian.plugin.servlet.filter.ServletFilterModuleContainerFilter.doFilter(ServletFilterModuleContainerFilter.java:52) at com.atlassian.plugin.servlet.filter.ServletFilterModuleContainerFilter.doFilter(ServletFilterModuleContainerFilter.java:40) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206) at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233) at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175) at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128) at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102) at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109) at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:263) at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844) at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:584) at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447) at java.lang.Thread.run(Thread.java:613) {code} I'm also attaching a build of the plugin, in case that helps diagnose the problem.
    via by Jonathan Nolen [Atlassian],
  • NullPointerException
    via GitHub by msf0r
    ,
    • java.lang.NullPointerException at java.util.AbstractCollection.addAll(AbstractCollection.java:316) at org.springframework.roo.classpath.javaparser.details.JavaParserConstructorMetadata.<init>(JavaParserConstructorMetadata.java:65) at org.springframework.roo.classpath.javaparser.details.JavaParserConstructorMetadata.addConstructor(JavaParserConstructorMetadata.java:249) at org.springframework.roo.classpath.javaparser.JavaParserMutableClassOrInterfaceTypeDetails.getOutput(JavaParserMutableClassOrInterfaceTypeDetails.java:516) at org.springframework.roo.classpath.javaparser.JavaParserMutableClassOrInterfaceTypeDetails.createType(JavaParserMutableClassOrInterfaceTypeDetails.java:532) at org.springframework.roo.classpath.javaparser.JavaParserMetadataProvider.createPhysicalType(JavaParserMetadataProvider.java:87) at org.springframework.roo.classpath.operations.ClasspathOperationsImpl.generateClassFile(ClasspathOperationsImpl.java:121)

    Users with the same issue

    andyglickandyglick
    1 times, last one,
    tvrmsmithtvrmsmith
    10 times, last one,
    Unknown visitor
    Unknown visitor1 times, last one,
    Unknown visitor
    Unknown visitor2 times, last one,