You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by sl...@apache.org on 2019/05/08 19:06:45 UTC

[maven] branch MNG-6626 updated (2bb8015 -> 36630f6)

This is an automated email from the ASF dual-hosted git repository.

slachiewicz pushed a change to branch MNG-6626
in repository https://gitbox.apache.org/repos/asf/maven.git.


 discard 2bb8015  [MNG-6626] fix DefaultExceptionHandler NPE (#241)
     add 61d888c  [MNG-6646] Upgrade maven-assembly-plugin to 3.1.1
     add 763f76c  [MNG-6642] Revert "[MNG-5995] Remove dependency to maven-compat (#185)"
     add fdde73f  Remove unused code that triggers Error Prone (#245)
     add 80c6fe3  [MNG-6643] - Version comparison CLI does not work anymore
     add baed5a2  [MNG-6629] - Make ID validation faster
     add ebac165  [MNG-6630] - Make ComparableVersion faster
     add 44ad1aa  [MNG-6631] - Make DefaultArtifactVersion faster
     add d34e8fb  [MNG-6631] documented the performance intent
     add 1e03388  [MNG-6632] - Remember artifact handlers after they've been used once
     add 869b615  [MNG-6636] merge reports location tracking
     add 5350ed8  [MNG-6644] don't fail if no input location tracking available
     add 4ff24e3  [MNG-6643] Integration test
     add 2760e3e  (doc) - correct plural form of 'child'
     new 36630f6  [MNG-6626] fix DefaultExceptionHandler NPE

This update added new revisions after undoing existing revisions.
That is to say, some revisions that were in the old version of the
branch are not in the new version.  This situation occurs
when a user --force pushes a change and generates a repository
containing something like this:

 * -- * -- B -- O -- O -- O   (2bb8015)
            \
             N -- N -- N   refs/heads/MNG-6626 (36630f6)

You should already have received notification emails for all of the O
revisions, and so the following emails describe only the N revisions
from the common base, B.

Any revisions marked "omit" are not gone; other references still
refer to them.  Any revisions marked "discard" are gone forever.

The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 maven-artifact/pom.xml                             |  12 +++
 .../artifact/versioning/ComparableVersion.java     | 119 +++++++++++++++++++--
 .../versioning/DefaultArtifactVersion.java         |  91 ++++++++++------
 .../artifact/versioning/ComparableVersionIT.java   |  93 ++++++++++++++++
 .../manager/DefaultArtifactHandlerManager.java     |  10 +-
 .../project/DefaultProjectBuildingHelper.java      |   6 +-
 .../maven/AbstractCoreMavenComponentTestCase.java  |  53 ---------
 .../org/apache/maven/plugin/PluginManagerTest.java |  22 ----
 .../model/plugin/DefaultReportingConverter.java    |   2 +-
 .../model/validation/DefaultModelValidator.java    |  53 +++++++--
 .../org/apache/maven/model/merge/ModelMerger.java  |  18 ++++
 maven-model/src/main/mdo/maven.mdo                 |  10 +-
 pom.xml                                            |   6 ++
 13 files changed, 355 insertions(+), 140 deletions(-)
 create mode 100644 maven-artifact/src/test/java/org/apache/maven/artifact/versioning/ComparableVersionIT.java


[maven] 01/01: [MNG-6626] fix DefaultExceptionHandler NPE

Posted by sl...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

slachiewicz pushed a commit to branch MNG-6626
in repository https://gitbox.apache.org/repos/asf/maven.git

commit 36630f6a3d0ac885061cae9d4ebb8c92496e4c0f
Author: Sergey Chernov <se...@gmail.com>
AuthorDate: Fri Apr 5 22:29:33 2019 +0300

    [MNG-6626] fix DefaultExceptionHandler NPE
    
    Closes #241
---
 .../maven/exception/DefaultExceptionHandler.java   |  9 ++--
 .../exception/DefaultExceptionHandlerTest.java     | 53 ++++++++++++++++++++--
 2 files changed, 55 insertions(+), 7 deletions(-)

diff --git a/maven-core/src/main/java/org/apache/maven/exception/DefaultExceptionHandler.java b/maven-core/src/main/java/org/apache/maven/exception/DefaultExceptionHandler.java
index 2a86667..2193e61 100644
--- a/maven-core/src/main/java/org/apache/maven/exception/DefaultExceptionHandler.java
+++ b/maven-core/src/main/java/org/apache/maven/exception/DefaultExceptionHandler.java
@@ -209,10 +209,13 @@ public class DefaultExceptionHandler
                 {
                     Throwable cause2 = cause.getCause();
 
-                    if ( cause2 instanceof NoClassDefFoundError
-                        && cause2.getMessage().contains( "org/sonatype/aether/" ) )
+                    if ( cause2 instanceof NoClassDefFoundError )
                     {
-                        reference = "AetherClassNotFound";
+                        String message = cause2.getMessage();
+                        if ( message != null && message.contains( "org/sonatype/aether/" ) )
+                        {
+                            reference = "AetherClassNotFound";
+                        }
                     }
                 }
 
diff --git a/maven-core/src/test/java/org/apache/maven/exception/DefaultExceptionHandlerTest.java b/maven-core/src/test/java/org/apache/maven/exception/DefaultExceptionHandlerTest.java
index 9727bdf..9fe6d4f 100644
--- a/maven-core/src/test/java/org/apache/maven/exception/DefaultExceptionHandlerTest.java
+++ b/maven-core/src/test/java/org/apache/maven/exception/DefaultExceptionHandlerTest.java
@@ -22,15 +22,22 @@ package org.apache.maven.exception;
 import java.io.IOException;
 import java.net.ConnectException;
 
+import org.apache.maven.model.Plugin;
+import org.apache.maven.plugin.MojoExecution;
 import org.apache.maven.plugin.MojoExecutionException;
 
-import junit.framework.TestCase;
+import org.apache.maven.plugin.PluginContainerException;
+import org.apache.maven.plugin.PluginExecutionException;
+import org.apache.maven.plugin.descriptor.MojoDescriptor;
+import org.apache.maven.plugin.descriptor.PluginDescriptor;
+import org.junit.Test;
+
+import static org.junit.Assert.assertEquals;
 
 /**
  * @author <a href="mailto:baerrach@apache.org">Barrie Treloar</a>
  */
 public class DefaultExceptionHandlerTest
-    extends TestCase
 {
     /**
      * Running Maven under JDK7 may cause connection issues because IPv6 is used by default.
@@ -42,11 +49,11 @@ public class DefaultExceptionHandlerTest
      * http://cwiki.apache.org/confluence/display/MAVEN/ConnectException
      * </p>
      */
+    @Test
     public void testJdk7ipv6()
     {
         ConnectException connEx = new ConnectException( "Connection refused: connect" );
-        IOException ioEx = new IOException( "Unable to establish loopback connection" );
-        ioEx.initCause( connEx );
+        IOException ioEx = new IOException( "Unable to establish loopback connection", connEx );
         MojoExecutionException mojoEx =
             new MojoExecutionException( "Error executing Jetty: Unable to establish loopback connection", ioEx );
 
@@ -57,4 +64,42 @@ public class DefaultExceptionHandlerTest
         assertEquals( expectedReference, exceptionSummary.getReference() );
 
     }
+
+    @Test
+    public void testHandleExceptionAetherClassNotFound()
+    {
+        Throwable cause2 = new NoClassDefFoundError( "org/sonatype/aether/RepositorySystem" );
+        Plugin plugin = new Plugin();
+        Exception cause = new PluginContainerException( plugin, null, null, cause2 );
+        PluginDescriptor pluginDescriptor = new PluginDescriptor();
+        MojoDescriptor mojoDescriptor = new MojoDescriptor();
+        mojoDescriptor.setPluginDescriptor( pluginDescriptor );
+        MojoExecution mojoExecution = new MojoExecution(mojoDescriptor);
+        Throwable exception = new PluginExecutionException( mojoExecution, null, cause );
+
+        DefaultExceptionHandler handler = new DefaultExceptionHandler();
+        ExceptionSummary summary = handler.handleException( exception );
+
+        String expectedReference = "http://cwiki.apache.org/confluence/display/MAVEN/AetherClassNotFound";
+        assertEquals( expectedReference, summary.getReference() );
+    }
+
+    @Test
+    public void testHandleExceptionNoClassDefFoundErrorNull()
+    {
+        Throwable cause2 = new NoClassDefFoundError();
+        Plugin plugin = new Plugin();
+        Exception cause = new PluginContainerException( plugin, null, null, cause2 );
+        PluginDescriptor pluginDescriptor = new PluginDescriptor();
+        MojoDescriptor mojoDescriptor = new MojoDescriptor();
+        mojoDescriptor.setPluginDescriptor( pluginDescriptor );
+        MojoExecution mojoExecution = new MojoExecution(mojoDescriptor);
+        Throwable exception = new PluginExecutionException( mojoExecution, null, cause );
+
+        DefaultExceptionHandler handler = new DefaultExceptionHandler();
+        ExceptionSummary summary = handler.handleException( exception );
+
+        String expectedReference = "http://cwiki.apache.org/confluence/display/MAVEN/PluginContainerException";
+        assertEquals( expectedReference, summary.getReference() );
+    }
 }