Re: T4: bug in expression cache?

2009-10-26 Thread Marc van Kempen

Hi Andreas,

I've tried Tapestry 4.1.6, same result :( And my ognl version is 2.7.3.

Are you able to reproduce it with the code I sent?

Cheers,
Marc.

On Oct 24, 2009, at 21:03 , Andreas Andreou wrote:


Hmm - don't see anything wrong... Are you using the latest ognl ...
afaik it's 2.7.3

Also, even though i dont remember (and kind find) any such bug report,
how hard is
it to try this with 4.1.6 ?

On Sat, Oct 24, 2009 at 9:08 PM, Marc van Kempen   
wrote:

Hi Andreas,

When the application starts, first a page is displayed that  
contains the
HelpBalloonDialog component, hence it's script expression is  
compiled into
the expression cache. Then I open a page that uses the Dialog  
component, now
it seems to retrieve the compiled expression for the other script  
and poof!


Here is the exception:

[ +/- ] Exception: Unable to read OGNL expression 'expression>'
of {component=$dialog_...@b03d85e5[assetsmanagement/fileManager. 
$Dialog],

widget=dialog,
props={"bgColor":"black","bgOpacity": 
0.400059604645 
,"followScroll":true,"closeOnBackgroundClick":false,"blockDuration": 
0,"lifeTime":0,"toggle":"fade","toggleDuration":150}}:
$Dialog_142 cannot be cast to  
nl.relate4u.pcc.contexthelp.HelpBalloonDialog

org.apache.hivemind.ApplicationRuntimeException
location:   classpath:/org/apache/tapestry/dojo/html/ 
Dialog.script, line

36, column 43
31   
32   
33
34   
35
tapestry.widget.synchronizeWidgetState("${component.clientId}",  
"Dialog",

${props}, ${component.destroy});
36   
37   dojo.widget.byId("${component.clientId}").hide 
();

38   
39   
40   dojo.widget.byId("${component.clientId}").show 
();

41   

[ +/- ] Exception: Unable to read OGNL expression 'expression>'
of {component=$dialog_...@b03d85e5[assetsmanagement/fileManager. 
$Dialog],

widget=dialog,
props={"bgColor":"black","bgOpacity": 
0.400059604645 
,"followScroll":true,"closeOnBackgroundClick":false,"blockDuration": 
0,"lifeTime":0,"toggle":"fade","toggleDuration":150}}:
$Dialog_142 cannot be cast to  
nl.relate4u.pcc.contexthelp.HelpBalloonDialog

 [ +/- ] Exception: $Dialog_142 cannot be cast to
nl.relate4u.pcc.contexthelp.HelpBalloonDialog
java.lang.ClassCastException
Stack Trace:
$ASTChain_12487ac4bf9.get($ASTChain_12487ac4bf9.java)
org.apache.tapestry.services.impl.ExpressionEvaluatorImpl.read 
(ExpressionEvaluatorImpl.java:141)
org.apache.tapestry.services.impl.ExpressionEvaluatorImpl.read 
(ExpressionEvaluatorImpl.java:110)
$ExpressionEvaluator_12487ac4a68.read 
($ExpressionEvaluator_12487ac4a68.java)
org.apache.tapestry.script.ScriptSessionImpl.evaluate 
(ScriptSessionImpl.java:86)
org.apache.tapestry.script.ScriptSessionImpl.evaluate 
(ScriptSessionImpl.java:91)
org.apache.tapestry.script.AbstractToken.evaluateBoolean 
(AbstractToken.java:102)

org.apache.tapestry.script.IfToken.evaluate(IfToken.java:43)
org.apache.tapestry.script.IfToken.write(IfToken.java:48)
org.apache.tapestry.script.AbstractToken.writeChildren 
(AbstractToken.java:71)

org.apache.tapestry.script.InitToken.write(InitToken.java:43)
org.apache.tapestry.script.AbstractToken.writeChildren 
(AbstractToken.java:71)

org.apache.tapestry.script.ParsedScript.execute(ParsedScript.java:82)
org.apache.tapestry.dojo.html.Dialog.renderWidget(Dialog.java:106)
(rest of stack trace omitted)
Here is the code for HelpBalloonDialog (the dialog component is the  
standard

Tapestry component included in the distribution):

