Bug 5431

Summary: ItemProcessListener#onProcessError has javadoc from ItemProcessListener#afterProcess
Product: jbatch Reporter: BrentDouglas
Component: TCKAssignee: ScottKurz
Status: RESOLVED FIXED    
Severity: minor CC: issues, m_edgar
Priority: P5    
Version: 1   
Target Milestone: ---   
Hardware: All   
OS: All   
Whiteboard:

Description BrentDouglas 2013-10-02 14:35:10 UTC
Except from artifact resolved from maven central with descriptor:

<pre>
            <dependency>
                <groupId>javax.batch</groupId>
                <artifactId>javax.batch-api</artifactId>
                <version>1.0</version>
            </dependency>
</pre>

 which I understand to be the RI of this spec.

<pre>
	/**
	 * The afterProcess method receives control after an item 
	 * processor processes an item.  The method receives the item processed 
	 * and the result item as an input.
	 * @param item specifies the item about to be processed.
	 * @param result specifies the item to pass to the item writer. 
	 * @throws Exception if an error occurs.
	 */
	public void afterProcess(Object item, Object result) throws Exception;
	/**
	 * The afterProcess method receives control after an item 
	 * processor processes an item.  The method receives the item processed 
	 * and the result item as an input.
	 * @param item specifies the item about to be processed.
	 * @param ex specifies the exception thrown by the item processor.
	 * @throws Exception
	 */
	public void onProcessError(Object item, Exception ex) throws Exception;
</pre>

The issue being that the javadoc from #onProcessError should describe #onProcessError rather than #afterProcess.
Comment 1 ScottKurz 2013-10-25 18:03:55 UTC
Reclassifying as this error appears in the spec as well as the RI.
Comment 2 ScottKurz 2013-11-08 00:29:53 UTC
Since we already have a lot of bugs.... maybe I can sneak another one into this one:

In the spec, StepExecution still says: 
 getUserPersistentData();
but the RI/TCK say
 getPersistentUserData()
Comment 3 ScottKurz 2014-01-08 16:02:26 UTC
Fixed this and another small detail in ItemProcessListener's javadoc.

Also fixed ItemWriteListener's javadoc which had some copy/paste errors wrongly reflecting the ItemReadListener text.

Here are excerpts including the new versions of all changed Javadoc:

ItemProcessListener:
---------------------

	/**
	 * The afterProcess method receives control after an item 
	 * processor processes an item.  The method receives the item processed 
	 * and the result item as an input.
	 * @param item specifies the item processed by the item processor.
	 * @param result specifies the item to pass to the item writer. 
	 * @throws Exception if an error occurs.
	 */
	public void afterProcess(Object item, Object result) throws Exception;
	/**
	 * The onProcessError method receives control after an 
	 * item processor processItem throws an exception.  The method 
	 * receives the item sent to the item processor as input. 
	 * @param item specifies the item the processor attempted to process.
	 * @param ex specifies the exception thrown by the item processor.
	 * @throws Exception if an error occurs
	 */
	public void onProcessError(Object item, Exception ex) throws Exception;

=========================

ItemWriteListener:
------------------

	/**
	 * The beforeWrite method receives control before 
	 * an item writer is called to write its items.  The 
	 * method receives the list of items sent to the item 
	 * writer as an input.
	 * @param items specifies the items about to be 
	 * written.
	 * @throws Exception is thrown if an error occurs.
	 */
	public void beforeWrite(List<Object> items) throws Exception;
	/**
	 * The afterWrite method receives control after an 
	 * item writer writes its items.  The method receives the 
	 * list of items sent to the item writer as an input.  
	 * @param items specifies the items written by the item writer.
	 * @throws Exception is thrown if an error occurs.
	 */
	public void afterWrite(List<Object> items) throws Exception;
	
	/**
	 * The onWriteError method receives control after an 
	 * item writer writeItems throws an exception.  The method 
	 * receives the list of items sent to the item writer as input. 
	 * @param items specifies the items which the item writer
	 * attempted to write.
	 * @param ex specifies the exception thrown by the item 
	 * writer.
	 * @throws Exception is thrown if an error occurs.
	 */
	public void onWriteError(List<Object> items, Exception ex) throws Exception;
Comment 4 m_edgar 2014-09-18 20:13:45 UTC
(In reply to ScottKurz from comment #1)
> Reclassifying as this error appears in the spec as well as the RI.

Scott-
You mention that the error appears in the RI - are you referring to ChunkStepControllerImpl @ line 379? I'm working with ItemProcessListener#onProcessError and have found that the first parameter will always be null when an exception occurs in processItem. Is that RI bug covered by this issue or should a new one be opened?

Mike
Comment 5 ScottKurz 2015-09-03 20:49:36 UTC
(In reply to m_edgar from comment #4)
> I'm working with
> ItemProcessListener#onProcessError and have found that the first parameter
> will always be null when an exception occurs in processItem. Is that RI bug
> covered by this issue or should a new one be opened?

This was fixed in the RI in 
https://github.com/WASdev/standards.jsr352.jbatch/commit/1679181c
and released in 1.0.1.

Moving to TCK as a new test candidate (verify items passed to onXXXError listeners).