tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From stef...@hyperreal.org
Subject cvs commit: jakarta-tools/ant/src/main/org/apache/tools/ant/taskdefs Cvs.java
Date Fri, 03 Dec 1999 00:26:34 GMT
stefano     99/12/02 16:26:34

  Modified:    ant/src/main/org/apache/tools/ant/taskdefs Cvs.java
  Log:
  fixed deprecation
  
  Revision  Changes    Path
  1.3       +18 -15    jakarta-tools/ant/src/main/org/apache/tools/ant/taskdefs/Cvs.java
  
  Index: Cvs.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tools/ant/src/main/org/apache/tools/ant/taskdefs/Cvs.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- Cvs.java	1999/11/23 08:27:29	1.2
  +++ Cvs.java	1999/12/03 00:26:34	1.3
  @@ -61,6 +61,7 @@
    *
    *
    * @author costin@dnt.ro
  + * @author stefano@apache.org
    */
   
   public class Cvs extends Task {
  @@ -71,31 +72,33 @@
       
       public void execute() throws BuildException {
   
  -	// XXX
  -	// I'd like to find some Java based CVS utility so that
  -	// we don't rely upon command line CVS to be here.
  +	// XXX: we should use JCVS (www.ice.com/JCVS) instead of command line
  +	// execution so that we don't rely on having native CVS stuff around (SM)
   	
   	try {
   	    String command="cvs -d " + cvsRoot + " co " + pack;
   	    System.out.println(command);
  -	    Process proc=Runtime.getRuntime().exec(command);
  +
  +        // exec command on system runtime
  +	    Process proc = Runtime.getRuntime().exec(command);
   	    
   	    // ignore response
  -	    DataInputStream din = new DataInputStream( proc.getInputStream() );
  -	    String line;
  +        BufferedReader din = new BufferedReader(
  +           new InputStreamReader(proc.getInputStream())
  +        );
   
  -	    // XXX
  -	    // Change this as din.readLine pops a deprecation warning
  -	    // under 1.3
  -	    
  -	    while( (line=din.readLine()) != null ) {
  -		System.out.println(line);
  +        // pipe CVS output to STDOUT
  +	    String line;
  +	    while((line = din.readLine()) != null) {
  +    		System.out.println(line);
   	    }
   	    
   	    proc.waitFor();
  -	    int err=proc.exitValue();
  -	    if( err!=0 ) throw new BuildException( "Error " + err +
  -						   "in " + command);
  +	    int err = proc.exitValue();
  +	    if (err != 0) {
  +	       throw new BuildException( "Error " + err + "in " + command);
  +	    }
  +	    
   	} catch (IOException ioe) {
   	    ioe.printStackTrace();
   	    throw new BuildException("Error checking out: " + pack );
  
  
  

Mime
View raw message