Uploaded image for project: 'Maven'
  1. Maven
  2. MNG-3753

ArtifactResolverDiagnoser.diagnose() fails with NPE if nested IOException has no detail message

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 2.0.9
    • 2.2.1
    • Errors, Logging
    • None
    • Patch

    Description

      The following stack trace has been extraced from MNG-3580:

      java.lang.NullPointerException
              at java.lang.String.indexOf(String.java:792)
              at java.lang.String.indexOf(String.java:770)
              at org.apache.maven.usability.ArtifactResolverDiagnoser.diagnose(ArtifactResolverDiagnoser.java:53)
              at org.apache.maven.usability.diagnostics.ErrorDiagnostics.diagnose(ErrorDiagnostics.java:84)
              at org.apache.maven.DefaultMaven.logDiagnostics(DefaultMaven.java:754)
              at org.apache.maven.DefaultMaven.logError(DefaultMaven.java:701)
              at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:135)
              at org.apache.maven.cli.MavenCli.main(MavenCli.java:287)
              at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
              at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:79)
              at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
              at java.lang.reflect.Method.invoke(Method.java:618)
              at org.codehaus.classworlds.Launcher.launchEnhanced(Launcher.java:315)
              at org.codehaus.classworlds.Launcher.launch(Launcher.java:255)
              at org.codehaus.classworlds.Launcher.mainWithExitCode(Launcher.java:430)
              at org.codehaus.classworlds.Launcher.main(Launcher.java:375)
      

      While this was originally triggerd by an IBM JDK, this is really a Maven bug, the line

      if ( ioe != null && exception.getMessage().indexOf( ioe.getMessage() ) < 0 )
      

      needs to check whether ioe.getMessage() is null. Compare API docs for Throwable.getMessage().

      Attachments

        1. null-exception-message.patch
          3 kB
          Benjamin Bentmann

        Issue Links

          Activity

            People

              bentmann Benjamin Bentmann
              bentmann Benjamin Bentmann
              Votes:
              3 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: