You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@pdfbox.apache.org by "Maruan Sahyoun (JIRA)" <ji...@apache.org> on 2012/05/04 08:11:09 UTC
[jira] [Commented] (PDFBOX-1300) COSNumber cannot convert numbers
to long
[ https://issues.apache.org/jira/browse/PDFBOX-1300?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13268159#comment-13268159 ]
Maruan Sahyoun commented on PDFBOX-1300:
----------------------------------------
Could you check where you get that number from? Could you attach a sample PDF? Although permitted a number in PDF should not be longer than 2,147,483,647 [ISO32000 Annex C.2].
> COSNumber cannot convert numbers to long
> -----------------------------------------
>
> Key: PDFBOX-1300
> URL: https://issues.apache.org/jira/browse/PDFBOX-1300
> Project: PDFBox
> Issue Type: Bug
> Components: Parsing
> Reporter: tatsiana mays
>
> in COSNumber.java if number passed is greater then long 9,223,372,036,854,775,807. This is what i have 2514740409086472832680141218906112. The method below cannot hadle
> Need to do some extra else if loop
> public static COSNumber get( String number ) throws IOException
> {
> if (number.length() == 1) {
> char digit = number.charAt(0);
> if ('0' <= digit && digit <= '9') {
> return COSInteger.get(digit - '0');
> } else if (digit == '-' || digit == '.') {
> // See https://issues.apache.org/jira/browse/PDFBOX-592
> return COSInteger.ZERO;
> } else {
> throw new IOException("Not a number: " + number);
> }
> } else if (number.indexOf('.') == -1 && number.length() < 19) {
> try
> {
> return COSInteger.get( Long.parseLong( number ) );
> }
> catch( NumberFormatException e )
> {
> throw new IOException( "Value is not an integer: " + number );
> }
> } else {
> return new COSFloat(number);
> }
> }
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira