Author: hibou
Date: Sun Sep 1 18:06:34 2013
New Revision: 1519299
URL: http://svn.apache.org/r1519299
Log:
Add more context in the log about errors when parsing OSGi versions
Modified:
ant/ivy/core/trunk/src/java/org/apache/ivy/osgi/core/OsgiLatestStrategy.java
ant/ivy/core/trunk/src/java/org/apache/ivy/osgi/util/Version.java
Modified:
ant/ivy/core/trunk/src/java/org/apache/ivy/osgi/core/OsgiLatestStrategy.java
URL:
http://svn.apache.org/viewvc/ant/ivy/core/trunk/src/java/org/apache/ivy/osgi/core/OsgiLatestStrategy.java?rev=1519299&r1=1519298&r2=1519299&view=diff
==============================================================================
---
ant/ivy/core/trunk/src/java/org/apache/ivy/osgi/core/OsgiLatestStrategy.java
(original)
+++
ant/ivy/core/trunk/src/java/org/apache/ivy/osgi/core/OsgiLatestStrategy.java
Sun Sep 1 18:06:34 2013
@@ -45,7 +45,15 @@ public class OsgiLatestStrategy extends
throw new RuntimeException("Uncomparable versions:" +
o1.getRevision() + " and "
+ o2.getRevision() + " (" + e.getMessage() + ")");
}
- return v1.compareTo(v2);
+ try {
+ return v1.compareTo(v2);
+ } catch (RuntimeException e) {
+ if (e.getCause() instanceof ParseException) {
+ throw new RuntimeException("Uncomparable versions:" +
o1.getRevision() + " and "
+ + o2.getRevision() + " (" + e.getMessage() + ")");
+ }
+ throw e;
+ }
}
}
Modified: ant/ivy/core/trunk/src/java/org/apache/ivy/osgi/util/Version.java
URL:
http://svn.apache.org/viewvc/ant/ivy/core/trunk/src/java/org/apache/ivy/osgi/util/Version.java?rev=1519299&r1=1519298&r2=1519299&view=diff
==============================================================================
--- ant/ivy/core/trunk/src/java/org/apache/ivy/osgi/util/Version.java (original)
+++ ant/ivy/core/trunk/src/java/org/apache/ivy/osgi/util/Version.java Sun Sep
1 18:06:34 2013
@@ -83,22 +83,22 @@ public class Version implements Comparab
}
String[] splits = input.split("\\.");
if (splits == null || splits.length == 0 || splits.length > 4)
{
- throw new RuntimeException("Ill formed OSGi version");
+ throw new RuntimeException(new ParseException("Ill formed
OSGi version", 0));
}
try {
major = Integer.parseInt(splits[0]);
} catch (NumberFormatException e) {
- throw new RuntimeException("Major part of an OSGi version
should be an integer");
+ throw new RuntimeException(new ParseException("Major part
of an OSGi version should be an integer", 0));
}
try {
minor = splits.length >= 2 ? Integer.parseInt(splits[1]) :
0;
} catch (NumberFormatException e) {
- throw new RuntimeException("Minor part of an OSGi version
should be an integer");
+ throw new RuntimeException(new ParseException("Minor part
of an OSGi version should be an integer", 0));
}
try {
patch = splits.length >= 3 ? Integer.parseInt(splits[2]) :
0;
} catch (NumberFormatException e) {
- throw new RuntimeException("Patch part of an OSGi version
should be an integer");
+ throw new RuntimeException(new ParseException("Patch part
of an OSGi version should be an integer", 0));
}
qualifier = splits.length == 4 ? splits[3] : null;
splitted = true;