Skip to content

Commit

Permalink
Merge pull request #4233 from tstoeter/develop
Browse files Browse the repository at this point in the history
Handle UnknownFormatException for batch processing multiple files.
  • Loading branch information
sbesson authored Sep 19, 2024
2 parents 686371d + e39e422 commit 800950a
Showing 1 changed file with 13 additions and 4 deletions.
17 changes: 13 additions & 4 deletions components/bio-formats-tools/src/loci/formats/tools/ImageInfo.java
Original file line number Diff line number Diff line change
Expand Up @@ -1132,6 +1132,7 @@ private void printDimension(String dim, int size, int effectiveSize,
public static void main(String[] args) throws Exception {
DebugTools.enableLogging("INFO");

int exitCode = 0;
List<String> argsList = Arrays.asList(args);
int idx = argsList.indexOf("-");

Expand All @@ -1141,15 +1142,23 @@ public static void main(String[] args) throws Exception {

while (scanner.hasNext()) {
newArgs[idx] = scanner.nextLine();
System.out.println("====% " + newArgs[idx]);
if (!new ImageInfo().testRead(newArgs)) System.exit(1);
System.out.println("====% " + newArgs[idx]);
try {
new ImageInfo().testRead(newArgs);
}
catch (Exception e) {
LOGGER.error("Caught " + e.getClass().getSimpleName(), e);
exitCode = 1;
continue;
}
}
scanner.close();
}
else {
if (!new ImageInfo().testRead(args)) System.exit(1);
}
}
}

System.exit(exitCode);
}
}

0 comments on commit 800950a

Please sign in to comment.