ant-notifications mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bode...@apache.org
Subject svn commit: r798838 - in /ant/core/trunk/src: main/org/apache/tools/ant/AntClassLoader.java tests/junit/org/apache/tools/ant/AntClassLoaderTest.java tests/junit/org/apache/tools/ant/BuildFileTest.java
Date Wed, 29 Jul 2009 10:22:59 GMT
Author: bodewig
Date: Wed Jul 29 10:22:58 2009
New Revision: 798838

URL: http://svn.apache.org/viewvc?rev=798838&view=rev
Log:
report name of corrupt ZIP to System.err,  PR 47593

Modified:
    ant/core/trunk/src/main/org/apache/tools/ant/AntClassLoader.java
    ant/core/trunk/src/tests/junit/org/apache/tools/ant/AntClassLoaderTest.java
    ant/core/trunk/src/tests/junit/org/apache/tools/ant/BuildFileTest.java

Modified: ant/core/trunk/src/main/org/apache/tools/ant/AntClassLoader.java
URL: http://svn.apache.org/viewvc/ant/core/trunk/src/main/org/apache/tools/ant/AntClassLoader.java?rev=798838&r1=798837&r2=798838&view=diff
==============================================================================
--- ant/core/trunk/src/main/org/apache/tools/ant/AntClassLoader.java (original)
+++ ant/core/trunk/src/main/org/apache/tools/ant/AntClassLoader.java Wed Jul 29 10:22:58 2009
@@ -1027,7 +1027,9 @@
                 }
             }
         } catch (Exception e) {
-            log("Unable to obtain resource from " + file + ": " + e, Project.MSG_WARN);
+            String msg = "Unable to obtain resource from " + file + ": ";
+            log(msg + e, Project.MSG_WARN);
+            System.err.println(msg);
             e.printStackTrace();
         }
         return null;

Modified: ant/core/trunk/src/tests/junit/org/apache/tools/ant/AntClassLoaderTest.java
URL: http://svn.apache.org/viewvc/ant/core/trunk/src/tests/junit/org/apache/tools/ant/AntClassLoaderTest.java?rev=798838&r1=798837&r2=798838&view=diff
==============================================================================
--- ant/core/trunk/src/tests/junit/org/apache/tools/ant/AntClassLoaderTest.java (original)
+++ ant/core/trunk/src/tests/junit/org/apache/tools/ant/AntClassLoaderTest.java Wed Jul 29
10:22:58 2009
@@ -19,7 +19,7 @@
 package org.apache.tools.ant;
 
 import java.io.File;
-import java.io.IOException;
+import java.io.PrintStream;
 import org.apache.tools.ant.types.Path;
 
 /**
@@ -160,12 +160,24 @@
         myPath.setLocation(jar);
         getProject().setUserProperty("build.sysclasspath","ignore");
         loader = getProject().createClassLoader(myPath);
-        loader.getResource("foo.txt");
-        String log = getLog();
-        int startMessage = log.indexOf("Unable to obtain resource from ");
-        assertTrue(startMessage >= 0);
-        assertTrue(log.indexOf("foo.jar", startMessage) > 0);
-
+        PrintStream sysErr = System.err;
+        try {
+            StringBuffer errBuffer = new StringBuffer();
+            PrintStream err =
+                new PrintStream(new BuildFileTest.AntOutputStream(errBuffer));
+            System.setErr(err);
+            loader.getResource("foo.txt");
+            String log = getLog();
+            int startMessage = log.indexOf("Unable to obtain resource from ");
+            assertTrue(startMessage >= 0);
+            assertTrue(log.indexOf("foo.jar", startMessage) > 0);
+            log = errBuffer.toString();
+            startMessage = log.indexOf("Unable to obtain resource from ");
+            assertTrue(startMessage >= 0);
+            assertTrue(log.indexOf("foo.jar", startMessage) > 0);
+        } finally {
+            System.setErr(sysErr);
+        }
     }
 
     private static class GetPackageWrapper extends ClassLoader {

Modified: ant/core/trunk/src/tests/junit/org/apache/tools/ant/BuildFileTest.java
URL: http://svn.apache.org/viewvc/ant/core/trunk/src/tests/junit/org/apache/tools/ant/BuildFileTest.java?rev=798838&r1=798837&r2=798838&view=diff
==============================================================================
--- ant/core/trunk/src/tests/junit/org/apache/tools/ant/BuildFileTest.java (original)
+++ ant/core/trunk/src/tests/junit/org/apache/tools/ant/BuildFileTest.java Wed Jul 29 10:22:58
2009
@@ -477,7 +477,7 @@
     /**
      * an output stream which saves stuff to our buffer.
      */
-    private static class AntOutputStream extends java.io.OutputStream {
+    protected static class AntOutputStream extends java.io.OutputStream {
         private StringBuffer buffer;
 
         public AntOutputStream( StringBuffer buffer ) {



Mime
View raw message