From bf7d7a01a028640ff558bd872591f929795922d9 Mon Sep 17 00:00:00 2001 From: Fabrizio Giustina Date: Mon, 8 Jan 2007 15:01:21 +0000 Subject: [PATCH] MNG-2746 fixing an obvious NPE when parent path is a directory and pom is not found. Also reported in MNGECLIPSE-184 and CONTINUUM-1000 git-svn-id: https://svn.apache.org/repos/asf/maven/components/trunk@494085 13f79535-47bb-0310-9956-ffa450edef68 --- .../project/DefaultMavenProjectBuilder.java | 20 ++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/maven-project/src/main/java/org/apache/maven/project/DefaultMavenProjectBuilder.java b/maven-project/src/main/java/org/apache/maven/project/DefaultMavenProjectBuilder.java index ede9c01a5d..84f51fb5a8 100644 --- a/maven-project/src/main/java/org/apache/maven/project/DefaultMavenProjectBuilder.java +++ b/maven-project/src/main/java/org/apache/maven/project/DefaultMavenProjectBuilder.java @@ -1092,20 +1092,22 @@ public class DefaultMavenProjectBuilder { getLogger().debug( "Parent-POM: " + parentModel.getId() + " for project: " + project.getId() + " cannot be loaded from relative path: " + parentDescriptor + "; path does not exist." ); } - - parentDescriptor = null; } } - try + if ( parentDescriptor != null ) { - parentDescriptor = parentDescriptor.getCanonicalFile(); - } - catch ( IOException e ) - { - getLogger().debug( "Failed to canonicalize potential parent POM: \'" + parentDescriptor + "\'", e ); + try + { + parentDescriptor = parentDescriptor.getCanonicalFile(); + } + catch ( IOException e ) + { + getLogger().debug( "Failed to canonicalize potential parent POM: \'" + parentDescriptor + "\'", + e ); - parentDescriptor = null; + parentDescriptor = null; + } } if ( parentDescriptor != null && parentDescriptor.exists() )