Skip to content

Instantly share code, notes, and snippets.

@jvmvik
Last active August 29, 2015 13:56
Show Gist options
  • Save jvmvik/9261528 to your computer and use it in GitHub Desktop.
Save jvmvik/9261528 to your computer and use it in GitHub Desktop.
here a bug found in JDK 7.45 on Windows. I'm running Groovy 2.2.1 on the top of the JVM.
import org.junit.Test
import java.nio.file.FileVisitResult
import java.nio.file.Path
import java.nio.file.Paths
/***
* Bug with directory starting by '.'
*
* Here is test to reproduce this issue.
* - Windows 7 / 64 bits
* - JVM 7.45
*/
class JavaBug
{
@Test
void fileWithDot()
{
Path path = Paths.get("path/to/.git");
// This test should fail because the directory name is: .git
assert !path.fileName.startsWith(".");
// This test passed when the directory name is converted to String
assert path.fileName.toString().startsWith(".");
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment