tommysiu / beanio

Automatically exported from code.google.com/p/beanio
Apache License 2.0
0 stars 0 forks source link

@Group annotation ignores order flag #128

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?  If applicable, please provide a
mapping configuration and sample record input to recreate the problem.

1. Create a Group with one Record and one inner Group
2. Annotate Record with order=1 and inner Group with order=2

What is the expected output?

Text is parsed with no errors.

What do you see instead?

Exception in thread "main" org.beanio.BeanIOConfigurationException: Invalid 
group 'group1', in stream 'test': Order must be set all children at a group 
level, or none at all
    at org.beanio.internal.compiler.ProcessorSupport.process(ProcessorSupport.java:93)
    at org.beanio.internal.compiler.ParserFactorySupport.createStream(ParserFactorySupport.java:88)
    at org.beanio.internal.compiler.StreamCompiler.build(StreamCompiler.java:66)
    at org.beanio.internal.DefaultStreamFactory.define(DefaultStreamFactory.java:53)
    at Main.main(Main.java:19)
Caused by: org.beanio.BeanIOConfigurationException: Order must be set all 
children at a group level, or none at all
    at org.beanio.internal.compiler.Preprocessor.finalizeGroup(Preprocessor.java:198)
    at org.beanio.internal.compiler.ProcessorSupport.handleComponent(ProcessorSupport.java:119)
    at org.beanio.internal.compiler.ProcessorSupport.handleComponent(ProcessorSupport.java:109)
    at org.beanio.internal.compiler.ProcessorSupport.process(ProcessorSupport.java:46)
    ... 4 more

What version of BeanIO are you using? What JDK version?

BeanIO 2.1.0
java version "1.8.0_11"
Java(TM) SE Runtime Environment (build 1.8.0_11-b12)

Please provide any additional information below.

This error occurs because 
org.beanio.internal.config.annotation.AnnotationParser doesn't set 
GroupConfig's order inside the method createGroup(TypeInfo info, Group group).

I've attached a test case and a patch for AnnotationParser.

Original issue reported on code.google.com by ricardom...@gmail.com on 17 Nov 2014 at 5:47

Attachments:

GoogleCodeExporter commented 8 years ago
I have the same issue coming. Please let me know the fix. Thank you very much

Original comment by waheed9...@gmail.com on 28 Jan 2015 at 6:28