ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From co...@apache.org
Subject cvs commit: jakarta-ant/src/main/org/apache/tools/ant/taskdefs/optional/perforce P4HandlerAdapter.java
Date Sat, 01 Feb 2003 05:13:45 GMT
conor       2003/01/31 21:13:45

  Modified:    src/main/org/apache/tools/ant/taskdefs/optional/perforce
                        Tag: ANT_15_BRANCH P4HandlerAdapter.java
  Log:
  Merged from HEAD
  
  PR:	16544
  
  Revision  Changes    Path
  No                   revision
  
  
  No                   revision
  
  
  1.5.2.1   +34 -13    jakarta-ant/src/main/org/apache/tools/ant/taskdefs/optional/perforce/P4HandlerAdapter.java
  
  Index: P4HandlerAdapter.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant/src/main/org/apache/tools/ant/taskdefs/optional/perforce/P4HandlerAdapter.java,v
  retrieving revision 1.5
  retrieving revision 1.5.2.1
  diff -u -w -u -r1.5 -r1.5.2.1
  --- P4HandlerAdapter.java	10 Jan 2002 13:59:38 -0000	1.5
  +++ P4HandlerAdapter.java	1 Feb 2003 05:13:45 -0000	1.5.2.1
  @@ -1,7 +1,7 @@
   /*
    * The Apache Software License, Version 1.1
    *
  - * Copyright (c) 2001 The Apache Software Foundation.  All rights
  + * Copyright (c) 2001-2003 The Apache Software Foundation.  All rights
    * reserved.
    *
    * Redistribution and use in source and binary forms, with or without
  @@ -87,18 +87,10 @@
               }
   
               //Now read any input and process
  -
  -            BufferedReader input = new BufferedReader(
  -                    new InputStreamReader(
  -                            new SequenceInputStream(is, es)));
  -
  -            String line;
  -            while ((line = input.readLine()) != null) {
  -                process(line);
  -            }
  -
  -            input.close();
  -
  +            Thread output = new Thread(new Reader(is));
  +            Thread error = new Thread(new Reader(es));
  +            output.start();
  +            error.start();
   
           } catch (Exception e) {
               throw new BuildException(e);
  @@ -123,4 +115,33 @@
   
       public void stop() {
       }
  +    
  +    public class Reader implements Runnable {
  +        protected InputStream mystream;
  +        public Reader(InputStream is)
  +        {
  +            mystream=is;
  +        }
  +        public void setStream(InputStream is) {
  +            mystream=is;
   }
  +        public void run() {
  +            BufferedReader input = new BufferedReader(
  +                    new InputStreamReader(mystream));
  +
  +            String line;
  +            try {
  +                while ((line = input.readLine()) != null) {
  +                    synchronized (this){
  +                        process(line);
  +                    }
  +                }
  +            }
  +            catch (Exception e) {
  +                throw new BuildException(e);
  +            }
  +        }
  +
  +    }
  +}
  +
  
  
  

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


Mime
View raw message