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

Claus Ibsen reassigned CAMEL-2687:
----------------------------------

    Assignee: Claus Ibsen

> exec component fails after receiving empty output
> -------------------------------------------------
>
>                 Key: CAMEL-2687
>                 URL: https://issues.apache.org/activemq/browse/CAMEL-2687
>             Project: Apache Camel
>          Issue Type: Bug
>          Components: camel-core
>    Affects Versions: 2.3.0
>         Environment: windows XP, jdk 1.6
>            Reporter: Chuck Adams
>            Assignee: Claus Ibsen
>
> I have a simple route here:
> {quote}
> public void configure() {
>     from("timer://foo?period=5000")
>     .to("C:/apps/putty/plink.exe?args=cad...@labmachine  -i 
> C:/apps/putty/priv/chuck.ppk \"ls /tmp/foo\"")
>     .to("log:experiments.cameltest");
> }
> {quote}
> This just runs a dummy command on a remote machine every five seconds.  
> Normally it has no problems as long as /tmp/foo has contents.  For example, I 
> create 'bar' and 'baz' files, and the log reflects this:
> {quote}
> [                          main] DefaultCamelContext            INFO  Apache 
> Camel 2.3-SNAPSHOT (CamelContext: camelContext) started in 734 millis
> [                           foo] ExecProducer                   INFO  
> Executing ExecCommand [args=[cad...@labmachine, -i, 
> C:/apps/putty/priv/chuck.ppk, ls /tmp/foo], 
> executable=C:/apps/putty/PLINK.EXE, timeout=9223372036854775807, 
> outFile=null, workingDir=null]
> [                           foo] ExecProducer                   INFO  The 
> command ExecCommand [args=[cad...@labmachine, -i, 
> C:/apps/putty/priv/chuck.ppk, ls /tmp/foo], 
> executable=C:/apps/putty/PLINK.EXE, timeout=9223372036854775807, 
> outFile=null, workingDir=null] had exit value 0
> [                           foo] cameltest                      INFO  
> Exchange[ExchangePattern:InOnly, 
> BodyType:org.apache.camel.component.exec.ExecResult, Body:bar
> baz
> blah
> ]
> [                           foo] ExecProducer                   INFO  
> Executing ExecCommand 
> [args=[cad...@spamlab-bizintel-corpus01.eng.symantec.com, -i, 
> C:/apps/putty/priv/chuck.ppk, ls /tmp/foo], 
> executable=C:/apps/putty/PLINK.EXE, timeout=9223372036854775807, 
> outFile=null, workingDir=null]
> [                           foo] ExecProducer                   INFO  The 
> command ExecCommand [args=[cad...@spamlab-bizintel-corpus01.eng.symantec.com, 
> -i, C:/apps/putty/priv/chuck.ppk, ls /tmp/foo], 
> executable=C:/apps/putty/PLINK.EXE, timeout=9223372036854775807, 
> outFile=null, workingDir=null] had exit value 0
> [                           foo] cameltest                      INFO  
> Exchange[ExchangePattern:InOnly, 
> BodyType:org.apache.camel.component.exec.ExecResult, Body:bar
> baz
> blah
> ]
> {quote}
> And so on....  But if I delete both files, this is what happens:
> {quote}
> [                           foo] ExecProducer                   INFO  
> Executing ExecCommand [args=[cad...@labmachine, -i, 
> C:/apps/putty/priv/chuck.ppk, ls /tmp/foo], 
> executable=C:/apps/putty/PLINK.EXE, timeout=9223372036854775807, 
> outFile=null, workingDir=null]
> [                           foo] ExecProducer                   INFO  The 
> command ExecCommand [args=[cad...@labmachine, -i, 
> C:/apps/putty/priv/chuck.ppk, ls /tmp/foo], 
> executable=C:/apps/putty/PLINK.EXE, timeout=9223372036854775807, 
> outFile=null, workingDir=null] had exit value 0
> [                           foo] ExecResultConverter            WARN  
> Received null stdout of the ExecResult for conversion!
> [                           foo] DefaultTypeConverter           WARN  
> Overriding type converter from: StaticMethodTypeConverter: public static 
> java.lang.String 
> org.apache.camel.component.exec.ExecResultConverter.convertToString(org.apache.camel.component.exec.ExecResult,org.apache.camel.Exchange)
>  throws java.io.FileNotFoundException to: 
> org.apache.camel.impl.converter.tostringtypeconver...@1e3d24a
> [                           foo] cameltest                      INFO  
> Exchange[ExchangePattern:InOnly, 
> BodyType:org.apache.camel.component.exec.ExecResult, 
> Body:org.apache.camel.component.exec.execres...@d767dc]
> {quote}
> And from that point on, even if I add files to the directory again, I get 
> nothing back, just the following log section over and over.  It seems that 
> the behavior of suddenly switching the converter to ToStringTypeConverter had 
> the effect of suppressing all output for good.  
> {quote}
> [                           foo] ExecProducer                   INFO  
> Executing ExecCommand [args=[cad...@labmachine, -i, 
> C:/apps/putty/priv/chuck.ppk, ls /tmp/foo], 
> executable=C:/apps/putty/PLINK.EXE, timeout=9223372036854775807, 
> outFile=null, workingDir=null]
> [                           foo] ExecProducer                   INFO  The 
> command ExecCommand [args=[cad...@labmachine, -i, 
> C:/apps/putty/priv/chuck.ppk, ls /tmp/foo], 
> executable=C:/apps/putty/PLINK.EXE, timeout=9223372036854775807, 
> outFile=null, workingDir=null] had exit value 0
> [                           foo] cameltest                      INFO  
> Exchange[ExchangePattern:InOnly, 
> BodyType:org.apache.camel.component.exec.ExecResult, 
> Body:org.apache.camel.component.exec.execres...@3aacb4]
> {quote}
> This behavior is certainly unexpected and undesireable.  I've been working 
> around this by making my remote script always produce some dummy output when 
> they otherwise have nothing to return, but any workaround I could use on the 
> Camel side pending a more permanent fix would be very much appreciated.

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

Reply via email to