Skip to main content

[jsr352-public] Re: ChunkTests#testChunkSkipMultipleExceptions question

  • From: Scott Kurz < >
  • To:
  • Subject: [jsr352-public] Re: ChunkTests#testChunkSkipMultipleExceptions question
  • Date: Fri, 20 Sep 2013 15:32:00 -0400


Michael,

I was just saying that including subclasses RuntimeException in
include/exclude elements in a portable manner might be tricky because of
different wrappering/chaining in different runtimes.

So you'd be left with cases like:
<skippable-exception-classes>
  <include class="java.lang.Exception"/>
  <exclude class="java.io.IOException"/>
  <include class="java.io.ProtocolException"/>
</skippable-exception-classes>

Maybe that is more practical than I'm giving it credit for.. it was just
striking me as not too common maybe.

------------------------------------------------------
Scott Kurz
WebSphere Batch / Compute Grid Development
T/L 295-5649;
External Phone 845-435-5649

--------------------------------------------------------



From:   Michael Minella 
< >
To:     
" "
 
< >,
Date:   09/20/2013 03:10 PM
Subject:        [jsr352-public] Re: ChunkTests#testChunkSkipMultipleExceptions
            question



Scott,

I'll open the SPEC bug as you request.  However, one small note.  I'm
confused by the "if we move away from RuntimeException" comment.  Most of
the interfaces throw checked exceptions (ItemReader for example throws
Exception on all of it's methods).  This is why that type of configuration
is very useful.

Michael

Thanks,
Michael Minella

http://www.michaelminella.com


On Fri, Sep 20, 2013 at 2:05 PM, Scott Kurz 
< >
 wrote:
  Interesting, I'd never come across the "determined by the nearest
  superclass " language.

  I'm still wondering how useful the include/exclude/include is.

  Re: this one example...

  Generally speaking... unchecked exceptions are part of the programming
  contract in the same way as checked exceptions... and can end up
  chained/wrapped such that I wonder if it makes sense to think of this
  being a part of "portable" JSL.

  And if we move away from RuntimeException I'm not sure how many deep
  exception hierarchies there are that this would be useful for.  (I could
  be wrong).

  But still, definitely open a SPEC bug if you want to keep it on this
  list.




  ------------------------------------------------------
  Scott Kurz
  WebSphere Batch / Compute Grid Development
  T/L 295-5649;
  External Phone 845-435-5649
  

  --------------------------------------------------------

  Inactive hide details for Michael Minella ---09/20/2013 02:44:45 PM---It
  looks like the point in the Spring Batch doc that wasnMichael Minella
  ---09/20/2013 02:44:45 PM---It looks like the point in the Spring Batch
  doc that wasn't covered by the spec is this line:


  From: Michael Minella 
< >
  To: 
" "
 
< >,
  Date: 09/20/2013 02:44 PM

  Subject: [jsr352-public] Re: ChunkTests#testChunkSkipMultipleExceptions
  question



  It looks like the point in the Spring Batch doc that wasn't covered by
  the spec is this line:

  "For any exception encountered, the skippability will be determined by
  the nearest superclass in the class hierarchy. Any unclassifed exception
  will be treated as 'fatal'. The order of the <include/>and <exclude/>
  elements does not matter."

  This allows you to include part of a class hierarchy without requiring
  the developer to skip the entire hierarchy.  With regards to the how
  useful it is, we have many cases where developers will skip all
  exceptions with exceptions included.  Going back to my previous example
  of:

  <skippable-exception-classes>
    <include class="java.lang.Exception"/>
    <include class="java.util.ConcurrentModificationException"/>
    <exclude class="java.lang.RuntimeException"/>
  </skippable-exception-classes>



  The idea of skipping all exceptions but a select few is not an
  unrealistic (and very common) use case but the TCK's interpretation of
  the spec doesn't allow it.

  Thanks,
  Michael Minella
  

  http://www.michaelminella.com


  On Fri, Sep 20, 2013 at 1:31 PM, Scott Kurz 
< >
 wrote:


        What language the spec has here is in section:     8.2.1.4.1
        Skipping Exceptions

        I agree the spec doesn't remove all doubt from this matter, so this
        is a useful discussion.

        However, I think it's a greater leap from what the spec says to any
        alternative interpretation (I can think of), than it is to the one
        we have in the RI/TCK.

        E.g. if ordering is important, and/or you can do an
        include/exclude/include, then this would need to be spelled out in
        more detail than it is.
        I don't see what other coherent rule, then, you could build from
        that language.

        All that said, I wonder how useful it really is to be able to
        include/exclude/include?




        ------------------------------------------------------
        Scott Kurz
        WebSphere Batch / Compute Grid Development
        T/L 295-5649;
        External Phone 845-435-5649
        

        --------------------------------------------------------

        Inactive hide details for Michael Minella ---09/20/2013 02:15:36
        PM---Scott, Where does the spec support this interpretation?
        Michael Minella ---09/20/2013 02:15:36 PM---Scott, Where does the
        spec support this interpretation?  The ant file analogy is


        From: Michael Minella 
< >
        To: 
" "
 
< >,
        Date: 09/20/2013 02:15 PM
        Subject: [jsr352-public] Re:
        ChunkTests#testChunkSkipMultipleExceptions question






        Scott,

        Where does the spec support this interpretation?  The ant file
        analogy is too simplistic in to apply to this case because file
        systems don't have inheritance.

        My issue is that with the interpretation you're providing, that
        means that include elements can be ignored even though a developer
        is explicitly stating that an exception should be included.  It
        also prevents you from excluding only parts of an exception
        hierarchy.  In the TCK's example, if you wanted to configure to
        skip MyParentException, don't skip MyChildException, but skip
        MyGrandchildException, how would that be done?

        Michael

        Thanks,
        Michael Minella
        

        http://www.michaelminella.com


        On Fri, Sep 20, 2013 at 1:06 PM, Scott Kurz 
< >
        wrote:
              Michael,

              It is NOT the case that this gets interpreted as: skip
              (include) all MyParentException  except (exclude) all
              MyChildException except (include now) all
              MyGrandchildException.
              We realized this was confusing which is why we have this TCK
              test to clarify.

              This test is designed to enforce the spec implication that
              this:




              <skippable-exception-classes>
                <include class=
              "com.ibm.jbatch.tck.artifacts.reusable.MyParentException"/>
                <include class=
              "com.ibm.jbatch.tck.artifacts.reusable.MyGrandchildException"
              />
                <exclude class=
              "com.ibm.jbatch.tck.artifacts.reusable.MyChildException"/>
              </skippable-exception-classes>


              ends up equivalent to this:




              <skippable-exception-classes>
                <include class=
              "com.ibm.jbatch.tck.artifacts.reusable.MyParentException"/>
                <exclude class=
              "com.ibm.jbatch.tck.artifacts.reusable.MyChildException"/>
              </skippable-exception-classes>

              Ordering does not matter.   We can simply state:
              1) skip an exception if is an instance of any include (or
              subclass)
                 UNLESS
              2) it is an instance of any exclude (or subclass), and then
              don't skip.

              In the RI, see com.ibm.jbatch.container.impl.SkipHandler.

              I believe this is how include/excludes work with Ant fileset
              (s), for example.

              Hope that clears things up,
              ------------------------------------------------------
              Scott Kurz
              WebSphere Batch / Compute Grid Development
              T/L 295-5649;
              External Phone 845-435-5649
              

              --------------------------------------------------------

              Inactive hide details for Michael Minella ---09/20/2013
              11:22:01 AM---The test
              ChunkTests#testChunkSkipMultipleExceptions() exeMichael
              Minella ---09/20/2013 11:22:01 AM---The test
              ChunkTests#testChunkSkipMultipleExceptions() executes a job
              that is configured to skip exce

              From: Michael Minella 
