Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -58,12 +58,13 @@
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;

import org.apache.commons.io.FilenameUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

public class LocalSubmit extends GaswSubmit {

private static final Logger logger = LoggerFactory.getLogger(LocalSubmit.class);

Check failure on line 67 in src/main/java/fr/insalyon/creatis/gasw/plugin/executor/local/execution/LocalSubmit.java

View workflow job for this annotation

GitHub Actions / all

The constant name 'logger' doesn't match '[A-Z][A-Z_0-9]*'

Configurable naming conventions for field declarations. This rule reports variable declarations which do not match the regex that applies to their specific kind ---e.g. constants (static final), enum constant, final field. Each regex can be configured through properties. By default this rule uses the standard Java naming convention (Camel case), and uses the ALL_UPPER convention for constants and enum constants. FieldNamingConventions (Priority: 1, Ruleset: Code Style) https://docs.pmd-code.org/snapshot/pmd_rules_java_codestyle.html#fieldnamingconventions
private static List<String> finishedJobs = new ArrayList<String>();
// Thread pool containing all invocation threads
// Initialize a pool of threads with a maximum number of threads
Expand Down Expand Up @@ -92,8 +93,8 @@
params.append(" ");
}
String fileName = scriptName.substring(0, scriptName.lastIndexOf("."));
LocalMonitor.getInstance().add(fileName, gaswInput.getExecutableName(),
fileName, params.toString());
String command = FilenameUtils.getBaseName(gaswInput.getExecutableName());
LocalMonitor.getInstance().add(fileName, command, fileName, params.toString());

executionThreadPool.execute(new Execution(fileName));

Expand Down Expand Up @@ -138,7 +139,7 @@
stdOutDir.mkdirs();
}
File stdOut = new File(stdOutDir, scriptName + ".out");
BufferedWriter out = new BufferedWriter(new FileWriter(stdOut));

Check failure on line 142 in src/main/java/fr/insalyon/creatis/gasw/plugin/executor/local/execution/LocalSubmit.java

View workflow job for this annotation

GitHub Actions / all

Avoid instantiating FileInputStream, FileOutputStream, FileReader, or FileWriter

The FileInputStream and FileOutputStream classes contains a finalizer method which will cause garbage collection pauses. See [JDK-8080225](https://bugs.openjdk.org/browse/JDK-8080225) for details. The FileReader and FileWriter constructors instantiate FileInputStream and FileOutputStream, again causing garbage collection issues while finalizer methods are called. * Use `Files.newInputStream(Paths.get(fileName))` instead of `new FileInputStream(fileName)`. * Use `Files.newOutputStream(Paths.get(fileName))` instead of `new FileOutputStream(fileName)`. * Use `Files.newBufferedReader(Paths.get(fileName))` instead of `new FileReader(fileName)`. * Use `Files.newBufferedWriter(Paths.get(fileName))` instead of `new FileWriter(fileName)`. Please note, that the `java.nio` API does not throw a `FileNotFoundException` anymore, instead it throws a `NoSuchFileException`. If your code dealt explicitly with a `FileNotFoundException`, then this needs to be adjusted. Both exceptions are subclasses of `IOException`, so catching that one covers both. AvoidFileStream (Priority: 1, Ruleset: Performance) https://docs.pmd-code.org/snapshot/pmd_rules_java_performance.html#avoidfilestream
out.write(infos.toString());
out.close();

Expand All @@ -148,7 +149,7 @@
}

File stdErr = new File(stdErrDir, scriptName + ".err");
BufferedWriter err = new BufferedWriter(new FileWriter(stdErr));

Check failure on line 152 in src/main/java/fr/insalyon/creatis/gasw/plugin/executor/local/execution/LocalSubmit.java

View workflow job for this annotation

GitHub Actions / all

Avoid instantiating FileInputStream, FileOutputStream, FileReader, or FileWriter

The FileInputStream and FileOutputStream classes contains a finalizer method which will cause garbage collection pauses. See [JDK-8080225](https://bugs.openjdk.org/browse/JDK-8080225) for details. The FileReader and FileWriter constructors instantiate FileInputStream and FileOutputStream, again causing garbage collection issues while finalizer methods are called. * Use `Files.newInputStream(Paths.get(fileName))` instead of `new FileInputStream(fileName)`. * Use `Files.newOutputStream(Paths.get(fileName))` instead of `new FileOutputStream(fileName)`. * Use `Files.newBufferedReader(Paths.get(fileName))` instead of `new FileReader(fileName)`. * Use `Files.newBufferedWriter(Paths.get(fileName))` instead of `new FileWriter(fileName)`. Please note, that the `java.nio` API does not throw a `FileNotFoundException` anymore, instead it throws a `NoSuchFileException`. If your code dealt explicitly with a `FileNotFoundException`, then this needs to be adjusted. Both exceptions are subclasses of `IOException`, so catching that one covers both. AvoidFileStream (Priority: 1, Ruleset: Performance) https://docs.pmd-code.org/snapshot/pmd_rules_java_performance.html#avoidfilestream
err.write(errors.toString());
err.close();

Expand Down
Loading