Author: maartenc
Date: Fri Dec 18 20:24:48 2009
New Revision: 892370
URL: http://svn.apache.org/viewvc?rev=892370&view=rev
Log:
FIX: Artifact report throws NPE when artifact is not in cache (IVY-1150)
(thanks to Steve Jones)
Modified:
ant/ivy/core/trunk/CHANGES.txt
ant/ivy/core/trunk/src/java/org/apache/ivy/ant/IvyArtifactReport.java
Modified: ant/ivy/core/trunk/CHANGES.txt
URL:
http://svn.apache.org/viewvc/ant/ivy/core/trunk/CHANGES.txt?rev=892370&r1=892369&r2=892370&view=diff
==============================================================================
--- ant/ivy/core/trunk/CHANGES.txt (original)
+++ ant/ivy/core/trunk/CHANGES.txt Fri Dec 18 20:24:48 2009
@@ -46,6 +46,7 @@
Scott Hebert
Matt Inger
Anders Janmyr
+ Steve Jones
Christer Jonsson
Michael Kebe
Matthias Kilian
@@ -101,6 +102,7 @@
- IMPROVEMENT: Trace a message when a property file referenced from the
settings doesn't exixts (IVY-1074)
- IMPROVEMENT: use defaultconf in combination with defaultconfmapping
(IVY-1135) (thanks to Jon Schneider)
+- FIX: Artifact report throws NPE when artifact is not in cache (IVY-1150)
(thanks to Steve Jones)
- FIX: resolve fails for transitive relocated maven modules when the type of
the dependency was set to 'jar'
- FIX: optional dependencies, sources and javadocs aren't resolved when a
maven module is relocated
- FIX: Encountered 'multiple artifacts retrieved to same file' error when
module does not have multiple artifacts (IVY-1148)
Modified: ant/ivy/core/trunk/src/java/org/apache/ivy/ant/IvyArtifactReport.java
URL:
http://svn.apache.org/viewvc/ant/ivy/core/trunk/src/java/org/apache/ivy/ant/IvyArtifactReport.java?rev=892370&r1=892369&r2=892370&view=diff
==============================================================================
--- ant/ivy/core/trunk/src/java/org/apache/ivy/ant/IvyArtifactReport.java
(original)
+++ ant/ivy/core/trunk/src/java/org/apache/ivy/ant/IvyArtifactReport.java Fri
Dec 18 20:24:48 2009
@@ -154,8 +154,7 @@
startArtifact(saxHandler, artifact.getArtifact());
writeOriginLocationIfPresent(cache, saxHandler,
artifact);
-
- writeCacheLocation(cache, saxHandler, artifact);
+ writeCacheLocationIfPresent(cache, saxHandler,
artifact);
Set artifactDestPaths = (Set)
artifactsToCopy.get(artifact);
for (Iterator iterator =
artifactDestPaths.iterator(); iterator
@@ -243,14 +242,16 @@
}
}
- private void writeCacheLocation(RepositoryCacheManager cache,
TransformerHandler saxHandler,
+ private void writeCacheLocationIfPresent(RepositoryCacheManager cache,
TransformerHandler saxHandler,
ArtifactDownloadReport artifact) throws SAXException {
File archiveInCache = artifact.getLocalFile();
- saxHandler.startElement(null, "cache-location", "cache-location", new
AttributesImpl());
- char[] archiveInCacheAsChars = archiveInCache.getPath().replace('\\',
'/').toCharArray();
- saxHandler.characters(archiveInCacheAsChars, 0,
archiveInCacheAsChars.length);
- saxHandler.endElement(null, "cache-location", "cache-location");
+ if (archiveInCache != null) {
+ saxHandler.startElement(null, "cache-location", "cache-location",
new AttributesImpl());
+ char[] archiveInCacheAsChars =
archiveInCache.getPath().replace('\\', '/').toCharArray();
+ saxHandler.characters(archiveInCacheAsChars, 0,
archiveInCacheAsChars.length);
+ saxHandler.endElement(null, "cache-location", "cache-location");
+ }
}
private void writeRetrieveLocation(TransformerHandler saxHandler, String
artifactDestPath)