cmlenz      2003/06/09 16:32:52

  Modified:    integration/ant/src/java/org/apache/cactus/integration/ant
                        CactifyWarTask.java
  Log:
  Catch the rather unexpected IOException one level down and log a warning instead of 
failing the build
  
  Revision  Changes    Path
  1.15      +23 -27    
jakarta-cactus/integration/ant/src/java/org/apache/cactus/integration/ant/CactifyWarTask.java
  
  Index: CactifyWarTask.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-cactus/integration/ant/src/java/org/apache/cactus/integration/ant/CactifyWarTask.java,v
  retrieving revision 1.14
  retrieving revision 1.15
  diff -u -r1.14 -r1.15
  --- CactifyWarTask.java       9 Jun 2003 19:53:55 -0000       1.14
  +++ CactifyWarTask.java       9 Jun 2003 23:32:52 -0000       1.15
  @@ -360,21 +360,14 @@
        */
       private void addCactusJars()
       {
  -        try
  -        {
  -            addJarWithClass("org.aspectj.lang.JoinPoint", "AspectJ Runtime");
  -            addJarWithClass("org.apache.cactus.ServletTestCase",
  -                "Cactus Framework");
  -            addJarWithClass("org.apache.commons.logging.Log",
  -                "Commons-Logging");
  -            addJarWithClass("org.apache.commons.httpclient.HttpClient",
  -                "Commons-HttpClient");
  -            addJarWithClass("junit.framework.TestCase", "JUnit");
  -        }
  -        catch (IOException ioe)
  -        {
  -            throw new BuildException("An I/O error occurred", ioe);
  -        }
  +        addJarWithClass("org.aspectj.lang.JoinPoint", "AspectJ Runtime");
  +        addJarWithClass("org.apache.cactus.ServletTestCase",
  +            "Cactus Framework");
  +        addJarWithClass("org.apache.commons.logging.Log",
  +            "Commons-Logging");
  +        addJarWithClass("org.apache.commons.httpclient.HttpClient",
  +            "Commons-HttpClient");
  +        addJarWithClass("junit.framework.TestCase", "JUnit");
       }
   
       /**
  @@ -384,24 +377,27 @@
        * @param theClassName The name of the class that the JAR contains
        * @param theDescription A description of the JAR that should be displayed
        *        to the user in log messages
  -     * @throws IOException If there is a problem reading the source WAR to find
  -     *         out about already present libraries
        */
       private void addJarWithClass(String theClassName, String theDescription)
  -        throws IOException
       {
  -        // TODO: only add a JAR if the source WAR doesn't already contain an
  -        // equivalent JAR. We'd probably determine equivalence by looking at the
  -        // 'Extension-Name' attributes in the JARs MANIFESTs
           String resourceName = "/" + theClassName.replace('.', '/') + ".class";
           if (this.srcFile != null)
           {
  -            WarArchive srcWar = new WarArchive(srcFile);
  -            if (srcWar.containsClass(theClassName))
  +            try
  +            {
  +                WarArchive srcWar = new WarArchive(srcFile);
  +                if (srcWar.containsClass(theClassName))
  +                {
  +                    log("The " + theDescription + " JAR is already present in "
  +                        + "the WAR", Project.MSG_VERBOSE);
  +                    return;
  +                }
  +            }
  +            catch (IOException ioe)
               {
  -                log("The " + theDescription + " JAR is already present in "
  -                    + "the WAR", Project.MSG_VERBOSE);
  -                return;
  +                log("Problem reading source WAR to when trying to detect "
  +                    + "already present JAR files (" + ioe + ")",
  +                    Project.MSG_WARN);
               }
           }
           ZipFileSet jar = new ZipFileSet();
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to