Created
April 3, 2017 15:46
-
-
Save cmangeat/3a2beb1c084f93128b2093d6d60d6fbb to your computer and use it in GitHub Desktop.
geos-7946-no-ignore-case
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/src/platform/src/main/java/org/geoserver/platform/resource/Files.java b/src/platform/src/main/java/org/geoserver/platform/resource/Files.java | |
index 3a5655b..f54d78b 100644 | |
--- a/src/platform/src/main/java/org/geoserver/platform/resource/Files.java | |
+++ b/src/platform/src/main/java/org/geoserver/platform/resource/Files.java | |
@@ -380,7 +380,7 @@ public final class Files { | |
throw new NullPointerException("File dest required"); | |
} | |
// same path? Do nothing | |
- if (source.getCanonicalPath().equalsIgnoreCase(dest.getCanonicalPath())){ | |
+ if (source.getCanonicalPath().equals(dest.getCanonicalPath())){ | |
return true; | |
} | |
@@ -422,7 +422,7 @@ public final class Files { | |
* (but not the directory itself). For each | |
* file that cannot be deleted a warning log will be issued. | |
* | |
- * @param dir | |
+ * @param directory | |
* @throws IOException | |
* @returns true if all the directory contents could be deleted, false otherwise | |
*/ | |
diff --git a/src/platform/src/test/java/org/geoserver/platform/resource/FileSystemResourceStoreTest.java b/src/platform/src/test/java/org/geoserver/platform/resource/FileSystemResourceStoreTest.java | |
new file mode 100644 | |
index 0000000..51fda42 | |
--- /dev/null | |
+++ b/src/platform/src/test/java/org/geoserver/platform/resource/FileSystemResourceStoreTest.java | |
@@ -0,0 +1,44 @@ | |
+package org.geoserver.platform.resource; | |
+ | |
+import org.junit.Before; | |
+import org.junit.Rule; | |
+import org.junit.Test; | |
+import org.junit.rules.TemporaryFolder; | |
+ | |
+import java.io.File; | |
+import java.io.IOException; | |
+ | |
+import static org.junit.Assert.assertEquals; | |
+ | |
+public class FileSystemResourceStoreTest { | |
+ | |
+ @Rule | |
+ public TemporaryFolder folder = new TemporaryFolder(); | |
+ | |
+ @Test | |
+ public void renameDirNamesDiffer() throws IOException, InterruptedException { | |
+ File toBeRenamed = folder.newFolder("DirA"); | |
+ String newName = "DirB"; | |
+ assertEquals(1, folder.getRoot().list().length); | |
+ FileSystemResourceStore toTest = new FileSystemResourceStore(folder.getRoot()); | |
+ | |
+ toTest.move(toBeRenamed.getName(), newName); | |
+ | |
+ assertEquals(1, folder.getRoot().list().length); | |
+ assertEquals(newName, folder.getRoot().list()[0]); | |
+ | |
+ } | |
+ | |
+ @Test | |
+ public void renameDirNamesCaseDiffer() throws IOException, InterruptedException { | |
+ File toBeRenamed = folder.newFolder("DirA"); | |
+ String newName = "Dira"; | |
+ assertEquals(1, folder.getRoot().list().length); | |
+ FileSystemResourceStore toTest = new FileSystemResourceStore(folder.getRoot()); | |
+ | |
+ toTest.move(toBeRenamed.getName(), newName); | |
+ | |
+ assertEquals(1, folder.getRoot().list().length); | |
+ assertEquals(newName, folder.getRoot().list()[0]); | |
+ } | |
+} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment