}
// report errors
- Console.debug("All errors from command line argument commands:\n"
- + errorsToString());
+ Console.warn(
+ "The following errors and warnings occurred whilst processing files:\n"
+ + errorsToString());
// gui errors reported in Jalview
if (argParser.getBoolean(Arg.QUIT))
return true;
}
- boolean isError = false;
+ Boolean isError = Boolean.valueOf(false);
// set wrap scope here so it can be applied after structures are opened
boolean wrap = false;
AppJmol jmol = (AppJmol) sview;
try
{
- whatNext wn = this.checksBeforeWritingToFile(avm, subVals,
- false, structureImageFilename, "structure image");
- if (wn == whatNext.ERROR)
- {
- isError = true;
- continue;
- }
- else if (wn == whatNext.CONTINUE)
+ boolean success = this.checksBeforeWritingToFile(avm,
+ subVals, false, structureImageFilename,
+ "structure image", isError);
+ if (!success)
{
continue;
}
return false;
}
- boolean isError = false;
+ Boolean isError = Boolean.valueOf(false);
if (avm.containsArg(Arg.IMAGE))
{
for (ArgValue av : avm.getArgValueList(Arg.IMAGE))
Console.info("Writing " + file);
- whatNext wn = this.checksBeforeWritingToFile(avm, subVal, false,
- fileName, "image");
- if (wn == whatNext.ERROR)
- {
- isError = true;
- continue;
- }
- else if (wn == whatNext.CONTINUE)
+ boolean success = checksBeforeWritingToFile(avm, subVal, false,
+ fileName, "image", isError);
+ if (!success)
{
continue;
}
return false;
}
- boolean isError = false;
+ Boolean isError = Boolean.valueOf(false);
if (avm.containsArg(Arg.OUTPUT))
{
}
}
- whatNext wn = this.checksBeforeWritingToFile(avm, subVals, true,
- fileName, ff.getName());
- if (wn == whatNext.ERROR)
- {
- isError = true;
- continue;
- }
- else if (wn == whatNext.CONTINUE)
+ boolean success = checksBeforeWritingToFile(avm, subVals, true,
+ fileName, ff.getName(), isError);
+ if (!success)
{
continue;
}
errors.add(errorMessage);
}
- private enum whatNext
- {
- OKAY, CONTINUE, ERROR;
- }
-
- private whatNext checksBeforeWritingToFile(ArgValuesMap avm,
+ private boolean checksBeforeWritingToFile(ArgValuesMap avm,
SubVals subVal, boolean includeBackups, String filename,
- String adjective)
+ String adjective, Boolean isError)
{
File file = new File(filename);
+ Arg.OVERWRITE.argString()
+ (includeBackups ? " or " + Arg.BACKUPS.argString() : "")
+ " set");
- return whatNext.CONTINUE;
+ return false;
}
boolean mkdirs = ArgParser.getFromSubValArgOrPref(avm, Arg.MKDIRS,
+ "' does not exist for " + adjective + " file '" + filename
+ "'."
+ (mkdirs ? "" : " Try using " + Arg.MKDIRS.argString()));
- return whatNext.ERROR;
+ isError = true;
+ return false;
}
- return whatNext.OKAY;
+ return true;
}
public List<String> getErrors()
StringBuilder sb = new StringBuilder();
for (String error : errors)
{
+ if (sb.length() > 0)
+ sb.append("\n");
sb.append("- " + error);
- sb.append("\n");
}
return sb.toString();
}