stefano     2003/02/17 07:06:59

  Modified:    tools/src XConfToolTask.java
  Log:
  prevent NPE
  
  Revision  Changes    Path
  1.8       +13 -11    xml-cocoon2/tools/src/XConfToolTask.java
  
  Index: XConfToolTask.java
  ===================================================================
  RCS file: /home/cvs/xml-cocoon2/tools/src/XConfToolTask.java,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- XConfToolTask.java        12 Aug 2002 22:24:38 -0000      1.7
  +++ XConfToolTask.java        17 Feb 2003 15:06:59 -0000      1.8
  @@ -111,16 +111,18 @@
   
           boolean hasChanged = false;
           final File[] files = directoryFile.listFiles();
  -        for(int i = 0; i < files.length; i++) {
  -            if (files[i].isDirectory()) {
  -                hasChanged |= process(builder, configuration, files[i], ext);
  -            } else if (files[i].getName().endsWith("." + ext)) {
  -                String file = files[i].getCanonicalPath();
  -                try {
  -                    // Adds configuration snippet from the file to the configuration
  -                    hasChanged |= add(configuration, builder.parse(file), file);
  -                } catch (SAXException e) {
  -                    System.out.println("Ignoring: " + file + "\n(not a valid XML)");
  +        if (files != null) {
  +            for(int i = 0; i < files.length; i++) {
  +                if (files[i].isDirectory()) {
  +                    hasChanged |= process(builder, configuration, files[i], ext);
  +                } else if (files[i].getName().endsWith("." + ext)) {
  +                    String file = files[i].getCanonicalPath();
  +                    try {
  +                        // Adds configuration snippet from the file to the 
configuration
  +                        hasChanged |= add(configuration, builder.parse(file), file);
  +                    } catch (SAXException e) {
  +                        System.out.println("Ignoring: " + file + "\n(not a valid 
XML)");
  +                    }
                   }
               }
           }
  
  
  

----------------------------------------------------------------------
In case of troubles, e-mail:     [EMAIL PROTECTED]
To unsubscribe, e-mail:          [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to