You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@cocoon.apache.org by vg...@apache.org on 2002/03/24 18:19:58 UTC

cvs commit: xml-cocoon2/tools/src ManifestToolTask.java

vgritsenko    02/03/24 09:19:57

  Modified:    tools/src ManifestToolTask.java
  Log:
  Fix NPE reported by Steven Noels [stevenn@outerthought.org]
  
  Revision  Changes    Path
  1.2       +21 -18    xml-cocoon2/tools/src/ManifestToolTask.java
  
  Index: ManifestToolTask.java
  ===================================================================
  RCS file: /home/cvs/xml-cocoon2/tools/src/ManifestToolTask.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- ManifestToolTask.java	12 Feb 2002 16:18:45 -0000	1.1
  +++ ManifestToolTask.java	24 Mar 2002 17:19:57 -0000	1.2
  @@ -17,7 +17,7 @@
    * in the specified directory.
    *
    * @author <a href="mailto:vgritsenko@apache.org">Vadim Gritsenko</a>
  - * @version CVS $Revision: 1.1 $ $Date: 2002/02/12 16:18:45 $
  + * @version CVS $Revision: 1.2 $ $Date: 2002/03/24 17:19:57 $
    */
   
   public final class ManifestToolTask extends Task {
  @@ -59,28 +59,31 @@
           System.out.println("Writing: " + manifest);
           FileWriter w = new FileWriter(manifest);
           w.write("Manifest-Version: 1.0\n");
  -        w.write("Cocoon-Libs: ");
   
  -        final File[] files = directoryFile.listFiles();
  -        for(int i = 0; i < files.length; i++) {
  -            if (files[i].getName().endsWith(".jar")) {
  -                w.write(files[i].getName());
  -                w.write(" ");
  +        if (directoryFile.exists() && directoryFile.isDirectory() ) {
  +            w.write("Cocoon-Libs: ");
  +
  +            final File[] files = directoryFile.listFiles();
  +            for(int i = 0; i < files.length; i++) {
  +                if (files[i].getName().endsWith(".jar")) {
  +                    w.write(files[i].getName());
  +                    w.write(" ");
  +                }
               }
  -        }
  -        w.write("\n");
  +            w.write("\n");
   
  -        for(int i = 0; i < files.length; i++) {
  -            if (files[i].getName().endsWith(".jar")) {
  -                w.write("Cocoon-Lib-");
  -                String s = files[i].getName().replace('.', '_');
  -                w.write(s);
  -                w.write(": ");
  -                w.write(String.valueOf(files[i].lastModified()));
  -                w.write("\n");
  +            for(int i = 0; i < files.length; i++) {
  +                if (files[i].getName().endsWith(".jar")) {
  +                    w.write("Cocoon-Lib-");
  +                    String s = files[i].getName().replace('.', '_');
  +                    w.write(s);
  +                    w.write(": ");
  +                    w.write(String.valueOf(files[i].lastModified()));
  +                    w.write("\n");
  +                }
               }
  -        }
   
  +        }
           w.close();
       }
   }
  
  
  

----------------------------------------------------------------------
In case of troubles, e-mail:     webmaster@xml.apache.org
To unsubscribe, e-mail:          cocoon-cvs-unsubscribe@xml.apache.org
For additional commands, e-mail: cocoon-cvs-help@xml.apache.org