Return-Path: Delivered-To: apmail-cocoon-cvs-archive@www.apache.org Received: (qmail 81289 invoked from network); 28 Jun 2004 08:28:50 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur-2.apache.org with SMTP; 28 Jun 2004 08:28:50 -0000 Received: (qmail 75362 invoked by uid 500); 28 Jun 2004 08:28:58 -0000 Delivered-To: apmail-cocoon-cvs-archive@cocoon.apache.org Received: (qmail 75120 invoked by uid 500); 28 Jun 2004 08:28:54 -0000 Mailing-List: contact cvs-help@cocoon.apache.org; run by ezmlm Precedence: bulk Reply-To: dev@cocoon.apache.org list-help: list-unsubscribe: list-post: Delivered-To: mailing list cvs@cocoon.apache.org Received: (qmail 75091 invoked by uid 500); 28 Jun 2004 08:28:53 -0000 Delivered-To: apmail-cocoon-2.1-cvs@apache.org Received: (qmail 75076 invoked by uid 99); 28 Jun 2004 08:28:53 -0000 X-ASF-Spam-Status: No, hits=0.5 required=10.0 tests=ALL_TRUSTED,NO_REAL_NAME X-Spam-Check-By: apache.org Received: from [209.237.227.194] (HELO minotaur.apache.org) (209.237.227.194) by apache.org (qpsmtpd/0.27.1) with SMTP; Mon, 28 Jun 2004 01:28:53 -0700 Received: (qmail 81040 invoked by uid 1509); 28 Jun 2004 08:28:38 -0000 Date: 28 Jun 2004 08:28:38 -0000 Message-ID: <20040628082838.81039.qmail@minotaur.apache.org> From: stephan@apache.org To: cocoon-2.1-cvs@apache.org Subject: cvs commit: cocoon-2.1/src/blocks/javaflow/test/org/apache/cocoon/components/flow/java/test LinkerContinuable.java PrimitivesFlow.java InnerContinuable.java JavaFlowTestCase.xtest X-Virus-Checked: Checked X-Spam-Rating: minotaur-2.apache.org 1.6.2 0/1000/N stephan 2004/06/28 01:28:38 Modified: src/test/org/apache/cocoon SitemapComponentTestCase.java src/blocks/javaflow/java/org/apache/cocoon/components/flow/java ContinuationClassLoader.java src/blocks/javaflow/java/org/apache/cocoon/components/flow/javascript JavaScriptHelper.java src/blocks/javaflow/test/org/apache/cocoon/components/flow/java/test InnerContinuable.java JavaFlowTestCase.xtest Added: src/blocks/javaflow/test/org/apache/cocoon/components/flow/java/test LinkerContinuable.java PrimitivesFlow.java Log: Further investigation into the LinkageError, no cause found until now. Revision Changes Path 1.8 +7 -1 cocoon-2.1/src/test/org/apache/cocoon/SitemapComponentTestCase.java Index: SitemapComponentTestCase.java =================================================================== RCS file: /home/cvs/cocoon-2.1/src/test/org/apache/cocoon/SitemapComponentTestCase.java,v retrieving revision 1.7 retrieving revision 1.8 diff -u -r1.7 -r1.8 --- SitemapComponentTestCase.java 23 Jun 2004 09:16:31 -0000 1.7 +++ SitemapComponentTestCase.java 28 Jun 2004 08:28:38 -0000 1.8 @@ -178,6 +178,8 @@ * @param parameters Action parameters. */ public final Map act(String type, String source, Parameters parameters) throws Exception { + + redirector.reset(); ComponentSelector selector = null; Action action = null; @@ -410,6 +412,8 @@ public String callFunction(String type, String source, String function, Map params) throws Exception { + redirector.reset(); + ComponentSelector selector = null; Interpreter interpreter = null; SourceResolver resolver = null; @@ -450,6 +454,8 @@ } public String callContinuation(String type, String source, String id, Map params) throws Exception { + + redirector.reset(); ComponentSelector selector = null; Interpreter interpreter = null; 1.13 +18 -2 cocoon-2.1/src/blocks/javaflow/java/org/apache/cocoon/components/flow/java/ContinuationClassLoader.java Index: ContinuationClassLoader.java =================================================================== RCS file: /home/cvs/cocoon-2.1/src/blocks/javaflow/java/org/apache/cocoon/components/flow/java/ContinuationClassLoader.java,v retrieving revision 1.12 retrieving revision 1.13 diff -u -r1.12 -r1.13 --- ContinuationClassLoader.java 26 Jun 2004 18:29:30 -0000 1.12 +++ ContinuationClassLoader.java 28 Jun 2004 08:28:38 -0000 1.13 @@ -113,6 +113,9 @@ protected synchronized Class loadClass(String name, boolean resolve) throws ClassNotFoundException { + + System.out.println("load class "+name); + // this finds also classes, which are already transformed, via findLoadedClass if (debug) System.out.println("load class "+name); @@ -141,6 +144,8 @@ private byte[] transform(JavaClass javaclazz) throws ClassNotFoundException { // make all methods of java class continuable + System.out.println("transforming flow class " + javaclazz.getClassName()); + ClassGen clazz = new ClassGen(javaclazz); ConstantPoolGen cp = clazz.getConstantPool(); @@ -169,6 +174,7 @@ if (isValid(method)) { // analyse the code of the method to create the frame // information about every instruction + System.out.println("analyse " + methods[i].getName()); ControlFlowGraph cfg = new ControlFlowGraph(method); if (debug) @@ -180,7 +186,6 @@ System.out.println("rewriting " + methods[i].getName()); rewrite(method, cfg); - // make last optional check for consistency clazz.replaceMethod(methods[i], method.getMethod()); } } @@ -206,6 +211,17 @@ } clazz.addInterface(CONTINUATIONCAPABLE_CLASS); + + byte[] changed = clazz.getJavaClass().getBytes(); + try { + java.io.FileOutputStream out = new java.io.FileOutputStream(clazz.getClassName() + ".rewritten"); + out.write(changed); + out.flush(); + out.close(); + } catch (java.io.IOException ioe) { + ioe.printStackTrace(); + } + return clazz.getJavaClass().getBytes(); } 1.3 +4 -1 cocoon-2.1/src/blocks/javaflow/java/org/apache/cocoon/components/flow/javascript/JavaScriptHelper.java Index: JavaScriptHelper.java =================================================================== RCS file: /home/cvs/cocoon-2.1/src/blocks/javaflow/java/org/apache/cocoon/components/flow/javascript/JavaScriptHelper.java,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- JavaScriptHelper.java 26 Jun 2004 18:29:30 -0000 1.2 +++ JavaScriptHelper.java 28 Jun 2004 08:28:38 -0000 1.3 @@ -45,6 +45,7 @@ import org.mozilla.javascript.EvaluatorException; import org.mozilla.javascript.Function; import org.mozilla.javascript.JavaScriptException; +import org.mozilla.javascript.NativeGlobal; import org.mozilla.javascript.NativeJavaClass; import org.mozilla.javascript.NativeJavaPackage; import org.mozilla.javascript.PropertyException; @@ -197,6 +198,8 @@ JXPathContextReferenceImpl.addNodePointerFactory(new ScriptablePointerFactory()); try { + NativeGlobal.init(context, scope, false); + scope = new Global(context); // Access to Cocoon internal objects errorReporter = new JSErrorReporter(getLogger()); 1.2 +3 -0 cocoon-2.1/src/blocks/javaflow/test/org/apache/cocoon/components/flow/java/test/InnerContinuable.java Index: InnerContinuable.java =================================================================== RCS file: /home/cvs/cocoon-2.1/src/blocks/javaflow/test/org/apache/cocoon/components/flow/java/test/InnerContinuable.java,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- InnerContinuable.java 26 Jun 2004 18:29:30 -0000 1.1 +++ InnerContinuable.java 28 Jun 2004 08:28:38 -0000 1.2 @@ -12,6 +12,9 @@ } public void doInnerClassTest2() { + + LinkerContinuable.init(null, null, false); + InnerClass ic = new InnerClass(); ic.sendResult2(); } 1.4 +1 -0 cocoon-2.1/src/blocks/javaflow/test/org/apache/cocoon/components/flow/java/test/JavaFlowTestCase.xtest Index: JavaFlowTestCase.xtest =================================================================== RCS file: /home/cvs/cocoon-2.1/src/blocks/javaflow/test/org/apache/cocoon/components/flow/java/test/JavaFlowTestCase.xtest,v retrieving revision 1.3 retrieving revision 1.4 diff -u -r1.3 -r1.4 --- JavaFlowTestCase.xtest 26 Jun 2004 18:29:30 -0000 1.3 +++ JavaFlowTestCase.xtest 28 Jun 2004 08:28:38 -0000 1.4 @@ -80,6 +80,7 @@ + 1.1 cocoon-2.1/src/blocks/javaflow/test/org/apache/cocoon/components/flow/java/test/LinkerContinuable.java Index: LinkerContinuable.java =================================================================== /* * Created on 27.06.2004 * * TODO To change the template for this generated file go to * Window - Preferences - Java - Code Generation - Code and Comments */ package org.apache.cocoon.components.flow.java.test; import org.mozilla.javascript.Context; import org.mozilla.javascript.IdFunction; import org.mozilla.javascript.IdFunctionMaster; import org.mozilla.javascript.JavaScriptException; import org.mozilla.javascript.Scriptable; /** * @author stephan * * TODO To change the template for this generated type comment go to * Window - Preferences - Java - Code Generation - Code and Comments */ public class LinkerContinuable extends IdFunction { /** * @param master * @param name * @param id */ public LinkerContinuable(IdFunctionMaster master, String name, int id) { super(master, name, id); // TODO Auto-generated constructor stub } public static void init(Context cx, Scriptable scope, boolean sealed) { } /* (non-Javadoc) * @see org.mozilla.javascript.IdFunctionMaster#execMethod(int, org.mozilla.javascript.IdFunction, org.mozilla.javascript.Context, org.mozilla.javascript.Scriptable, org.mozilla.javascript.Scriptable, java.lang.Object[]) */ public Object execMethod(int methodId, IdFunction function, Context cx, Scriptable scope, Scriptable thisObj, Object[] args) throws JavaScriptException { // TODO Auto-generated method stub return null; } /* (non-Javadoc) * @see org.mozilla.javascript.IdFunctionMaster#methodArity(int) */ public int methodArity(int methodId) { // TODO Auto-generated method stub return 0; } } 1.1 cocoon-2.1/src/blocks/javaflow/test/org/apache/cocoon/components/flow/java/test/PrimitivesFlow.java Index: PrimitivesFlow.java =================================================================== /* * Copyright 1999-2004 The Apache Software Foundation. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not * use this file except in compliance with the License. You may obtain a copy of * the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the * License for the specific language governing permissions and limitations under * the License. */ package org.apache.cocoon.components.flow.java.test; import junit.framework.TestCase; import org.apache.cocoon.components.flow.java.*; public class PrimitivesFlow extends TestCase implements Continuable { public PrimitivesFlow(String s) { super(s); } public void testPrimitives() { boolean bool = true; byte b = (byte)0xab; double d = 123456789.123456789d; float f = 987654321.987654321f; int i = 9876598; long l = 1234512345l; Object n = null; Object o = new Integer(12345); short s = 12; Continuation.suspend(); assertEquals(bool, true); assertEquals(b, 0xab); assertEquals(d, 123456789.123456789d, 0d); assertEquals(f, 987654321.987654321f, 0f); assertEquals(i, 9876598); assertEquals(l, 1234512345l); assertEquals(n, null); assertEquals(o, new Integer(12345)); assertEquals(s, 12); } }