spring-batch icon indicating copy to clipboard operation
spring-batch copied to clipboard

StaxEventItemReader method moveCursorToNextFragment creates an infinite loop upon retrieving endDocument event [BATCH-1878]

Open spring-projects-issues opened this issue 13 years ago • 4 comments
trafficstars

Martins Kazuss opened BATCH-1878 and commented

StaxEventItemReader method moveCursorToNextFragment(XMLEventReader reader)is not processing endDocument event. An infinite loop is created after retrieving this event as method is trying to find the next startElement (but as the end of the file is reached it is impossible). An example solution is provided as an attachment (CustomStaxEventItemReader which is basically the original StaxEventItemReader with modified moveCursorToNextFragment(XMLEventReader reader) method).


Attachments:

Referenced from: commits https://github.com/spring-projects/spring-batch/commit/96d3564247e85275f7bedc19b9ab7527018cc87b

1 votes, 3 watchers

spring-projects-issues avatar Jul 25 '12 00:07 spring-projects-issues

Dave Syer commented

Do you have a test case? The loop terminates when reader.peek() returns null, which happens after the end element, so it looks OK to me. I added 2 test cases but the loop always terminates.

spring-projects-issues avatar Jul 25 '12 00:07 spring-projects-issues

Martins Kazuss commented

As there are no issues for you, I suppose it can be some local issue. I can not provide you the context to reproduce the issue.

I suppose it may as well be removed. Anyway - if you believe that the issue should remain open, at least I need to remove the attachment.

spring-projects-issues avatar Oct 29 '12 06:10 spring-projects-issues

Roman Nikolaenko commented

Hi!

I faced with this kind of issue on WebLogic 10.3.6, using org.springframework.batch version 2.1.9.RELEASE.

We have batch job that reads Domain objects from xml, then populates database with it. Everything was OK on Tomcat and Gigaspases. But when we deploy app to Weblogic, job was hanging.

Looks like Weblogic has its own implementation of jaxb-api, that is why this bug could be reproduced only there. Also it seems to me that peek() method of Weblogic XMLEventReader implementation return EndDocumentEvent when reach end of file.

Attachment file fixed the problem. I used CustomStaxEventItemReader instead StaxEventItemReader.

Thanks.

spring-projects-issues avatar Dec 12 '12 01:12 spring-projects-issues

Thank you for opening the issue. Can you retry with the latest release of Spring Batch and report back the results?

cppwfs avatar Jul 17 '23 13:07 cppwfs