Hi

I dont think we should probe the file types by default. I doesn't add
so much value and has these potential issue as shown here.
I think we should add an option on the file component to turn this off|on.

Its introduced by: https://issues.apache.org/jira/browse/CAMEL-8357

On Tue, Jan 19, 2016 at 2:58 AM, Willem Jiang <[email protected]> wrote:
> Hi,
>
> It looks like the JVM have some trouble to detect the content type of the 
> file.
>
>
> Java frames: (J=compiled Java code, j=interpreted, Vv=VM code)
> j  sun.nio.fs.GnomeFileTypeDetector.probeUsingGio(J)[B+0
> j  
> sun.nio.fs.GnomeFileTypeDetector.implProbeContentType(Ljava/nio/file/Path;)Ljava/lang/String;+53
> j  
> sun.nio.fs.UnixFileSystemProvider$2.implProbeContentType(Ljava/nio/file/Path;)Ljava/lang/String;+26
> j  
> sun.nio.fs.AbstractFileTypeDetector.probeContentType(Ljava/nio/file/Path;)Ljava/lang/String;+16
> j  
> java.nio.file.Files.probeContentType(Ljava/nio/file/Path;)Ljava/lang/String;+47
> j  
> org.apache.camel.component.file.GenericFile.populateHeaders(Lorg/apache/camel/component/file/GenericFileMessage;)V+84
>
> To Fix this issue, you may need to write your own FileTypeDetector[1].
>
>
> [1]http://stackoverflow.com/questions/22679201/java-probecontenttype
>
> --
> Willem Jiang
>
>
> Blog: http://willemjiang.blogspot.com (English)
> http://jnn.iteye.com (Chinese)
> Twitter: willemjiang
> Weibo: 姜宁willem
>
>
>
> On January 18, 2016 at 7:48:20 PM, Hubertus.Willuhn 
> ([email protected]) wrote:
>> Hi Community,
>>
>> i got an error reading 4 directory (with 1 file per directory) in 4 routes
>> with file: endpoint.
>> I use Camel 2.16.1 and Spring 4.1.8 as well as Spring Boot 1.2.7.
>>
>> After Compiling my code the app starts normal via Spring Boot but after
>> initializing my routes the
>> app crashes with error:
>>
>> # A fatal error has been detected by the Java Runtime Environment:
>> (process:15444): GLib-GObject-CRITICAL **: g_object_new: assertion
>> `G_TYPE_IS_OBJECT (object_type)' failed
>> #
>> # SIGSEGV (0xb) at pc=0x00007fd4f12ed5e9, pid=15444, tid=140552575444736
>> [thread 140552572286720 also had an error]
>> #
>> # JRE version: Java(TM) SE Runtime Environment (8.0_45-b14) (build
>> 1.8.0_45-b14)
>> # Java VM: Java HotSpot(TM) 64-Bit Server VM (25.45-b02 mixed mode
>> linux-amd64 compressed oops)
>> # Problematic frame:
>> # C [libglib-2.0.so.0+0x595e9] g_slice_alloc+0x139
>> #
>> # Failed to write core dump. Core dumps have been disabled. To enable core
>> dumping, try "ulimit -c unlimited" before starting Java again
>> #
>> # An error report file with more information is saved as:
>>
>> The saved error log can you see as an attachment: error.log
>>
>>
>> My routes are 4 classes (one for every directory) which got there routes
>> from a abstract base class.
>> Configuration is correct. So all parameters are set.
>>
>> The main base route looks like:
>>
>> from(producer())
>> // split document on each record
>> .split().xtokenize(splitPath(), extractionMode(),
>> namespaces()).streaming()
>> //.tokenizeXML(this.splitPath(), this.root()).streaming()
>> // threading
>> .parallelProcessing().executorServiceRef(CamelConfig.THREAD_POOL_NAME)
>> // TODO filter by parameter
>> //.filter(simple("${exchangeProperty.CamelSplitIndex} > 46000"))
>> //.setHeader(RECID, this.id())
>> .process(processor())
>> .to(consumer())
>> //.end() // filter
>> .end() // split
>> .stop();
>>
>> The next class implementing some of the parameter functions looks like
>>
>> protected String baseDir;
>>
>> @Override
>> protected Processor processor()
>> {
>> return (exchange -> {
>> String body = exchange.getIn().getBody(String.class);
>>
>> // remove whitespaces
>> body = body.trim();
>>
>> RegEx regex = new RegEx(">\\s+<").exec(body);
>>
>> body = regex.replaceAll("><");
>>
>> // extract record id
>> regex = new RegEx(idExpression()).exec(body);
>>
>> if(!regex.hits()) {
>> throw new IllegalArgumentException("Invalid XML-content detected: no
>> record id found.");
>> }
>>
>> exchange.getIn().setBody(body, String.class);
>> exchange.getIn().setHeader(RECID, regex.group(1));
>> });
>> }
>>
>> protected String idExpression()
>> {
>> return "> }
>>
>> and the last level did the endpoint declaration for the directory:
>>
>> @Override
>> public Endpoint producer()
>> {
>> return endpoint("file:" + this.baseDir + "/srv" + "?noop=true");
>> }
>>
>> @Override
>> public Endpoint consumer()
>> {
>> return endpoint(WI_Aggregator.ENDPOINT);
>> }
>>
>> @Override
>> protected String splitPath()
>> {
>> return "/CENSRV/WI";
>> }
>>
>> Did somebody got an idea what to do?
>>
>> Best regards
>>
>> Hubertus
>>
>>
>>
>> --
>> View this message in context: 
>> http://camel.465427.n5.nabble.com/Error-Reading-Files-from-four-different-Routes-tp5776391.html
>> Sent from the Camel - Users mailing list archive at Nabble.com.
>>
>



-- 
Claus Ibsen
-----------------
http://davsclaus.com @davsclaus
Camel in Action 2: https://www.manning.com/ibsen2

Reply via email to