bugGNU Octave - Bugs: bug #48819, java interface: set String[] fails

 
 

bug #48819: java interface: set String[] fails

Submitted by:  Ernst Reissner <ernstreissner>
Submitted on:  Thu 18 Aug 2016 05:41:29 PM UTC  
 
Category: Octave FunctionSeverity: 3 - Normal
Priority: 5 - NormalItem Group: Incorrect Result
Status: NoneAssigned to: None
Originator Name: Open/Closed: Open
Release: devOperating System: Any

Add a New Comment(Rich Markup)
   

You are not logged in

Please log in, so followups can be emailed to you.

 

Thu 18 Aug 2016 05:41:29 PM UTC, original submission:

With the java class attached, try:

Of course t.aStr returns null, i.e. [], because not initialized.
Initialize in the following way:

and check:

which really yields

So all ok until now.
Normally, it should be much easier to initialize t.aStr.
Try
which should initialize with another String[], namely['ab';'cd';'ef'] according to
http://de.mathworks.com/help/matlab/matlab_external/passing-data-to-a-java-method.html

but trying

yields
representing the null-value.
This is easy to see:
ClassHelper.castArgument just returns null if it cannot cast.
That way, the field becomes initialized with null.

This works for all reference types because for these null is untyped.
So, the bug is hidden.
It would be better to throw a ClassCastException in ClassHelper.castArgument.

Ernst Reissner <ernstreissner>

 

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

Attach File(s):
   
   
Comment:
   

Attached Files
file #38257:  OctaveInterfaceTester.java added by ernstreissner (5KiB - application/x-java)

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -unavailable- added by mtmiller (Updated the item)
  • -unavailable- added by ernstreissner (Submitted the item)
  • -unavailable- added by ernstreissner
  •  

    Do you think this task is very important?
    If so, you can click here to add your encouragement to it.
    This task has 0 encouragements so far.

    Only project members can vote.

     

    Please enter the title of George Orwell's famous dystopian book (it's a date):

     

     

    Follow 4 latest changes.

    Date Changed By Updated Field Previous Value => Replaced By
    Fri 18 Nov 2016 07:29:26 PM UTCmtmillerCategoryNone=>Octave Function
      Item GroupNone=>Incorrect Result
    Thu 18 Aug 2016 05:41:29 PM UTCernstreissnerAttached File-=>Added OctaveInterfaceTester.java, #38257
      Carbon-Copy-=>Added -unavailable-

    Back to the top


    Powered by Savane 3.1-cleanup1