use of com.intellij.openapi.vfs.impl.jar.JarHandler in project intellij-community by JetBrains.
the class JarFileSystemTest method testJarHandlerDoNotCreateCopyWhenListingArchive.
@Test
public void testJarHandlerDoNotCreateCopyWhenListingArchive() throws Exception {
File jar = IoTestUtil.createTestJar(tempDir.newFile("test.jar"));
JarHandler handler = new JarHandler(jar.getPath());
FileAttributes attributes = handler.getAttributes(JarFile.MANIFEST_NAME);
assertNotNull(attributes);
assertEquals(0, attributes.length);
assertTimestampsEqual(jar.lastModified(), attributes.lastModified);
if (((JarFileSystemImpl) JarFileSystem.getInstance()).isMakeCopyOfJar(jar)) {
// for performance reasons we create file copy on windows when we read contents and have the handle open to the copy
Field resolved = handler.getClass().getDeclaredField("myFileWithMirrorResolved");
resolved.setAccessible(true);
assertTrue(resolved.get(handler) == null);
}
}
Aggregations