You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@ant.apache.org by xa...@apache.org on 2008/03/11 16:37:19 UTC

svn commit: r635977 - /ant/ivy/core/trunk/src/java/org/apache/ivy/plugins/parser/m2/PomModuleDescriptorParser.java

Author: xavier
Date: Tue Mar 11 08:37:15 2008
New Revision: 635977

URL: http://svn.apache.org/viewvc?rev=635977&view=rev
Log:
prevent NPE when loading parent pom failed

Modified:
    ant/ivy/core/trunk/src/java/org/apache/ivy/plugins/parser/m2/PomModuleDescriptorParser.java

Modified: ant/ivy/core/trunk/src/java/org/apache/ivy/plugins/parser/m2/PomModuleDescriptorParser.java
URL: http://svn.apache.org/viewvc/ant/ivy/core/trunk/src/java/org/apache/ivy/plugins/parser/m2/PomModuleDescriptorParser.java?rev=635977&r1=635976&r2=635977&view=diff
==============================================================================
--- ant/ivy/core/trunk/src/java/org/apache/ivy/plugins/parser/m2/PomModuleDescriptorParser.java (original)
+++ ant/ivy/core/trunk/src/java/org/apache/ivy/plugins/parser/m2/PomModuleDescriptorParser.java Tue Mar 11 08:37:15 2008
@@ -171,7 +171,12 @@
                         domReader.getParentVersion());
                     ResolvedModuleRevision parentModule = parseOtherPom(ivySettings, 
                         parentModRevID);
-                    parentDescr = parentModule.getDescriptor();
+                    if (parentModule != null) {
+                        parentDescr = parentModule.getDescriptor();
+                    } else {
+                       Message.warn("impossible to load parent for " + descriptorURL + "."
+                           + " Parent=" + parentModRevID); 
+                    }
                 }
                                 
                 Map pomProperties = domReader.getPomProperties();



Re: svn commit: r635977 - /ant/ivy/core/trunk/src/java/org/apache/ivy/plugins/parser/m2/PomModuleDescriptorParser.java

Posted by Xavier Hanin <xa...@gmail.com>.
On Wed, Mar 12, 2008 at 8:35 AM, Gilles Scokart <gs...@gmail.com> wrote:
> Is it just a warning?  Don't you think it should be an error?  It is
>  actually an entire part of your module descriptor that can not be read
>  (including some dependencies).
>
>  WDYT?

It depends what you mean by an error. If you mean using the error
level for the message, it makes sense. If you meaning throwing a
ParseException, then I don't know... Throwing an exception would
better fit Ivy philosophy about consistency checking. And I guess
maven also halt the build if it doesn't find the parent, right? So
indeed even halting the parsing with a ParseException would make
sense.

WDYT?

Xavier

>  Gilles
>
>
>
>  On 11/03/2008, xavier@apache.org <xa...@apache.org> wrote:
>  > Author: xavier
>  >  Date: Tue Mar 11 08:37:15 2008
>  >  New Revision: 635977
>  >
>  >  URL: http://svn.apache.org/viewvc?rev=635977&view=rev
>  >  Log:
>  >  prevent NPE when loading parent pom failed
>  >
>  >  Modified:
>  >     ant/ivy/core/trunk/src/java/org/apache/ivy/plugins/parser/m2/PomModuleDescriptorParser.java
>  >
>  >  Modified: ant/ivy/core/trunk/src/java/org/apache/ivy/plugins/parser/m2/PomModuleDescriptorParser.java
>  >  URL: http://svn.apache.org/viewvc/ant/ivy/core/trunk/src/java/org/apache/ivy/plugins/parser/m2/PomModuleDescriptorParser.java?rev=635977&r1=635976&r2=635977&view=diff
>  >  ==============================================================================
>  >  --- ant/ivy/core/trunk/src/java/org/apache/ivy/plugins/parser/m2/PomModuleDescriptorParser.java (original)
>  >  +++ ant/ivy/core/trunk/src/java/org/apache/ivy/plugins/parser/m2/PomModuleDescriptorParser.java Tue Mar 11 08:37:15 2008
>  >  @@ -171,7 +171,12 @@
>  >                          domReader.getParentVersion());
>  >                      ResolvedModuleRevision parentModule = parseOtherPom(ivySettings,
>  >                          parentModRevID);
>  >  -                    parentDescr = parentModule.getDescriptor();
>  >  +                    if (parentModule != null) {
>  >  +                        parentDescr = parentModule.getDescriptor();
>  >  +                    } else {
>  >  +                       Message.warn("impossible to load parent for " + descriptorURL + "."
>  >  +                           + " Parent=" + parentModRevID);
>  >  +                    }
>  >                  }
>  >
>  >                  Map pomProperties = domReader.getPomProperties();
>  >
>  >
>  >
>
>
>  --
>  Gilles Scokart
>
>  ---------------------------------------------------------------------
>  To unsubscribe, e-mail: dev-unsubscribe@ant.apache.org
>  For additional commands, e-mail: dev-help@ant.apache.org
>
>



-- 
Xavier Hanin - Independent Java Consultant
http://xhab.blogspot.com/
http://ant.apache.org/ivy/
http://www.xoocode.org/

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@ant.apache.org
For additional commands, e-mail: dev-help@ant.apache.org


Re: svn commit: r635977 - /ant/ivy/core/trunk/src/java/org/apache/ivy/plugins/parser/m2/PomModuleDescriptorParser.java

Posted by Gilles Scokart <gs...@gmail.com>.
Is it just a warning?  Don't you think it should be an error?  It is
actually an entire part of your module descriptor that can not be read
(including some dependencies).

WDYT?
Gilles

On 11/03/2008, xavier@apache.org <xa...@apache.org> wrote:
> Author: xavier
>  Date: Tue Mar 11 08:37:15 2008
>  New Revision: 635977
>
>  URL: http://svn.apache.org/viewvc?rev=635977&view=rev
>  Log:
>  prevent NPE when loading parent pom failed
>
>  Modified:
>     ant/ivy/core/trunk/src/java/org/apache/ivy/plugins/parser/m2/PomModuleDescriptorParser.java
>
>  Modified: ant/ivy/core/trunk/src/java/org/apache/ivy/plugins/parser/m2/PomModuleDescriptorParser.java
>  URL: http://svn.apache.org/viewvc/ant/ivy/core/trunk/src/java/org/apache/ivy/plugins/parser/m2/PomModuleDescriptorParser.java?rev=635977&r1=635976&r2=635977&view=diff
>  ==============================================================================
>  --- ant/ivy/core/trunk/src/java/org/apache/ivy/plugins/parser/m2/PomModuleDescriptorParser.java (original)
>  +++ ant/ivy/core/trunk/src/java/org/apache/ivy/plugins/parser/m2/PomModuleDescriptorParser.java Tue Mar 11 08:37:15 2008
>  @@ -171,7 +171,12 @@
>                          domReader.getParentVersion());
>                      ResolvedModuleRevision parentModule = parseOtherPom(ivySettings,
>                          parentModRevID);
>  -                    parentDescr = parentModule.getDescriptor();
>  +                    if (parentModule != null) {
>  +                        parentDescr = parentModule.getDescriptor();
>  +                    } else {
>  +                       Message.warn("impossible to load parent for " + descriptorURL + "."
>  +                           + " Parent=" + parentModRevID);
>  +                    }
>                  }
>
>                  Map pomProperties = domReader.getPomProperties();
>
>
>


-- 
Gilles Scokart

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@ant.apache.org
For additional commands, e-mail: dev-help@ant.apache.org