maven-doxia-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From vsive...@apache.org
Subject svn commit: r709674 - in /maven/doxia/doxia-tools/trunk/doxia-converter: pom.xml src/main/java/org/apache/maven/doxia/DefaultConverter.java src/test/java/org/apache/maven/doxia/ConverterTest.java
Date Sat, 01 Nov 2008 11:11:48 GMT
Author: vsiveton
Date: Sat Nov  1 04:11:48 2008
New Revision: 709674

URL: http://svn.apache.org/viewvc?rev=709674&view=rev
Log:
o using latest plexus utils 

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

Modified: maven/doxia/doxia-tools/trunk/doxia-converter/pom.xml
URL: http://svn.apache.org/viewvc/maven/doxia/doxia-tools/trunk/doxia-converter/pom.xml?rev=709674&r1=709673&r2=709674&view=diff
==============================================================================
--- maven/doxia/doxia-tools/trunk/doxia-converter/pom.xml (original)
+++ maven/doxia/doxia-tools/trunk/doxia-converter/pom.xml Sat Nov  1 04:11:48 2008
@@ -33,6 +33,16 @@
   <name>Doxia Tools :: Converter</name>
   <description>Doxia Converter Tool to convert a supported format to another</description>
 
+  <dependencyManagement>
+    <dependencies>
+      <!-- Latest Plexus -->
+      <dependency>
+        <groupId>org.codehaus.plexus</groupId>
+        <artifactId>plexus-utils</artifactId>
+        <version>1.5.7-SNAPSHOT</version>
+      </dependency>
+    </dependencies>
+  </dependencyManagement>
   <dependencies>
     <!-- doxia -->
     <dependency>

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=709674&r1=709673&r2=709674&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
Sat Nov  1 04:11:48 2008
@@ -57,6 +57,7 @@
 import org.codehaus.plexus.util.StringUtils;
 import org.codehaus.plexus.util.WriterFactory;
 import org.codehaus.plexus.util.xml.XmlStreamReader;
+import org.codehaus.plexus.util.xml.XmlUtil;
 import org.codehaus.plexus.util.xml.pull.MXParser;
 import org.codehaus.plexus.util.xml.pull.XmlPullParser;
 import org.codehaus.plexus.util.xml.pull.XmlPullParserException;
@@ -496,7 +497,7 @@
         InputStream is = null;
         try
         {
-            if ( isXML( f ) )
+            if ( XmlUtil.isXml( f ) )
             {
                 reader = ReaderFactory.newXmlReader( f );
                 return ( (XmlStreamReader) reader ).getEncoding();
@@ -527,39 +528,6 @@
     }
 
     /**
-     * Determines if a given File shall be handled as XML.
-     *
-     * @param f not null file
-     * @return <code>true</code> if the given file has XML content, <code>false</code>
otherwise.
-     */
-    private static boolean isXML( File f )
-    {
-        if ( !f.isFile() )
-        {
-            throw new IllegalArgumentException( "The file '" + f.getAbsolutePath() + "' is
not a file." );
-        }
-
-        Reader reader = null;
-        try
-        {
-            reader = new XmlStreamReader( f );
-            XmlPullParser parser = new MXParser();
-            parser.setInput( reader );
-            parser.nextToken();
-
-            return true;
-        }
-        catch ( Exception e )
-        {
-            return false;
-        }
-        finally
-        {
-            IOUtil.close( reader );
-        }
-    }
-
-    /**
      * Auto detect Doxia format for the given file depending:
      * <ul>
      * <li>the file name for TextMarkup based Doxia files</li>

Modified: maven/doxia/doxia-tools/trunk/doxia-converter/src/test/java/org/apache/maven/doxia/ConverterTest.java
URL: http://svn.apache.org/viewvc/maven/doxia/doxia-tools/trunk/doxia-converter/src/test/java/org/apache/maven/doxia/ConverterTest.java?rev=709674&r1=709673&r2=709674&view=diff
==============================================================================
--- maven/doxia/doxia-tools/trunk/doxia-converter/src/test/java/org/apache/maven/doxia/ConverterTest.java
(original)
+++ maven/doxia/doxia-tools/trunk/doxia-converter/src/test/java/org/apache/maven/doxia/ConverterTest.java
Sat Nov  1 04:11:48 2008
@@ -630,57 +630,6 @@
     }
 
     /**
-     * Test {@link DefaultConverter#isXML( f )}
-     *
-     * @throws Throwable
-     */
-    public void testIsXML()
-        throws Throwable
-    {
-        String in = getBasedir() + "/src/test/resources/unit/apt/test.apt";
-        File f = new File( in );
-        Boolean result =
-            (Boolean) PrivateAccessor.invoke( DefaultConverter.class, "isXML", new Class[]
{ File.class },
-                                              new Object[] { f } );
-        assertEquals( result, Boolean.FALSE );
-
-        in = getBasedir() + "/src/test/resources/unit/confluence/test.confluence";
-        f = new File( in );
-        result =
-            (Boolean) PrivateAccessor.invoke( DefaultConverter.class, "isXML", new Class[]
{ File.class },
-                                              new Object[] { f } );
-        assertEquals( result, Boolean.FALSE );
-
-        in = getBasedir() + "/src/test/resources/unit/docbook/test.xml";
-        f = new File( in );
-        result =
-            (Boolean) PrivateAccessor.invoke( DefaultConverter.class, "isXML", new Class[]
{ File.class },
-                                              new Object[] { f } );
-        assertEquals( result, Boolean.TRUE );
-
-        in = getBasedir() + "/src/test/resources/unit/fml/test.fml";
-        f = new File( in );
-        result =
-            (Boolean) PrivateAccessor.invoke( DefaultConverter.class, "isXML", new Class[]
{ File.class },
-                                              new Object[] { f } );
-        assertEquals( result, Boolean.TRUE );
-
-        in = getBasedir() + "/src/test/resources/unit/twiki/test.twiki";
-        f = new File( in );
-        result =
-            (Boolean) PrivateAccessor.invoke( DefaultConverter.class, "isXML", new Class[]
{ File.class },
-                                              new Object[] { f } );
-        assertEquals( result, Boolean.FALSE );
-
-        in = getBasedir() + "/src/test/resources/unit/xhtml/test.xhtml";
-        f = new File( in );
-        result =
-            (Boolean) PrivateAccessor.invoke( DefaultConverter.class, "isXML", new Class[]
{ File.class },
-                                              new Object[] { f } );
-        assertEquals( result, Boolean.TRUE );
-    }
-
-    /**
      * Test {@link DefaultConverter#autoDetectFormat( f, encoding )}
      *
      * @throws Throwable



Mime
View raw message