bugGNU Octave - Bugs: bug #42710, fieldnames() fails for classnames...

 
 

bug #42710: fieldnames() fails for classnames in java dynamic classpath

Submitter:  Carnë Draug <carandraug>
Submitted:  Tue 08 Jul 2014 06:23:35 PM UTC
 
Category:  Libraries Severity:  3 - Normal
Priority:  5 - Normal Item Group:  Incorrect Result
Status:  Confirmed Assigned to:  None
Originator Name:  Open/Closed:  * Open
Release:  * dev Operating System:  * GNU/Linux
Fixed Release:  None Planned Release:  None
* Mandatory Fields

Add a New Comment (Rich Markup)
   

Comment Type & Canned Response:
       

 

Thu 11 Aug 2016 02:21:48 PM UTC, comment #5: 

in file scripts/general/fieldnames.m
I removed a superfluous branch.

(file #38177)

Ernst Reissner <ernstreissner>
Thu 21 Jul 2016 10:29:43 PM UTC, comment #4: 

not only fieldnames but also methods has the same problem:
error: [java] java.lang.ClassNotFoundException: eu.simuline.octave.OctaveInterfaceTester

with my class eu.simuline.octave.OctaveInterfaceTester
on the dynamic classpath.

Ernst Reissner <ernstreissner>
Mon 06 Apr 2015 07:51:50 PM UTC, comment #3: 

Reopening the bug, as the bug is still present.

This bug only affects classes on the java dynamic classpath.

Carnë Draug <carandraug>
Project Member
Mon 06 Apr 2015 02:40:22 PM UTC, comment #2: 

Not sure when but this seems to already been fixed. Removed the FIXME comment http://hg.savannah.gnu.org/hgweb/octave/rev/68aec55f5eb6 and closing the bug report

Carnë Draug <carandraug>
Project Member
Sun 22 Feb 2015 07:42:42 PM UTC, comment #1: 

I pushed this http://hg.savannah.gnu.org/hgweb/octave/rev/b2c4f869ff7c

which will fix the original bug. While fixing this, I noticed that it will still fails if a classname from the dynamic classpath is used (I think this is an Octave only feature, Matlab seems to not accept strings as input for fieldnames).

So:

$ wget http://downloads.openmicroscopy.org/bio-formats/5.0.2/artifacts/loci_tools.jar
[...]
$ octave
octave-gui:1> javaaddpath ("./loci_tools.jar" );
octave-gui:2> r = javaObject ("loci.formats.in.ZipReader");
octave-gui:3> fieldnames (r) # this now works
ans =
{
  [1,1] = MUST_GROUP
  [1,2] = CAN_GROUP
  [1,3] = CANNOT_GROUP
  [1,4] = COMPRESSION_SUFFIXES
}
octave-gui:4> class (r)
ans = loci.formats.in.ZipReader
octave-gui:5> fieldnames (class (r)) # this continues to fail
error: [java] java.lang.ClassNotFoundException: loci.formats.in.ZipReader
error: called from
    fieldnames at line 57 column 15

Carnë Draug <carandraug>
Project Member
Tue 08 Jul 2014 06:23:35 PM UTC, original submission:  

The function javafields() is currently deprecated and fieldnames() is recommended instead. However, fieldnames() fails for classes that are on the dynamic classpath instead of static path, while javafields() is working fine for both cases.

The following is using loci_tools.jar which can be downloaded from http://downloads.openmicroscopy.org/bio-formats/5.0.2/artifacts/loci_tools.jar just for the sake of an example:

$ wget http://downloads.openmicroscopy.org/bio-formats/5.0.2/artifacts/loci_tools.jar
[...]
$ octave
octave-cli-3.8.1> javaaddpath ("./loci_tools.jar" );
octave-cli-3.8.1> r = javaObject ('loci.formats.in.ZipReader');
octave-cli-3.8.1> javafields (r)
warning: javafields is obsolete and will be removed from a future version of Octave, please use fieldnames instead

{
  [1,1] = public static final int loci.formats.IFormatReader.MUST_GROUP
  [1,2] = public static final int loci.formats.IFormatReader.CAN_GROUP
  [1,3] = public static final int loci.formats.IFormatReader.CANNOT_GROUP
  [1,4] = public static final java.lang.String[] loci.formats.FormatHandler.COMPRESSION_SUFFIXES
}
octave-cli-3.8.1> fieldnames (r)
error: [java] java.lang.ClassNotFoundException: loci.formats.in.ZipReader
error: called from:
error:   /usr/local/share/octave/3.8.1/m/general/fieldnames.m at line 54, column 15
octave-cli-3.8.1> exit

$ echo './loci_tools.jar' > javaclasspath.txt
$ octave
octave-cli-3.8.1> r = javaObject ('loci.formats.in.ZipReader');
octave-cli-3.8.1> fieldnames (r)
ans =
{
  [1,1] = public static final int loci.formats.IFormatReader.MUST_GROUP
  [1,2] = public static final int loci.formats.IFormatReader.CAN_GROUP
  [1,3] = public static final int loci.formats.IFormatReader.CANNOT_GROUP
  [1,4] = public static final java.lang.String[] loci.formats.FormatHandler.COMPRESSION_SUFFIXES
}

Carnë Draug <carandraug>
Project Member

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach Files:
   
   
Comment:
   

Attached Files
file #38177:  patchBug42710.patch added by ernstreissner (3KiB - text/x-patch)

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by ernstreissner (Posted a comment)
  • -email is unavailable- added by mtmiller (Updated the item)
  • -email is unavailable- added by carandraug (Submitted the item)
  •  

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

    Only project members can vote.

     

     

     

     

    Follow 8 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2016-08-11 ernstreissner Attached File- Added patchBug42710.patch, #38177
    2015-04-06 carandraug StatusFixed Confirmed
        Open/ClosedClosed Open
    2015-04-06 carandraug StatusNone Fixed
        Open/ClosedOpen Closed
    2015-02-22 carandraug Summaryfieldnames() fails for java classes in dynamic classpath fieldnames() fails for classnames in java dynamic classpath
    2015-02-22 mtmiller CategoryNone Libraries
        Item GroupNone Incorrect Result

    Back to the top

    Powered by Savane 3.9