maven-doxia-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From vsive...@apache.org
Subject svn commit: r701254 - /maven/doxia/doxia-tools/trunk/doxia-converter/src/main/java/org/apache/maven/doxia/DefaultConverter.java
Date Thu, 02 Oct 2008 21:56:10 GMT
Author: vsiveton
Date: Thu Oct  2 14:56:09 2008
New Revision: 701254

URL: http://svn.apache.org/viewvc?rev=701254&view=rev
Log:
o code duplication
o warning about DOXIA-184
o minor javadoc typo

Modified:
    maven/doxia/doxia-tools/trunk/doxia-converter/src/main/java/org/apache/maven/doxia/DefaultConverter.java

Modified: maven/doxia/doxia-tools/trunk/doxia-converter/src/main/java/org/apache/maven/doxia/DefaultConverter.java
URL: http://svn.apache.org/viewvc/maven/doxia/doxia-tools/trunk/doxia-converter/src/main/java/org/apache/maven/doxia/DefaultConverter.java?rev=701254&r1=701253&r2=701254&view=diff
==============================================================================
--- maven/doxia/doxia-tools/trunk/doxia-converter/src/main/java/org/apache/maven/doxia/DefaultConverter.java
(original)
+++ maven/doxia/doxia-tools/trunk/doxia-converter/src/main/java/org/apache/maven/doxia/DefaultConverter.java
Thu Oct  2 14:56:09 2008
@@ -267,21 +267,7 @@
                 getLog().debug( "Sink used: " + sink.getClass().getName() );
             }
 
-            try
-            {
-                parser.parse( input.getReader(), sink );
-            }
-            catch ( ParseException e )
-            {
-                throw new ConverterException( "ParseException: " + e.getMessage(), e );
-            }
-            finally
-            {
-                IOUtil.close( input.getReader() );
-                sink.flush();
-                sink.close();
-                IOUtil.close( output.getWriter() );
-            }
+            parse( parser, input.getFormat(), input.getReader(), sink, output.getWriter()
);
         }
         finally
         {
@@ -422,6 +408,27 @@
             getLog().debug( "Sink used: " + sink.getClass().getName() );
         }
 
+        parse( parser, inputFormat, reader, sink, writer );
+    }
+
+    /**
+     * @param parser not null
+     * @param reader not null
+     * @param sink not null
+     * @param writer not null
+     * @throws ConverterException if any
+     */
+    private void parse( Parser parser, String inputFormat, Reader reader, Sink sink, Writer
writer )
+        throws ConverterException
+    {
+        // add warnings
+        if ( inputFormat.equals( DOCBOOK_PARSER ) && getLog().isWarnEnabled() )
+        {
+            getLog().warn(
+                           "Docbook parser has some known issues. "
+                               + "Please refer to http://jira.codehaus.org/browse/DOXIA-184"
);
+        }
+
         try
         {
             parser.parse( reader, sink );
@@ -662,7 +669,7 @@
     {
         if ( xmlFile == null )
         {
-            throw new IllegalArgumentException( "f is required." );
+            throw new IllegalArgumentException( "xmlFile is required." );
         }
         if ( !xmlFile.isFile() )
         {



Mime
View raw message