svn commit: rev 35609 - avalon/trunk/tools/magic/src/main/org/apache/avalon/tools/tasks

[email protected]
Newsgroups gmane.comp.jakarta.avalon.cvs
Message-ID <[email protected]>
Author: niclas
Date: Mon Aug  2 18:46:38 2004
New Revision: 35609

Modified:
   avalon/trunk/tools/magic/src/main/org/apache/avalon/tools/tasks/DeclareTask.java
Log:
Fix bug for resource types.

Modified: avalon/trunk/tools/magic/src/main/org/apache/avalon/tools/tasks/DeclareTask.java
==============================================================================
--- avalon/trunk/tools/magic/src/main/org/apache/avalon/tools/tasks/DeclareTask.java	(original)
+++ avalon/trunk/tools/magic/src/main/org/apache/avalon/tools/tasks/DeclareTask.java	Mon Aug  2 18:46:38 2004
@@ -187,16 +187,16 @@
         final String pad = padding + "  ";
         final ResourceRef[] resources =
           def.getResourceRefs( getProject(), Policy.RUNTIME, ResourceRef.ANY, true );
-        writeResourceRefs( writer, pad, resources );
+        writeResourceRefs( writer, pad, resources, "jar" );
         if( flag )
         {
-            writeResource( writer, pad, def );
+            writeResource( writer, pad, def, "jar" );
         }
         writer.write( "\n" + padding + "</classpath>" );
     }
 
     private void writeResourceRefs( 
-      final Writer writer, final String pad, final ResourceRef[] resources )
+      final Writer writer, final String pad, final ResourceRef[] resources, String type )
       throws IOException
     {
         for( int i=0; i<resources.length; i++ )
@@ -206,20 +206,22 @@
             if( policy.isRuntimeEnabled() )
             {
                 final Resource resource = getHome().getResource( ref );
-                writeResource( writer, pad, resource );
+                writeResource( writer, pad, resource, type );
             }
         }
     }
 
     private void writeResource( 
-      final Writer writer, final String pad, final Resource resource )
+      final Writer writer, final String pad, final Resource resource, String type )
       throws IOException
     {
         final Info info = resource.getInfo();
+        if( !info.getType().equals( type ) )
+          return;
+
         final String name = info.getName();
         final String group = info.getGroup();
         final String version = info.getVersion();
-        final String type = info.getType();
 
         writer.write( "\n" );
         writer.write( pad );
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.