You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by jd...@apache.org on 2007/07/17 01:00:34 UTC
svn commit: r556760 - in
/maven/plugins/trunk/maven-assembly-plugin/src/main/java/org/apache/maven/plugin/assembly:
archive/archiver/PrefixingProxyArchiver.java
filter/ComponentsXmlArchiverFileFilter.java
Author: jdcasey
Date: Mon Jul 16 16:00:30 2007
New Revision: 556760
URL: http://svn.apache.org/viewvc?view=rev&rev=556760
Log:
Fully converting the components.xml handler to a FileSelector instead of a filter, and removing a System.out from the proxy archiver.
Modified:
maven/plugins/trunk/maven-assembly-plugin/src/main/java/org/apache/maven/plugin/assembly/archive/archiver/PrefixingProxyArchiver.java
maven/plugins/trunk/maven-assembly-plugin/src/main/java/org/apache/maven/plugin/assembly/filter/ComponentsXmlArchiverFileFilter.java
Modified: maven/plugins/trunk/maven-assembly-plugin/src/main/java/org/apache/maven/plugin/assembly/archive/archiver/PrefixingProxyArchiver.java
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-assembly-plugin/src/main/java/org/apache/maven/plugin/assembly/archive/archiver/PrefixingProxyArchiver.java?view=diff&rev=556760&r1=556759&r2=556760
==============================================================================
--- maven/plugins/trunk/maven-assembly-plugin/src/main/java/org/apache/maven/plugin/assembly/archive/archiver/PrefixingProxyArchiver.java (original)
+++ maven/plugins/trunk/maven-assembly-plugin/src/main/java/org/apache/maven/plugin/assembly/archive/archiver/PrefixingProxyArchiver.java Mon Jul 16 16:00:30 2007
@@ -259,8 +259,6 @@
{
if ( acceptFile( inputFile ) )
{
- System.out.println( "File: " + inputFile + " was accepted by selectors." );
-
inPublicApi.set( Boolean.TRUE );
try
{
@@ -278,8 +276,6 @@
{
if ( acceptFile( inputFile ) )
{
- System.out.println( "File: " + inputFile + " was accepted by selectors." );
-
inPublicApi.set( Boolean.TRUE );
try
{
Modified: maven/plugins/trunk/maven-assembly-plugin/src/main/java/org/apache/maven/plugin/assembly/filter/ComponentsXmlArchiverFileFilter.java
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-assembly-plugin/src/main/java/org/apache/maven/plugin/assembly/filter/ComponentsXmlArchiverFileFilter.java?view=diff&rev=556760&r1=556759&r2=556760
==============================================================================
--- maven/plugins/trunk/maven-assembly-plugin/src/main/java/org/apache/maven/plugin/assembly/filter/ComponentsXmlArchiverFileFilter.java (original)
+++ maven/plugins/trunk/maven-assembly-plugin/src/main/java/org/apache/maven/plugin/assembly/filter/ComponentsXmlArchiverFileFilter.java Mon Jul 16 16:00:30 2007
@@ -16,7 +16,6 @@
* limitations under the License.
*/
-import org.codehaus.plexus.archiver.ArchiveFilterException;
import org.codehaus.plexus.archiver.Archiver;
import org.codehaus.plexus.archiver.ArchiverException;
import org.codehaus.plexus.archiver.UnArchiver;
@@ -55,23 +54,6 @@
public static final String COMPONENTS_XML_PATH = "META-INF/plexus/components.xml";
- public boolean include( InputStream dataStream, String entryName )
- throws ArchiveFilterException
- {
- try
- {
- return isIncluded( dataStream, entryName );
- }
- catch ( XmlPullParserException e )
- {
- throw new ArchiveFilterException( "Error reading components from stream: " + e.getMessage(), e );
- }
- catch ( IOException e )
- {
- throw new ArchiveFilterException( "Error reading components from stream: " + e.getMessage(), e );
- }
- }
-
protected void addComponentsXml( Reader componentsReader )
throws XmlPullParserException, IOException
{
@@ -177,51 +159,57 @@
return null;
}
- private boolean isIncluded( InputStream dataStream, String entryName )
- throws XmlPullParserException, IOException
+ public boolean isSelected( FileInfo fileInfo )
+ throws IOException
{
- if ( excludeOverride )
+ if ( fileInfo.isFile() )
{
- return true;
- }
+ if ( excludeOverride )
+ {
+ return true;
+ }
- String entry = entryName;
+ String entry = fileInfo.getName();
- if ( entry.startsWith( "/" ) )
- {
- entry = entry.substring( 1 );
- }
+ if ( entry.startsWith( "/" ) )
+ {
+ entry = entry.substring( 1 );
+ }
- if ( ComponentsXmlArchiverFileFilter.COMPONENTS_XML_PATH.equals( entry ) )
- {
- addComponentsXml( new InputStreamReader( dataStream ) );
+ if ( ComponentsXmlArchiverFileFilter.COMPONENTS_XML_PATH.equals( entry ) )
+ {
+ InputStream stream = null;
+ InputStreamReader reader = null;
- return false;
- }
+ try
+ {
+ stream = fileInfo.getContents();
+ reader = new InputStreamReader( stream );
+ addComponentsXml( reader );
+ }
+ catch ( XmlPullParserException e )
+ {
+ IOException error = new IOException( "Error finalizing component-set for archive. Reason: " + e.getMessage() );
+ error.initCause( e );
- return true;
- }
+ throw error;
+ }
+ finally
+ {
+ IOUtil.close( stream );
+ IOUtil.close( reader );
+ }
- public boolean isSelected( FileInfo fileInfo )
- throws IOException
- {
- if ( fileInfo.isFile() )
- {
- try
- {
- return isIncluded( fileInfo.getContents(), fileInfo.getName() );
+ return false;
}
- catch ( XmlPullParserException e )
+ else
{
- IOException error = new IOException( "Error finalizing component-set for archive. Reason: " + e.getMessage() );
- error.initCause( e );
-
- throw error;
+ return true;
}
}
else
{
- return false;
+ return true;
}
}