You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tapestry.apache.org by "samwen (JIRA)" <ta...@jakarta.apache.org> on 2005/09/01 08:38:07 UTC
[jira] Created: (TAPESTRY-617) get static field fail with use table component, bug report like bug tapestry-408
get static field fail with use table component, bug report like bug tapestry-408
---------------------------------------------------------------------------------
Key: TAPESTRY-617
URL: http://issues.apache.org/jira/browse/TAPESTRY-617
Project: Tapestry
Type: Bug
Components: Contrib
Versions: 3.0.3
Environment: weblogic+windows2000+jdk1.4.2
Reporter: samwen
bug report like bug tapestry-408
in my table component define
columns="id.bigClientId:title1:[0].id.bigClientId,
contractDate:mydate:@com.csair.keyacc.Visit@formatter.format([0].contractDate)"
it can't access static field !!
weblogic 8.1.3+windows 2000+eclipse
/* when weblogic classpath include ognl.jar
* mywebapp
* +web-inf
* |
* +lib ognl.jar;tapestry-3.x.x.jar; tapestry-contrib-3.x.x.jar;
*
*/
//org.apache.tapestry.contrib.table.model.ognl.OgnlTableColumnEvaluator.java
public Object getColumnValue(ITableColumn objColumn, Object objRow)
{
// If no expression is given, then this is dummy column. Return something.
if (m_strExpression == null || m_strExpression.equals(""))
return "";
if (m_objParsedExpression == null)
{
synchronized (this)
{
if (m_objParsedExpression == null)
m_objParsedExpression =
OgnlUtils.getParsedExpression(m_strExpression);
}
}
try
{
Object objValue = Ognl.getValue(m_objParsedExpression, objRow);
return objValue;
}
catch (OgnlException e)
{
LOG.error(
"Cannot use column expression '" + m_strExpression + "' in row",
e);
return "";
}
}
patch:
// org.apache.tapestry.contrib.table.model.ognl.OgnlTableColumnEvaluator.java
/**
* @see org.apache.tapestry.contrib.table.model.simple.ITableColumnEvaluator#getColumnValue(ITableColumn, Object)
*/
public Object getColumnValue(ITableColumn objColumn, Object objRow)
{
// If no expression is given, then this is dummy column. Return something.
if (m_strExpression == null || m_strExpression.equals(""))
return "";
if (m_objParsedExpression == null)
{
synchronized (this)
{
if (m_objParsedExpression == null)
m_objParsedExpression =
OgnlUtils.getParsedExpression(m_strExpression);
}
}
try
{
ClassResolver resolver= new ClassResolver(){
public Class classForName(String className, Map context) throws ClassNotFoundException {
ClassLoader contextClassLoader = Thread.currentThread().getContextClassLoader();
return Class.forName(className, true, contextClassLoader);
}
};
Map context = Ognl.createDefaultContext(objRow, resolver);
Object objValue= Ognl.getValue(m_objParsedExpression, context, objRow);
//Object objValue = Ognl.getValue(m_objParsedExpression, objRow);
return objValue;
}
catch (OgnlException e)
{
System.out.println("ognl exception!!");
e.printStackTrace();
LOG.error(
"Cannot use column expression '" + m_strExpression + "' in row",
e);
return "";
}catch(RuntimeException ex){
System.out.println("throw Exception OgnlTableColumnEvaluator!!");
ex.printStackTrace();
throw ex;
}catch(Exception ex){
ex.printStackTrace();
throw new RuntimeException(ex);
}
}
weblogic 8.1.3+windows 2000+eclipse
/* when weblogic classpath include ognl.jar;tapestry-3.x.x.jar;tapestry-contrib-patch.jar
* mywebapp
* +web-inf
* |
* +lib ognl.jar;tapestry-3.x.x.jar; tapestry-contrib-3.x.x.jar;
*
*/
and run Ok!
--
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: tapestry-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-dev-help@jakarta.apache.org
[jira] Resolved: (TAPESTRY-617) get static field fail with use
table component, bug report like bug tapestry-408
Posted by "Brian K. Wallace (JIRA)" <ta...@jakarta.apache.org>.
[ http://issues.apache.org/jira/browse/TAPESTRY-617?page=all ]
Brian K. Wallace resolved TAPESTRY-617:
---------------------------------------
Fix Version: 3.0.5
Resolution: Fixed
Assign To: Brian K. Wallace
Added context class loader parameter to Ognl.getValue call
> get static field fail with use table component, bug report like bug tapestry-408
> --------------------------------------------------------------------------------
>
> Key: TAPESTRY-617
> URL: http://issues.apache.org/jira/browse/TAPESTRY-617
> Project: Tapestry
> Type: Bug
> Components: Contrib
> Versions: 3.0.3
> Environment: weblogic+windows2000+jdk1.4.2
> Reporter: samwen
> Assignee: Brian K. Wallace
> Fix For: 3.0.5
>
> bug report like bug tapestry-408
> in my table component define
> columns="id.bigClientId:title1:[0].id.bigClientId,
> contractDate:mydate:@com.csair.keyacc.Visit@formatter.format([0].contractDate)"
> it can't access static field !!
> weblogic 8.1.3+windows 2000+eclipse
> /* when weblogic classpath include ognl.jar
> * mywebapp
> * +web-inf
> * |
> * +lib ognl.jar;tapestry-3.x.x.jar; tapestry-contrib-3.x.x.jar;
> *
> */
>
> //org.apache.tapestry.contrib.table.model.ognl.OgnlTableColumnEvaluator.java
>
> public Object getColumnValue(ITableColumn objColumn, Object objRow)
> {
> // If no expression is given, then this is dummy column. Return something.
> if (m_strExpression == null || m_strExpression.equals(""))
> return "";
> if (m_objParsedExpression == null)
> {
> synchronized (this)
> {
> if (m_objParsedExpression == null)
> m_objParsedExpression =
> OgnlUtils.getParsedExpression(m_strExpression);
> }
> }
> try
> {
> Object objValue = Ognl.getValue(m_objParsedExpression, objRow);
> return objValue;
> }
> catch (OgnlException e)
> {
> LOG.error(
> "Cannot use column expression '" + m_strExpression + "' in row",
> e);
> return "";
> }
> }
> patch:
> // org.apache.tapestry.contrib.table.model.ognl.OgnlTableColumnEvaluator.java
> /**
> * @see org.apache.tapestry.contrib.table.model.simple.ITableColumnEvaluator#getColumnValue(ITableColumn, Object)
> */
> public Object getColumnValue(ITableColumn objColumn, Object objRow)
> {
> // If no expression is given, then this is dummy column. Return something.
> if (m_strExpression == null || m_strExpression.equals(""))
> return "";
> if (m_objParsedExpression == null)
> {
> synchronized (this)
> {
> if (m_objParsedExpression == null)
> m_objParsedExpression =
> OgnlUtils.getParsedExpression(m_strExpression);
> }
> }
> try
> {
>
> ClassResolver resolver= new ClassResolver(){
> public Class classForName(String className, Map context) throws ClassNotFoundException {
> ClassLoader contextClassLoader = Thread.currentThread().getContextClassLoader();
> return Class.forName(className, true, contextClassLoader);
> }
> };
> Map context = Ognl.createDefaultContext(objRow, resolver);
> Object objValue= Ognl.getValue(m_objParsedExpression, context, objRow);
>
> //Object objValue = Ognl.getValue(m_objParsedExpression, objRow);
> return objValue;
> }
> catch (OgnlException e)
> {
> System.out.println("ognl exception!!");
> e.printStackTrace();
> LOG.error(
> "Cannot use column expression '" + m_strExpression + "' in row",
> e);
> return "";
> }catch(RuntimeException ex){
> System.out.println("throw Exception OgnlTableColumnEvaluator!!");
> ex.printStackTrace();
> throw ex;
> }catch(Exception ex){
> ex.printStackTrace();
> throw new RuntimeException(ex);
> }
>
> }
> weblogic 8.1.3+windows 2000+eclipse
> /* when weblogic classpath include ognl.jar;tapestry-3.x.x.jar;tapestry-contrib-patch.jar
> * mywebapp
> * +web-inf
> * |
> * +lib ognl.jar;tapestry-3.x.x.jar; tapestry-contrib-3.x.x.jar;
> *
> */
> and run Ok!
--
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: tapestry-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-dev-help@jakarta.apache.org