Bug 4590

Summary: Minor wording suggestion on 'filter' from process returning 'null'
Product: jbatch Reporter: ScottKurz
Component: sourceAssignee: cvignola
Status: RESOLVED FIXED    
Severity: enhancement CC: issues, mminella, waynexlund
Priority: P5    
Version: 1   
Target Milestone: ---   
Hardware: PC   
OS: Windows   
Whiteboard:

Description ScottKurz 2013-01-25 04:25:48 UTC
The Javadoc for ItemProcessor.processItem() states:

"If processItem returns null, no value is passed onto the chunk's item writer."

It's not clear to me whether this means that the ItemWriter is NOT called at all or if a 'null' value is passed within the List sent to writeItems.  

I'm guessing the former but why leave room for interpretation?  If it's the former how about:

"If processItem returns null, then the chunk's item writer is not called, and the chunk loop continues with the next readItem."
Comment 1 waynexlund 2013-01-25 16:04:30 UTC
I agree with the wording adjustment and it conforms to how we handle null from an itemProcessor in SB.  Our java doc states, "returning null indicates that the item should not be continued to be processed'.
Comment 2 cvignola 2013-01-25 18:08:14 UTC
(In reply to comment #1)

The spec now uses that wording.

> I agree with the wording adjustment and it conforms to how we handle null from
> an itemProcessor in SB.  Our java doc states, "returning null indicates that
> the item should not be continued to be processed'.
Comment 3 mminella 2013-01-28 19:12:23 UTC
That wording is not 100% correct.  When an ItemProcessor returns null, it is filtered out and not included in the chunk that is passed to the ItemWriter.  An ItemWriter is called once per chunk so even if the ItemProcessor returns null, the ItemWriter may still be called.