pradeepsjsu / beanio

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

Using value in segment causes NPE #72

Closed GoogleCodeExporter closed 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. Using attached beanio.xml and examplefile.txt
2. Attempt to parse file
3.

What is the expected output? What do you see instead?
Fails to run, returns a NPE.

This will work however if i remove the value="statusCode" and instead replace 
it with a class that has both of the segment's fields in it.

Same issue occurs if i use value and collection="list"

What version of BeanIO are you using? What JDK version?
BeanIO-2.0.5
JDK 6

Please provide any additional information below.

Stacktrace:
java.lang.NullPointerException
    at org.beanio.internal.compiler.ParserFactorySupport.reflectCollectionType(ParserFactorySupport.java:1045)
    at org.beanio.internal.compiler.ParserFactorySupport.createAggregation(ParserFactorySupport.java:896)
    at org.beanio.internal.compiler.ParserFactorySupport.initializeSegmentIteration(ParserFactorySupport.java:608)
    at org.beanio.internal.compiler.ParserFactorySupport.initializeSegment(ParserFactorySupport.java:596)
    at org.beanio.internal.compiler.ProcessorSupport.handleComponent(ProcessorSupport.java:131)
    at org.beanio.internal.compiler.ProcessorSupport.handleComponent(ProcessorSupport.java:125)
    at org.beanio.internal.compiler.ProcessorSupport.handleComponent(ProcessorSupport.java:117)
    at org.beanio.internal.compiler.ProcessorSupport.handleComponent(ProcessorSupport.java:109)
    at org.beanio.internal.compiler.ProcessorSupport.process(ProcessorSupport.java:46)
    at org.beanio.internal.compiler.ParserFactorySupport.createStream(ParserFactorySupport.java:92)
    at org.beanio.internal.compiler.StreamCompiler.createStreamDefinitions(StreamCompiler.java:130)
    at org.beanio.internal.compiler.StreamCompiler.loadMapping(StreamCompiler.java:84)
    at org.beanio.internal.DefaultStreamFactory.load(DefaultStreamFactory.java:52)
    at org.beanio.StreamFactory.load(StreamFactory.java:258)
    at org.beanio.StreamFactory.load(StreamFactory.java:234)
    at org.beanio.StreamFactory.load(StreamFactory.java:223)
    at com.kobie.alchemy.fbpr.files.FlatWormTest.process(FlatWormTest.java:31)
    at com.kobie.alchemy.fbpr.files.FlatWormTest.main(FlatWormTest.java:15)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:597)
    at com.intellij.rt.execution.application.AppMain.main(AppMain.java:120)

Original issue reported on code.google.com by seph...@gmail.com on 11 Apr 2013 at 8:51

Attachments:

GoogleCodeExporter commented 8 years ago
A NPE is never good (and definitely a bug), but try assigning a type to those 
fields:

  <field name="reasonCode" type="string" length="2" />
  <field name="statusCode" type="string" length="2" />

Thanks,
Kevin

Original comment by kevin.s...@gmail.com on 11 Apr 2013 at 10:16

GoogleCodeExporter commented 8 years ago
Tried what you suggested and Still have the same error.

Original comment by seph...@gmail.com on 12 Apr 2013 at 2:23

Attachments:

GoogleCodeExporter commented 8 years ago
Fixed for 2.0.6- snapshot JAR attached.  Let me know if you have any further 
issues.

Thanks,
Kevin

Original comment by kevin.s...@gmail.com on 15 Apr 2013 at 1:27

Attachments:

GoogleCodeExporter commented 8 years ago
Verified this fixed the issue.

Thanks!

Original comment by seph...@gmail.com on 16 Apr 2013 at 2:10

GoogleCodeExporter commented 8 years ago

Original comment by kevin.s...@gmail.com on 21 May 2013 at 2:41