Skip to content

Commit e44d7ab

Browse files
committed
Prevent useless logging when FS is not expected class
1 parent 718d8c6 commit e44d7ab

File tree

1 file changed

+13
-11
lines changed

1 file changed

+13
-11
lines changed

org.eclipse.jdt.core.javac/src/org/eclipse/jdt/internal/javac/ZipFileSystemProviderWithCache.java

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -117,18 +117,20 @@ public FileSystem newFileSystem(Path path, Map<String,?> env) throws IOException
117117
}
118118

119119
static void makeFileSystemUninterruptible(FileSystem res) {
120-
try {
121-
// workaround to make the underlying work of the ZipFileSystem
122-
// resistant to thread abortion. Without it, the zips become
123-
// useless when a consumer thread aborts
124-
var zipFileSystemClass = res.getClass();
125-
var chField = zipFileSystemClass.getDeclaredField("ch");
126-
chField.setAccessible(true);
127-
if (chField.get(res) instanceof FileChannelImpl fileChannel) {
128-
fileChannel.setUninterruptible();
120+
if (res.getClass().getName().contains("ZipFileSystem")) {
121+
try {
122+
// workaround to make the underlying work of the ZipFileSystem
123+
// resistant to thread abortion. Without it, the zips become
124+
// useless when a consumer thread aborts
125+
var zipFileSystemClass = res.getClass();
126+
var chField = zipFileSystemClass.getDeclaredField("ch");
127+
chField.setAccessible(true);
128+
if (chField.get(res) instanceof FileChannelImpl fileChannel) {
129+
fileChannel.setUninterruptible();
130+
}
131+
} catch (Exception ex) {
132+
ILog.get().error(ex.getMessage(), ex);
129133
}
130-
} catch (Exception ex) {
131-
ILog.get().error(ex.getMessage(), ex);
132134
}
133135
}
134136

0 commit comments

Comments
 (0)