Maven 2 & 3

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

Details

  • Type: Bug Bug
  • Status: Closed Closed
  • Priority: Major Major
  • Resolution: Fixed
  • Affects Version/s: 2.0.9
  • Fix Version/s: 2.2.1
  • Component/s: Errors, Logging
  • Labels:
    None
  • Complexity:
    Intermediate
  • Testcase included:
    yes
  • Patch Submitted:
    Yes
  • Number of attachments :
    1

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().

Issue Links

Activity

Hide
Benjamin Bentmann added a comment -

Fixed in r793305.

Show
Benjamin Bentmann added a comment - Fixed in r793305.

People

Vote (3)
Watch (3)

Dates

  • Created:
    Updated:
    Resolved: