You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@camel.apache.org by "Claus Ibsen (JIRA)" <ji...@apache.org> on 2010/08/11 16:29:47 UTC

[jira] Resolved: (CAMEL-3045) Flatpack component : unable to set the delimiter parameter in spring config file

     [ https://issues.apache.org/activemq/browse/CAMEL-3045?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Claus Ibsen resolved CAMEL-3045.
--------------------------------

    Fix Version/s: 2.5.0
       Resolution: Fixed

trunk: 984420.

> Flatpack component : unable to set the delimiter parameter in spring config file
> --------------------------------------------------------------------------------
>
>                 Key: CAMEL-3045
>                 URL: https://issues.apache.org/activemq/browse/CAMEL-3045
>             Project: Apache Camel
>          Issue Type: Bug
>          Components: camel-flatpack
>    Affects Versions: 2.4.0
>            Reporter: Richard Sinelle
>            Assignee: Claus Ibsen
>             Fix For: 2.5.0
>
>
> It's not possible to set the delimiter parameter in spring configuration file or I don't find the way to do it !
> For example : 
> <route id="routeA">
>    <from uri="file:src/test/resources/csv?move=done/&amp;fileName=testfileRouteA.csv" />
>    <to uri="flatpack:delim:META-INF/Delimited.pzmap.xml?delimiter=;" />
> </route>
> I get the following error :
> Exception in thread "main" org.apache.camel.RuntimeCamelException: org.apache.camel.FailedToCreateRouteException: Failed to create route routeA at: >>> To[flatpack:delim:META-INF/Delimited.pzmap.xml?ignoreFirstRecord=false&splitRows=true&delimiter=;] <<< in route: Route[[From[file:src/test/resources/csv?move=done/&fileName=... because of Failed to resolve endpoint: flatpack://delim:META-INF/Delimited.pzmap.xml?delimiter=%3B&ignoreFirstRecord=false&splitRows=true due to: Could not find a suitable setter for property: delimiter as there isn't a setter method with same type: java.lang.String nor type conversion possible: No type converter available to convert from type: java.lang.String to the required type: char with value ;
> 	at org.apache.camel.util.ObjectHelper.wrapRuntimeCamelException(ObjectHelper.java:1126)
> 	at org.apache.camel.spring.SpringCamelContext.onApplicationEvent(SpringCamelContext.java:103)
> 	at org.apache.camel.spring.CamelContextFactoryBean.onApplicationEvent(CamelContextFactoryBean.java:231)
> 	at org.springframework.context.event.SimpleApplicationEventMulticaster.multicastEvent(SimpleApplicationEventMulticaster.java:97)
> 	at org.springframework.context.support.AbstractApplicationContext.publishEvent(AbstractApplicationContext.java:303)
> 	at org.springframework.context.support.AbstractApplicationContext.finishRefresh(AbstractApplicationContext.java:911)
> 	at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:428)
> 	at org.springframework.context.support.ClassPathXmlApplicationContext.<init>(ClassPathXmlApplicationContext.java:139)
> 	at org.springframework.context.support.ClassPathXmlApplicationContext.<init>(ClassPathXmlApplicationContext.java:93)
> 	at org.apache.camel.spring.Main.createDefaultApplicationContext(Main.java:219)
> 	at org.apache.camel.spring.Main.doStart(Main.java:173)
> 	at org.apache.camel.impl.ServiceSupport.start(ServiceSupport.java:56)
> 	at org.apache.camel.impl.MainSupport.run(MainSupport.java:114)
> 	at org.apache.camel.impl.MainSupport.run(MainSupport.java:291)
> 	at org.apache.camel.spring.Main.main(Main.java:97)
> If it's a bug, to solve it, it's just necessary to change the class org.apache.camel.component.flatpack.DelimitedEndpoint as below :
> - change the flied definition like this (and getter/setter to):
>     private String delimiter = ",";
>     private String textQualifier = "\"";
> - and the the method createParser like this :
>     public Parser createParser(Exchange exchange) throws InvalidPayloadException, IOException {
>         Reader bodyReader = ExchangeHelper.getMandatoryInBody(exchange, Reader.class);
>         Resource resource = getResource();
>         if (delimiter == null || delimiter.equals(""))
>         	delimiter = ",";        
>         if (textQualifier == null || textQualifier.equals(""))
>         	textQualifier = "\"";
>         if (resource == null) {
>             return getParserFactory().newDelimitedParser(bodyReader, delimiter.charAt(0), textQualifier.charAt(0));
>         } else {
>             return getParserFactory().newDelimitedParser(new InputStreamReader(resource.getInputStream()), bodyReader, delimiter.charAt(0), textQualifier.charAt(0), ignoreFirstRecord);
>         }
>     }

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.