java.lang.NullPointerException

Spring JIRA | Ricardo García | 6 years ago
  1. 0

    Sorry for been so late, but I haven't got enought time. Here is an example to reproduce the error described in https://jira.springsource.org/browse/ROO-1529 using a test Add-on to get toString representation of class methods: Method testMethod: {code} @WebMethod public void testMethod() { return; } {code} Method testMethod *toString*: {noformat} [JavaParserMethodMetadata@6f48db9c declaredByMetadataId = [null], modifier = 'public', methodName = dajkjdsaj, parameterTypes = list[[empty]], parameterNames = list[[empty]], returnType = void, throwsTypes = list[[empty]], annotations = list[[JavaParserAnnotationMetadata@184a17d8 annotationType = org.gvnix.service.layer.roo.addon.annotations.GvNIXWebMethod, attributes = list[operationName -> dajkjdsaj, resultName -> void, webResultType -> java.lang.Void]]], body = '{ return; {noformat} Method correctInputParameters: {code} public String correctInputParameters(Car listaVacia, java.util.List<String> listaLlena, HashSet<String> primerHashSet, Set<String> set, String name) throws Exception, NullPointerException { return "aaaaaaaaaaaaaaaaaaaaaaaaa" + "aaaaaaaaaaaaaaaaaaaaaaaaah"; } {code} Method correctInputParameters *toString*: {noformat} [JavaParserMethodMetadata@5e8fee26 declaredByMetadataId = [null], modifier = 'public', methodName = correctInputParameters, parameterTypes = list[org.gvnix.test.relation.list.table.service.Car, java.util.List<java.lang.String>, java.util.HashSet<java.lang.String>, org.gvnix.test.relation.list.table.service.Set<java.lang.String>, java.lang.String], parameterNames = list[listaVacia, listaLlena, primerHashSet, set, name], returnType = java.lang.String, throwsTypes = list[java.lang.Exception, java.lang.NullPointerException], annotations = list[[empty]], body = '{ return "aaaaaaaaaaaaaaaaaaaaaaaaa" + "aaaaaaaaaaaaaaaaaaaaaaaaah"; }'] {noformat} Method testMethod *returnNothing*:Parsing the method: {code} @WebMethod public String returnNothing( @WebParam(name = "nenene", partName = "parameters", mode = Mode.IN, header = false) String nenene, @WebParam(name = "numerooo", partName = "parameters", mode = Mode.IN, header = false) Integer numerooo, @WebParam(name = "cuatrooo", targetNamespace = "http://service.table.list.relation.test.gvnix.org/", partName = "parameters", mode = Mode.IN, header = false) Cuarto cuatrooo, @WebParam(name = "setString", partName = "parameters", mode = Mode.IN, header = false) Set<String> set, @WebParam(name = "hashSetString", partName = "parameters", mode = Mode.IN, header = false) HashSet<String> hashSetString) throws Exception { return "mensaje"; } {code} Method returnNothing *toString*: {noformat} com.sun.jdi.InvocationException occurred invoking method. java.lang.NullPointerException at org.springframework.roo.classpath.details.AnnotationMetadataUtils.computeAttributeValue(AnnotationMetadataUtils.java:117) at org.springframework.roo.classpath.details.AnnotationMetadataUtils.toSourceForm(AnnotationMetadataUtils.java:78) at org.springframework.roo.classpath.details.AnnotationMetadataUtils.toSourceForm(AnnotationMetadataUtils.java:36) at org.springframework.roo.classpath.details.annotations.AnnotatedJavaType.toString(AnnotatedJavaType.java:52) at java.lang.String.valueOf(String.java:2615) at org.springframework.roo.support.style.DefaultValueStyler.style(DefaultValueStyler.java:78) at org.springframework.roo.support.style.DefaultValueStyler.style(DefaultValueStyler.java:107) at org.springframework.roo.support.style.DefaultValueStyler.style(DefaultValueStyler.java:72) at org.springframework.roo.support.style.DefaultToStringStyler.styleValue(DefaultToStringStyler.java:91) at org.springframework.roo.support.style.DefaultToStringStyler.styleField(DefaultToStringStyler.java:79) at org.springframework.roo.support.style.ToStringCreator.append(ToStringCreator.java:156) at org.springframework.roo.classpath.javaparser.details.JavaParserMethodMetadata.toString(JavaParserMethodMetadata.java:164) at org.test.service.layer.roo.addon.OperationsImpl.getMethodFromClass(OperationsImpl.java:195) at org.test.service.layer.roo.addon.Commands.getMethodFromClass(Commands.java:62) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:585) at org.springframework.roo.support.util.ReflectionUtils.invokeMethod(ReflectionUtils.java:191) at org.springframework.roo.process.manager.ProcessManagerHostedExecutionStrategy$1.callback(ProcessManagerHostedExecutionStrategy.java:34) at org.springframework.roo.process.manager.internal.DefaultProcessManager.doTransactionally(DefaultProcessManager.java:169) at org.springframework.roo.process.manager.internal.DefaultProcessManager.execute(DefaultProcessManager.java:132) at org.springframework.roo.process.manager.ProcessManagerHostedExecutionStrategy.execute(ProcessManagerHostedExecutionStrategy.java:32) at org.springframework.roo.shell.AbstractShell.executeCommand(AbstractShell.java:158) at org.springframework.roo.shell.jline.JLineShell.promptLoop(JLineShell.java:200) at org.springframework.roo.shell.jline.JLineShell.run(JLineShell.java:126) at java.lang.Thread.run(Thread.java:595) {noformat} Error in *parameterTypes* value: {noformat} com.sun.jdi.InvocationException occurred invoking method. {noformat} when in *JavaParserMethodMetadata* access to *toString()* method: {code} tsc.append("parameterTypes", parameterTypes); {code} The Error is reproduced when the method has annotations assigned to Method parameter types. You can try it using this test Add-on attached to issue with the command ``get toString methods`` with the parameter *--class* to inspect a selected class with the methods defined in the issue. Thank you!

    Spring JIRA | 6 years ago | Ricardo García
    java.lang.NullPointerException
  2. 0

    Sorry for been so late, but I haven't got enought time. Here is an example to reproduce the error described in https://jira.springsource.org/browse/ROO-1529 using a test Add-on to get toString representation of class methods: Method testMethod: {code} @WebMethod public void testMethod() { return; } {code} Method testMethod *toString*: {noformat} [JavaParserMethodMetadata@6f48db9c declaredByMetadataId = [null], modifier = 'public', methodName = dajkjdsaj, parameterTypes = list[[empty]], parameterNames = list[[empty]], returnType = void, throwsTypes = list[[empty]], annotations = list[[JavaParserAnnotationMetadata@184a17d8 annotationType = org.gvnix.service.layer.roo.addon.annotations.GvNIXWebMethod, attributes = list[operationName -> dajkjdsaj, resultName -> void, webResultType -> java.lang.Void]]], body = '{ return; {noformat} Method correctInputParameters: {code} public String correctInputParameters(Car listaVacia, java.util.List<String> listaLlena, HashSet<String> primerHashSet, Set<String> set, String name) throws Exception, NullPointerException { return "aaaaaaaaaaaaaaaaaaaaaaaaa" + "aaaaaaaaaaaaaaaaaaaaaaaaah"; } {code} Method correctInputParameters *toString*: {noformat} [JavaParserMethodMetadata@5e8fee26 declaredByMetadataId = [null], modifier = 'public', methodName = correctInputParameters, parameterTypes = list[org.gvnix.test.relation.list.table.service.Car, java.util.List<java.lang.String>, java.util.HashSet<java.lang.String>, org.gvnix.test.relation.list.table.service.Set<java.lang.String>, java.lang.String], parameterNames = list[listaVacia, listaLlena, primerHashSet, set, name], returnType = java.lang.String, throwsTypes = list[java.lang.Exception, java.lang.NullPointerException], annotations = list[[empty]], body = '{ return "aaaaaaaaaaaaaaaaaaaaaaaaa" + "aaaaaaaaaaaaaaaaaaaaaaaaah"; }'] {noformat} Method testMethod *returnNothing*:Parsing the method: {code} @WebMethod public String returnNothing( @WebParam(name = "nenene", partName = "parameters", mode = Mode.IN, header = false) String nenene, @WebParam(name = "numerooo", partName = "parameters", mode = Mode.IN, header = false) Integer numerooo, @WebParam(name = "cuatrooo", targetNamespace = "http://service.table.list.relation.test.gvnix.org/", partName = "parameters", mode = Mode.IN, header = false) Cuarto cuatrooo, @WebParam(name = "setString", partName = "parameters", mode = Mode.IN, header = false) Set<String> set, @WebParam(name = "hashSetString", partName = "parameters", mode = Mode.IN, header = false) HashSet<String> hashSetString) throws Exception { return "mensaje"; } {code} Method returnNothing *toString*: {noformat} com.sun.jdi.InvocationException occurred invoking method. java.lang.NullPointerException at org.springframework.roo.classpath.details.AnnotationMetadataUtils.computeAttributeValue(AnnotationMetadataUtils.java:117) at org.springframework.roo.classpath.details.AnnotationMetadataUtils.toSourceForm(AnnotationMetadataUtils.java:78) at org.springframework.roo.classpath.details.AnnotationMetadataUtils.toSourceForm(AnnotationMetadataUtils.java:36) at org.springframework.roo.classpath.details.annotations.AnnotatedJavaType.toString(AnnotatedJavaType.java:52) at java.lang.String.valueOf(String.java:2615) at org.springframework.roo.support.style.DefaultValueStyler.style(DefaultValueStyler.java:78) at org.springframework.roo.support.style.DefaultValueStyler.style(DefaultValueStyler.java:107) at org.springframework.roo.support.style.DefaultValueStyler.style(DefaultValueStyler.java:72) at org.springframework.roo.support.style.DefaultToStringStyler.styleValue(DefaultToStringStyler.java:91) at org.springframework.roo.support.style.DefaultToStringStyler.styleField(DefaultToStringStyler.java:79) at org.springframework.roo.support.style.ToStringCreator.append(ToStringCreator.java:156) at org.springframework.roo.classpath.javaparser.details.JavaParserMethodMetadata.toString(JavaParserMethodMetadata.java:164) at org.test.service.layer.roo.addon.OperationsImpl.getMethodFromClass(OperationsImpl.java:195) at org.test.service.layer.roo.addon.Commands.getMethodFromClass(Commands.java:62) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:585) at org.springframework.roo.support.util.ReflectionUtils.invokeMethod(ReflectionUtils.java:191) at org.springframework.roo.process.manager.ProcessManagerHostedExecutionStrategy$1.callback(ProcessManagerHostedExecutionStrategy.java:34) at org.springframework.roo.process.manager.internal.DefaultProcessManager.doTransactionally(DefaultProcessManager.java:169) at org.springframework.roo.process.manager.internal.DefaultProcessManager.execute(DefaultProcessManager.java:132) at org.springframework.roo.process.manager.ProcessManagerHostedExecutionStrategy.execute(ProcessManagerHostedExecutionStrategy.java:32) at org.springframework.roo.shell.AbstractShell.executeCommand(AbstractShell.java:158) at org.springframework.roo.shell.jline.JLineShell.promptLoop(JLineShell.java:200) at org.springframework.roo.shell.jline.JLineShell.run(JLineShell.java:126) at java.lang.Thread.run(Thread.java:595) {noformat} Error in *parameterTypes* value: {noformat} com.sun.jdi.InvocationException occurred invoking method. {noformat} when in *JavaParserMethodMetadata* access to *toString()* method: {code} tsc.append("parameterTypes", parameterTypes); {code} The Error is reproduced when the method has annotations assigned to Method parameter types. You can try it using this test Add-on attached to issue with the command ``get toString methods`` with the parameter *--class* to inspect a selected class with the methods defined in the issue. Thank you!

    Spring JIRA | 6 years ago | Ricardo García
    java.lang.NullPointerException
  3. 0

    Android: Saving Map State in Google map

    Stack Overflow | 11 months ago | Junie Negentien
    java.lang.RuntimeException: Unable to resume activity {com.ourThesis.junieNegentien2015/com.ourThesis.junieNegentien2015.MainActivity}: java.lang.NullPointerException
  4. Speed up your debug routine!

    Automated exception search integrated into your IDE

    Not finding the right solution?
    Take a tour to get the most out of Samebug.

    Tired of useless tips?

    Automated exception search integrated into your IDE

    Root Cause Analysis

    1. java.lang.NullPointerException

      No message provided

      at org.springframework.roo.classpath.details.AnnotationMetadataUtils.computeAttributeValue()
    2. org.springframework.roo
      AnnotatedJavaType.toString
      1. org.springframework.roo.classpath.details.AnnotationMetadataUtils.computeAttributeValue(AnnotationMetadataUtils.java:117)
      2. org.springframework.roo.classpath.details.AnnotationMetadataUtils.toSourceForm(AnnotationMetadataUtils.java:78)
      3. org.springframework.roo.classpath.details.AnnotationMetadataUtils.toSourceForm(AnnotationMetadataUtils.java:36)
      4. org.springframework.roo.classpath.details.annotations.AnnotatedJavaType.toString(AnnotatedJavaType.java:52)
      4 frames
    3. Java RT
      String.valueOf
      1. java.lang.String.valueOf(String.java:2615)
      1 frame
    4. org.springframework.roo
      JavaParserMethodMetadata.toString
      1. org.springframework.roo.support.style.DefaultValueStyler.style(DefaultValueStyler.java:78)
      2. org.springframework.roo.support.style.DefaultValueStyler.style(DefaultValueStyler.java:107)
      3. org.springframework.roo.support.style.DefaultValueStyler.style(DefaultValueStyler.java:72)
      4. org.springframework.roo.support.style.DefaultToStringStyler.styleValue(DefaultToStringStyler.java:91)
      5. org.springframework.roo.support.style.DefaultToStringStyler.styleField(DefaultToStringStyler.java:79)
      6. org.springframework.roo.support.style.ToStringCreator.append(ToStringCreator.java:156)
      7. org.springframework.roo.classpath.javaparser.details.JavaParserMethodMetadata.toString(JavaParserMethodMetadata.java:164)
      7 frames
    5. org.test.service
      Commands.getMethodFromClass
      1. org.test.service.layer.roo.addon.OperationsImpl.getMethodFromClass(OperationsImpl.java:195)
      2. org.test.service.layer.roo.addon.Commands.getMethodFromClass(Commands.java:62)
      2 frames
    6. Java RT
      Method.invoke
      1. sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      2. sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
      3. sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      4. java.lang.reflect.Method.invoke(Method.java:585)
      4 frames
    7. org.springframework.roo
      JLineShell.run
      1. org.springframework.roo.support.util.ReflectionUtils.invokeMethod(ReflectionUtils.java:191)
      2. org.springframework.roo.process.manager.ProcessManagerHostedExecutionStrategy$1.callback(ProcessManagerHostedExecutionStrategy.java:34)
      3. org.springframework.roo.process.manager.internal.DefaultProcessManager.doTransactionally(DefaultProcessManager.java:169)
      4. org.springframework.roo.process.manager.internal.DefaultProcessManager.execute(DefaultProcessManager.java:132)
      5. org.springframework.roo.process.manager.ProcessManagerHostedExecutionStrategy.execute(ProcessManagerHostedExecutionStrategy.java:32)
      6. org.springframework.roo.shell.AbstractShell.executeCommand(AbstractShell.java:158)
      7. org.springframework.roo.shell.jline.JLineShell.promptLoop(JLineShell.java:200)
      8. org.springframework.roo.shell.jline.JLineShell.run(JLineShell.java:126)
      8 frames
    8. Java RT
      Thread.run
      1. java.lang.Thread.run(Thread.java:595)
      1 frame