camel-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Chuck Adams (JIRA)" <j...@apache.org>
Subject [jira] Commented: (CAMEL-2687) exec component fails after receiving empty output
Date Fri, 30 Apr 2010 16:05:31 GMT

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

Chuck Adams commented on CAMEL-2687:
------------------------------------

It's always the way with me that I only see my own error after reporting it as a bug... I
can see now that the converter returned an ExecResult as the body instead of converting it
to a string, and that I should therefore be expecting an ExecResult instead of a string. 


Still, the fact that it actually changes the converter for further messages doesn't strike
me as entirely right: I would simply have expected empty output to yield an empty string instead
of a null that magically changes the behavior of the component going forward.



> 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
>
> I have a simple route here:
> {quote}
> public void configure() {
>     from("timer://foo?period=5000")
>     .to("C:/apps/putty/PLINK.EXE?args=cadams@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=[cadams@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=[cadams@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=[cadams@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=[cadams@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=[cadams@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=[cadams@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.ToStringTypeConverter@1e3d24a
> [                           foo] cameltest                      INFO  Exchange[ExchangePattern:InOnly,
BodyType:org.apache.camel.component.exec.ExecResult, Body:org.apache.camel.component.exec.ExecResult@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=[cadams@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=[cadams@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.ExecResult@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.


Mime
View raw message