HelpBalloonDialog.java:

package nl.relate4u.pcc.contexthelp;

import java.util.HashMap;
import java.util.Map;

import org.apache.tapestry.IMarkupWriter;
import org.apache.tapestry.IRequestCycle;
import org.apache.tapestry.IScript;
import org.apache.tapestry.TapestryUtils;
import org.apache.tapestry.dojo.AbstractWidget;
import org.apache.tapestry.services.ResponseBuilder;

/**
 * Implementation of HelpBalloons, by calling custom javascript code.
 */
public abstract class HelpBalloonDialog extends AbstractWidget {
   public abstract boolean isHidden();

   public abstract void setHidden(boolean hidden);

   public abstract String getIconElementId();

   public abstract void setIconElementId(String v);

   public abstract void setTitle(String title);

   public abstract String getTitle();

   public void show() {
   setHidden(false);
   }

   public void hide() {
   setHidden(true);
   }

   /**
* {...@inheritdoc}
*/
   public void renderWidget(IMarkupWriter writer, IRequestCycle  
cycle) {

   if (!cycle.isRewinding()) {
   writer.begin(getTemplateTagName()); // use element  
specified
   renderIdAttribute(writer, cycle);

Re: T4: bug in expression cache?

2009-10-24 Thread Marc van Kempen
ng()) {
if (!getResponseBuilder 
().isInitializationScriptAllowed(this)) {

getResponseBuilder().updateComponent(getId());
}

getResponseBuilder().addScriptAfterInitialization(this,
"dojo.widget.byId('" + getClientId() +  
"').checkSize();");

}
}
}

public abstract ResponseBuilder getResponseBuilder();

// TODO left over from Dialog code, do we need the resize stuff??
public abstract boolean isResizing();

public abstract void setResizing(boolean value);

/** injected. */
public abstract IScript getScript();
}

HelpBalloonDialog.jwc:


http://tapestry.apache.org/dtd/Tapestry_4_0.dtd";>

class="nl.relate4u.pcc.contexthelp.HelpBalloonDialog"
 allow-body="yes" allow-informal- 
parameters="yes">



Creates a HelpBalloon Dialog.






object="HelpBalloonDialog.script"/>




HelpBalloonDialog.script:


"-//Apache Software Foundation//Tapestry Script Specification  
3.0//EN"

"http://tapestry.apache.org/dtd/Script_3_0.dtd";>

<input-symbol key="component" required="yes" />

