@@ -72,14 +72,14 @@ public Collection<RuntimeBeanReference> parse(Element element, ParserContext par
72
72
@ SuppressWarnings ("unchecked" )
73
73
List <Element > taskElements = (List <Element >) DomUtils .getChildElementsByTagName (element , "task" );
74
74
@ SuppressWarnings ("unchecked" )
75
- List <Element > chunkOrientedElements = (List <Element >) DomUtils .getChildElementsByTagName (element , "chunk-oriented " );
75
+ List <Element > chunkElements = (List <Element >) DomUtils .getChildElementsByTagName (element , "chunk" );
76
76
if (taskElements .size () > 0 ) {
77
77
Object task = parseTask (taskElements .get (0 ), parserContext );
78
78
stateBuilder .addConstructorArgValue (stepRef );
79
79
stateBuilder .addConstructorArgValue (task );
80
80
}
81
- else if (chunkOrientedElements .size () > 0 ) {
82
- Object task = parseChunkOriented ( chunkOrientedElements .get (0 ), parserContext );
81
+ else if (chunkElements .size () > 0 ) {
82
+ Object task = parseChunk ( chunkElements .get (0 ), parserContext );
83
83
stateBuilder .addConstructorArgValue (stepRef );
84
84
stateBuilder .addConstructorArgValue (task );
85
85
}
@@ -196,7 +196,7 @@ public static RuntimeBeanReference getStateTransitionReference(ParserContext par
196
196
* @param parserContext
197
197
* @return the TaskletStep bean
198
198
*/
199
- protected RootBeanDefinition parseChunkOriented (Element element , ParserContext parserContext ) {
199
+ protected RootBeanDefinition parseChunk (Element element , ParserContext parserContext ) {
200
200
201
201
RootBeanDefinition bd ;
202
202
@@ -237,30 +237,32 @@ protected RootBeanDefinition parseChunkOriented(Element element, ParserContext p
237
237
RuntimeBeanReference tx = new RuntimeBeanReference (transactionManager );
238
238
bd .getPropertyValues ().addPropertyValue ("transactionManager" , tx );
239
239
240
- String commitInterval = element .getAttribute ("commit-interval " );
240
+ String commitInterval = element .getAttribute ("chunk-size " );
241
241
if (StringUtils .hasText (commitInterval )) {
242
242
bd .getPropertyValues ().addPropertyValue ("commitInterval" , commitInterval );
243
243
}
244
244
245
- if (isFaultTolerant ) {
246
- String skipLimit = element .getAttribute ("skip-limit" );
247
- if (StringUtils .hasText (skipLimit )) {
248
- bd .getPropertyValues ().addPropertyValue ("skipLimit" , skipLimit );
249
- }
245
+ String skipLimit = element .getAttribute ("skip-limit" );
246
+ if (StringUtils .hasText (skipLimit )) {
247
+ if (!isFaultTolerant ) {
248
+ throw new BeanCreationException ("skip-limit can only be specified if fault-tolerant is set to 'true'" );
249
+ }
250
+ bd .getPropertyValues ().addPropertyValue ("skipLimit" , skipLimit );
250
251
}
251
252
252
- if (isFaultTolerant ) {
253
- String retryLimit = element .getAttribute ("retry-limit" );
254
- if (StringUtils .hasText (retryLimit )) {
255
- bd .getPropertyValues ().addPropertyValue ("retryLimit" , retryLimit );
256
- }
253
+ String retryLimit = element .getAttribute ("retry-limit" );
254
+ if (StringUtils .hasText (retryLimit )) {
255
+ if (!isFaultTolerant ) {
256
+ throw new BeanCreationException ("retry-limit can only be specified if fault-tolerant is set to 'true'" );
257
+ }
258
+ bd .getPropertyValues ().addPropertyValue ("retryLimit" , retryLimit );
257
259
}
258
260
259
- handleExceptionElement (element , bd , "skippable-exception-classes" , "skippableExceptionClasses" );
261
+ handleExceptionElement (element , bd , "skippable-exception-classes" , "skippableExceptionClasses" , isFaultTolerant );
260
262
261
- handleExceptionElement (element , bd , "retryable-exception-classes" , "retryableExceptionClasses" );
263
+ handleExceptionElement (element , bd , "retryable-exception-classes" , "retryableExceptionClasses" , isFaultTolerant );
262
264
263
- handleExceptionElement (element , bd , "fatal-exception-classes" , "fatalExceptionClasses" );
265
+ handleExceptionElement (element , bd , "fatal-exception-classes" , "fatalExceptionClasses" , isFaultTolerant );
264
266
265
267
handleListenersElement (element , bd , parserContext );
266
268
@@ -271,10 +273,13 @@ protected RootBeanDefinition parseChunkOriented(Element element, ParserContext p
271
273
}
272
274
273
275
private void handleExceptionElement (Element element , RootBeanDefinition bd ,
274
- String attributeName , String propertyName ) {
276
+ String attributeName , String propertyName , boolean isFaultTolerant ) {
275
277
String exceptions =
276
278
DomUtils .getChildElementValueByTagName (element , attributeName );
277
279
if (StringUtils .hasLength (exceptions )) {
280
+ if (!isFaultTolerant ) {
281
+ throw new BeanCreationException (attributeName + " can only be specified if fault-tolerant is set to 'true'" );
282
+ }
278
283
String [] exceptionArray = StringUtils .tokenizeToStringArray (
279
284
StringUtils .delete (exceptions , "," ), "\n " );
280
285
if (exceptionArray .length > 0 ) {
0 commit comments