octave-bug-tracker
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Octave-bug-tracker] [bug #48013] Java integration: conversion to double


From: Philip Nienhuis
Subject: [Octave-bug-tracker] [bug #48013] Java integration: conversion to double
Date: Sat, 20 Aug 2016 19:00:29 +0000 (UTC)
User-agent: Mozilla/5.0 (X11; Linux i686 on x86_64; rv:43.0) Gecko/20100101 Firefox/43.0 SeaMonkey/2.40

Update of bug #48013 (project octave):

                  Status:                   Fixed => None                   
             Open/Closed:                  Closed => Open                   

    _______________________________________________________

Follow-up Comment #21:

Reopening this bug report.

Since applying the cset in comment #17 I get errors when reading .ods
spreadsheets with the JOD (jOpenDocument) interface.
Backing out f094186125d3 restores proper operation.

With that cset applied, Octave reads (jOpenDocument) cell types "FLOAT" as
java.math.BigDecimal instead of converting them to Octave double.

I have manually executed the relevant statements from the respective (private)
jOpenDocument functions in the io package (v.2.4.2) in Matlab r2016a, and
there, in Matlab, the cells are converted to double as I expected.

A simple .ods spreadsheet file is attached to this bug report. Reading it with
LibreOffice, Excel 2013, Octave+io package with OCT / OTK / UNO interfaces
works fine. 
Reading it with JOD gets erroneous results; to reproduce:

>> pkg load io
>> javaaddpath ('jOpenDocument-1.4r2.jar')
>> format compact
>> ods = odsopen ('iomltest.ods', 0, 'jod')
ods =
  scalar structure containing the fields:
    xtype = JOD
    app = file
    filename = iomltest.ods
    workbook =
<Java object: org.jopendocument.dom.spreadsheet.SpreadSheet>
    changed = 0
    limits = [](0x0)
    odfvsn =  4
>> rawarr = ods2oct (ods, 1)
rawarr =
{
  [1,1] =
<Java object: java.math.BigDecimal>
  [2,1] =
<Java object: java.math.BigDecimal>
  [1,2] =
<Java object: java.math.BigDecimal>
  [2,2] =
<Java object: java.math.BigDecimal>
}
>> ods = odsclose (ods)
ods = [](0x0)


The proper results (e.g., with the otk interface = ODF Toolkit / odfdom)
should look like:

>> ods = odsopen ('/mnt/win7/tmp/iomltest.ods', 0, 'otk')
Checking requested interface(s):
OTK*; (* = default interface)
ods =
  scalar structure containing the fields:
    xtype = OTK
    app =
<Java object: org.odftoolkit.odfdom.doc.OdfSpreadsheetDocument>
    filename = /mnt/win7/tmp/iomltest.ods
    workbook =
<Java object: org.odftoolkit.odfdom.dom.OdfContentDom>
    changed = 0
    limits = [](0x0)
    odfvsn = 0.8.8
>> raw = ods2oct (ods)
raw =
{
  [1,1] =  1
  [2,1] =  1.5000
  [1,2] =  2
  [2,2] =  2.5000
}


jOpendDocument-1.4-rc2.jar can be obtained from www.jopendocument.og (it is
GPL, BTW).

Given that this occurs only with jOpenDocument, one can argue about whether
this is jopendocument's fault.
But again, Matlab does return doubles with the jOpenDocument classlib loaded.
So I tend to point to the fix in comment #7.

It can be worked around in the io package, but at the cost of a significant
amount of complexity, duplicate code and if-endif blocks to select code paths
depending on the Octave version at hand. 
Obviously I'd rather see Octave mimic Matlab :-)

(BTW  jOpenDocument is IMO the best of all Java-based spreadsheet I/O classes
for .ods; by far the fastest and it also supports the old OpenOffice.org .sxc
format.)


    _______________________________________________________

Reply to this item at:

  <http://savannah.gnu.org/bugs/?48013>

_______________________________________________
  Message sent via/by Savannah
  http://savannah.gnu.org/




reply via email to

[Prev in Thread] Current Thread [Next in Thread]