Announcement Announcement Module
No announcement yet.
Skipping based on Throwable.getCause() ? Page Title Module
Move Remove Collapse
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

  • Skipping based on Throwable.getCause() ?

    I'd like to know the best way to configure chunk skippable-exception-classes such that the results of (for example), FlatFileParseException.getCause() could be used as input to the decision rather than the Class hierarchy.

    At the moment I am creating a specific kind of exception during line mapping and if that occurs I want to skip the item. However MyException is being caught by DefaultLineMapper and converted to a FlatFileParseException. I think that somewhere down the line the FlatFileParseException (containing MyException as it's cause), is being passed to a BinaryExceptionClassifier which looks at the class hierarchy of FlatFileParseException - it's not aware of Throwable and nested exceptions. This means I have no way of skipping when I throw instances of MyException - I need to skip all instances of FlatFileParseException.

    Is this correct and if so how can implement the behaviour I desire - namely skipping only on MyException?

  • #2
    I think the best way currently is to implement ItemSkipPolicy and inject an instance of your policy instead of configuring the skip-limit and skippable-exceptions in the step.