camel-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Charles Moulliard (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (CAMEL-5423) NPE with Camel 2.10.0 and Bindy
Date Wed, 11 Jul 2012 05:36:33 GMT

    [ https://issues.apache.org/jira/browse/CAMEL-5423?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13411250#comment-13411250
] 

Charles Moulliard commented on CAMEL-5423:
------------------------------------------

Where do you deploy your camel project (JBoss, WebSphere, Tomcat, ...)? According to camel-bindy
code, the NPE is generated when we try to get the package and name from the type. As the type
object is not null, this is the package object which should be null.

    public void initModel() throws Exception {
        // Find classes defined as Model
        if (packageNames != null)  {
            initModelClasses(this.packageNames);
        } else if (type != null) {
            // use the package name from the type as it may refer to types in the same package
            String pckName = type.getPackage().getName(); // NPE generated here

According to Java Doc, the package could be null if no package object was created by the class
loader of this class

http://docs.oracle.com/javase/6/docs/api/java/lang/Class.html#getPackage()
                
> NPE with Camel 2.10.0 and Bindy
> -------------------------------
>
>                 Key: CAMEL-5423
>                 URL: https://issues.apache.org/jira/browse/CAMEL-5423
>             Project: Camel
>          Issue Type: Bug
>          Components: camel-bindy
>    Affects Versions: 2.10.0
>         Environment: Windows 7, Java 1.6.0_31
>            Reporter: Renato Weiner
>            Priority: Minor
>
> Running this route:
> from("direct:start").unmarshal().bindy(BindyType.Csv, services.billing.BillingItem.class).to("direct:middle");
> Where services.billing.BillingItem.class exists and has the following annotations:
> @CsvRecord(separator = ",", quote = "\"", skipFirstLine = true)
> public class BillingItem {
> ...
> It throws a NPE:
> java.lang.NullPointerException
> 	at org.apache.camel.dataformat.bindy.BindyAbstractFactory.initModel(BindyAbstractFactory.java:81)
> 	at org.apache.camel.dataformat.bindy.BindyAbstractFactory.<init>(BindyAbstractFactory.java:65)
> 	at org.apache.camel.dataformat.bindy.BindyCsvFactory.<init>(BindyCsvFactory.java:76)
> 	at org.apache.camel.dataformat.bindy.csv.BindyCsvDataFormat.createModelFactory(BindyCsvDataFormat.java:261)
> 	at org.apache.camel.dataformat.bindy.BindyAbstractDataFormat.getFactory(BindyAbstractDataFormat.java:69)
> 	at org.apache.camel.dataformat.bindy.csv.BindyCsvDataFormat.unmarshal(BindyCsvDataFormat.java:108)
> 	at org.apache.camel.processor.UnmarshalProcessor.process(UnmarshalProcessor.java:57)
> 	at org.apache.camel.util.AsyncProcessorConverterHelper$ProcessorToAsyncProcessorBridge.process(AsyncProcessorConverterHelper.java:61)
> 	at org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:73)
> 	at org.apache.camel.processor.DelegateAsyncProcessor.processNext(DelegateAsyncProcessor.java:99)
> 	at org.apache.camel.processor.DelegateAsyncProcessor.process(DelegateAsyncProcessor.java:90)
> 	at org.apache.camel.management.InstrumentationProcessor.process(InstrumentationProcessor.java:73)
> 	at org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:73)
> 	at org.apache.camel.processor.DelegateAsyncProcessor.processNext(DelegateAsyncProcessor.java:99)
> 	at org.apache.camel.processor.DelegateAsyncProcessor.process(DelegateAsyncProcessor.java:90)
> 	at org.apache.camel.processor.interceptor.TraceInterceptor.process(TraceInterceptor.java:163)
> 	at org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:73)
> 	at org.apache.camel.processor.RedeliveryErrorHandler.processErrorHandler(RedeliveryErrorHandler.java:330)
> 	at org.apache.camel.processor.RedeliveryErrorHandler.process(RedeliveryErrorHandler.java:220)
> When I change the code to:
> from("direct:start").unmarshal().bindy(BindyType.Csv, "services.billing").to("direct:middle");
> It works.
> Expected result: if this the incorrect way to use, it should return a readable message.
> Thanks.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Mime
View raw message