maven-doxia-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From vsive...@apache.org
Subject svn commit: r806098 - /maven/doxia/doxia-sitetools/trunk/doxia-doc-renderer/src/main/java/org/apache/maven/doxia/docrenderer/pdf/itext/ITextPdfRenderer.java
Date Thu, 20 Aug 2009 09:33:39 GMT
Author: vsiveton
Date: Thu Aug 20 09:33:39 2009
New Revision: 806098

URL: http://svn.apache.org/viewvc?rev=806098&view=rev
Log:
MPDF-17: Test fails with JDK 1.5+ if base directory has a space in its path

o using a writer in the StreamResult

Modified:
    maven/doxia/doxia-sitetools/trunk/doxia-doc-renderer/src/main/java/org/apache/maven/doxia/docrenderer/pdf/itext/ITextPdfRenderer.java

Modified: maven/doxia/doxia-sitetools/trunk/doxia-doc-renderer/src/main/java/org/apache/maven/doxia/docrenderer/pdf/itext/ITextPdfRenderer.java
URL: http://svn.apache.org/viewvc/maven/doxia/doxia-sitetools/trunk/doxia-doc-renderer/src/main/java/org/apache/maven/doxia/docrenderer/pdf/itext/ITextPdfRenderer.java?rev=806098&r1=806097&r2=806098&view=diff
==============================================================================
--- maven/doxia/doxia-sitetools/trunk/doxia-doc-renderer/src/main/java/org/apache/maven/doxia/docrenderer/pdf/itext/ITextPdfRenderer.java
(original)
+++ maven/doxia/doxia-sitetools/trunk/doxia-doc-renderer/src/main/java/org/apache/maven/doxia/docrenderer/pdf/itext/ITextPdfRenderer.java
Thu Aug 20 09:33:39 2009
@@ -491,13 +491,28 @@
 
         addTransformerParameters( transformer, documentModel, iTextFile );
 
+        // need a writer for StreamResult to prevent FileNotFoundException when iTextFile
contains spaces
+        Writer writer = null;
         try
         {
-            transformer.transform( new DOMSource( document ), new StreamResult( iTextFile
) );
+            writer = WriterFactory.newXmlWriter( iTextFile );
+            transformer.transform( new DOMSource( document ), new StreamResult( writer )
);
         }
         catch ( TransformerException e )
         {
-            throw new DocumentRendererException( "Error transforming Document " + document
+ ": " + e.getMessage() );
+            throw new DocumentRendererException(
+                                                 "Error transforming Document " + document
+ ": " + e.getMessage(),
+                                                 e );
+        }
+        catch ( IOException e )
+        {
+            throw new DocumentRendererException(
+                                                 "Error transforming Document " + document
+ ": " + e.getMessage(),
+                                                 e );
+        }
+        finally
+        {
+            IOUtil.close( writer );
         }
     }
 



Mime
View raw message