mirror of https://github.com/FreeCol/freecol.git
Make the save game validator return useful exit codes.
This commit is contained in:
parent
98c71550ab
commit
cb08aa8e0b
|
@ -828,7 +828,8 @@
|
|||
<condition property="savegame" else="">
|
||||
<isset property="savegame" />
|
||||
</condition>
|
||||
<java classname="net.sf.freecol.tools.SaveGameValidator">
|
||||
<java classname="net.sf.freecol.tools.SaveGameValidator"
|
||||
failonerror="true">
|
||||
<classpath refid="test.run.classpath"/>
|
||||
<arg value="${savegame}" />
|
||||
</java>
|
||||
|
|
|
@ -61,8 +61,9 @@ public class SaveGameValidator {
|
|||
}
|
||||
}
|
||||
|
||||
int ret = 0;
|
||||
for (File file : allFiles) {
|
||||
System.out.println("Processing file " + file.getPath());
|
||||
//System.out.println("Processing file " + file.getPath());
|
||||
try {
|
||||
FreeColSavegameFile mapFile = new FreeColSavegameFile(file);
|
||||
saveGameValidator.validate(new StreamSource(mapFile.getSavegameInputStream()));
|
||||
|
@ -71,10 +72,13 @@ public class SaveGameValidator {
|
|||
System.out.println(e.getMessage()
|
||||
+ " at line=" + e.getLineNumber()
|
||||
+ " column=" + e.getColumnNumber());
|
||||
ret = Math.max(ret, 1);
|
||||
} catch (IOException | SAXException e) {
|
||||
System.out.println("Failed to read " + file.getName());
|
||||
ret = 2;
|
||||
}
|
||||
}
|
||||
System.exit(ret);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue