On 18.01.2015 15:32, Egon Willighagen wrote:
OK, thanks!
BTW, I could confirm the NPE solved by adding that json-YYYYMMDD/ subdir...
Great.
Another question: is it possible to cancel to process of parsing a
datadump file programmatically? I saw the time out, but integrating it
in a GUI where the user may push a cancel button, and would be nice if
I could propagate that, and stop the actual processing...
You can just throw some RuntimeException (or, cleaner, a subclass
thereof that you can specifically catch on the outer level) from within
the processor. That's what the existing timer also does. The files used
within the processing are opened using Java's try-with-resources
construct, so that they should be closed cleanly when an exception occurs.
From an architectural point of view, it would probably be cleaner to
create a checked exception for this purpose and declare all processing
methods to throw it. Any preferences?
Markus