Maintenance: Planio will be observing a scheduled maintenance window this Tuesday, November 5, 2024 from 03:00 UTC until 06:30 UTC to perform urgent network maintenance in our primary data center. Your Planio account will be unavailable during this maintenance window.
Error on Conversion of external object
Added by Anonymous almost 17 years ago
Legacy ID: #4725336 Legacy Poster: popol (mrjeje)
Hi, I am currently using saxon 8.8B with external Java functions in XQueries. I have a problem when using a list containing only one item. My first query is: let $var1 := variable:new('name1','value1') let $var2 := variable:new('name2','value2') return test:run(($var1, $var2)) My second query is: let $var1 := variable:new('name1','value1') return test:run(($var1)) My run method is: public class Test { public static String run(List<Variable> aVAr) { return "Hello"; } } My Variable class is quite simple: public Variable(final String aName, final String aValue) { name = aName; value = aValue; } The execution of return test:run(($var1, $var2)) is ok, but when I try return test:run(($var1)) I get the following exception: Error on line 1 of module with no systemId: Error in call to extension function {public static java.lang.String com.airbus.ics.settings.query.Test.run(java.util.List)}: Conversion of external object to java.util.List is not supported Exception in thread "main" ; SystemID: module with no systemId; Line#: 1; Column#: -1 net.sf.saxon.trans.DynamicError: Error in call to extension function {public static java.lang.String com.airbus.ics.settings.query.Test.run(java.util.List)}: Conversion of external object to java.util.List is not supported I assumed that test:run(($var1)) is equivalent to a list containing only one item. Having a look at this stack and at the saxon method convertToJava, I have the impression that Saxon converts the one item list into an Atomic value that doesnot fit the run method. If I try the same queries with var1 and var2 containing String intances, both tests are exceuted sucessfully. Is there a known bug on problems handling list with one or more instance of user external java class ? Thanks
Replies (4)
Please register to reply
RE: Error on Conversion of external object - Added by Anonymous almost 17 years ago
Legacy ID: #4729500 Legacy Poster: Michael Kay (mhkay)
I agree that the behaviour here is not very satisfactory, and I plan to make some improvements in a future release. However, because almost any change in this area has the risk of introducing incompatibilities, I'm not going to treat this as a bug fix. Michael Kay
RE: Error on Conversion of external object - Added by Anonymous almost 17 years ago
Legacy ID: #4729546 Legacy Poster: Michael Kay (mhkay)
I've taken a more careful look and it appears that this is handled properly for built-in atomic types such as integers and strings, and that the same technique should work for external objects too. So I'll treat it as something that can be patched after all. Watch the bug register. Unfortunately it didn't make it into 9.0.0.3 which was released this morning.
RE: Error on Conversion of external object - Added by Anonymous almost 17 years ago
Legacy ID: #4735621 Legacy Poster: popol (mrjeje)
Thanks for your answer. Unfortunately, at present I cannot integrate an upper version of saxon (and of course the correction of this bug is high priority for me). Is it possible for you to give me the patch to apply on saxon 8.8 in order for me to apply it myself ?
RE: Error on Conversion of external object - Added by Anonymous almost 17 years ago
Legacy ID: #4735637 Legacy Poster: Michael Kay (mhkay)
You can find the patch in Subversion (the comments on all Subversion changes identify the bug by its SourceForge number) and then you can attempt to retrofit it. I don't maintain old versions of the code myself.
Please register to reply