nicolaken    02/03/26 04:43:03

  Modified:    tools/src XConfToolTask.java
  Log:
  Patch (Bug#: 7251) submitted by Marcus Crafter ([EMAIL PROTECTED]):
  
  Small optimization to XConfTool to check if the
  file is actually a XConfTool file. If the file is not meant to be used by
  XConfTool then it's skipped (ie. if the file doesn't contain the correct root
  element, which should be the same as the extension name of the file).
  
  This also fixes an apparent problem when the specified configuration file is
  also used as one of the input files.
  
  Revision  Changes    Path
  1.4       +11 -2     xml-cocoon2/tools/src/XConfToolTask.java
  
  Index: XConfToolTask.java
  ===================================================================
  RCS file: /home/cvs/xml-cocoon2/tools/src/XConfToolTask.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- XConfToolTask.java        10 Mar 2002 17:15:46 -0000      1.3
  +++ XConfToolTask.java        26 Mar 2002 12:43:03 -0000      1.4
  @@ -37,7 +37,8 @@
    *
    * @author <a href="mailto:[EMAIL PROTECTED]";>Carsten Ziegeler</a>
    * @author <a href="mailto:[EMAIL PROTECTED]";>Vadim Gritsenko</a>
  - * @version CVS $Revision: 1.3 $ $Date: 2002/03/10 17:15:46 $
  + * @author <a href="mailto:[EMAIL PROTECTED]";>Marcus Crafter</a>
  + * @version CVS $Revision: 1.4 $ $Date: 2002/03/26 12:43:03 $
    */
   
   public final class XConfToolTask extends Task {
  @@ -134,8 +135,16 @@
                        String file)
               throws TransformerException, IOException
       {
  +        // Check to see if Document is an xconf-tool document
  +        Element elem = component.getDocumentElement();
  +        if (!elem.getTagName().equals(extension)) {
  +           System.out.println("Skipping non xconf-tool file: " + file);
  +           return false;
  +        }
  +
           // Get 'root' node were 'component' will be inserted into
  -        String xpath = component.getDocumentElement().getAttribute("xpath");
  +        String xpath = elem.getAttribute("xpath");    
  +    
           NodeList nodes = XPathAPI.selectNodeList(configuration, xpath);
           if (nodes.getLength() != 1) {
               System.out.println("Error in: " + file);
  
  
  

----------------------------------------------------------------------
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