[ 
http://issues.apache.org/jira/browse/TAPESTRY-642?page=comments#action_12323293 
] 

Howard M. Lewis Ship commented on TAPESTRY-642:
-----------------------------------------------

First trick of enhancement problems; enable debugging by updating 
log4j.properties:

log4j.category.tapestry.enhance.ComponentConstructorFactory=debug


Now I can see the generated class:


ComponentConstructorFactory [DEBUG] Creating class:

ClassFab[
public class $ReportInfo_26 extends com.vaisala.ww.ui.pages.report.ReportInfo
  implements org.apache.tapestry.event.PageDetachListener

private org.apache.tapestry.form.IFormComponent _$tallNoField;

private org.apache.tapestry.form.IFormComponent _$otherField;

private org.apache.tapestry.form.IFormComponent _$otherDetailField;

private com.vaisala.ww.ui.data.UserIdentity _$userIdentity;

private org.apache.tapestry.engine.state.ApplicationStateManager 
_$applicationStateManager;

private com.vaisala.ww.ui.data.ReportProposal _$proposal;

private com.vaisala.ww.ui.services.ReportProposalMapURLFactory _$mapFactory;

private org.apache.tapestry.components.Block _$content;

private org.apache.tapestry.services.ComponentMessagesSource 
_$componentMessagesSource;

private org.apache.hivemind.Messages _$messages;

private org.apache.tapestry.spec.IComponentSpecification _$specification;

private boolean _$tallNo;

private boolean _$tallNo$default;

private boolean _$tallYes;

private boolean _$tallYes$default;

private java.lang.String _$message;

private java.lang.String _$message$defaultValue;

public $ReportInfo_26(org.apache.tapestry.engine.state.ApplicationStateManager 
$1, com.vaisala.ww.ui.services.ReportProposalMapURLFactory $2, 
org.apache.tapestry.services.ComponentMessagesSource $3, 
org.apache.tapestry.spec.IComponentSpecification $4)
{
  _$applicationStateManager = $1;
  _$mapFactory = $2;
  _$componentMessagesSource = $3;
  _$specification = $4;
}


public java.lang.String nameAndCompany(java.lang.String $1, java.lang.String 
$2, java.lang.String $3)
{
  java.lang.Object[] params = new java.lang.Object[3];
  params[0] = $1;
  params[1] = $2;
  params[2] = $3;
  return getMessages().format("name-and-company", params);
}


public java.lang.String otherIsRequired()
{
  return getMessages().getMessage("other-is-required");
}


public java.lang.String getNavigationTitle()
{
  return getMessages().getMessage("nav-title");
}


public void setUserIdentity(com.vaisala.ww.ui.data.UserIdentity $1)
{
  _$applicationStateManager.store("userIdentity", $1);
  _$userIdentity = $1;
}


public boolean isTallYes()
return _$tallYes;

public java.lang.String formWasCancelled()
{
  return getMessages().getMessage("form-was-cancelled");
}


public com.vaisala.ww.ui.services.ReportProposalMapURLFactory getMapFactory()
return _$mapFactory;

public org.apache.tapestry.form.IFormComponent getOtherField()
return _$otherField;

public void setProposal(com.vaisala.ww.ui.data.ReportProposal $1)
{
  _$applicationStateManager.store("reportProposal", $1);
  _$proposal = $1;
}


public boolean isTallNo()
return _$tallNo;

public void setTallYes(boolean $1)
{
  org.apache.tapestry.Tapestry#fireObservedChange(this, "tallYes", ($w) $1);
  _$tallYes = $1;
}


public com.vaisala.ww.ui.data.ReportProposal getProposal()
{
  if (_$proposal == null)
    _$proposal = (com.vaisala.ww.ui.data.ReportProposal) 
_$applicationStateManager.get("reportProposal");
  return _$proposal;
}


public org.apache.tapestry.form.IFormComponent getTallNoField()
return _$tallNoField;

public org.apache.tapestry.valid.IValidationDelegate getDelegate()
return (org.apache.tapestry.valid.IValidationDelegate) 
getBeans().getBean("delegate");

public java.lang.String getMessage()
return _$message;

public org.apache.tapestry.form.IFormComponent getOtherDetailField()
return _$otherDetailField;

public com.vaisala.ww.ui.pages.UIMPage getAccountManagement()
return 
(com.vaisala.ww.ui.pages.UIMPage)getPage().getRequestCycle().getPage("account/AccountManagement");

public java.lang.String mustSetTallYesOrNo()
{
  return getMessages().getMessage("must-set-tall-yes-or-no");
}


public com.vaisala.ww.ui.data.UserIdentity getUserIdentity()
{
  if (_$userIdentity == null)
    _$userIdentity = (com.vaisala.ww.ui.data.UserIdentity) 
_$applicationStateManager.get("userIdentity");
  return _$userIdentity;
}


public org.apache.tapestry.spec.IComponentSpecification getSpecification()
return _$specification;

public void setTallNo(boolean $1)
{
  org.apache.tapestry.Tapestry#fireObservedChange(this, "tallNo", ($w) $1);
  _$tallNo = $1;
}


public java.lang.String yesOrNo()
{
  return getMessages().getMessage("yes-or-no");
}


public void setMessage(java.lang.String $1)
_$message = $1;

public void pageDetached(org.apache.tapestry.event.PageEvent $1)
{
  _$userIdentity = null;
  _$proposal = null;
  _$tallNo = _$tallNo$default;
  _$tallYes = _$tallYes$default;
  _$message = _$message$defaultValue;
}


public org.apache.tapestry.components.Block getContent()
return _$content;

public org.apache.hivemind.Messages getMessages()
{
  if (_$messages == null)
    _$messages = _$componentMessagesSource.getMessages(this);
  return _$messages;
}


public void finishLoad(org.apache.tapestry.IRequestCycle $1, 
org.apache.tapestry.engine.IPageLoader $2, 
org.apache.tapestry.spec.IComponentSpecification $3)
{
  super.finishLoad($$);
  _$tallNoField = (org.apache.tapestry.form.IFormComponent) 
getComponent("tallNo");
  _$otherField = (org.apache.tapestry.form.IFormComponent) 
getComponent("other");
  _$otherDetailField = (org.apache.tapestry.form.IFormComponent) 
getComponent("otherDetail");
  _$content = (org.apache.tapestry.components.Block) getComponent("content");
  _$tallNo$default = _$tallNo;
  _$tallYes$default = _$tallYes;
  _$message$defaultValue = _$message;
  getPage().addPageDetachListener(this);
}


]

