You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@ant.apache.org by bo...@apache.org on 2014/03/14 19:57:51 UTC

svn commit: r1577660 - /ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/optional/ReplaceRegExp.java

Author: bodewig
Date: Fri Mar 14 18:57:51 2014
New Revision: 1577660

URL: http://svn.apache.org/r1577660
Log:
whitespace only

Modified:
    ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/optional/ReplaceRegExp.java

Modified: ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/optional/ReplaceRegExp.java
URL: http://svn.apache.org/viewvc/ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/optional/ReplaceRegExp.java?rev=1577660&r1=1577659&r2=1577660&view=diff
==============================================================================
--- ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/optional/ReplaceRegExp.java (original)
+++ ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/optional/ReplaceRegExp.java Fri Mar 14 18:57:51 2014
@@ -364,96 +364,96 @@ public class ReplaceRegExp extends Task 
                     BufferedReader br = new BufferedReader(r);
                     BufferedWriter bw = new BufferedWriter(w);
 
-            log("Replacing pattern '" + regex.getPattern(getProject())
-                + "' with '" + subs.getExpression(getProject())
-                + "' in '" + f.getPath() + "'" + (byline ? " by line" : "")
-                + (flags.length() > 0 ? " with flags: '" + flags + "'" : "")
-                + ".", Project.MSG_VERBOSE);
-
-            if (byline) {
-                StringBuffer linebuf = new StringBuffer();
-                String line = null;
-                String res = null;
-                int c;
-                boolean hasCR = false;
-
-                do {
-                    c = br.read();
-
-                    if (c == '\r') {
-                        if (hasCR) {
-                            // second CR -> EOL + possibly empty line
-                            line = linebuf.toString();
-                            res  = doReplace(regex, subs, line, options);
-
-                            if (!res.equals(line)) {
-                                changes = true;
+                    log("Replacing pattern '" + regex.getPattern(getProject())
+                        + "' with '" + subs.getExpression(getProject())
+                        + "' in '" + f.getPath() + "'" + (byline ? " by line" : "")
+                        + (flags.length() > 0 ? " with flags: '" + flags + "'" : "")
+                        + ".", Project.MSG_VERBOSE);
+
+                    if (byline) {
+                        StringBuffer linebuf = new StringBuffer();
+                        String line = null;
+                        String res = null;
+                        int c;
+                        boolean hasCR = false;
+
+                        do {
+                            c = br.read();
+
+                            if (c == '\r') {
+                                if (hasCR) {
+                                    // second CR -> EOL + possibly empty line
+                                    line = linebuf.toString();
+                                    res  = doReplace(regex, subs, line, options);
+
+                                    if (!res.equals(line)) {
+                                        changes = true;
+                                    }
+
+                                    bw.write(res);
+                                    bw.write('\r');
+
+                                    linebuf = new StringBuffer();
+                                    // hasCR is still true (for the second one)
+                                } else {
+                                    // first CR in this line
+                                    hasCR = true;
+                                }
+                            } else if (c == '\n') {
+                                // LF -> EOL
+                                line = linebuf.toString();
+                                res  = doReplace(regex, subs, line, options);
+
+                                if (!res.equals(line)) {
+                                    changes = true;
+                                }
+
+                                bw.write(res);
+                                if (hasCR) {
+                                    bw.write('\r');
+                                    hasCR = false;
+                                }
+                                bw.write('\n');
+
+                                linebuf = new StringBuffer();
+                            } else { // any other char
+                                if ((hasCR) || (c < 0)) {
+                                    // Mac-style linebreak or EOF (or both)
+                                    line = linebuf.toString();
+                                    res  = doReplace(regex, subs, line, options);
+
+                                    if (!res.equals(line)) {
+                                        changes = true;
+                                    }
+
+                                    bw.write(res);
+                                    if (hasCR) {
+                                        bw.write('\r');
+                                        hasCR = false;
+                                    }
+
+                                    linebuf = new StringBuffer();
+                                }
+
+                                if (c >= 0) {
+                                    linebuf.append((char) c);
+                                }
                             }
+                        } while (c >= 0);
 
-                            bw.write(res);
-                            bw.write('\r');
+                    } else {
+                        String buf = FileUtils.safeReadFully(br);
 
-                            linebuf = new StringBuffer();
-                            // hasCR is still true (for the second one)
-                        } else {
-                            // first CR in this line
-                            hasCR = true;
-                        }
-                    } else if (c == '\n') {
-                        // LF -> EOL
-                        line = linebuf.toString();
-                        res  = doReplace(regex, subs, line, options);
+                        String res = doReplace(regex, subs, buf, options);
 
-                        if (!res.equals(line)) {
+                        if (!res.equals(buf)) {
                             changes = true;
                         }
 
                         bw.write(res);
-                        if (hasCR) {
-                            bw.write('\r');
-                            hasCR = false;
-                        }
-                        bw.write('\n');
-
-                        linebuf = new StringBuffer();
-                    } else { // any other char
-                        if ((hasCR) || (c < 0)) {
-                            // Mac-style linebreak or EOF (or both)
-                            line = linebuf.toString();
-                            res  = doReplace(regex, subs, line, options);
-
-                            if (!res.equals(line)) {
-                                changes = true;
-                            }
-
-                            bw.write(res);
-                            if (hasCR) {
-                                bw.write('\r');
-                                hasCR = false;
-                            }
-
-                            linebuf = new StringBuffer();
-                        }
-
-                        if (c >= 0) {
-                            linebuf.append((char) c);
-                        }
                     }
-                } while (c >= 0);
-
-            } else {
-                String buf = FileUtils.safeReadFully(br);
-
-                String res = doReplace(regex, subs, buf, options);
-
-                if (!res.equals(buf)) {
-                    changes = true;
-                }
-
-                bw.write(res);
-            }
 
-            bw.flush();
+                    bw.flush();
 
                 } finally {
                     os.close();