<initialization>
<if expression="component.hidden">
if (helpBalloonPlaceHolder) {
helpBalloonPlaceHolder.hide();
/*
</pre><tt>	 * remove the help balloon dialog from the balloon and  
</tt><tt>put it back
</tt><pre style="margin: 0em;">
 * under the helpBalloonUpdateArea (which is not visible)
 */
</pre><tt>	var helpBalloonDialog = document.getElementById('$ 
</tt><tt>{component.clientId}');
</tt><tt>	helpBalloonDialog.parentNode.removeChild 
</tt><tt>(helpBalloonDialog);
</tt><tt>	document.getElementById 
</tt><tt>('helpBalloonUpdateArea').appendChild(helpBalloonDialog);
</tt><pre style="margin: 0em;">
helpBalloonPlaceHolder = null;
}
</if>
<if-not expression="component.hidden">
/*
 * The help balloon object will move the component from the
</pre><tt> * helpBalloonUpdateArea to under its own element  
</tt><tt>hierarchy,
</tt><tt> * when we hide the balloon we move it back again, see  
</tt><tt>above.
</tt><pre style="margin: 0em;">
 */
    helpBalloonPlaceHolder = new HelpBalloon({
title: "${component.title}",
content: '${component.clientId}',
</pre><tt>	icon: document.getElementById('$ 
</tt><tt>{component.iconElementId}'),
</tt><pre style="margin: 0em;">
returnElement: true,
anchorPosition: 'top right'
});
helpBalloonPlaceHolder.show();
</if-not>
</initialization>



On Oct 24, 2009, at 16:21 , Andreas Andreou wrote:


I can't really see what's going on.. is it possible to include the
exception and/or
some related code?

On Sat, Oct 24, 2009 at 2:44 PM, Marc van Kempen   
wrote:

Hi,

I have copied and changed the Dialog component in my project  
(Tapestry
4.1.5) in order to create a HelpBalloon popup. This gives me the  
following

files that I've added to my project:

HelpBalloonDialog.java
HelpBalloonDialog.jwc
HelpBalloonDialog.script

 I kept the condition checking the same as in Dialog.script, i.e.:


   <input-symbol key="component" required="yes" />

   <initialization>
   <if expression="component.hidden">
   do_stuff();
   </if>
   <if-not expression="component.hidden">
   do_different_stuff();
   </if-not>
   </initialization>


This is essentially the same construction as Dialog.script uses,  
and most
importantly the expression string "component.hidden" is exactly the  
same.
Requesting a page however where Dialog is used gives me a cast  
exception
when it tries to use the cached compiled expression that it finds.  
Changing

the name "component" to something else makes the problem go away.

Now, looking at the code I'm seeing the following:

The ExpressionCache uses the symbol map in ScriptSessionImpl as its  
key, so
therefore the cache should be local to a script and I should be  
allowed to

use the same expression in different scripts.

Is this the intended behaviour, am I missing something or am I  
looking at a

bug?

Kind regards,
Marc van Kempen.







--
Andreas Andreou - andy...@apache.org - http://blog.andyhot.gr
Tapestry / Tacos developer
Open Source / JEE Consulting

-
To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
For additional commands, e-mail: users-h...@tapestry.apache.org





T4: bug in expression cache?

2009-10-24 Thread Marc van Kempen

Hi,

I have copied and changed the Dialog component in my project (Tapestry  
4.1.5) in order to create a HelpBalloon popup. This gives me the  
following files that I've added to my project:


HelpBalloonDialog.java
HelpBalloonDialog.jwc
HelpBalloonDialog.script

 I kept the condition checking the same as in Dialog.script, i.e.:


<input-symbol key="component" required="yes" />

<initialization>
<if expression="component.hidden">
do_stuff();
</if>
<if-not expression="component.hidden">
do_different_stuff();
</if-not>
</initialization>


This is essentially the same construction as Dialog.script uses, and  
most importantly the expression string "component.hidden" is exactly  
the same. Requesting a page however where Dialog is used gives me a  
cast exception when it tries to use the cached compiled expression  
that it finds. Changing the name "component" to something else makes  
the problem go away.


Now, looking at the code I'm seeing the following:

The ExpressionCache uses the symbol map in ScriptSessionImpl as its  
key, so therefore the cache should be local to a script and I should  
be allowed to use the same expression in different scripts.


Is this the intended behaviour, am I missing something or am I looking  
at a bug?


Kind regards,
Marc van Kempen.




T4: bug in expression cache?

2009-10-24 Thread Marc van Kempen

Hi,

I have copied and changed the Dialog component in my project (Tapestry  
4.1.5) in order to create a HelpBalloon popup. This gives me the  
following files that I've added to my project:


HelpBalloonDialog.java
HelpBalloonDialog.jwc
HelpBalloonDialog.script

 I kept the condition checking the same as in Dialog.script, i.e.:


<input-symbol key="component" required="yes" />

<initialization>
<if expression="component.hidden">
do_stuff();
</if>
<if-not expression="component.hidden">
do_different_stuff();
</if-not>
</initialization>


This is essentially the same construction as Dialog.script uses, and  
most importantly the expression string "component.hidden" is exactly  
the same. Requesting a page however where Dialog is used gives me a  
cast exception when it tries to use the cached compiled expression  
that it finds. Changing the name "component" to something else makes  
the problem go away.


Now, looking at the code I'm seeing the following:

The ExpressionCache uses the symbol map in ScriptSessionImpl as its  
key, so therefore the cache should be local to a script and I should  
be allowed to use the same expression in different scripts.


Is this the intended behaviour, am I missing something or am I looking  
at a bug?


Kind regards,
Marc van Kempen.