maven-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Brett Porter <br...@apache.org>
Subject Re: svn commit: r565947 - /maven/plugins/trunk/maven-enforcer-plugin/src/main/java/org/apache/maven/plugin/enforcer/PluginVersionsDefined.java
Date Wed, 15 Aug 2007 00:25:04 GMT
You'll need to close the file reader in a finally block - the  
Xpp3Reader doesn't do it for you.

On 15/08/2007, at 8:17 AM, jvanzyl@apache.org wrote:

> Author: jvanzyl
> Date: Tue Aug 14 15:17:48 2007
> New Revision: 565947
>
> URL: http://svn.apache.org/viewvc?view=rev&rev=565947
> Log:
> o a little pom reading snippet
>
> Modified:
>     maven/plugins/trunk/maven-enforcer-plugin/src/main/java/org/ 
> apache/maven/plugin/enforcer/PluginVersionsDefined.java
>
> Modified: maven/plugins/trunk/maven-enforcer-plugin/src/main/java/ 
> org/apache/maven/plugin/enforcer/PluginVersionsDefined.java
> URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven- 
> enforcer-plugin/src/main/java/org/apache/maven/plugin/enforcer/ 
> PluginVersionsDefined.java?view=diff&rev=565947&r1=565946&r2=565947
> ====================================================================== 
> ========
> --- maven/plugins/trunk/maven-enforcer-plugin/src/main/java/org/ 
> apache/maven/plugin/enforcer/PluginVersionsDefined.java (original)
> +++ maven/plugins/trunk/maven-enforcer-plugin/src/main/java/org/ 
> apache/maven/plugin/enforcer/PluginVersionsDefined.java Tue Aug 14  
> 15:17:48 2007
> @@ -28,6 +28,10 @@
>  import java.util.Map;
>  import java.util.Set;
>  import java.util.Map.Entry;
> +import java.io.File;
> +import java.io.Reader;
> +import java.io.FileReader;
> +import java.io.IOException;
>
>  import org.apache.maven.BuildFailureException;
>  import org.apache.maven.artifact.repository.ArtifactRepository;
> @@ -40,6 +44,8 @@
>  import org.apache.maven.lifecycle.LifecycleExecutor;
>  import org.apache.maven.lifecycle.mapping.LifecycleMapping;
>  import org.apache.maven.model.Plugin;
> +import org.apache.maven.model.Model;
> +import org.apache.maven.model.io.xpp3.MavenXpp3Reader;
>  import org.apache.maven.plugin.InvalidPluginException;
>  import org.apache.maven.plugin.PluginManager;
>  import org.apache.maven.plugin.PluginManagerException;
> @@ -57,6 +63,7 @@
>  import  
> org.codehaus.plexus.component.repository.exception.ComponentLookupExce 
> ption;
>  import org.codehaus.plexus.util.ReflectionUtils;
>  import org.codehaus.plexus.util.StringUtils;
> +import org.codehaus.plexus.util.xml.pull.XmlPullParserException;
>
>  /**
>   * @author <a href="mailto:brianf@apache.org">Brian Fox</a>
> @@ -506,4 +513,13 @@
>          return pluginDescriptor;
>      }
>
> +    private Model readModel( File model )
> +        throws IOException, XmlPullParserException
> +    {
> +        MavenXpp3Reader xpp3 = new MavenXpp3Reader();
> +
> +        Reader reader = new FileReader( model );
> +
> +        return xpp3.read( reader );
> +    }
>  }
>

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
For additional commands, e-mail: dev-help@maven.apache.org


Mime
View raw message