Return-Path: X-Original-To: apmail-groovy-notifications-archive@minotaur.apache.org Delivered-To: apmail-groovy-notifications-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 6B6C218751 for ; Sun, 5 Jul 2015 14:57:43 +0000 (UTC) Received: (qmail 66859 invoked by uid 500); 5 Jul 2015 14:57:43 -0000 Delivered-To: apmail-groovy-notifications-archive@groovy.apache.org Received: (qmail 66835 invoked by uid 500); 5 Jul 2015 14:57:43 -0000 Mailing-List: contact notifications-help@groovy.incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@groovy.incubator.apache.org Delivered-To: mailing list notifications@groovy.incubator.apache.org Received: (qmail 66826 invoked by uid 99); 5 Jul 2015 14:57:43 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Sun, 05 Jul 2015 14:57:43 +0000 X-ASF-Spam-Status: No, hits=-2000.6 required=5.0 tests=ALL_TRUSTED,RP_MATCHES_RCVD X-Spam-Check-By: apache.org Received: from [140.211.11.3] (HELO mail.apache.org) (140.211.11.3) by apache.org (qpsmtpd/0.29) with SMTP; Sun, 05 Jul 2015 14:55:33 +0000 Received: (qmail 65120 invoked by uid 99); 5 Jul 2015 14:56:04 -0000 Received: from arcas.apache.org (HELO arcas.apache.org) (140.211.11.28) by apache.org (qpsmtpd/0.29) with ESMTP; Sun, 05 Jul 2015 14:56:04 +0000 Date: Sun, 5 Jul 2015 14:56:04 +0000 (UTC) From: "Pascal Schumacher (JIRA)" To: notifications@groovy.incubator.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Updated] (GROOVY-7351) Behaviour difference between GroovyEngine and CachingGroovyEngine MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 X-Virus-Checked: Checked by ClamAV on apache.org [ https://issues.apache.org/jira/browse/GROOVY-7351?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Pascal Schumacher updated GROOVY-7351: -------------------------------------- Description: When using BSF to interact with GroovyEngine it was seen that a Groovy class that was created as a result of a previous execution was not available for subsequent execution when GroovyEngine was used. If CachingGroovyEngine was used, it would work. Sample code is given below {code} public class GroovyUsePreviousClass { public static void main(String[] args) { try { String myScript1 = "public class BSFHelloWorld {\n public static void main(" + "String[] args ) { println(\'BSF: main: Hello World!\'); }\n };"; String myScript2 = "import BSFHelloWorld;\n inst = new BSFHelloWorld();\n"; BSFManager bsfm = new BSFManager(); // Problem can be resolved by uncommenting the line below: //BSFManager.registerScriptingEngine("groovy", "org.codehaus.groovy.bsf.CachingGroovyEngine", new String[]{"groovy", "gy"}); BSFEngine anEngine = bsfm.loadScriptingEngine("groovy"); anEngine.exec("Step HelloWorld1", 0, 0, myScript1) ; anEngine.exec("Step HelloWorld2", 0, 0, myScript2) ; } catch (BSFException bse) { bse.printStackTrace(); } } }{code} was: When using BSF to interact with GroovyEngine it was seen that a Groovy class that was created as a result of a previous execution was not available for subsequent execution when GroovyEngine was used. If CachingGroovyEngine was used, it would work. Sample code is given below public class GroovyUsePreviousClass { public static void main(String[] args) { try { String myScript1 = "public class BSFHelloWorld {\n public static void main(" + "String[] args ) { println(\'BSF: main: Hello World!\'); }\n };"; String myScript2 = "import BSFHelloWorld;\n inst = new BSFHelloWorld();\n"; BSFManager bsfm = new BSFManager(); // Problem can be resolved by uncommenting the line below: //BSFManager.registerScriptingEngine("groovy", "org.codehaus.groovy.bsf.CachingGroovyEngine", new String[]{"groovy", "gy"}); BSFEngine anEngine = bsfm.loadScriptingEngine("groovy"); anEngine.exec("Step HelloWorld1", 0, 0, myScript1) ; anEngine.exec("Step HelloWorld2", 0, 0, myScript2) ; } catch (BSFException bse) { bse.printStackTrace(); } } > Behaviour difference between GroovyEngine and CachingGroovyEngine > ----------------------------------------------------------------- > > Key: GROOVY-7351 > URL: https://issues.apache.org/jira/browse/GROOVY-7351 > Project: Groovy > Issue Type: Bug > Components: GroovyScriptEngine > Affects Versions: 2.3.3 > Reporter: Sebu Koleth > > When using BSF to interact with GroovyEngine it was seen that a Groovy class that was created as a result of a previous execution was not available for subsequent execution when GroovyEngine was used. > If CachingGroovyEngine was used, it would work. > Sample code is given below > {code} > public class GroovyUsePreviousClass { > public static void main(String[] args) { > try { > String myScript1 = "public class BSFHelloWorld {\n public static void main(" + > "String[] args ) { println(\'BSF: main: Hello World!\'); }\n };"; > String myScript2 = "import BSFHelloWorld;\n inst = new BSFHelloWorld();\n"; > BSFManager bsfm = new BSFManager(); > // Problem can be resolved by uncommenting the line below: > //BSFManager.registerScriptingEngine("groovy", "org.codehaus.groovy.bsf.CachingGroovyEngine", new String[]{"groovy", "gy"}); > BSFEngine anEngine = bsfm.loadScriptingEngine("groovy"); > anEngine.exec("Step HelloWorld1", 0, 0, myScript1) ; > anEngine.exec("Step HelloWorld2", 0, 0, myScript2) ; > } catch (BSFException bse) { > bse.printStackTrace(); > } > } > }{code} -- This message was sent by Atlassian JIRA (v6.3.4#6332)