diff options
-rw-r--r-- | org.eclipse.jgit.java7.test/src/org/eclipse/jgit/util/FSJava7Test.java | 10 | ||||
-rw-r--r-- | org.eclipse.jgit.java7/src/org/eclipse/jgit/util/FileUtil.java | 5 |
2 files changed, 8 insertions, 7 deletions
diff --git a/org.eclipse.jgit.java7.test/src/org/eclipse/jgit/util/FSJava7Test.java b/org.eclipse.jgit.java7.test/src/org/eclipse/jgit/util/FSJava7Test.java index 4b5fe5979e..70eaef231a 100644 --- a/org.eclipse.jgit.java7.test/src/org/eclipse/jgit/util/FSJava7Test.java +++ b/org.eclipse.jgit.java7.test/src/org/eclipse/jgit/util/FSJava7Test.java @@ -85,16 +85,16 @@ public class FSJava7Test { @Test public void testSymlinkAttributes() throws IOException, InterruptedException { FS fs = FS.DETECTED; - File link = new File(trash, "x"); - File target = new File(trash, "y"); - fs.createSymLink(link, "y"); + File link = new File(trash, "ä"); + File target = new File(trash, "å"); + fs.createSymLink(link, "å"); assertTrue(fs.exists(link)); String targetName = fs.readSymLink(link); - assertEquals("y", targetName); + assertEquals("å", targetName); assertTrue(fs.lastModified(link) > 0); assertTrue(fs.exists(link)); assertFalse(fs.canExecute(link)); - assertEquals(1, fs.length(link)); + assertEquals(2, fs.length(link)); assertFalse(fs.exists(target)); assertFalse(fs.isFile(target)); assertFalse(fs.isDirectory(target)); diff --git a/org.eclipse.jgit.java7/src/org/eclipse/jgit/util/FileUtil.java b/org.eclipse.jgit.java7/src/org/eclipse/jgit/util/FileUtil.java index 428a45f79b..0fd19bcdd1 100644 --- a/org.eclipse.jgit.java7/src/org/eclipse/jgit/util/FileUtil.java +++ b/org.eclipse.jgit.java7/src/org/eclipse/jgit/util/FileUtil.java @@ -52,7 +52,7 @@ import java.nio.file.attribute.FileTime; import java.text.Normalizer; import java.text.Normalizer.Form; -import org.eclipse.jgit.util.SystemReader; +import org.eclipse.jgit.lib.Constants; class FileUtil { @@ -113,7 +113,8 @@ class FileUtil { public static long getLength(File path) throws IOException { Path nioPath = path.toPath(); if (Files.isSymbolicLink(nioPath)) - return Files.readSymbolicLink(nioPath).toString().length(); + return Files.readSymbolicLink(nioPath).toString() + .getBytes(Constants.CHARSET).length; return Files.size(nioPath); } |