import java.io.File; 
import java.io.IOException; 
import java.net.URI; 
import java.nio.file.FileSystem; 
import java.nio.file.FileSystems; 
import java.nio.file.Path; 
import java.util.Collections; 

class ZipPathBug { 
	public static void main(String[] args) throws IOException { 
		URI jarFile = URI.create("jar:" + new File("test.zip").getAbsoluteFile().toURI().toString()); 
		try (FileSystem fileSystem = FileSystems.newFileSystem(jarFile, Collections.emptyMap())) { 
			Path path = fileSystem.getPath("/foo");
			Path path2 = fileSystem.getPath("/foo"); 
			System.out.println(path.relativize(path2).getNameCount()); 
		} 
	} 
} 
