You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tapestry.apache.org by hl...@apache.org on 2004/03/31 00:40:25 UTC
cvs commit: jakarta-tapestry/junit/mock-scripts TestOptimizeRootExpressionBinding.xml
hlship 2004/03/30 14:40:25
Modified: . status.xml
framework/src/org/apache/tapestry/binding
ExpressionBinding.java
Added: junit/context33/WEB-INF app.application MyConditional.jwc
Home.page MyConditional.html
junit/context33 Home.html README
junit/src/org/apache/tapestry/junit/mock/c33 Visit.java
Home.java
junit/mock-scripts TestOptimizeRootExpressionBinding.xml
Log:
[28010] ExpressionBinding optimizes expressions incorrectly
Revision Changes Path
1.35 +6 -2 jakarta-tapestry/status.xml
Index: status.xml
===================================================================
RCS file: /home/cvs/jakarta-tapestry/status.xml,v
retrieving revision 1.34
retrieving revision 1.35
diff -u -r1.34 -r1.35
--- status.xml 30 Mar 2004 18:45:57 -0000 1.34
+++ status.xml 30 Mar 2004 22:40:24 -0000 1.35
@@ -216,9 +216,13 @@
Create proper OGNL context when checking for invariant OGNL expressions
(when initializing component properties).
</action>
- <action type="fix" dev="HLS" fixed-bug="27628">
+ <action type="fix" dev="HLS" fixes-bug="27628">
DataSqueezer: Incorrect exception message
</action>
+ <action type="fix" dev="HLS" fixes-bug="28010">
+ ExpressionBinding optimizes expressions incorrectly
+ </action>
+
</release>
<release version="3.0-rc-1" date="Mar 15 2004">
1.1 jakarta-tapestry/junit/context33/WEB-INF/app.application
Index: app.application
===================================================================
<?xml version="1.0" encoding="UTF-8"?>
<!--
Copyright 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.
-->
<!-- $Id: app.application,v 1.1 2004/03/30 22:40:24 hlship Exp $ -->
<!DOCTYPE application PUBLIC
"-//Apache Software Foundation//Tapestry Specification 3.0//EN"
"http://jakarta.apache.org/tapestry/dtd/Tapestry_3_0.dtd">
<application>
<property name="org.apache.tapestry.visit-class" value="org.apache.tapestry.junit.mock.c33.Visit"/>
</application>
1.1 jakarta-tapestry/junit/context33/WEB-INF/MyConditional.jwc
Index: MyConditional.jwc
===================================================================
<?xml version="1.0" encoding="UTF-8"?>
<!--
Copyright 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.
-->
<!-- $Id: MyConditional.jwc,v 1.1 2004/03/30 22:40:24 hlship Exp $ -->
<!DOCTYPE component-specification PUBLIC
"-//Apache Software Foundation//Tapestry Specification 3.0//EN"
"http://jakarta.apache.org/tapestry/dtd/Tapestry_3_0.dtd">
<component-specification>
<parameter name="enabled" type="boolean" required="yes" direction="in"/>
</component-specification>
1.1 jakarta-tapestry/junit/context33/WEB-INF/Home.page
Index: Home.page
===================================================================
<?xml version="1.0" encoding="UTF-8"?>
<!--
Copyright 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.
-->
<!-- $Id: Home.page,v 1.1 2004/03/30 22:40:24 hlship Exp $ -->
<!DOCTYPE page-specification PUBLIC
"-//Apache Software Foundation//Tapestry Specification 3.0//EN"
"http://jakarta.apache.org/tapestry/dtd/Tapestry_3_0.dtd">
<page-specification class="org.apache.tapestry.junit.mock.c33.Home"/>
1.1 jakarta-tapestry/junit/context33/WEB-INF/MyConditional.html
Index: MyConditional.html
===================================================================
<!--
Copyright 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.
-->
<!-- $Id: MyConditional.html,v 1.1 2004/03/30 22:40:24 hlship Exp $ -->
<span jwcid="$content$">
<span jwcid="@Conditional" condition="ognl:page.visit.enabled && enabled">
<span jwcid="@RenderBody"/>
</span>
</span>
1.1 jakarta-tapestry/junit/context33/Home.html
Index: Home.html
===================================================================
<!--
Copyright 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.
-->
<!-- $Id: Home.html,v 1.1 2004/03/30 22:40:25 hlship Exp $ -->
<span jwcid="$content$">
<html jwcid="@Shell" title="Expression Optimization">
<body jwcid="@Body">
Disabled: [<span jwcid="@MyConditional" enabled="ognl:false">Disabled</span>]
Enabled: [<span jwcid="@MyConditional" enabled="ognl:true">Enabled</span>]
<a jwcid="@DirectLink" listener="ognl:listeners.enable">enable</a>
</body>
</html>
</span>
1.1 jakarta-tapestry/junit/context33/README
Index: README
===================================================================
Test case for bug 28010 OGNL bug in org.apache.tapestry.binding.ExpressionBinding ?
http://issues.apache.org/bugzilla/show_bug.cgi?id=28010
1.1 jakarta-tapestry/junit/src/org/apache/tapestry/junit/mock/c33/Visit.java
Index: Visit.java
===================================================================
// Copyright 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.tapestry.junit.mock.c33;
/**
* Used for testing expression binding optimization. Stores a global flag
* used to enable or disable the MyConditional component.
*
* @author Howard Lewis Ship
* @version $Id: Visit.java,v 1.1 2004/03/30 22:40:25 hlship Exp $
*/
public class Visit
{
private boolean _enabled;
public boolean isEnabled()
{
return _enabled;
}
public void setEnabled(boolean b)
{
_enabled = b;
}
}
1.1 jakarta-tapestry/junit/src/org/apache/tapestry/junit/mock/c33/Home.java
Index: Home.java
===================================================================
// Copyright 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.tapestry.junit.mock.c33;
import org.apache.tapestry.IRequestCycle;
import org.apache.tapestry.html.BasePage;
/**
* Used to test expression binding optimization.
*
* @author Howard Lewis Ship
* @version $Id: Home.java,v 1.1 2004/03/30 22:40:25 hlship Exp $
*/
public class Home extends BasePage
{
public void enable(IRequestCycle cycle)
{
Visit visit = (Visit) getVisit();
visit.setEnabled(true);
}
}
1.13 +15 -3 jakarta-tapestry/framework/src/org/apache/tapestry/binding/ExpressionBinding.java
Index: ExpressionBinding.java
===================================================================
RCS file: /home/cvs/jakarta-tapestry/framework/src/org/apache/tapestry/binding/ExpressionBinding.java,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -r1.12 -r1.13
--- ExpressionBinding.java 19 Feb 2004 17:37:39 -0000 1.12
+++ ExpressionBinding.java 30 Mar 2004 22:40:25 -0000 1.13
@@ -235,8 +235,10 @@
if (appSpec != null && appSpec.checkExtension(Tapestry.OGNL_TYPE_CONVERTER))
{
- TypeConverter typeConverter = (TypeConverter) appSpec.getExtension(
- Tapestry.OGNL_TYPE_CONVERTER, TypeConverter.class);
+ TypeConverter typeConverter =
+ (TypeConverter) appSpec.getExtension(
+ Tapestry.OGNL_TYPE_CONVERTER,
+ TypeConverter.class);
Ognl.setTypeConverter(_context, typeConverter);
}
@@ -304,6 +306,16 @@
if (checkForConstant())
return;
+
+ try
+ {
+ if (!Ognl.isSimpleNavigationChain(_parsedExpression, getOgnlContext()))
+ return;
+ }
+ catch (OgnlException ex)
+ {
+ throw new BindingException(ex.getMessage(), this, ex);
+ }
// Split the expression into individual property names.
// We then optimize what we can from the expression. This will
1.1 jakarta-tapestry/junit/mock-scripts/TestOptimizeRootExpressionBinding.xml
Index: TestOptimizeRootExpressionBinding.xml
===================================================================
<?xml version="1.0" encoding="UTF-8"?>
<!-- $Id: TestOptimizeRootExpressionBinding.xml,v 1.1 2004/03/30 22:40:25 hlship Exp $ -->
<!--
Copyright 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.
-->
<mock-test>
<context name="c33" root="context33"/>
<servlet name="app" class="org.apache.tapestry.ApplicationServlet"/>
<request>
<assert-regexp name="Disabled">
<![CDATA[
Disabled:\s+\[\s+\]
]]>
</assert-regexp>
<assert-regexp name="Enabled">
<![CDATA[
Enabled:\s+\[\s+\]
]]>
</assert-regexp>
<assert-output name="Link">
<![CDATA[
service=direct/1/Home/$DirectLink
]]>
</assert-output>
</request>
<request>
<parameter name="service" value="direct/1/Home/$DirectLink"/>
<assert-regexp name="Disabled">
<![CDATA[
Disabled:\s+\[\s+\]
]]>
</assert-regexp>
<assert-regexp name="Enabled">
<![CDATA[
Enabled:\s+\[\s*Enabled\s*\]
]]>
</assert-regexp>
</request>
</mock-test>
---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-dev-help@jakarta.apache.org