maven-doxia-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From vsive...@apache.org
Subject svn commit: r740274 - /maven/doxia/doxia/trunk/doxia-book/src/main/java/org/apache/maven/doxia/book/services/io/DefaultBookIo.java
Date Tue, 03 Feb 2009 11:16:59 GMT
Author: vsiveton
Date: Tue Feb  3 11:16:59 2009
New Revision: 740274

URL: http://svn.apache.org/viewvc?rev=740274&view=rev
Log:
o using ReaderFactory to read book

Modified:
    maven/doxia/doxia/trunk/doxia-book/src/main/java/org/apache/maven/doxia/book/services/io/DefaultBookIo.java

Modified: maven/doxia/doxia/trunk/doxia-book/src/main/java/org/apache/maven/doxia/book/services/io/DefaultBookIo.java
URL: http://svn.apache.org/viewvc/maven/doxia/doxia/trunk/doxia-book/src/main/java/org/apache/maven/doxia/book/services/io/DefaultBookIo.java?rev=740274&r1=740273&r2=740274&view=diff
==============================================================================
--- maven/doxia/doxia/trunk/doxia-book/src/main/java/org/apache/maven/doxia/book/services/io/DefaultBookIo.java
(original)
+++ maven/doxia/doxia/trunk/doxia-book/src/main/java/org/apache/maven/doxia/book/services/io/DefaultBookIo.java
Tue Feb  3 11:16:59 2009
@@ -25,12 +25,15 @@
 import org.apache.maven.doxia.book.context.BookContext;
 import org.apache.maven.doxia.module.site.SiteModule;
 import org.apache.maven.doxia.module.site.manager.SiteModuleManager;
+import org.codehaus.plexus.util.IOUtil;
+import org.codehaus.plexus.util.ReaderFactory;
 import org.codehaus.plexus.util.xml.pull.XmlPullParserException;
 import org.codehaus.plexus.logging.AbstractLogEnabled;
 
 import java.io.FileReader;
 import java.io.IOException;
 import java.io.File;
+import java.io.Reader;
 import java.util.Collection;
 import java.util.Iterator;
 import java.util.Map;
@@ -60,9 +63,11 @@
     public BookModel readBook( File bookDescriptor )
         throws BookDoxiaException
     {
+        Reader reader = null;
         try
         {
-            return new BookModelXpp3Reader().read( new FileReader( bookDescriptor ), true
);
+            reader = ReaderFactory.newXmlReader( bookDescriptor );
+            return new BookModelXpp3Reader().read( reader, true );
         }
         catch ( IOException e )
         {
@@ -72,6 +77,10 @@
         {
             throw new BookDoxiaException( "Error while reading book descriptor.", e );
         }
+        finally
+        {
+            IOUtil.close( reader );
+        }
     }
 
     /** {@inheritDoc} */



Mime
View raw message