bugGNU Octave - Bugs: bug #44764, exist() does not recognize Java...

 
 

bug #44764: exist() does not recognize Java objects

Submitted by:  Thomas Foesel <thofoe>
Submitted on:  Tue 07 Apr 2015 03:56:48 PM UTC  
 
Category: Octave FunctionSeverity: 3 - Normal
Priority: 5 - NormalItem Group: Incorrect Result
Status: FixedAssigned to: None
Originator Name: Open/Closed: Closed
Release: devOperating System: GNU/Linux

Add a New Comment(Rich Markup)
   

You are not logged in

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

 

(Jump to the original submission Jump to the original submission)

Wed 08 Apr 2015 04:22:57 PM UTC, comment #7:

We only need to override the base object's functions that we are interested in. The default is to return false, so we're good.

Rik <rik5>
Project Administrator
Wed 08 Apr 2015 03:54:56 PM UTC, comment #6:

Yes, but only this weekend this I started playing more with stuff in libinterp/java-octave and didn't want to touch this.

Should we keep octave_java::is_object and just have it return false?

Carnë Draug <carandraug>
Project Member
Wed 08 Apr 2015 03:20:25 PM UTC, comment #5:

Okay, I'm not surprised. Did you see my comment in the cset?

I changed to using is_constant instead and 'make check' passes for me. See new cset (http://hg.savannah.gnu.org/hgweb/octave/rev/d7b1999f0554).

Rik <rik5>
Project Administrator
Wed 08 Apr 2015 12:27:56 PM UTC, comment #4:

The fix is causing other bugs, because while exist() must recognize java objects, isobject() must not recognize java objects. On Matlab r2010b:

This is causing fieldnames to fail its tests (because it uses isobject() to distinguish them).

Carnë Draug <carandraug>
Project Member
Wed 08 Apr 2015 05:07:25 AM UTC, comment #3:

Fixed in this cset (http://hg.savannah.gnu.org/hgweb/octave/rev/302e48c2de5d). Closing report.

Rik <rik5>
Project Administrator
Tue 07 Apr 2015 07:12:41 PM UTC, comment #2:

See task #12601 at the bottom of the original report (https://savannah.gnu.org/task/?12601)

Philip Nienhuis <philipnienhuis>
Project Member
Tue 07 Apr 2015 04:43:53 PM UTC, comment #1:

Confirmed. This should return '1' because j_str obviously exists as a variable within the workspace which you can check with 'who' or 'whos'.

Rik <rik5>
Project Administrator
Tue 07 Apr 2015 03:56:48 PM UTC, original submission:

The Octave built-in function exist() does not recognize Java objects: the following code

===========================
j_str=javaObject('java.lang.String','Hello, world.');
exist('j_str')
===========================

gives the output value 0, i.e. false. This is counter-intuitive/wrong, and also different to Matlab (check with my latest available version, R2012b) which returns 1, i.e. true; so I guess this is a bug.

This behavior is also the case if the variable has been created previously. Octave returns the value 0 also for the following:

===========================
j_str=42;
j_str=javaObject('java.lang.String','Hello, world.');
exist('j_str')
===========================

Thomas Foesel <thofoe>

 

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

Attach File(s):
   
   
Comment:
   

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -unavailable- added by rik5 (Posted a comment)
  • -unavailable- added by thofoe (Submitted the item)
  •  

    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 9 latest changes.

    Date Changed By Updated Field Previous Value => Replaced By
    Wed 08 Apr 2015 03:20:25 PM UTCrik5StatusConfirmed=>Fixed
      Open/ClosedOpen=>Closed
    Wed 08 Apr 2015 12:27:56 PM UTCcarandraugStatusFixed=>Confirmed
      Open/ClosedClosed=>Open
    Wed 08 Apr 2015 05:07:25 AM UTCrik5StatusConfirmed=>Fixed
      Open/ClosedOpen=>Closed
    Tue 07 Apr 2015 04:43:53 PM UTCrik5Item GroupNone=>Incorrect Result
      StatusNone=>Confirmed
      Release3.8.2=>dev

    Back to the top


    Powered by Savane 3.1-cleanup1