Skip to content

Commit

Permalink
Sonar warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
gquerret committed Apr 18, 2018
1 parent 372b589 commit d70be3b
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 21 deletions.
3 changes: 3 additions & 0 deletions src/java/com/phenix/pct/CompilationWrapper.java
Expand Up @@ -240,6 +240,9 @@ public void setXCode(boolean xcode) {
compAttributes.setXCode(xcode);
}

/**
* @deprecated
*/
@Deprecated
@Override
public void setXCodeKey(String xcodeKey) {
Expand Down
10 changes: 4 additions & 6 deletions src/java/com/phenix/pct/PCT.java
Expand Up @@ -674,13 +674,11 @@ protected static void copyStreamFromJar(String streamName, File outFile) throws
}

protected static boolean createDir(File dir) {
if (dir.exists() && !dir.isDirectory()) {
return false;
}
if (!dir.exists() && !dir.mkdirs()) {
return false;
if (dir.exists()) {
return dir.isDirectory();
} else {
return dir.mkdirs();
}
return true;
}

}
21 changes: 9 additions & 12 deletions src/java/com/phenix/pct/PCTRun.java
Expand Up @@ -393,11 +393,9 @@ public void execute() {

try {
// File name generation is deffered at this stage, because when defined in constructor,
// we still don't know if
// we have to use source code or compiled version. And it's impossible to extract source
// code to a directory named
// something.pl as Progress tries to open a procedure library, and miserably fails with
// error 13.
// we still don't know if we have to use source code or compiled version. And it's
// impossible to extract source code to a directory named something.pl as Progress tries
// to open a procedure library, and miserably fails with error 13.
pctLib = new File(
System.getProperty(PCT.TMPDIR), "pct" + plID + (isSourceCodeUsed() ? "" : ".pl")); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$

Expand Down Expand Up @@ -582,7 +580,8 @@ protected Charset getCharset() {
}

private String readCharset() {
String pfCpInt = null, pfCpStream = null;
String pfCpInt = null;
String pfCpStream = null;

// If paramFile is defined, then read it and check for cpStream or cpInternal
if (runAttributes.getParamFile() != null) {
Expand Down Expand Up @@ -749,7 +748,7 @@ private void createInitProcedure() {
// Creates a StringBuffer containing output parameters when calling the progress
// procedure
StringBuilder sb = new StringBuilder();
if ((runAttributes.getOutputParameters() != null) && (runAttributes.getOutputParameters().size() > 0)) {
if ((runAttributes.getOutputParameters() != null) && !runAttributes.getOutputParameters().isEmpty()) {
sb.append('(');
int zz = 0;
for (OutputParameter param : runAttributes.getOutputParameters()) {
Expand All @@ -769,8 +768,7 @@ private void createInitProcedure() {
bw.write(MessageFormat.format(this.getProgressProcedures().getRunString(),
escapeString(runAttributes.getProcedure()), sb.toString()));
// Checking return value
bw.write(MessageFormat.format(this.getProgressProcedures().getAfterRun(),
new Object[]{}));
bw.write(this.getProgressProcedures().getAfterRun());
// Writing output parameters to temporary files
if (this.runAttributes.getOutputParameters() != null) {
for (OutputParameter param : runAttributes.getOutputParameters()) {
Expand All @@ -783,13 +781,12 @@ private void createInitProcedure() {
}
}
// Quit
bw.write(MessageFormat.format(this.getProgressProcedures().getQuit(), new Object[]{}));
bw.write(this.getProgressProcedures().getQuit());

// Private procedures
bw.write(MessageFormat.format(this.getProgressProcedures().getReturnProc(),
escapeString(status.getAbsolutePath())));
bw.write(MessageFormat.format(this.getProgressProcedures().getOutputParameterProc(),
new Object[]{}));
bw.write(this.getProgressProcedures().getOutputParameterProc());
} catch (IOException ioe) {
throw new BuildException(ioe);
}
Expand Down
3 changes: 2 additions & 1 deletion src/java/com/phenix/pct/RCodeSelector.java
Expand Up @@ -119,7 +119,8 @@ public boolean isSelected(File basedir, String filename, File file) {
case MODE_MD5:
log(MessageFormat.format("MD5 {2} File1 {0} File2 {1}", file1.getMD5(), file2.getMD5(), filename), Project.MSG_VERBOSE);
return !file1.getMD5().equals(file2.getMD5());
default: return true;
default:
return true;
}
}
}
4 changes: 2 additions & 2 deletions src/java/eu/rssw/pct/oedoc/ClassDocumentationVisitor.java
Expand Up @@ -125,7 +125,7 @@ public boolean visit(TemptableDeclaration node) {
tt.serialize = node.getSerializeName();
String fName = "";
if (node.getFileName() != null) {
fName = propath.searchRelative(node.getFileName(), false).toPortableString();
fName = propath.searchRelative(node.getFileName(), false).toPortableString();
}
tt.definition = fName;

Expand Down Expand Up @@ -164,7 +164,7 @@ public boolean visit(DatasetDeclaration node) {
}
String fName = "Main file";
if (node.getFileName() != null) {
fName = propath.searchRelative(node.getFileName(), false).toPortableString();
fName = propath.searchRelative(node.getFileName(), false).toPortableString();
}
ds.definition = fName;

Expand Down

0 comments on commit d70be3b

Please sign in to comment.