Changeset 16533

Show
Ignore:
Timestamp:
24.07.2008 14:40:48 (11 years ago)
Author:
oranfry
Message:

the rsr task now produces a confirmation message on success

Location:
release-kits/shared/ant-tasks/orans
Files:
2 modified

Legend:

Unmodified
Added
Removed
  • release-kits/shared/ant-tasks/orans/RegexSearchReplace.java

    r16532 r16533  
    4040        } 
    4141 
     42        int noReplaces = 0; 
    4243 
    4344        //create the output stream 
     
    7172        try { 
    7273            while ( (line = in.readLine()) != null ) { 
    73                 line = line.replaceAll( pattern, replacement); 
     74 
     75                String oldLine = line; 
     76                line = line.replaceAll(pattern, replacement); 
     77                if ( !oldLine.equals( line ) ) { 
     78                    noReplaces++; 
     79                } 
     80 
    7481                out.write(line); 
    7582                out.newLine(); 
     
    116123            throw new BuildException( "Error - Couldn't write to the specified file" ); 
    117124        } 
    118          
     125 
     126        String linesWord = "lines";      
     127        if ( noReplaces == 1 ) { 
     128            linesWord = "line"; 
     129        } 
     130        System.out.println( "Changed " + noReplaces + " " + linesWord + " in " + file ); 
    119131    } 
    120132