ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dona...@apache.org
Subject cvs commit: jakarta-ant/src/main/org/apache/tools/ant/taskdefs/cvslib RedirectingStreamHandler.java ChangeLogTask.java
Date Tue, 02 Apr 2002 09:17:30 GMT
donaldp     02/04/02 01:17:30

  Modified:    src/main/org/apache/tools/ant/taskdefs/cvslib
                        RedirectingStreamHandler.java ChangeLogTask.java
  Log:
  Log errors rather than ignoring them.
  
  Submitted by: dion@multitask.com.au via "Vincent Massol" <vmassol@octo.com>
  
  Revision  Changes    Path
  1.4       +20 -3     jakarta-ant/src/main/org/apache/tools/ant/taskdefs/cvslib/RedirectingStreamHandler.java
  
  Index: RedirectingStreamHandler.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant/src/main/org/apache/tools/ant/taskdefs/cvslib/RedirectingStreamHandler.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- RedirectingStreamHandler.java	2 Apr 2002 07:49:08 -0000	1.3
  +++ RedirectingStreamHandler.java	2 Apr 2002 09:17:30 -0000	1.4
  @@ -64,7 +64,7 @@
    * A dummy stream handler that just passes stuff to the parser.
    *
    * @author <a href="mailto:peter@apache.org">Peter Donald</a>
  - * @version $Revision: 1.3 $ $Date: 2002/04/02 07:49:08 $
  + * @version $Revision: 1.4 $ $Date: 2002/04/02 09:17:30 $
    */
   class RedirectingStreamHandler
       implements ExecuteStreamHandler
  @@ -72,12 +72,25 @@
       private final ChangeLogParser m_parser;
       private BufferedReader m_reader;
       private InputStreamReader m_error;
  +    private final StringBuffer m_errors = new StringBuffer();
   
  -    public RedirectingStreamHandler( final ChangeLogParser parser )
  +    RedirectingStreamHandler( final ChangeLogParser parser )
       {
           m_parser = parser;
       }
   
  +    String getErrors()
  +    {
  +        if( 0 == m_errors.length() )
  +        {
  +            return null;
  +        }
  +        else
  +        {
  +            return m_errors.toString();
  +        }
  +    }
  +
       /**
        * Install a handler for the input stream of the subprocess.
        *
  @@ -127,7 +140,11 @@
           //http://developer.java.sun.com/developer/bugParade/bugs/4329985.html)
           while( m_error.ready() )
           {
  -            m_error.read();
  +            final int value = m_error.read();
  +            if( -1 != value )
  +            {
  +                m_errors.append( (char)value );
  +            }
           }
       }
   
  
  
  
  1.8       +7 -1      jakarta-ant/src/main/org/apache/tools/ant/taskdefs/cvslib/ChangeLogTask.java
  
  Index: ChangeLogTask.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant/src/main/org/apache/tools/ant/taskdefs/cvslib/ChangeLogTask.java,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- ChangeLogTask.java	2 Apr 2002 08:42:44 -0000	1.7
  +++ ChangeLogTask.java	2 Apr 2002 09:17:30 -0000	1.8
  @@ -100,7 +100,7 @@
    *
    * @author <a href="mailto:jeff.martin@synamic.co.uk">Jeff Martin</a>
    * @author <a href="mailto:peter@apache.org">Peter Donald</a>
  - * @version $Revision: 1.7 $ $Date: 2002/04/02 08:42:44 $
  + * @version $Revision: 1.8 $ $Date: 2002/04/02 09:17:30 $
    * @ant.task name="changelog"
    */
   public class ChangeLogTask
  @@ -278,6 +278,12 @@
           catch( final IOException ioe )
           {
               throw new BuildException( ioe.toString() );
  +        }
  +
  +        final String errors = handler.getErrors();
  +        if( null != errors )
  +        {
  +            log( errors, Project.MSG_ERR );
           }
   
           final CVSEntry[] entrySet = parser.getEntrySetAsArray();
  
  
  

--
To unsubscribe, e-mail:   <mailto:ant-dev-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:ant-dev-help@jakarta.apache.org>


Mime
View raw message