You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@sis.apache.org by de...@apache.org on 2013/09/10 11:44:41 UTC
svn commit: r1521409 -
/sis/branches/JDK7/core/sis-build-helper/src/main/java/org/apache/sis/internal/maven/JarCollector.java
Author: desruisseaux
Date: Tue Sep 10 09:44:40 2013
New Revision: 1521409
URL: http://svn.apache.org/r1521409
Log:
Avoid an exception when creating a link between two files on different Windows drives.
Modified:
sis/branches/JDK7/core/sis-build-helper/src/main/java/org/apache/sis/internal/maven/JarCollector.java
Modified: sis/branches/JDK7/core/sis-build-helper/src/main/java/org/apache/sis/internal/maven/JarCollector.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-build-helper/src/main/java/org/apache/sis/internal/maven/JarCollector.java?rev=1521409&r1=1521408&r2=1521409&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-build-helper/src/main/java/org/apache/sis/internal/maven/JarCollector.java [UTF-8] (original)
+++ sis/branches/JDK7/core/sis-build-helper/src/main/java/org/apache/sis/internal/maven/JarCollector.java [UTF-8] Tue Sep 10 09:44:40 2013
@@ -23,8 +23,6 @@ import java.io.FileWriter;
import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.IOException;
-import java.nio.file.Path;
-import java.nio.file.Files;
import java.util.Set;
import java.util.LinkedHashSet;
import org.apache.maven.plugin.AbstractMojo;
@@ -34,6 +32,11 @@ import org.apache.maven.artifact.Artifac
import static org.apache.sis.internal.maven.Filenames.*;
+// Related to JDK7
+import java.nio.file.Path;
+import java.nio.file.Files;
+import java.nio.file.FileSystemException;
+
/**
* Collects <code>.jar</code> files in a single "{@code target/binaries}" directory.
@@ -230,8 +233,13 @@ public final class JarCollector extends
try {
Files.createLink(target, source);
return;
- } catch (UnsupportedOperationException e) {
- // If hard links are not supported, edit the "content.txt" file instead.
+ } catch (UnsupportedOperationException | FileSystemException e) {
+ /*
+ * If hard links are not supported, edit the "content.txt" file instead.
+ * Note that a hard link may be unsupported because the source and target
+ * are on different Windows drives or mount points, in which case we get
+ * a FileSystemException instead than UnsupportedOperationException.
+ */
}
/*
* If we can not use hard links, creates or updates a "target/content.txt" file instead.