< >
              To: 
" "
 
< >,
              Date: 09/20/2013 11:22 AM
              Subject: [jsr352-public]
              ChunkTests#testChunkSkipMultipleExceptions question






              The test ChunkTests#testChunkSkipMultipleExceptions()
              executes a job that is configured to skip exceptions as
              follows:

              <skippable-exception-classes>
                <include class=
              "com.ibm.jbatch.tck.artifacts.reusable.MyParentException"/>
                <include class=
              "com.ibm.jbatch.tck.artifacts.reusable.MyGrandchildException"
              />
                <exclude class=
              "com.ibm.jbatch.tck.artifacts.reusable.MyChildException"/>
              </skippable-exception-classes>



              When executed, the job throws a MyParentException and a
              MyGrandchildException.  The test expects the first exception
              (MyParentException) to be skipped but the
              MyGrandchildException to be not be and the job to fail.
              However, with the given configuration, I would expect that it
              should complete.  I would expect that the above configuration
              translates into "skip all MyParentExceptions and it's
              children except MyChildException and it's children except
              MyGrandchildException and it's children".  The spec doesn't
              state that there is any precedence between include and
              exclude (from what I can tell) and this interpretation allows
              for the exclusion of ranges of a class hierarchy.  For
              example, I'd expect to be able to configure the following:

              <skippable-exception-classes>
                <include class="java.lang.Exception"/>
                <include class="java.util.ConcurrentModificationException"
              />
                <exclude class="java.lang.RuntimeException"/>
              </skippable-exception-classes>



              I would expect this configuration to skip all checked
              exceptions and ConcurrentModificationException and fail for
              any others (ConcurrentModificationException extends
              RuntimeException).  Am I missing something?  Any insight is
              appreciated.

              Thanks,
              Michael Minella
              

              http://www.michaelminella.com










GIF image



[jsr352-public] ChunkTests#testChunkSkipMultipleExceptions question

Michael Minella 09/20/2013

[jsr352-public] Re: ChunkTests#testChunkSkipMultipleExceptions question

Scott Kurz 09/20/2013

[jsr352-public] Re: ChunkTests#testChunkSkipMultipleExceptions question

Michael Minella 09/20/2013

[jsr352-public] Re: ChunkTests#testChunkSkipMultipleExceptions question

Scott Kurz 09/20/2013

[jsr352-public] Re: ChunkTests#testChunkSkipMultipleExceptions question

Michael Minella 09/20/2013

[jsr352-public] Re: ChunkTests#testChunkSkipMultipleExceptions question

Scott Kurz 09/20/2013

[jsr352-public] Re: ChunkTests#testChunkSkipMultipleExceptions question

Michael Minella 09/20/2013

[jsr352-public] Re: ChunkTests#testChunkSkipMultipleExceptions question

Scott Kurz 09/20/2013
 
 
Close
loading
Please Confirm
Close