diff --git a/hawtjni-runtime/src/main/java/org/fusesource/hawtjni/runtime/Library.java b/hawtjni-runtime/src/main/java/org/fusesource/hawtjni/runtime/Library.java index 3239750c..be51a193 100755 --- a/hawtjni-runtime/src/main/java/org/fusesource/hawtjni/runtime/Library.java +++ b/hawtjni-runtime/src/main/java/org/fusesource/hawtjni/runtime/Library.java @@ -319,7 +319,6 @@ private void chmod755(File file) { if (getPlatform().startsWith("windows")) return; // Use Files.setPosixFilePermissions if we are running Java 7+ to avoid forking the JVM for executing chmod - boolean chmodSuccessful = false; try { ClassLoader classLoader = getClass().getClassLoader(); // Check if the PosixFilePermissions exists in the JVM, if not this will throw a ClassNotFoundException @@ -334,15 +333,7 @@ private void chmod755(File file) { Class filesClass = classLoader.loadClass("java.nio.file.Files"); Method setPosixFilePermissionsMethod = filesClass.getMethod("setPosixFilePermissions", pathClass, Set.class); setPosixFilePermissionsMethod.invoke(null, new Object[] {path, permissionSet}); - chmodSuccessful = true; - } catch (ClassNotFoundException ignored) { - // Ignored as we are probably running in a JVM < 7 - } catch (Exception e) { - // NoSuchMethodException | InvocationTargetException | IllegalAccessException - System.err.println("Unable to use Files.setPosixFilePermissions: " + e.getMessage() + - ", falling back to Runtime.exec"); - } - if (!chmodSuccessful) { + } catch (Throwable ignored) { // Fallback to starting a new process try { Runtime.getRuntime().exec(new String[]{"chmod", "755", file.getCanonicalPath()}).waitFor();