Java interop - Unexpected FORG0006 ("Invalid arguments")

Friday, 30 March 2012 · 4 messages
DP
Dimitar Popovin reply to Charles Duffy, 30 Mar 2012, 18:1230 Mar 2012 17:25 #
Quoted text · 09:12:39 · 37 lines
Am Freitag, 30. März 2012, 09:12:39 schrieb Charles Duffy: > Howdy -- > > I have a thin wrapper around the 3rd-party svnkit library. At present, it > provides two functions: > > module namespace svnkit = "http://dyfis.net/svnkit-wrapper"; > declare namespace j="java:net.dyfis.svnkit_wrapper.SvnWrapper"; > > declare function svnkit:cat($path as xs:string) as xs:string { > j:cat($path) > }; > > declare function svnkit:cat($path as xs:string, $rev as xs:integer) as > xs:string { > j:cat($path, $rev) > }; > > > SvnWrapper (written in Clojure) provides both versions of cat as static > methods: > > (ns net.dyfis.svnkit-wrapper.core (:gen-class > :name net.dyfis.svnkit_wrapper.SvnWrapper > :methods [#^{:static true} [cat [java.lang.String] java.lang.String] > #^{:static true} [cat [java.lang.String int] > java.lang.String]])) > > > svnkit:cat($path) works fine. > svnkit:cat($path, $revno) results in the following: > > [FORG0006] Invalid arguments: SvnWrapper.cat(xs:string, xs:integer) found. > > > SvnWrapper.cat(xs:string, xs:integer) is exactly what I *expect* it to > find, so the error doesn't make a great deal of sense to me. Any hints?
In BaseX xs:integer is mapped to java.math.BigInteger. So either you should change your Clojure methods to java.math.BigInteger or change the XQuery wrapper function to xs:int (I guess this make more sense). Regards, Dimitar
DP
Dimitar Popov30 Mar 2012 17:32 #
Quoted text · 09:12:39 · 42 lines
Am Freitag, 30. März 2012, 17:25:42 schrieb Dimitar Popov: > Am Freitag, 30. März 2012, 09:12:39 schrieb Charles Duffy: > > Howdy -- > > > > I have a thin wrapper around the 3rd-party svnkit library. At present, it > > provides two functions: > > > > module namespace svnkit = "http://dyfis.net/svnkit-wrapper"; > > declare namespace j="java:net.dyfis.svnkit_wrapper.SvnWrapper"; > > > > declare function svnkit:cat($path as xs:string) as xs:string { > > j:cat($path) > > }; > > > > declare function svnkit:cat($path as xs:string, $rev as xs:integer) as > > xs:string { > > j:cat($path, $rev) > > }; > > > > > > SvnWrapper (written in Clojure) provides both versions of cat as static > > methods: > > > > (ns net.dyfis.svnkit-wrapper.core (:gen-class > > :name net.dyfis.svnkit_wrapper.SvnWrapper > > :methods [#^{:static true} [cat [java.lang.String] java.lang.String] > > #^{:static true} [cat [java.lang.String int] > > java.lang.String]])) > > > > > > svnkit:cat($path) works fine. > > svnkit:cat($path, $revno) results in the following: > > > > [FORG0006] Invalid arguments: SvnWrapper.cat(xs:string, xs:integer) found. > > > > > > SvnWrapper.cat(xs:string, xs:integer) is exactly what I *expect* it to > > find, so the error doesn't make a great deal of sense to me. Any hints? > > In BaseX xs:integer is mapped to java.math.BigInteger. So either you should > change your Clojure methods to java.math.BigInteger or change the XQuery > wrapper function to xs:int (I guess this make more sense).
... or cast xs:integer to xs:int
CD
Charles Duffy30 Mar 2012 18:12 #
Howdy -- I have a thin wrapper around the 3rd-party svnkit library. At present, it provides two functions:
module namespace svnkit = "http://dyfis.net/svnkit-wrapper";
declare namespace j="java:net.dyfis.svnkit_wrapper.SvnWrapper";

declare function svnkit:cat($path as xs:string) as xs:string {
j:cat($path)
};

declare function svnkit:cat($path as xs:string, $rev as xs:integer) as
xs:string {
j:cat($path, $rev)
};
SvnWrapper (written in Clojure) provides both versions of cat as static methods: (ns net.dyfis.svnkit-wrapper.core (:gen-class :name net.dyfis.svnkit_wrapper.SvnWrapper :methods [#^{:static true} [cat [java.lang.String] java.lang.String] #^{:static true} [cat [java.lang.String int] java.lang.String]]))
svnkit:cat($path) works fine.
svnkit:cat($path, $revno) results in the following:
[FORG0006] Invalid arguments: SvnWrapper.cat(xs:string, xs:integer) found. SvnWrapper.cat(xs:string, xs:integer) is exactly what I *expect* it to find, so the error doesn't make a great deal of sense to me. Any hints?
CD
Charles Duffyin reply to Dimitar Popov, 30 Mar 2012, 17:3230 Mar 2012 19:45 #
Thank you very much -- this was precisely the issue.
Quoted text · Dimitar Popov · 51 lines
On Fri, Mar 30, 2012 at 10:32 AM, Dimitar Popov < Dimitar.Popov at uni-konstanz.de> wrote: > Am Freitag, 30. März 2012, 17:25:42 schrieb Dimitar Popov: > > Am Freitag, 30. März 2012, 09:12:39 schrieb Charles Duffy: > > > Howdy -- > > > > > > I have a thin wrapper around the 3rd-party svnkit library. At present, > it > > > provides two functions: > > > > > > module namespace svnkit = "http://dyfis.net/svnkit-wrapper"; > > > declare namespace j="java:net.dyfis.svnkit_wrapper.SvnWrapper"; > > > > > > declare function svnkit:cat($path as xs:string) as xs:string { > > > j:cat($path) > > > }; > > > > > > declare function svnkit:cat($path as xs:string, $rev as xs:integer) as > > > xs:string { > > > j:cat($path, $rev) > > > }; > > > > > > > > > SvnWrapper (written in Clojure) provides both versions of cat as static > > > methods: > > > > > > (ns net.dyfis.svnkit-wrapper.core (:gen-class > > > :name net.dyfis.svnkit_wrapper.SvnWrapper > > > :methods [#^{:static true} [cat [java.lang.String] > java.lang.String] > > > #^{:static true} [cat [java.lang.String int] > > > java.lang.String]])) > > > > > > > > > svnkit:cat($path) works fine. > > > svnkit:cat($path, $revno) results in the following: > > > > > > [FORG0006] Invalid arguments: SvnWrapper.cat(xs:string, xs:integer) > found. > > > > > > > > > SvnWrapper.cat(xs:string, xs:integer) is exactly what I *expect* it to > > > find, so the error doesn't make a great deal of sense to me. Any hints? > > > > In BaseX xs:integer is mapped to java.math.BigInteger. So either you > should > > change your Clojure methods to java.math.BigInteger or change the XQuery > > wrapper function to xs:int (I guess this make more sense). > > ... or cast xs:integer to xs:int >

⚡Generated with XQuery