[ 
https://issues.apache.org/jira/browse/TAPESTRY-1776?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12530115
 ] 

Ognen Ivanovski commented on TAPESTRY-1776:
-------------------------------------------

Yes, the errors can be avoided but I think Tapestry should not allow them to 
happen.  Allowing component/page classes to be loaded in by a classloader other 
than the one intended is not a good idea. 

It is especially annoying when such a thing happens within the "controlled" 
environment of another page/component. 

public class Referee {} /*  component  */
public class Referrer {

  @Parameter(defaultPrefix="component")
  private Referee reference;  // this is trouble!
}

I would suggest that Tapestry installs a special class loader as the thread's 
context classloader early in the request handling chain (probably as early as 
possible).

This one would have two delegating classloaders 
 - the PackageAwareLoader, to which it delegates all loadClass() calls for 
components and pages
 - the orginal context class loader for all other classes

I think in this way component classes are still defined by the 
PackageAwareLoader, so the cache can be flushed and at the same time you 
inhibit classlading of unenhanced component / page classes.  



> Component Class object exists in several instances  
> ----------------------------------------------------
>
>                 Key: TAPESTRY-1776
>                 URL: https://issues.apache.org/jira/browse/TAPESTRY-1776
>             Project: Tapestry
>          Issue Type: Bug
>          Components: tapestry-core
>    Affects Versions: 5.0.5
>         Environment: Mac OS X, Eclipse 3.3, Jetty Launcher, Jetty 5
>            Reporter: Ognen Ivanovski
>         Attachments: log.txt
>
>
> I get the following exception:
> java.lang.IllegalArgumentException: Could not find a coercion from type 
> com.telekurs.pass.online.permissiongui.components.CheckboxGroup to type 
> com.telekurs.pass.online.permissiongui.components.CheckboxGroup.  Available 
> coercions:... (full trace attached)
> Note that it says "cannot find a coercion from A to A". I did some debugging 
> and indeed the class CheckboxGroup was represented by two different objects. 
> Tapestry should not allow for a component class to be loaded differently than 
> in the modified version. 
> More details: 
>  - CheckBoxGroup is a component very similar to RadioGroup (80% code similar) 
> it is used to group render a set of checkboxes with the same name. 
> - BulkSelect is a js component that i used for "select all" and "select none" 
> operations in connection to the CheckBoxGroup. It has a  
>   @Parameter(required = true, defaultPrefix="component")
>   private CheckboxGroup checkboxes;
> They are used in the following way:
>       <t:BulkSelect checkboxes="permissionSelections" select="true" />
>       <t:CheckboxGroup t:id="permissionSelections"
>         value="selected" encoder="permissionValueEncoder" disabled="disabled">
>            <!-- ...-->
>         </t:CheckboxGroup>

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to