[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Octave-bug-tracker] [bug #46010] methods.m: often fails if applied to c
From: |
Philip Nienhuis |
Subject: |
[Octave-bug-tracker] [bug #46010] methods.m: often fails if applied to complex Java objects |
Date: |
Sun, 20 Sep 2015 23:02:27 +0000 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:36.0) Gecko/20100101 Firefox/36.0 SeaMonkey/2.33 |
URL:
<http://savannah.gnu.org/bugs/?46010>
Summary: methods.m: often fails if applied to complex Java
objects
Project: GNU Octave
Submitted by: philipnienhuis
Submitted on: Mon 21 Sep 2015 01:02:26 AM CEST
Category: Octave Function
Severity: 3 - Normal
Priority: 5 - Normal
Item Group: Incorrect Result
Status: In Progress
Assigned to: philipnienhuis
Originator Name: Philip Nienhuis
Originator Email:
Open/Closed: Open
Discussion Lock: Any
Release: dev
Operating System: Any
_______________________________________________________
Details:
methods.m always applies the (Java) "getMethods" method to the *class names*
rather than the actual Java object.
For some (several) more complicated Java objects this will fail.
Sample using JExcelAPI (just to illustrate):
>> javaclasspath
STATIC JAVA PATH
- empty -
DYNAMIC JAVA PATH
:
/home/philip/java/jxl.jar
:
>> xls = xlsopen ('new.xls', 1, 'jxl')
Checking requested interface(s):
JXL*; (* = default interface)
xls =
scalar structure containing the fields:
xtype = JXL
app =
<Java object: java.io.File>
filename = new.xls
workbook =
<Java object: jxl.write.biff.WritableWorkbookImpl>
changed = 3
limits = [](0x0)
>> methods (xls.workbook)
error: [java] java.lang.ClassNotFoundException:
jxl.write.biff.WritableWorkbookImpl
error: called from
methods at line 53 column 14
However, applying getMethods() to the Java object itself:
>> strsplit (javaMethod ("getMethods", "org.octave.ClassHelper",
xls.workbook), ";")
ans =
{
[1,1] = java.lang.String getName(int)
[1,2] = void write() throws java.io.IOException
[1,3] = void close() throws java.io.IOException,
jxl.write.biff.JxlWriteException
[1,4] = java.lang.String getExternalSheetName(int)
:
<many methods snipped>
:
[1,43] = void notifyAll()
}
>>
A try-catch where getMethods() is first applied to the Java object and if this
fails, converting to the class name in the catch clause, is a simple fix for
this bug.
I'll upload a changeset as soon as I have the bug number.
_______________________________________________________
Reply to this item at:
<http://savannah.gnu.org/bugs/?46010>
_______________________________________________
Message sent via/by Savannah
http://savannah.gnu.org/
- [Octave-bug-tracker] [bug #46010] methods.m: often fails if applied to complex Java objects,
Philip Nienhuis <=