Merge branch 'pmd/new-rule-8' into 'master'
Ref: add new static analyser rule: category/java/bestpractices.xml/LiteralsFirstInComparisons See merge request sheepitrenderfarm/client!321
This commit is contained in:
@@ -15,6 +15,7 @@
|
||||
<rule ref="category/java/bestpractices.xml/AvoidUsingHardCodedIP" />
|
||||
<rule ref="category/java/bestpractices.xml/CheckResultSet" />
|
||||
<rule ref="category/java/bestpractices.xml/MissingOverride" />
|
||||
<rule ref="category/java/bestpractices.xml/LiteralsFirstInComparisons" />
|
||||
<rule ref="category/java/bestpractices.xml/OneDeclarationPerLine" />
|
||||
<rule ref="category/java/bestpractices.xml/PrimitiveWrapperInstantiation" />
|
||||
<rule ref="category/java/bestpractices.xml/UnusedFormalParameter" />
|
||||
|
||||
@@ -278,7 +278,7 @@ import lombok.Data;
|
||||
try {
|
||||
String extension = file.getName().substring(file.getName().lastIndexOf('.')).toLowerCase();
|
||||
String name = file.getName().substring(0, file.getName().length() - 1 * extension.length());
|
||||
if (extension.equals(".zip") || extension.equals(".wool")) {
|
||||
if (".zip".equals(extension) || ".wool".equals(extension)) {
|
||||
// check if the md5 of the file is ok
|
||||
String md5_local = Utils.md5(file.getAbsolutePath());
|
||||
|
||||
@@ -344,7 +344,7 @@ import lombok.Data;
|
||||
try {
|
||||
String extension = file.getName().substring(file.getName().lastIndexOf('.')).toLowerCase();
|
||||
String name = file.getName().substring(0, file.getName().length() - 1 * extension.length());
|
||||
if (extension.equals(".zip") || extension.equals(".wool")) {
|
||||
if (".zip".equals(extension) || ".wool".equals(extension)) {
|
||||
// check if the md5 of the file is ok
|
||||
String md5_local = Utils.md5(file.getAbsolutePath());
|
||||
|
||||
|
||||
@@ -746,7 +746,7 @@ import java.util.regex.Pattern;
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (getUpdateRenderingStatusMethod().equals(Job.UPDATE_METHOD_BY_TILE)) {
|
||||
else if (Job.UPDATE_METHOD_BY_TILE.equals(getUpdateRenderingStatusMethod())) {
|
||||
String search = " Tile ";
|
||||
int index = line.lastIndexOf(search);
|
||||
if (index != -1) {
|
||||
|
||||
@@ -89,7 +89,7 @@ public final class Log {
|
||||
try {
|
||||
int checkpointToWrite = (point_ > 0 ? point_ : this.lastCheckPoint);
|
||||
|
||||
if (msg_.equals("") == false) {
|
||||
if ("".equals(msg_) == false) {
|
||||
String line = this.dateFormat.format(new Date()) + " (" + level_ + ") " + msg_;
|
||||
if (this.checkpoints.containsKey(checkpointToWrite) && this.checkpoints.get(checkpointToWrite) != null) {
|
||||
this.checkpoints.get(checkpointToWrite).add(line);
|
||||
|
||||
@@ -401,7 +401,7 @@ public class Server extends Thread {
|
||||
jobData.getRenderTask().getUseGpu() == 1, jobData.getRenderTask().getRendererInfos().getCommandline(), validationUrl,
|
||||
jobData.getRenderTask().getScript(), jobData.getRenderTask().getChunks(), jobData.getRenderTask().getRendererInfos().getMd5(),
|
||||
jobData.getRenderTask().getName(), jobData.getRenderTask().getPassword(),
|
||||
jobData.getRenderTask().getSynchronousUpload().equals("1"), jobData.getRenderTask().getRendererInfos().getUpdateMethod());
|
||||
"1".equals(jobData.getRenderTask().getSynchronousUpload()), jobData.getRenderTask().getRendererInfos().getUpdateMethod());
|
||||
}
|
||||
catch (SheepItException e) {
|
||||
throw e;
|
||||
@@ -688,7 +688,7 @@ public class Server extends Thread {
|
||||
try {
|
||||
String extension = local_file.getName().substring(local_file.getName().lastIndexOf('.')).toLowerCase();
|
||||
String name = local_file.getName().substring(0, local_file.getName().length() - 1 * extension.length());
|
||||
if (extension.equals(".zip") || extension.equals(".wool")) {
|
||||
if (".zip".equals(extension) || ".wool".equals(extension)) {
|
||||
// node_file.setAttribute("md5", name);
|
||||
FileMD5 fileMD5 = new FileMD5();
|
||||
fileMD5.setMd5(name);
|
||||
|
||||
@@ -119,7 +119,7 @@ public class Linux extends OS {
|
||||
if ((userLevel = reader.readLine()) != null) {
|
||||
// Root user in *ix systems -independently of the alias used to login- has a id value of 0. On top of being a user with root capabilities,
|
||||
// to support changing the priority the nice tool must be accessible from the current user
|
||||
return (userLevel.equals("0")) & isNiceAvailable();
|
||||
return ("0".equals(userLevel)) & isNiceAvailable();
|
||||
}
|
||||
}
|
||||
catch (IOException e) {
|
||||
|
||||
@@ -89,7 +89,7 @@ public class Mac extends OS {
|
||||
if ((userLevel = reader.readLine()) != null) {
|
||||
// Root user in *ix systems -independently of the alias used to login- has a id value of 0. On top of being a user with root capabilities,
|
||||
// to support changing the priority the nice tool must be accessible from the current user
|
||||
return (userLevel.equals("0")) & isNiceAvailable();
|
||||
return ("0".equals(userLevel)) & isNiceAvailable();
|
||||
}
|
||||
}
|
||||
catch (IOException e) {
|
||||
|
||||
@@ -221,10 +221,10 @@ public class GuiSwing extends JFrame implements Gui {
|
||||
this.showActivity(ActivityType.SETTINGS);
|
||||
|
||||
try {
|
||||
if (client.getConfiguration().getTheme().equals("light")) {
|
||||
if ("light".equals(client.getConfiguration().getTheme())) {
|
||||
UIManager.setLookAndFeel(new FlatLightLaf());
|
||||
}
|
||||
else if (client.getConfiguration().getTheme().equals("dark")) {
|
||||
else if ("dark".equals(client.getConfiguration().getTheme())) {
|
||||
UIManager.setLookAndFeel(new FlatDarkLaf());
|
||||
}
|
||||
|
||||
|
||||
@@ -205,7 +205,7 @@ public class GuiText implements Gui {
|
||||
.append(String.join("", Collections.nCopies(20 - (int)(progress / 5), " ")))
|
||||
.append(']');
|
||||
|
||||
if (!this.eta.equals("")) {
|
||||
if ("".equals(this.eta) == false) {
|
||||
progressBar.append(String.format(" ETA %s", this.eta));
|
||||
}
|
||||
|
||||
|
||||
@@ -236,7 +236,7 @@ public class GuiTextOneLine implements Gui {
|
||||
.append(String.join("", Collections.nCopies(10 - (int) (progress / 10), " ")))
|
||||
.append(']');
|
||||
|
||||
if (!this.eta.equals("")) {
|
||||
if ("".equals(this.eta) == false) {
|
||||
progressBar.append(String.format(" ETA %s", this.eta));
|
||||
}
|
||||
|
||||
|
||||
@@ -346,7 +346,7 @@ public class Worker {
|
||||
}
|
||||
|
||||
if (theme != null) {
|
||||
if (!theme.equals("light") && !theme.equals("dark")) {
|
||||
if ("light".equals(theme) == false && "dark".equals(theme) == false) {
|
||||
System.err.println("ERROR: The entered theme (-theme parameter) doesn't exist. Please choose either 'light' or 'dark'");
|
||||
System.exit(2);
|
||||
}
|
||||
@@ -406,7 +406,7 @@ public class Worker {
|
||||
}
|
||||
|
||||
if (shutdownMode != null) {
|
||||
if (shutdownMode.equalsIgnoreCase("wait") || shutdownMode.equalsIgnoreCase("hard")) {
|
||||
if ("wait".equalsIgnoreCase(shutdownMode) || "hard".equalsIgnoreCase(shutdownMode)) {
|
||||
config.setShutdownMode(shutdownMode.toLowerCase());
|
||||
}
|
||||
else {
|
||||
@@ -425,7 +425,7 @@ public class Worker {
|
||||
}
|
||||
|
||||
System.out.println("==============================================================================");
|
||||
if (config.getShutdownMode().equals("wait")) {
|
||||
if ("wait".equals(config.getShutdownMode())) {
|
||||
System.out.println(String.format(
|
||||
"WARNING!\n\nThe client will stop requesting new jobs at %s.\nTHE EFFECTIVE SHUTDOWN MIGHT OCCUR LATER THAN THE REQUESTED TIME AS THE UPLOAD\nQUEUE MUST BE FULLY UPLOADED BEFORE THE SHUTDOWN PROCESS STARTS.\n\nIf you want to shutdown the computer sharp at the specified time, please\ninclude the '-shutdown-mode hard' parameter in the application call",
|
||||
shutdownTime));
|
||||
|
||||
@@ -181,12 +181,12 @@ public class Settings implements Activity {
|
||||
|
||||
lightMode = new JRadioButton("Light");
|
||||
lightMode.setActionCommand("light");
|
||||
lightMode.setSelected(config.getTheme().equals("light"));
|
||||
lightMode.setSelected("light".equals(config.getTheme()));
|
||||
lightMode.addActionListener(new ApplyThemeAction());
|
||||
|
||||
darkMode = new JRadioButton("Dark");
|
||||
darkMode.setActionCommand("dark");
|
||||
darkMode.setSelected(config.getTheme().equals("dark"));
|
||||
darkMode.setSelected("dark".equals(config.getTheme()));
|
||||
darkMode.addActionListener(new ApplyThemeAction());
|
||||
|
||||
themePanel.add(lightMode);
|
||||
@@ -590,10 +590,10 @@ public class Settings implements Activity {
|
||||
|
||||
private void applyTheme(String theme_) {
|
||||
try {
|
||||
if (theme_.equals("light")) {
|
||||
if ("light".equals(theme_)) {
|
||||
UIManager.setLookAndFeel(new FlatLightLaf());
|
||||
}
|
||||
else if (theme_.equals("dark")) {
|
||||
else if ("dark".equals(theme_)) {
|
||||
UIManager.setLookAndFeel(new FlatDarkLaf());
|
||||
}
|
||||
|
||||
|
||||
@@ -309,7 +309,7 @@ public class Working implements Activity {
|
||||
public void setStatus(String msg_, boolean overwriteSuspendedMsg) {
|
||||
Client client = parent.getClient();
|
||||
|
||||
if (!msg_.equals("")) {
|
||||
if ("".equals(msg_) == false) {
|
||||
this.previousStatus = msg_;
|
||||
}
|
||||
|
||||
|
||||
@@ -35,32 +35,32 @@ public class CLIInputActionHandler implements CLIInputListener {
|
||||
if (client == null) {
|
||||
return;
|
||||
}
|
||||
if (command.equalsIgnoreCase("block")) {
|
||||
if ("block".equalsIgnoreCase(command)) {
|
||||
Job job = client.getRenderingJob();
|
||||
if (job != null) {
|
||||
job.block();
|
||||
}
|
||||
}
|
||||
else if (command.equalsIgnoreCase("resume")) {
|
||||
else if ("resume".equalsIgnoreCase(command)) {
|
||||
client.resume();
|
||||
}
|
||||
else if (command.equalsIgnoreCase("pause")) {
|
||||
else if ("pause".equalsIgnoreCase(command)) {
|
||||
client.suspend();
|
||||
}
|
||||
else if (command.equalsIgnoreCase("stop")) {
|
||||
else if ("stop".equalsIgnoreCase(command)) {
|
||||
client.askForStop();
|
||||
}
|
||||
else if (command.equalsIgnoreCase("status")) {
|
||||
else if ("status".equalsIgnoreCase(command)) {
|
||||
displayStatus(client);
|
||||
}
|
||||
else if (command.equalsIgnoreCase("cancel")) {
|
||||
else if ("cancel".equalsIgnoreCase(command)) {
|
||||
client.cancelStop();
|
||||
}
|
||||
else if (command.equalsIgnoreCase("quit")) {
|
||||
else if ("quit".equalsIgnoreCase(command)) {
|
||||
client.stop();
|
||||
System.exit(0);
|
||||
}
|
||||
else if ((command.length() > priorityLength) && (command.substring(0, priorityLength).equalsIgnoreCase("priority"))) {
|
||||
else if ((command.length() > priorityLength) && "priority".equalsIgnoreCase(command.substring(0, priorityLength))) {
|
||||
changePriority(client, command.substring(priorityLength));
|
||||
}
|
||||
else {
|
||||
|
||||
Reference in New Issue
Block a user