Announcement Announcement Module
Collapse
No announcement yet.
Errors and Update in Documentation Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Errors and Update in Documentation

    Dear members

    I detected an errata in the documentation since the API has changed.

    In section

    6.3.1. Chaining ItemProcessors

    Has this example

    Code:
    <bean id="compositeItemProcessor" 
          class="org.springframework.batch.item.support.CompositeItemProcessor">
        <property name="itemProcessors">
            <list>
                <bean class="..FooProcessor" />
                <bean class="..BarProcessor" />
            </list>
        </property>
    </bean>
    When I run this example I get this error
    Code:
    Error setting property values; 
    nested exception is 
    org.springframework.beans.NotWritablePropertyException: 
    Invalid property 'itemProcessors' of bean class 
    [org.springframework.batch.item.support.CompositeItemProcessor]: 
    Bean property 'itemProcessors' is not writable or has an invalid setter method. 
    Does the parameter type of the setter match the re
    turn type of the getter?
     .....
    I recall clearly that this work before, Therefore I checked the API for
    CompositeItemProcessor<I,O>
    and well such method not appear

    My unique change was the version release
    For spring-batch-2.0.1.RELEASE\ in
    spring-batch-infrastructure-2.0.1.RELEASE-sources.jar\org\springframework\batch\item\support\

    we have
    Code:
    @SuppressWarnings("unchecked")
    public class CompositeItemProcessor<I, O> implements ItemProcessor<I, O>, InitializingBean {
    
    	private List<ItemProcessor> itemProcessors;
    
    	public O process(I item) throws Exception {
    		Object result = item;
    	
    		for(ItemProcessor transformer: itemProcessors){
    			if(result == null){
    				return null;
    			}
    			result = transformer.process(result);
    		}
    		return (O) result;
    	}
    
    	public void afterPropertiesSet() throws Exception {
    		Assert.notEmpty(itemProcessors);
    	}
    
    	/**
    	 * @param itemProcessors will be chained to produce a composite
    	 * transformation.
    	 */
    	public void setItemProcessors(List<ItemProcessor> itemProcessors) {
    		this.itemProcessors = itemProcessors;
    	}
    
    }
    But in spring-batch-2.1.0.RELEASE in
    spring-batch-infrastructure-2.1.0.RELEASE-sources.jar\org\springframework\batch\item\support
    We have instead
    Code:
    public class CompositeItemProcessor<I, O> implements ItemProcessor<I, O>, InitializingBean {
    
    	private List<ItemProcessor<Object, Object>> delegates;
    
    	@SuppressWarnings("unchecked")
    	public O process(I item) throws Exception {
    		Object result = item;
    
    		for (ItemProcessor<Object, Object> delegate : delegates) {
    			if (result == null) {
    				return null;
    			}
    			result = delegate.process(result);
    		}
    		return (O) result;
    	}
    
    	public void afterPropertiesSet() throws Exception {
    		Assert.notNull(delegates, "The 'delgates' may not be null");
    		Assert.notEmpty(delegates, "The 'delgates' may not be empty");
    	}
    
    	public void setDelegates(List<ItemProcessor<Object, Object>> delegates) {
    		this.delegates = delegates;
    	}
    
    }
    How you can see the variable name changed from itemProcessors to delegates through the versions from "spring-batch-2.0.1.RELEASE" to "spring-batch-2.1.0.RELEASE"

    Consider too the title of the actual and unique API for Spring Batch
    Spring Batch 2.1.0.CI-SNAPSHOT API , It is not updated anymore
    Therefore same appreciation for our documentation sample


    The other error in Spring batch documentation is about the poincut expression used in two places , for the section

    8.6. Declarative Iteration
    shown
    Code:
    <aop:config>
        <aop:pointcut id="transactional"
            expression="execution(* com...*Service.processMessage(..))" />
        <aop:advisor pointcut-ref="transactional"
            advice-ref="retryAdvice" order="-1"/>
    </aop:config>
    and for the section 9.5. Declarative Retry shown
    Code:
    <aop:config>
        <aop:pointcut id="transactional"
            expression="execution(* com...*Service.remoteCall(..))" />
        <aop:advisor pointcut-ref="transactional"
            advice-ref="retryAdvice" order="-1"/>
    </aop:config>
    Both are wrong, because * com...* has three points and must be two * com..*

    I going to arise an JIRA for these situations

    Best Regards

    -Manuel

  • #2
    I created long days ago a JIRA report BATCH-1533, the status is fixed, but I see that the documentation still with the same two problems

    Therefore what were fix it?

    Comment


    • #3
      The documentation has not been redeployed. It'll be done when 2.1.1 is released I guess.

      Comment

      Working...
      X