Hi Michael,

Indeed I was using outdated version if iText, sorry for that.

After update to latest 5.4.2, NumberFormatException is still there,
check test PDF
<https://www.dropbox.com/s/te3icjsj9xjd4p0/itext_NumberFormatException.pdf>.
Tested with:

    java -cp itextpdf-5.4.2.jar
    com.itextpdf.text.pdf.parser.PdfContentReaderTool
    "itext_NumberFormatException.pdf"
    ...
    0 -1.6006 TD
    (<tgagatctac
    0 Nttccga taactcccta a898Tsg7>0 -3.3992 TD
    (<200>  124TjtN<iETjava.lang.RuntimeException: - is not a valid
    number - *java.lang.NumberFormatException*: For input string: "-"
            at com.itextpdf.text.pdf.PdfNumber.<init>(PdfNumber.java:83)
            at
    
com.itextpdf.text.pdf.PdfContentParser.readPRObject(PdfContentParser.java:182)
            at
    com.itextpdf.text.pdf.PdfContentParser.parse(PdfContentParser.java:89)
            at
    
com.itextpdf.text.pdf.parser.PdfContentStreamProcessor.processContent(PdfContentStreamProcessor.java:365)
            at
    
com.itextpdf.text.pdf.parser.PdfReaderContentParser.processContent(PdfReaderContentParser.java:79)
            at
    
com.itextpdf.text.pdf.parser.PdfTextExtractor.getTextFromPage(PdfTextExtractor.java:73)
            at
    
com.itextpdf.text.pdf.parser.PdfContentReaderTool.listContentStreamForPage(PdfContentReaderTool.java:181)
            at
    
com.itextpdf.text.pdf.parser.PdfContentReaderTool.listContentStream(PdfContentReaderTool.java:204)
            at
    
com.itextpdf.text.pdf.parser.PdfContentReaderTool.main(PdfContentReaderTool.java:248)

StringIndexOutOfBoundsException seems to be fixed. I will doublecheck.

On 04.06.2013 9:49, Michael Demey wrote:
> Hi Dmitry,
>
> If you're using the latest version of iText (5.4.2), could you provide 
> those PDFs to us?
> If you're not, could you upgrade and check your PDFs again?
>
> Kind regards,
> Michaƫl.
>
>
> Op 3/06/2013 12:50, Dmitry Katsubo schreef:
>> Dear iText developers,
>>
>> I have noticed that for certain (perhaps not well-formed) PDFs following
>> exceptions are thrown:
>>
>>   * NumberFormatException in PdfNumber
>>
>>     java.lang.RuntimeException: - is not a valid number -
>>     java.lang.NumberFormatException: For input string: "-"
>>          at com.itextpdf.text.pdf.PdfNumber.<init>(PdfNumber.java:83)
>>          at
>>     
>> com.itextpdf.text.pdf.PdfContentParser.readPRObject(PdfContentParser.java:180)
>>          at
>>     com.itextpdf.text.pdf.PdfContentParser.parse(PdfContentParser.java:89)
>>          at
>>     
>> com.itextpdf.text.pdf.parser.PdfContentStreamProcessor.processContent(PdfContentStreamProcessor.java:359)
>>          at
>>     
>> com.itextpdf.text.pdf.parser.PdfReaderContentParser.processContent(PdfReaderContentParser.java:41)
>>
>>     It looks like there should be an additional check in PdfNumber that
>>     input string is actually a number and perhaps ignore it in case it
>>     is not.
>>
>>   * StringIndexOutOfBoundsException in SimpleTextExtractionStrategy
>>
>>     java.lang.StringIndexOutOfBoundsException: String index out of range: 0
>>          at java.lang.String.charAt(String.java:686)
>>          at
>>     
>> com.itextpdf.text.pdf.parser.SimpleTextExtractionStrategy.renderText(SimpleTextExtractionStrategy.java:126)
>>          at
>>     
>> com.itextpdf.text.pdf.parser.PdfContentStreamProcessor.displayPdfString(PdfContentStreamProcessor.java:304)
>>          at
>>     
>> com.itextpdf.text.pdf.parser.PdfContentStreamProcessor.access$2500(PdfContentStreamProcessor.java:75)
>>          at
>>     
>> com.itextpdf.text.pdf.parser.PdfContentStreamProcessor$ShowTextArray.invoke(PdfContentStreamProcessor.java:428)
>>          at
>>     
>> com.itextpdf.text.pdf.parser.PdfContentStreamProcessor.invokeOperator(PdfContentStreamProcessor.java:247)
>>          at
>>     
>> com.itextpdf.text.pdf.parser.PdfContentStreamProcessor.processContent(PdfContentStreamProcessor.java:366)
>>          at
>>     
>> com.itextpdf.text.pdf.parser.PdfReaderContentParser.processContent(PdfReaderContentParser.java:41)
>>
>>     Additional check for string length is required or perhaps
>>     StringUtils.substring(renderInfo.getText(), 0, 1) will be safe enough.
>>
>>
>>
>>
>> ------------------------------------------------------------------------------
>> Get 100% visibility into Java/.NET code with AppDynamics Lite
>> It's a free troubleshooting tool designed for production
>> Get down to code-level detail for bottlenecks, with <2% overhead.
>> Download for free and get started troubleshooting in minutes.
>> http://p.sf.net/sfu/appdyn_d2d_ap2
>>
>>
>>
>> _______________________________________________
>> iText-questions mailing list
>> iText-questions@lists.sourceforge.net
>> https://lists.sourceforge.net/lists/listinfo/itext-questions
>>
>> iText(R) is a registered trademark of 1T3XT BVBA.
>> Many questions posted to this list can (and will) be answered with a 
>> reference to the iText book: http://www.itextpdf.com/book/
>> Please check the keywords list before you ask for examples: 
>> http://itextpdf.com/themes/keywords.php
>>
>
> ------------------------------------------------------------------------------
> How ServiceNow helps IT people transform IT departments:
> 1. A cloud service to automate IT design, transition and operations
> 2. Dashboards that offer high-level views of enterprise services
> 3. A single system of record for all IT processes
> http://p.sf.net/sfu/servicenow-d2d-j
> _______________________________________________
> iText-questions mailing list
> iText-questions@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/itext-questions
>
> iText(R) is a registered trademark of 1T3XT BVBA.
> Many questions posted to this list can (and will) be answered with a 
> reference to the iText book: http://www.itextpdf.com/book/
> Please check the keywords list before you ask for examples: 
> http://itextpdf.com/themes/keywords.php
>


-- 
C ?????????? ???????????,
???????

------------------------------------------------------------------------------
How ServiceNow helps IT people transform IT departments:
1. A cloud service to automate IT design, transition and operations
2. Dashboards that offer high-level views of enterprise services
3. A single system of record for all IT processes
http://p.sf.net/sfu/servicenow-d2d-j
_______________________________________________
iText-questions mailing list
iText-questions@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/itext-questions

iText(R) is a registered trademark of 1T3XT BVBA.
Many questions posted to this list can (and will) be answered with a reference 
to the iText book: http://www.itextpdf.com/book/
Please check the keywords list before you ask for examples: 
http://itextpdf.com/themes/keywords.php

Reply via email to