Uploaded image for project: 'SonarQube'
  1. SonarQube
  2. SONAR-9423

NullPointerException is sometimes generated instead of the real error message

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 6.5-M1, 6.5
    • Component/s: Web API
    • Labels:

      Description

      In a web service, It may happen that the protobuf message is badly generated (probably because of bad input data), and it this case a NullPointerException is generated and is hiding the real error.

      2017.06.06 11:54:38 ERROR web[o.s.s.w.WebServiceEngine] Fail to process request http://localshot/batch/project.protobuf?key=projectKey
      java.lang.NullPointerException: null
      	at com.google.protobuf.ByteString.copyFromUtf8(ByteString.java:321) ~[protobuf-java-3.0.0-beta-2.jar:na]
      	at com.google.protobuf.TextFormat.escapeText(TextFormat.java:1892) ~[protobuf-java-3.0.0-beta-2.jar:na]
      	at com.google.protobuf.TextFormat$Printer.printFieldValue(TextFormat.java:428) ~[protobuf-java-3.0.0-beta-2.jar:na]
      	at com.google.protobuf.TextFormat$Printer.printSingleField(TextFormat.java:368) ~[protobuf-java-3.0.0-beta-2.jar:na]
      	at com.google.protobuf.TextFormat$Printer.printField(TextFormat.java:327) ~[protobuf-java-3.0.0-beta-2.jar:na]
      	at com.google.protobuf.TextFormat$Printer.print(TextFormat.java:314) ~[protobuf-java-3.0.0-beta-2.jar:na]
      	at com.google.protobuf.TextFormat$Printer.printFieldValue(TextFormat.java:450) ~[protobuf-java-3.0.0-beta-2.jar:na]
      	at com.google.protobuf.TextFormat$Printer.printSingleField(TextFormat.java:368) ~[protobuf-java-3.0.0-beta-2.jar:na]
      	at com.google.protobuf.TextFormat$Printer.printField(TextFormat.java:324) ~[protobuf-java-3.0.0-beta-2.jar:na]
      	at com.google.protobuf.TextFormat$Printer.print(TextFormat.java:314) ~[protobuf-java-3.0.0-beta-2.jar:na]
      	at com.google.protobuf.TextFormat$Printer.access$400(TextFormat.java:288) ~[protobuf-java-3.0.0-beta-2.jar:na]
      	at com.google.protobuf.TextFormat.shortDebugString(TextFormat.java:113) ~[protobuf-java-3.0.0-beta-2.jar:na]
      	at org.sonarqube.ws.MessageFormatter.print(MessageFormatter.java:32) ~[sonar-ws-5.6.6.jar:na]
      	at org.sonar.server.ws.WsUtils.writeProtobuf(WsUtils.java:63) ~[sonar-server-5.6.6.jar:na]
      	at org.sonar.server.batch.ProjectAction.handle(ProjectAction.java:83) ~[sonar-server-5.6.6.jar:na]
      	at org.sonar.server.ws.WebServiceEngine.execute(WebServiceEngine.java:107) ~[sonar-server-5.6.6.jar:na]
      	at sun.reflect.GeneratedMethodAccessor219.invoke(Unknown Source) ~[na:na]
      	at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[na:1.8.0_121]
      	at java.lang.reflect.Method.invoke(Unknown Source) ~[na:1.8.0_121]
      

      The problem is coming from this : we should not try to display the protobuff message as it may be badly created, but only display the error.

        Attachments

          Activity

            People

            • Assignee:
              julien.lancelot Julien Lancelot
              Reporter:
              julien.lancelot Julien Lancelot
            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Due:
                Created:
                Updated:
                Resolved: