maven-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bentm...@apache.org
Subject svn commit: r930708 - /maven/maven-3/trunk/maven-model-builder/src/main/java/org/apache/maven/model/io/DefaultModelReader.java
Date Sun, 04 Apr 2010 16:18:48 GMT
Author: bentmann
Date: Sun Apr  4 16:18:47 2010
New Revision: 930708

URL: http://svn.apache.org/viewvc?rev=930708&view=rev
Log:
o Refactored code

Modified:
    maven/maven-3/trunk/maven-model-builder/src/main/java/org/apache/maven/model/io/DefaultModelReader.java

Modified: maven/maven-3/trunk/maven-model-builder/src/main/java/org/apache/maven/model/io/DefaultModelReader.java
URL: http://svn.apache.org/viewvc/maven/maven-3/trunk/maven-model-builder/src/main/java/org/apache/maven/model/io/DefaultModelReader.java?rev=930708&r1=930707&r2=930708&view=diff
==============================================================================
--- maven/maven-3/trunk/maven-model-builder/src/main/java/org/apache/maven/model/io/DefaultModelReader.java
(original)
+++ maven/maven-3/trunk/maven-model-builder/src/main/java/org/apache/maven/model/io/DefaultModelReader.java
Sun Apr  4 16:18:47 2010
@@ -20,6 +20,7 @@ package org.apache.maven.model.io;
  */
 
 import java.io.File;
+import java.io.FileInputStream;
 import java.io.IOException;
 import java.io.InputStream;
 import java.io.Reader;
@@ -50,7 +51,7 @@ public class DefaultModelReader
             throw new IllegalArgumentException( "input file missing" );
         }
 
-        Model model = read( ReaderFactory.newXmlReader( input ), options );
+        Model model = read( new FileInputStream( input ), options );
 
         model.setPomFile( input );
 
@@ -67,12 +68,7 @@ public class DefaultModelReader
 
         try
         {
-            MavenXpp3Reader r = new MavenXpp3Reader();
-            return r.read( input, isStrict( options ) );
-        }
-        catch ( XmlPullParserException e )
-        {
-            throw new ModelParseException( e.getMessage(), e.getLineNumber(), e.getColumnNumber(),
e );
+            return read( input, isStrict( options ) );
         }
         finally
         {
@@ -90,12 +86,7 @@ public class DefaultModelReader
 
         try
         {
-            MavenXpp3Reader r = new MavenXpp3Reader();
-            return r.read( input, isStrict( options ) );
-        }
-        catch ( XmlPullParserException e )
-        {
-            throw new ModelParseException( e.getMessage(), e.getLineNumber(), e.getColumnNumber(),
e );
+            return read( ReaderFactory.newXmlReader( input ), isStrict( options ) );
         }
         finally
         {
@@ -109,4 +100,18 @@ public class DefaultModelReader
         return value == null || Boolean.parseBoolean( value.toString() );
     }
 
+    private Model read( Reader reader, boolean strict )
+        throws IOException
+    {
+        try
+        {
+            MavenXpp3Reader r = new MavenXpp3Reader();
+            return r.read( reader, strict );
+        }
+        catch ( XmlPullParserException e )
+        {
+            throw new ModelParseException( e.getMessage(), e.getLineNumber(), e.getColumnNumber(),
e );
+        }
+    }
+
 }



Mime
View raw message