Quantcast

[GitHub] poi pull request #55: fix: NumberFormatException if XSSFName.setNameName is ...

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

[GitHub] poi pull request #55: fix: NumberFormatException if XSSFName.setNameName is ...

asfgit
GitHub user Mille4Ever opened a pull request:

    https://github.com/apache/poi/pull/55

    fix: NumberFormatException if XSSFName.setNameName is set with a long name

    If you call XSSFName.setNameName with a long value consisting of a letter followed by a big number, you will get a NumberFormatException.
   
    **For example:**
    I want to set the name "F04030020010". In Excel using name box, I can set the name without any problems. If I want set the same name using poi, I will get the exception mentioned above.  
   
    The reason for the NumberFormatException:
    The method XSSFName.validateName splits the value "F04030020010" in a column part and in a row part. Columns only have letters, rows only numbers. The outcome looks like:
    _Column = F_
    _Row = 04030020010_
   
    In the next step, row will be converted into a number using _Integer.parseInt_. But the current row value exceed the max value of an Integer resulting in a NumberFormatException.
   
    Since the logic is fine, I replaced Integer.parseInt with BigDecimal, so there is no problem with parsing big numbers anymore.

You can merge this pull request into a Git repository by running:

    $ git pull https://github.com/Mille4Ever/poi trunk

Alternatively you can review and apply these changes as the patch at:

    https://github.com/apache/poi/pull/55.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

    This closes #55
   
----
commit 339838b909faf0744e8408ef12718f0a6463ffb7
Author: Thomas S <[hidden email]>
Date:   2017-05-18T11:35:59Z

    fix: NumberFormatException if XSSFName.setNameName is set with a long name which consists of a letter followed by a lot of numbers.

----


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [hidden email] or file a JIRA ticket
with INFRA.
---

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

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

[GitHub] poi pull request #55: fix: NumberFormatException if XSSFName.setNameName is ...

asfgit
Github user asfgit closed the pull request at:

    https://github.com/apache/poi/pull/55


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [hidden email] or file a JIRA ticket
with INFRA.
---

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

Loading...