Author: danielwilson
Date: Wed Feb 10 03:27:44 2010
New Revision: 908338

URL: http://svn.apache.org/viewvc?rev=908338&view=rev
Log:
re: PDFBOX-614 , log exception rather than crash.

Modified:
    pdfbox/trunk/src/main/java/org/apache/pdfbox/util/PDFStreamEngine.java

Modified: pdfbox/trunk/src/main/java/org/apache/pdfbox/util/PDFStreamEngine.java
URL: 
http://svn.apache.org/viewvc/pdfbox/trunk/src/main/java/org/apache/pdfbox/util/PDFStreamEngine.java?rev=908338&r1=908337&r2=908338&view=diff
==============================================================================
--- pdfbox/trunk/src/main/java/org/apache/pdfbox/util/PDFStreamEngine.java 
(original)
+++ pdfbox/trunk/src/main/java/org/apache/pdfbox/util/PDFStreamEngine.java Wed 
Feb 10 03:27:44 2010
@@ -316,10 +316,16 @@
         //This will typically be 1000 but in the case of a type3 font
         //this might be a different number
         final float glyphSpaceToTextSpaceFactor = 
1f/font.getFontMatrix().getValue( 0, 0 );
+        float spaceWidthText=0;
+        
+        try{ // to avoid crash as described in PDFBOX-614
+            // lets see what the space displacement should be
+            spaceWidthText = (font.getFontWidth( SPACE_BYTES, 0, 1 
)/glyphSpaceToTextSpaceFactor);
+        }catch (Throwable exception)
+        {
+            log.warn( exception, exception);
+        }
         
-
-        // lets see what the space displacement should be
-        float spaceWidthText = (font.getFontWidth( SPACE_BYTES, 0, 1 
)/glyphSpaceToTextSpaceFactor);
         if( spaceWidthText == 0 )
         {
             spaceWidthText = 
(font.getAverageFontWidth()/glyphSpaceToTextSpaceFactor);


Reply via email to