Apache POI

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

Apache POI

dejan ikodinovic
Hi guys,

I m working on parsing Excel xlsb files using Apache POI 3.17 version and
have problem for some numbers.
The problem is reading some numbers with 7 - 9 digits result as 0. This is
not the case for all 7 - 9 digits numbers.

for numbers like
1000000, 10000000, 1880000, 1880400 it works correct, but one example where
I get 0 is *1880450*.

---------------------------------- *GOOD *
-------------------------------------
With debug I found for *1880400* read as byte array
[0, 0, 0, 0, 80, -79, 60, 65]

this is correct I also checked with java code as:

System.out.println(
    ByteBuffer.wrap(new byte[] { 65, 60, -79, 80, 0, 0, 0, 0 })
        .getDouble());

and it outputs 1880400.0

also when read bytes like

ByteBuffer.allocate(8).putDouble(1880400).array()

[65, 60, -79, 80, 0, 0, 0, 0]
same as with *XSSFBParser*

---------------------------------- *BAD*
-------------------------------------

but *XSSFBParser* when read bytes for *1880450* returns array
[0, 0, 0, 0, 10, -58, 114, 0]

and when I check with

ByteBuffer.allocate(8).putDouble(1880450).array()

[65, 60, -79, -126, 0, 0, 0, 0]
and this is correct byte array, but we dont get these bytes when read from
InputStream

I guess this wrong read bytes comes from

LittleEndianInputStream in XSSFBParser

Just to mention that I saw you've released new Version 4.0.0 and tried it
as well and problem still exists. It reads 0 value for 1880450.

Any idea (advice, help) what could be problem and how I can fix this?
Many thanks in advance!!!

Cheers,
Dejan
Reply | Threaded
Open this post in threaded view
|

Re: Apache POI

pj.fanning
Could you raise a bugzilla issue and attach an xlsb file?
https://bz.apache.org/bugzilla/

xlsb is not an active area of development, I'm afraid.



--
Sent from: http://apache-poi.1045710.n5.nabble.com/POI-Dev-f2312866.html

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: Apache POI

Tim Allison
In reply to this post by dejan ikodinovic
Can you open an issue on out bugzilla and post a test file w a unit test?
Thank you for sharing this w us!

On Wed, Sep 12, 2018 at 5:58 AM dejan ikodinovic <[hidden email]>
wrote:

> Hi guys,
>
> I m working on parsing Excel xlsb files using Apache POI 3.17 version and
> have problem for some numbers.
> The problem is reading some numbers with 7 - 9 digits result as 0. This is
> not the case for all 7 - 9 digits numbers.
>
> for numbers like
> 1000000, 10000000, 1880000, 1880400 it works correct, but one example where
> I get 0 is *1880450*.
>
> ---------------------------------- *GOOD *
> -------------------------------------
> With debug I found for *1880400* read as byte array
> [0, 0, 0, 0, 80, -79, 60, 65]
>
> this is correct I also checked with java code as:
>
> System.out.println(
>     ByteBuffer.wrap(new byte[] { 65, 60, -79, 80, 0, 0, 0, 0 })
>         .getDouble());
>
> and it outputs 1880400.0
>
> also when read bytes like
>
> ByteBuffer.allocate(8).putDouble(1880400).array()
>
> [65, 60, -79, 80, 0, 0, 0, 0]
> same as with *XSSFBParser*
>
> ---------------------------------- *BAD*
> -------------------------------------
>
> but *XSSFBParser* when read bytes for *1880450* returns array
> [0, 0, 0, 0, 10, -58, 114, 0]
>
> and when I check with
>
> ByteBuffer.allocate(8).putDouble(1880450).array()
>
> [65, 60, -79, -126, 0, 0, 0, 0]
> and this is correct byte array, but we dont get these bytes when read from
> InputStream
>
> I guess this wrong read bytes comes from
>
> LittleEndianInputStream in XSSFBParser
>
> Just to mention that I saw you've released new Version 4.0.0 and tried it
> as well and problem still exists. It reads 0 value for 1880450.
>
> Any idea (advice, help) what could be problem and how I can fix this?
> Many thanks in advance!!!
>
> Cheers,
> Dejan
>
Reply | Threaded
Open this post in threaded view
|

Re: Apache POI

Tim Allison
In reply to this post by dejan ikodinovic
Dejan,
  Thank you for letting us know about this problem.  I was able to
reproduce it, and I've opened a ticket:
https://bz.apache.org/bugzilla/show_bug.cgi?id=62815
On Wed, Sep 12, 2018 at 5:58 AM dejan ikodinovic
<[hidden email]> wrote:

>
> Hi guys,
>
> I m working on parsing Excel xlsb files using Apache POI 3.17 version and
> have problem for some numbers.
> The problem is reading some numbers with 7 - 9 digits result as 0. This is
> not the case for all 7 - 9 digits numbers.
>
> for numbers like
> 1000000, 10000000, 1880000, 1880400 it works correct, but one example where
> I get 0 is *1880450*.
>
> ---------------------------------- *GOOD *
> -------------------------------------
> With debug I found for *1880400* read as byte array
> [0, 0, 0, 0, 80, -79, 60, 65]
>
> this is correct I also checked with java code as:
>
> System.out.println(
>     ByteBuffer.wrap(new byte[] { 65, 60, -79, 80, 0, 0, 0, 0 })
>         .getDouble());
>
> and it outputs 1880400.0
>
> also when read bytes like
>
> ByteBuffer.allocate(8).putDouble(1880400).array()
>
> [65, 60, -79, 80, 0, 0, 0, 0]
> same as with *XSSFBParser*
>
> ---------------------------------- *BAD*
> -------------------------------------
>
> but *XSSFBParser* when read bytes for *1880450* returns array
> [0, 0, 0, 0, 10, -58, 114, 0]
>
> and when I check with
>
> ByteBuffer.allocate(8).putDouble(1880450).array()
>
> [65, 60, -79, -126, 0, 0, 0, 0]
> and this is correct byte array, but we dont get these bytes when read from
> InputStream
>
> I guess this wrong read bytes comes from
>
> LittleEndianInputStream in XSSFBParser
>
> Just to mention that I saw you've released new Version 4.0.0 and tried it
> as well and problem still exists. It reads 0 value for 1880450.
>
> Any idea (advice, help) what could be problem and how I can fix this?
> Many thanks in advance!!!
>
> Cheers,
> Dejan

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]