Include source of duplicate path
This simple addition to the error message helps to track down JARs
supplying identically named resources into a java_binary target.
diff --git a/src/com/facebook/buck/java/JarDirectoryStep.java b/src/com/facebook/buck/java/JarDirectoryStep.java
index 34dfb58..af6b306 100644
--- a/src/com/facebook/buck/java/JarDirectoryStep.java
+++ b/src/com/facebook/buck/java/JarDirectoryStep.java
@@ -49,10 +49,25 @@
import java.util.jar.Manifest;
import java.util.logging.Level;
import java.util.zip.ZipEntry;
+import java.util.zip.ZipException;
import java.util.zip.ZipFile;
import javax.annotation.Nullable;
+import com.facebook.buck.step.ExecutionContext;
+import com.facebook.buck.step.Step;
+import com.facebook.buck.util.DirectoryTraversal;
+import com.facebook.buck.util.ProjectFilesystem;
+import com.google.common.base.Joiner;
+import com.google.common.base.Preconditions;
+import com.google.common.base.Throwables;
+import com.google.common.collect.ImmutableSet;
+import com.google.common.collect.Sets;
+import com.google.common.io.ByteStreams;
+import com.google.common.io.Closeables;
+import com.google.common.io.Closer;
+import com.google.common.io.Files;
+
/**
* Creates a JAR file from a collection of directories/ZIP/JAR files.
*/
@@ -220,7 +235,14 @@
ZipEntry newEntry = new ZipEntry(entry);
newEntry.setCompressedSize(-1);
- jar.putNextEntry(newEntry);
+ try {
+ jar.putNextEntry(newEntry);
+ } catch (ZipException ze) {
+ throw new ZipException(String.format(
+ "%s from %s",
+ ze.getMessage(), file.getPath()));
+ }
+
InputStream inputStream = zip.getInputStream(entry);
ByteStreams.copy(inputStream, jar);
jar.closeEntry();