cocoon-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From stef...@apache.org
Subject cvs commit: xml-cocoon2/tools/src XConfToolTask.java
Date Mon, 17 Feb 2003 15:06:59 GMT
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:     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


Mime
View raw message