Add a null-pointer check for invoker result.

In some rare conditions it might turn out the resulting exception from
invoker result is null, that's why we need a null-check and throw
a default exception.


Project: http://git-wip-us.apache.org/repos/asf/maven-archetype/repo
Commit: http://git-wip-us.apache.org/repos/asf/maven-archetype/commit/078bc197
Tree: http://git-wip-us.apache.org/repos/asf/maven-archetype/tree/078bc197
Diff: http://git-wip-us.apache.org/repos/asf/maven-archetype/diff/078bc197

Branch: refs/heads/master
Commit: 078bc1976e151793a09f6bca5767029e85d72bb8
Parents: 44929a1
Author: Petar Tahchiev <[email protected]>
Authored: Sun Aug 14 10:27:52 2016 +0300
Committer: Petar Tahchiev <[email protected]>
Committed: Sun Aug 14 10:27:52 2016 +0300

----------------------------------------------------------------------
 .../maven/archetype/creator/FilesetArchetypeCreator.java    | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/maven-archetype/blob/078bc197/archetype-common/src/main/java/org/apache/maven/archetype/creator/FilesetArchetypeCreator.java
----------------------------------------------------------------------
diff --git 
a/archetype-common/src/main/java/org/apache/maven/archetype/creator/FilesetArchetypeCreator.java
 
b/archetype-common/src/main/java/org/apache/maven/archetype/creator/FilesetArchetypeCreator.java
index eabcb08..9481a87 100644
--- 
a/archetype-common/src/main/java/org/apache/maven/archetype/creator/FilesetArchetypeCreator.java
+++ 
b/archetype-common/src/main/java/org/apache/maven/archetype/creator/FilesetArchetypeCreator.java
@@ -292,7 +292,14 @@ public class FilesetArchetypeCreator
             InvocationResult invokerResult = invoker.execute( internalRequest 
);
             if ( invokerResult.getExitCode() != 0 )
             {
-                throw invokerResult.getExecutionException();
+                if ( invokerResult.getExecutionException() != null )
+                {
+                    throw invokerResult.getExecutionException();
+                }
+                else
+                {
+                    throw new Exception( "Invoker process ended with redult 
different than 0!" );
+                }
             }
 
         }

Reply via email to