On Mon, May 2, 2011 at 11:40 PM, Philip Nienhuis <[email protected]> wrote: > ## Create "Short" java object. > ## NB the value should be input as string (as per Javadocs) > octave-3.2.4.exe:45> Cellflgs = java_new ("java.lang.Short", "23") > Cellflgs = > > <Java object: java.lang.Short> > I conclude that Java object xRQ is properly formed (other methods operate > fine with it), but somehow queryContentCells() chokes on its input argument. > I tried other short values too (allowed are any logical combination of 1, 2, > 4 & 16; 23 = sum of them all). > > Q1: > Do java.lang.Short objects get transformed or wrangled somehow on their way > between Octave and the actual Java method?
No, Short objects do not get automatically boxed/unboxed. That's why you still get a java object returned after creating the java.lang.Short object. Otherwise it would get converted automatically. > Q2: > If so, is there another way to get the short object to arrive properly at > the method in question (i.e., queryContentCells()) ? I'm not sure what's happening here. Some debugging will be needed. See http://octave.svn.sourceforge.net/viewvc/octave/trunk/octave-forge/extra/java/src/org/octave/ClassHelper.java?revision=7623&view=markup for the relevant code. The function invoked is: public static Object invokeMethod ( Object target, String name, Object[] args, Class[] argTypes ) It works by looking for the most appropriate method by looking for the methods by name, then matching the arguments. It seems in your case, it fails to match the Short argument. Argument matching is performed through the isCallableFrom method. Argument casting (when actually invoking the method) is performed through the castArgument method. All this code has support for integer and double, but not for short. That's probably the cause of your problem, but you'll have to debug it and probably add the missing support for shorts. > Q3: > From a more general perspective, is there a way to recover the actual Java > errors hidden behind "NoSuchMethodException" messages? The latter often > functions as a general container message for many other Java errors. As arguments are matched dynamically, this is really the error: no method could be found matching the arguments provided. Michael. ------------------------------------------------------------------------------ WhatsUp Gold - Download Free Network Management Software The most intuitive, comprehensive, and cost-effective network management toolset available today. Delivers lowest initial acquisition cost and overall TCO of any competing solution. http://p.sf.net/sfu/whatsupgold-sd _______________________________________________ Octave-dev mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/octave-dev
