Return-Path: Delivered-To: apmail-tapestry-dev-archive@www.apache.org Received: (qmail 37914 invoked from network); 2 Apr 2007 14:32:08 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 2 Apr 2007 14:32:08 -0000 Received: (qmail 21049 invoked by uid 500); 2 Apr 2007 14:32:15 -0000 Delivered-To: apmail-tapestry-dev-archive@tapestry.apache.org Received: (qmail 20877 invoked by uid 500); 2 Apr 2007 14:32:14 -0000 Mailing-List: contact commits-help@tapestry.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@tapestry.apache.org Delivered-To: mailing list commits@tapestry.apache.org Received: (qmail 20867 invoked by uid 99); 2 Apr 2007 14:32:14 -0000 Received: from herse.apache.org (HELO herse.apache.org) (140.211.11.133) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 02 Apr 2007 07:32:14 -0700 X-ASF-Spam-Status: No, hits=-99.5 required=10.0 tests=ALL_TRUSTED,NO_REAL_NAME X-Spam-Check-By: apache.org Received: from [140.211.11.3] (HELO eris.apache.org) (140.211.11.3) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 02 Apr 2007 07:32:05 -0700 Received: by eris.apache.org (Postfix, from userid 65534) id 9D3511A9838; Mon, 2 Apr 2007 07:31:45 -0700 (PDT) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r524795 - in /tapestry/tapestry4/trunk: ./ tapestry-annotations/ tapestry-contrib/ tapestry-examples/TimeTracker/ tapestry-examples/Workbench/ tapestry-framework/src/java/org/apache/tapestry/services/impl/ tapestry-portlet/ Date: Mon, 02 Apr 2007 14:31:45 -0000 To: commits@tapestry.apache.org From: jkuhnert@apache.org X-Mailer: svnmailer-1.1.0 Message-Id: <20070402143145.9D3511A9838@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Author: jkuhnert Date: Mon Apr 2 07:31:44 2007 New Revision: 524795 URL: http://svn.apache.org/viewvc?view=rev&rev=524795 Log: The promised fail safe ognl expression evaluator changes. Modified: tapestry/tapestry4/trunk/tapestry-annotations/tapestry-annotations.iml tapestry/tapestry4/trunk/tapestry-contrib/tapestry-contrib.iml tapestry/tapestry4/trunk/tapestry-examples/TimeTracker/TimeTracker.iml tapestry/tapestry4/trunk/tapestry-examples/Workbench/Workbench.iml tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/services/impl/HiveMindExpressionCompiler.java tapestry/tapestry4/trunk/tapestry-portlet/tapestry-portlet.iml tapestry/tapestry4/trunk/tapestry.iml tapestry/tapestry4/trunk/tapestry.ipr tapestry/tapestry4/trunk/tapestry.iws Modified: tapestry/tapestry4/trunk/tapestry-annotations/tapestry-annotations.iml URL: http://svn.apache.org/viewvc/tapestry/tapestry4/trunk/tapestry-annotations/tapestry-annotations.iml?view=diff&rev=524795&r1=524794&r2=524795 ============================================================================== --- tapestry/tapestry4/trunk/tapestry-annotations/tapestry-annotations.iml (original) +++ tapestry/tapestry4/trunk/tapestry-annotations/tapestry-annotations.iml Mon Apr 2 07:31:44 2007 @@ -11,7 +11,7 @@ - + @@ -258,7 +258,6 @@ - Modified: tapestry/tapestry4/trunk/tapestry-contrib/tapestry-contrib.iml URL: http://svn.apache.org/viewvc/tapestry/tapestry4/trunk/tapestry-contrib/tapestry-contrib.iml?view=diff&rev=524795&r1=524794&r2=524795 ============================================================================== --- tapestry/tapestry4/trunk/tapestry-contrib/tapestry-contrib.iml (original) +++ tapestry/tapestry4/trunk/tapestry-contrib/tapestry-contrib.iml Mon Apr 2 07:31:44 2007 @@ -11,7 +11,7 @@ - + @@ -267,7 +267,6 @@ - Modified: tapestry/tapestry4/trunk/tapestry-examples/TimeTracker/TimeTracker.iml URL: http://svn.apache.org/viewvc/tapestry/tapestry4/trunk/tapestry-examples/TimeTracker/TimeTracker.iml?view=diff&rev=524795&r1=524794&r2=524795 ============================================================================== --- tapestry/tapestry4/trunk/tapestry-examples/TimeTracker/TimeTracker.iml (original) +++ tapestry/tapestry4/trunk/tapestry-examples/TimeTracker/TimeTracker.iml Mon Apr 2 07:31:44 2007 @@ -13,7 +13,9 @@ - + + + @@ -337,9 +339,6 @@ - - - Modified: tapestry/tapestry4/trunk/tapestry-examples/Workbench/Workbench.iml URL: http://svn.apache.org/viewvc/tapestry/tapestry4/trunk/tapestry-examples/Workbench/Workbench.iml?view=diff&rev=524795&r1=524794&r2=524795 ============================================================================== --- tapestry/tapestry4/trunk/tapestry-examples/Workbench/Workbench.iml (original) +++ tapestry/tapestry4/trunk/tapestry-examples/Workbench/Workbench.iml Mon Apr 2 07:31:44 2007 @@ -15,7 +15,9 @@ - + + + @@ -249,9 +251,6 @@ - - - Modified: tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/services/impl/HiveMindExpressionCompiler.java URL: http://svn.apache.org/viewvc/tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/services/impl/HiveMindExpressionCompiler.java?view=diff&rev=524795&r1=524794&r2=524795 ============================================================================== --- tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/services/impl/HiveMindExpressionCompiler.java (original) +++ tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/services/impl/HiveMindExpressionCompiler.java Mon Apr 2 07:31:44 2007 @@ -194,12 +194,62 @@ expression.getAccessor().setExpression(expression); } + } catch (CannotCompileException et) { + et.printStackTrace(); + + generateFailSafe(context, expression, root); + } catch (Throwable t) { t.printStackTrace(); + throw new ApplicationRuntimeException("Error compiling expression on object " + root + " with expression node " + expression + " getter body: " + getBody + " setter body: " + setBody, t); } + } + } + + protected void generateFailSafe(OgnlContext context, Node expression, Object root) + { + if (expression.getAccessor() != null) + return; + + try { + ClassFab classFab = _classFactory.newClass(expression.getClass().getName() + expression.hashCode() + "Accessor", Object.class); + classFab.addInterface(ExpressionAccessor.class); + + MethodSignature valueGetter = new MethodSignature(Object.class, "get", new Class[]{OgnlContext.class, Object.class}, null); + MethodSignature valueSetter = new MethodSignature(void.class, "set", new Class[]{OgnlContext.class, Object.class, Object.class}, null); + + MethodSignature expressionSetter = new MethodSignature(void.class, "setExpression", new Class[]{Node.class}, null); + + if (!classFab.containsMethod(expressionSetter)) { + + classFab.addField("_node", Node.class); + classFab.addMethod(Modifier.PUBLIC, expressionSetter, "{ _node = $1; }"); + } + + classFab.addMethod(Modifier.PUBLIC, valueGetter, generateOgnlGetter(classFab, valueGetter)); + + classFab.addMethod(Modifier.PUBLIC, valueSetter, generateOgnlSetter(classFab, valueSetter)); + + + classFab.addConstructor(new Class[0], new Class[0], "{}"); + + Class clazz = ((AbstractFab) classFab).createClass(true); + + expression.setAccessor((ExpressionAccessor) clazz.newInstance()); + + // need to set expression on node if the field was just defined. + + if (classFab.containsMethod(expressionSetter)) { + + expression.getAccessor().setExpression(expression); + } + + } catch (Throwable t) { + + t.printStackTrace(); } } Modified: tapestry/tapestry4/trunk/tapestry-portlet/tapestry-portlet.iml URL: http://svn.apache.org/viewvc/tapestry/tapestry4/trunk/tapestry-portlet/tapestry-portlet.iml?view=diff&rev=524795&r1=524794&r2=524795 ============================================================================== --- tapestry/tapestry4/trunk/tapestry-portlet/tapestry-portlet.iml (original) +++ tapestry/tapestry4/trunk/tapestry-portlet/tapestry-portlet.iml Mon Apr 2 07:31:44 2007 @@ -12,7 +12,7 @@ - + @@ -277,7 +277,6 @@ - Modified: tapestry/tapestry4/trunk/tapestry.iml URL: http://svn.apache.org/viewvc/tapestry/tapestry4/trunk/tapestry.iml?view=diff&rev=524795&r1=524794&r2=524795 ============================================================================== --- tapestry/tapestry4/trunk/tapestry.iml (original) +++ tapestry/tapestry4/trunk/tapestry.iml Mon Apr 2 07:31:44 2007 @@ -45,6 +45,9 @@ + + + Modified: tapestry/tapestry4/trunk/tapestry.ipr URL: http://svn.apache.org/viewvc/tapestry/tapestry4/trunk/tapestry.ipr?view=diff&rev=524795&r1=524794&r2=524795 ============================================================================== --- tapestry/tapestry4/trunk/tapestry.ipr (original) +++ tapestry/tapestry4/trunk/tapestry.ipr Mon Apr 2 07:31:44 2007 @@ -180,7 +180,9 @@ - + + + @@ -188,7 +190,9 @@ - + + + @@ -196,7 +200,17 @@ - + + + + + + + + + + + @@ -204,7 +218,7 @@ - + @@ -212,7 +226,7 @@ - + Modified: tapestry/tapestry4/trunk/tapestry.iws URL: http://svn.apache.org/viewvc/tapestry/tapestry4/trunk/tapestry.iws?view=diff&rev=524795&r1=524794&r2=524795 ============================================================================== --- tapestry/tapestry4/trunk/tapestry.iws (original) +++ tapestry/tapestry4/trunk/tapestry.iws Mon Apr 2 07:31:44 2007 @@ -23,11 +23,9 @@ - - @@ -223,7 +221,7 @@ - + @@ -275,29 +273,12 @@ - + @@ -453,7 +451,7 @@ - + @@ -478,7 +476,7 @@