You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@commons.apache.org by bu...@apache.org on 2005/11/23 09:39:21 UTC

DO NOT REPLY [Bug 37600] New: - Using Object as a tag property class automatically changes the value to a String

DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG�
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=37600>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND�
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=37600

           Summary: Using Object as a tag property class automatically
                    changes the value to a String
           Product: Commons
           Version: 1.0 Final
          Platform: Other
        OS/Version: other
            Status: NEW
          Severity: major
          Priority: P3
         Component: Jelly
        AssignedTo: commons-dev@jakarta.apache.org
        ReportedBy: info@harveyvandermeer.nl


Hi I recently found a bug in either the Jelly Engine, or in some of the tags which  
are provided.

I encountered a problem with the following code:

<c:new className="java.lang.Long" var="value">
   <c:arg type="long" value="${12345}"/>
</c:new>
<c:new className="Profile" var="profile"/>
<c:invoke method="setValue" on="${profile}">
   <c:arg type="java.lang.Long" value="${321}"/>
   <c:arg type="java.lang.Long" value="${123}"/>
   <c:arg value="${value}"/>
</c:invoke>

the Profile setValue method takes three arguments; Long, Long, Object

Invoking the code results in the arg always passing the value to the invoke tag
as a String, not as an Object.

I looked into the ArgTag source code seeing that it is using java.lang.Object as
the type property class, not the ....jelly.Expression class. Since I was unsure
I created my own tag and taglib to simulate the problem.

public class MyTag extends TagSupport {
	private Object object = null;
	private Object expr = null;
	public void setObject(Object object) {
		this.object = object;
	}
	public void setExpression(Expression expr) {
		this.expr = expr.evaluate(this.getContext());
	}
	public void doTag(XMLOutput output) throws MissingAttributeException,
JellyTagException {
		System.out.println(object+" ("+object.getClass().getName()+")");
		System.out.println(expr+" ("+expr.getClass().getName()+")");
	}
}

executing the following script confirms the issue

	<c:new className="java.lang.Long" var="value">
		<c:arg type="long" value="${12345}"/>
	</c:new>
	<my:tag object="${value}" expression="${value}"/>

it result printing the following tho lines:
12345 (java.lang.String)
12345 (java.lang.Long)

Is this a problem in the engine, or should the arg tag be using the Expression
class instead of Object?

Kind Regards,

Harvey van der Meer

-- 
Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.

---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org