You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jaxme-dev@ws.apache.org by "Jochen Wiedmann (JIRA)" <ja...@ws.apache.org> on 2005/04/19 10:24:45 UTC
[jira] Aktualisiert: (JAXME-48) ClassCastException in IndentationEngineImpl (write method) when a primitive array
[ http://issues.apache.org/jira/browse/JAXME-48?page=all ]
Jochen Wiedmann updated JAXME-48:
---------------------------------
Attachment: JAXME-48.patch
Go on and check it in. Don't forget to edit your record in the status file. And please be so kind to check it into HEAD and v0_4.
> ClassCastException in IndentationEngineImpl (write method) when a primitive array
> ---------------------------------------------------------------------------------
>
> Key: JAXME-48
> URL: http://issues.apache.org/jira/browse/JAXME-48
> Project: JaxMe
> Type: Bug
> Components: JaxMeJS
> Reporter: Nacho G. Mac Dowell
> Priority: Minor
> Attachments: JAXME-48.patch
>
> The method write(IndentationTarget pTarget, Object pObject) in IndentationEngineImpl throws a ClassCastException when object type is a primitive array. The solution is (AFAIK) to use reflection. The patch:
> Index: IndentationEngineImpl.java
> ===================================================================
> RCS file: /home/cvspublic/ws-jaxme/src/js/org/apache/ws/jaxme/js/IndentationEngineImpl.java,v
> retrieving revision 1.3
> diff -u -r1.3 IndentationEngineImpl.java
> --- IndentationEngineImpl.java 16 Feb 2004 23:39:55 -0000 1.3
> +++ IndentationEngineImpl.java 19 Apr 2005 07:06:40 -0000
> @@ -18,6 +18,7 @@
>
> import java.io.IOException;
> import java.io.StringWriter;
> +import java.lang.reflect.Array;
> import java.util.ArrayList;
> import java.util.Collection;
> import java.util.HashMap;
> @@ -278,11 +279,11 @@
> public void write(IndentationTarget pTarget, Object pObject)
> throws IOException {
> if (pObject.getClass().isArray()) {
> - Object[] objects = (Object[]) pObject;
> - for (int i = 0; i < objects.length; i++) {
> - write(pTarget, objects[i]);
> - }
> - } else if (pObject instanceof JavaSourceObject) {
> + int arrayLength = Array.getLength(pObject);
> + for (int i = 0; i < arrayLength; i++) {
> + write(pTarget, Array.get(pObject, i));
> + }
> + } else if (pObject instanceof JavaSourceObject) {
> pTarget.write(((JavaSourceObject) pObject).getName());
> } else if (pObject instanceof List) {
> for (Iterator iter = ((List) pObject).iterator(); iter.hasNext(); ) {
--
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: jaxme-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: jaxme-dev-help@ws.apache.org