Re: Bug in ScritpComponent when using "script" attribute
--------------------------------------------------------

                 Key: SM-781
                 URL: https://issues.apache.org/activemq/browse/SM-781
             Project: ServiceMix
          Issue Type: Bug
          Components: servicemix-components
    Affects Versions: 3.0
            Reporter: Andrea Zoppello


When the script component is configured using the "script" attribute instead of 
"scriptText" attribute the components doesn't work.

For example:
   <sm:activationSpec componentName="myGenericGroovymioGroovy" 
service="foo:myGenericGroovymioGroovy"
destinationService="*foo:myScreenOutputmioGroovy*">
  <sm:component>
               <bean
class="org.apache.servicemix.components.groovy.GroovyComponent">
                          <property name="script"
value="c:/tmp/sm/groovy/testsmx.groovy" />
                </bean>
      </sm:component>
</sm:activationSpec>

fails with message: "If no 'compiledScript' is specified you must specify the 
'scriptText'

The problems seems to be in the start() method of  
org.apache.servicemix.components.script.ScriptComponent class.
in the following lines:
....
 if (compiledScript == null) {
            checkScriptTextAvailable();
        }
        if (compiledScript == null) {
            if (engine instanceof Compilable) {
                Compilable compilable = (Compilable) engine;
                compileScript(compilable);
            }
        }
....

I've replaced this code with the code below  and it works correctly:

.....
if ((compiledScript == null) && (script != null)) {
            if (engine instanceof Compilable) {
                Compilable compilable = (Compilable) engine;
                compileScript(compilable);
            }
        }
        if (compiledScript == null) {
            checkScriptTextAvailable();
        }
..... 
  


-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: 
https://issues.apache.org/activemq/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Reply via email to