You are viewing a plain text version of this content. The canonical link for it is here.
Posted to taglibs-dev@jakarta.apache.org by bu...@apache.org on 2008/07/18 15:07:49 UTC
DO NOT REPLY [Bug 45433] New: Unstandard -Tag doesn't accept
arrays
https://issues.apache.org/bugzilla/show_bug.cgi?id=45433
Summary: Unstandard <size>-Tag doesn't accept arrays
Product: Taglibs
Version: unspecified
Platform: All
OS/Version: All
Status: NEW
Severity: normal
Priority: P2
Component: Sandbox Taglibs
AssignedTo: taglibs-dev@jakarta.apache.org
ReportedBy: o.dr@gmx.de
We are still using J2EE 1.3 and use "unstandard-taglibs".
The Tag <size> doesn't work with arrays - it returns -1.
Error is in the class "org.apache.taglibs.unstandard.SizeTag":
// Error
if(target instanceof Collection) {
result = ( (Object[])target ).length;
}
// Bugfix
if(target.isArray) {
result = ( (Object[])target ).length;
}
And the casting (Object[]) doesn't works with primitive arrays (int[],
boolean[], etc).
--
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: taglibs-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: taglibs-dev-help@jakarta.apache.org
DO NOT REPLY [Bug 45433] Unstandard -Tag doesn't accept arrays
Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=45433
Henri Yandell <ba...@apache.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |RESOLVED
Resolution| |FIXED
--- Comment #2 from Henri Yandell <ba...@apache.org> 2009-05-25 02:06:37 PST ---
svn ci -m "Fixing bugzilla entry 45433. SizeTag doesn't accept arrays"
Sending src/main/java/org/apache/taglibs/unstandard/SizeTag.java
Transmitting file data .
Committed revision 778359 ( https://svn.apache.org/viewcvs.cgi?view=rev&rev=778359 ).
Index: src/main/java/org/apache/taglibs/unstandard/SizeTag.java
===================================================================
--- src/main/java/org/apache/taglibs/unstandard/SizeTag.java (revision
775710 ( https://svn.apache.org/viewcvs.cgi?view=rev&rev=775710 ))
+++ src/main/java/org/apache/taglibs/unstandard/SizeTag.java (working copy)
@@ -75,8 +75,15 @@
if(target instanceof String) {
result = ( (String)target ).length();
} else
- if(target instanceof Collection) {
- result = ( (Object[])target ).length;
+ if(target.getClass().isArray()) {
+ try {
+ Field lengthField = target.getClass().getField("length");
+ result = lengthField.getInt(target);
+ } catch(NoSuchFieldException nsfe) {
+ throw new JspException("Array found without a length
field", nsfe);
+ } catch(IllegalAccessException iae) {
+ throw new JspException("Array found with a non-accessible
length field", iae);
+ }
}
}
if(var == null && result != -1) {
--
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: taglibs-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: taglibs-dev-help@jakarta.apache.org
DO NOT REPLY [Bug 45433] Unstandard -Tag doesn't accept arrays
Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=45433
--- Comment #1 from Oleksiy Drugobytskyy <o....@gmx.de> 2008-07-18 06:08:59 PST ---
Created an attachment (id=22282)
--> (https://issues.apache.org/bugzilla/attachment.cgi?id=22282)
Sample jsp with <size>-Tag
--
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: taglibs-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: taglibs-dev-help@jakarta.apache.org