> Injections that cause bad casts need better reporting
> -----------------------------------------------------
>
>          Key: TAPESTRY-642
>          URL: http://issues.apache.org/jira/browse/TAPESTRY-642
>      Project: Tapestry
>         Type: Bug
>   Components: Framework
>     Versions: 4.0
>     Reporter: Howard M. Lewis Ship
>     Assignee: Howard M. Lewis Ship

>
> When injection code performs a cast and a ClassCastException occurs, it's 
> very difficult to determine what actually failed.
> The exception report provides no details (not an accurate location, and no 
> additional information).
> Unable to instantiate component report/ReportInfo: $BaseComponent_2
> component:    [EMAIL PROTECTED]/ReportInfo]
> location:     context:/WEB-INF/report/ReportInfo.page, line 6, column 23
> 1     <?xml version="1.0"?>
> 2     <!DOCTYPE page-specification PUBLIC
> 3     "-//Apache Software Foundation//Tapestry Specification 4.0//EN"
> 4     "http://jakarta.apache.org/tapestry/dtd/Tapestry_4_0.dtd";>
> 5     
> 6     <page-specification>
> 7     
> 8     
> 9     <component id="tallYes" type="Checkbox">
> 10    <binding name="value" value="tallYes"/>
> 11    </component>
>  
> java.lang.ClassCastException
> $BaseComponent_2
> Stack Trace:
>     * $ReportInfo_26.finishLoad($ReportInfo_26.java)
>     * 
> org.apache.tapestry.pageload.PageLoader.constructComponent(PageLoader.java:470)
>     * org.apache.tapestry.pageload.PageLoader.loadPage(PageLoader.java:639)
>     * $IPageLoader_1064cccc780.loadPage($IPageLoader_1064cccc780.java)
>     * $IPageLoader_1064cccc781.loadPage($IPageLoader_1064cccc781.java)
>     * org.apache.tapestry.pageload.PageSource.getPage(PageSource.java:118)
>     * $IPageSource_1064cccc6eb.getPage($IPageSource_1064cccc6eb.java)
>     * org.apache.tapestry.engine.RequestCycle.loadPage(RequestCycle.java:265)
>     * org.apache.tapestry.engine.RequestCycle.getPage(RequestCycle.java:248)
> The exception is occuring inside the finishLoad() method of the enhanced 
> class.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


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

Reply via email to