Author: maartenc
Date: Tue Oct 21 14:03:57 2008
New Revision: 706768
URL: http://svn.apache.org/viewvc?rev=706768&view=rev
Log:
FIX: Ivy doesn't throw an error when the parent POM cannot be loaded (IVY-931)
Added:
ant/ivy/core/trunk/test/java/org/apache/ivy/plugins/parser/m2/test-parent-not-found.pom
Modified:
ant/ivy/core/trunk/CHANGES.txt
ant/ivy/core/trunk/src/java/org/apache/ivy/plugins/parser/m2/PomModuleDescriptorParser.java
ant/ivy/core/trunk/test/java/org/apache/ivy/plugins/parser/m2/PomModuleDescriptorParserTest.java
Modified: ant/ivy/core/trunk/CHANGES.txt
URL:
http://svn.apache.org/viewvc/ant/ivy/core/trunk/CHANGES.txt?rev=706768&r1=706767&r2=706768&view=diff
==============================================================================
--- ant/ivy/core/trunk/CHANGES.txt (original)
+++ ant/ivy/core/trunk/CHANGES.txt Tue Oct 21 14:03:57 2008
@@ -115,6 +115,7 @@
- FIX: Correctly set ivy.resolved.configurations property when the conf string
includes a negation operator (IVY-951) (thanks to Patrick Woodworth)
- FIX: Maven pom license url can contain xml entities (IVY-950)
- FIX: Maven pom license has name as optional element (IVY-949)
+- FIX: Ivy doesn't throw an error when the parent POM cannot be loaded
(IVY-931)
2.0.0-rc1
=====================================
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=706768&r1=706767&r2=706768&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 Oct 21 14:03:57 2008
@@ -135,8 +135,8 @@
if (parentModule != null) {
parentDescr = parentModule.getDescriptor();
} else {
- Message.warn("impossible to load parent for " +
descriptorURL + "."
- + " Parent=" + parentModRevID);
+ throw new IOException("Impossible to load parent for " +
descriptorURL + "."
+ + " Parent=" + parentModRevID);
}
if (parentDescr != null) {
Map parentPomProps =
PomModuleDescriptorBuilder.extractPomProperties(
Modified:
ant/ivy/core/trunk/test/java/org/apache/ivy/plugins/parser/m2/PomModuleDescriptorParserTest.java
URL:
http://svn.apache.org/viewvc/ant/ivy/core/trunk/test/java/org/apache/ivy/plugins/parser/m2/PomModuleDescriptorParserTest.java?rev=706768&r1=706767&r2=706768&view=diff
==============================================================================
---
ant/ivy/core/trunk/test/java/org/apache/ivy/plugins/parser/m2/PomModuleDescriptorParserTest.java
(original)
+++
ant/ivy/core/trunk/test/java/org/apache/ivy/plugins/parser/m2/PomModuleDescriptorParserTest.java
Tue Oct 21 14:03:57 2008
@@ -138,7 +138,6 @@
assertEquals("ejb", artifact[0].getType());
}
-
public void testParent() throws Exception {
ModuleDescriptor md =
PomModuleDescriptorParser.getInstance().parseDescriptor(
settings, getClass().getResource("test-parent.pom"), false);
@@ -152,7 +151,17 @@
assertEquals(mrid, artifact[0].getModuleRevisionId());
assertEquals("test", artifact[0].getName());
}
-
+
+ public void testParentNotFound() throws Exception {
+ try {
+ PomModuleDescriptorParser.getInstance().parseDescriptor(
+ new IvySettings(),
getClass().getResource("test-parent-not-found.pom"), false);
+ fail("IOException should have been thrown!");
+ } catch (IOException e) {
+ assertTrue(e.getMessage().indexOf("Impossible to load parent") !=
-1);
+ }
+ }
+
public void testParent2() throws Exception {
ModuleDescriptor md =
PomModuleDescriptorParser.getInstance().parseDescriptor(
settings, getClass().getResource("test-parent2.pom"), false);
Added:
ant/ivy/core/trunk/test/java/org/apache/ivy/plugins/parser/m2/test-parent-not-found.pom
URL:
http://svn.apache.org/viewvc/ant/ivy/core/trunk/test/java/org/apache/ivy/plugins/parser/m2/test-parent-not-found.pom?rev=706768&view=auto
==============================================================================
---
ant/ivy/core/trunk/test/java/org/apache/ivy/plugins/parser/m2/test-parent-not-found.pom
(added)
+++
ant/ivy/core/trunk/test/java/org/apache/ivy/plugins/parser/m2/test-parent-not-found.pom
Tue Oct 21 14:03:57 2008
@@ -0,0 +1,36 @@
+<?xml version="1.0"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied. See the License for the
+ specific language governing permissions and limitations
+ under the License.
+-->
+<project>
+ <parent>
+ <artifactId>test-parent</artifactId>
+ <groupId>org.apache.parent</groupId>
+ <version>1.0.parent.notfound</version>
+ </parent>
+ <modelVersion>4.0.0</modelVersion>
+ <groupId>org.apache</groupId>
+ <artifactId>test</artifactId>
+ <name>Test Module for Ivy M2 parsing</name>
+ <version>1.0</version>
+ <url>http://ivy.jayasoft.org/</url>
+ <organization>
+ <name>Jayasoft</name>
+ <url>http://www.jayasoft.org/</url>
+ </organization>
+</project>