Feat: add static analytic of code

This commit is contained in:
Laurent Clouet
2024-06-03 14:02:30 +00:00
parent c966a1a032
commit 4bce6409e3
52 changed files with 249 additions and 316 deletions

View File

@@ -33,10 +33,6 @@ public class Linux extends OS {
private final String NICE_BINARY_PATH = "nice";
private final String ID_COMMAND_INVOCATION = "id -u";
public Linux() {
super();
}
@Override public String name() {
return "linux";
}
@@ -55,7 +51,7 @@ public class Linux extends OS {
@Override public Process exec(List<String> command, Map<String, String> env_overight) throws IOException {
Map<String, String> new_env = new HashMap<String, String>();
new_env.putAll(java.lang.System.getenv()); // clone the env
new_env.putAll(System.getenv()); // clone the env
// if Blender is already loading an OpenGL library, don't need to load Blender's default one (it will
// create system incompatibilities). If no OpenGL library is found, then load the one included in the binary
@@ -200,7 +196,7 @@ public class Linux extends OS {
try {
// Shutdown the computer waiting delayInMinutes minutes to allow all SheepIt threads to close and exit the app
ProcessBuilder builder = new ProcessBuilder("shutdown", "-h", String.valueOf(delayInMinutes));
Process process = builder.inheritIO().start();
builder.inheritIO().start();
}
catch (IOException e) {
System.err.println(String.format("Linux::shutdownComputer Unable to execute the 'shutdown -h 1' command. Exception %s", e.getMessage()));

View File

@@ -32,10 +32,6 @@ public class Mac extends OS {
private final String NICE_BINARY_PATH = "nice";
private final String ID_COMMAND_INVOCATION = "id -u";
public Mac() {
super();
}
@Override public String name() {
return "mac";
}
@@ -128,7 +124,7 @@ public class Mac extends OS {
try {
// Shutdown the computer waiting delayInMinutes minutes to allow all SheepIt threads to close and exit the app
ProcessBuilder builder = new ProcessBuilder("shutdown", "-h", String.valueOf(delayInMinutes));
Process process = builder.inheritIO().start();
builder.inheritIO().start();
}
catch (IOException e) {
System.err.println(String.format("Mac::shutdownComputer Unable to execute the 'shutdown -h 1' command. Exception %s", e.getMessage()));

View File

@@ -153,7 +153,7 @@ public abstract class OS {
if (proc.isAlive() == false) {
return true;
}
java.lang.Thread.sleep(100);
Thread.sleep(100);
}
proc.destroyForcibly();

View File

@@ -53,10 +53,10 @@ public class Windows extends OS {
kernel32lib = (Kernel32Lib) Native.load(Kernel32Lib.path, Kernel32Lib.class);
kernel32lib.SetErrorMode(Kernel32Lib.SEM_NOGPFAULTERRORBOX);
}
catch (java.lang.UnsatisfiedLinkError e) {
catch (UnsatisfiedLinkError e) {
System.out.println("OS.Windows::exec failed to load kernel32lib " + e);
}
catch (java.lang.ExceptionInInitializerError e) {
catch (ExceptionInInitializerError e) {
System.out.println("OS.Windows::exec failed to load kernel32lib " + e);
}
catch (Exception e) {
@@ -192,7 +192,7 @@ public class Windows extends OS {
try {
// Shutdown the computer, waiting delayInMinutes minutes, force app closure and on the shutdown screen indicate that was initiated by SheepIt app
ProcessBuilder builder = new ProcessBuilder("shutdown", "/s", "/f", "/t", String.valueOf(delayInMinutes * 60), "/c", "\"SheepIt App has initiated this computer shutdown.\"");
Process process = builder.inheritIO().start();
builder.inheritIO().start();
}
catch (IOException e) {
System.err.println(

View File

@@ -51,10 +51,10 @@ public class WinProcess {
try {
this.kernel32lib = (Kernel32Lib) Native.load(Kernel32Lib.path, Kernel32Lib.class);
}
catch (java.lang.UnsatisfiedLinkError e) {
catch (UnsatisfiedLinkError e) {
System.out.println("WinProcess::construct " + e);
}
catch (java.lang.ExceptionInInitializerError e) {
catch (ExceptionInInitializerError e) {
System.out.println("WinProcess::construct " + e);
}
catch (Exception e) {