Changeset 16535
- Timestamp:
- 2008-07-24T15:01:34+12:00 (16 years ago)
- Location:
- release-kits/shared/ant-tasks/orans
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
release-kits/shared/ant-tasks/orans/RegexSearchReplace.java
r16534 r16535 60 60 61 61 } catch (IOException e) { 62 throw new BuildException( "Error - Couldn't create the temp file" );62 throw new BuildException( "Error - Couldn't create or open the temp file" ); 63 63 } 64 64 … … 67 67 BufferedReader in = null; 68 68 try { 69 in = new BufferedReader( new FileReader( file ));69 in = new BufferedReader( new FileReader( file ) ); 70 70 } catch ( Exception e ) { 71 71 throw new BuildException( "Error - Couldn't open the specified file" ); … … 74 74 //pass the file through, searching and replacing 75 75 String line; 76 try { 77 while ( (line = in.readLine()) != null ) { 76 boolean hasMoreLines = true; 77 while ( hasMoreLines ) { 78 79 try { 80 line = in.readLine(); 81 } catch ( Exception e ) { 82 throw new BuildException( "Error - Couldn't read from the specified file" ); 83 } 84 85 if ( line == null ) { 86 hasMoreLines = false; 87 } else { 78 88 79 89 String oldLine = line; … … 83 93 } 84 94 85 out.write(line); 86 out.newLine(); 95 try { 96 out.write(line); 97 out.newLine(); 98 } catch ( Exception e ) { 99 throw new BuildException( "Error - Couldn't write to the temp file" ); 100 } 87 101 } 88 } catch ( Exception e ) {89 throw new BuildException( "Error - Couldn't read from the specified file" );90 102 } 103 91 104 92 105 try { 93 94 106 //close them both up 95 107 in.close(); 96 108 out.close(); 97 98 109 } catch ( Exception e ) { 99 110 throw new BuildException( "Error - Couldn't close a file" );
Note:
See TracChangeset
for help on using the changeset viewer.