Permalink
Browse files

Added runMethod() to Main to allow other applications running pipelin…

…es to catch exceptions
  • Loading branch information...
ndw committed Sep 22, 2015
1 parent 60fecce commit c061bd35a01a6dc8651f637543b5a1f4b9814e69
Showing with 20 additions and 0 deletions.
  1. +20 −0 src/main/java/com/xmlcalabash/drivers/Main.java
@@ -151,6 +151,26 @@ public void run(String[] args) throws IOException {
}
}
// This method runs the pipeline but doesn't catch any exceptions.
// The idea is you could call this from some other object and catch (or not) the
// exceptions yourself.
public void runMethod(String[] args) throws IOException, SaxonApiException, URISyntaxException {
UserArgs userArgs = new ParseArgs().parse(args);
XProcConfiguration config = userArgs.createConfiguration();
runtime = new XProcRuntime(config);
debug = config.debug;
try {
run(userArgs, config);
} finally {
// Here all memory should be freed by the next gc, right?
if (runtime != null) {
runtime.close();
}
}
}
boolean run(UserArgs userArgs, XProcConfiguration config) throws SaxonApiException, IOException, URISyntaxException {
if (userArgs.isShowVersion()) {
XProcConfiguration.showVersion(runtime);

0 comments on commit c061bd3

Please sign in to comment.