Skip to content

Commit

Permalink
query report message counter to fix wrong exit message for single fil…
Browse files Browse the repository at this point in the history
…e validation // fixes #740
  • Loading branch information
tofi86 committed Jul 16, 2017
1 parent 49412e0 commit 68af5a9
Showing 1 changed file with 24 additions and 7 deletions.
31 changes: 24 additions & 7 deletions src/main/java/com/adobe/epubcheck/tool/EpubChecker.java
Original file line number Diff line number Diff line change
Expand Up @@ -181,14 +181,23 @@ else if (validationResult == 1)
}
else
{
if (check.validate())
boolean validationResult = check.validate();
if (validationResult)
{
outWriter.println(Messages.get("no_errors__or_warnings"));
return 0;
}
System.err.println(Messages.get("there_were_errors"));
else if (report.getWarningCount() > 0 && report.getFatalErrorCount() == 0 && report.getErrorCount() == 0)
{
System.err.println(Messages.get("there_were_warnings"));
return failOnWarnings ? 1 : 0;
}
else
{
System.err.println(Messages.get("there_were_errors"));
return 1;
}
}
return 1;
}

int validateEpubFile(String path, EPUBVersion version, Report report)
Expand Down Expand Up @@ -231,14 +240,22 @@ int validateEpubFile(String path, EPUBVersion version, Report report)
.report(report).resourceProvider(resourceProvider).mimetype(modeMimeTypeMap.get(opsType))
.version(version).profile(profile).build());

if (check.validate())
boolean validationResult = check.validate();
if (validationResult)
{
outWriter.println(Messages.get("no_errors__or_warnings"));
return 0;
}
System.err.println(Messages.get("there_were_errors"));

return 1;
else if (report.getWarningCount() > 0 && report.getFatalErrorCount() == 0 && report.getErrorCount() == 0)
{
System.err.println(Messages.get("there_were_warnings"));
return failOnWarnings ? 1 : 0;
}
else
{
System.err.println(Messages.get("there_were_errors"));
return 1;
}
}

public int run(String[] args)
Expand Down

0 comments on commit 68af5a9

Please sign in to comment.