commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Matt Benson (JIRA)" <j...@apache.org>
Subject [jira] Commented: (JXPATH-73) ValueUtils should catch IndexOutOfBoundsException instead of ArrayIndexOutOfBoundsException (for XmlBeans support)
Date Fri, 05 Jan 2007 16:15:27 GMT

    [ https://issues.apache.org/jira/browse/JXPATH-73?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12462519
] 

Matt Benson commented on JXPATH-73:
-----------------------------------

Actually, it's not a catch; it's an instanceof check.  Will attach a proper patch against
svn HEAD shortly.

> ValueUtils should catch IndexOutOfBoundsException instead of ArrayIndexOutOfBoundsException
(for XmlBeans support)
> ------------------------------------------------------------------------------------------------------------------
>
>                 Key: JXPATH-73
>                 URL: https://issues.apache.org/jira/browse/JXPATH-73
>             Project: Commons JXPath
>          Issue Type: Bug
>    Affects Versions: 1.2 Final
>         Environment: XmlBeans with JDK 1.4.2 and JXpath 1.2
>            Reporter: James Schopp
>             Fix For: 1.3
>
>
> Basically, I want to do createPathAndSetValue on an XmlBean . But, my xpath statement
inlcudes a collection (an array, actually), so the missing elements in the array need to be
created.
> JXPath checks for this condition (ie. that array elements are missing and need to be
created) by catching an ArrayIndexOutOfBoundsException.
> Unfortunately, XmlBeans does not throw that type of exception. It throws an IndexOutOfBoundsException
exception instead. So, instead of detecting that the array is too small and needs to be grown
(by calling my AbstractFactory), it just propogates the exception up the chain.
> The fix is quite simple: on line 423 of ValueUtils, just change the "catch" clause to
catch a "IndexOutOfBoundsException" instead. This should not break any existing code since
ArrayIndexOutOfBoundsException is actually a subclass of IndexOutOfBoundsException anyway.
> I made this fix to my local source tree, and everything works perfectly (ie. existing
code did not break, but now I can also use JXPath on top of my XmlBeans beans too with my
own custom AbstractFactory).
> Thanks!
> James

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

        

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


Mime
View raw message