You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@creadur.apache.org by db...@apache.org on 2011/12/19 00:39:21 UTC

svn commit: r1220563 - /incubator/rat/tentacles/trunk/src/main/java/org/apache/rat/tentacles/Deauthorize.java

Author: dblevins
Date: Sun Dec 18 23:39:21 2011
New Revision: 1220563

URL: http://svn.apache.org/viewvc?rev=1220563&view=rev
Log:
slight improvement in readability

Modified:
    incubator/rat/tentacles/trunk/src/main/java/org/apache/rat/tentacles/Deauthorize.java

Modified: incubator/rat/tentacles/trunk/src/main/java/org/apache/rat/tentacles/Deauthorize.java
URL: http://svn.apache.org/viewvc/incubator/rat/tentacles/trunk/src/main/java/org/apache/rat/tentacles/Deauthorize.java?rev=1220563&r1=1220562&r2=1220563&view=diff
==============================================================================
--- incubator/rat/tentacles/trunk/src/main/java/org/apache/rat/tentacles/Deauthorize.java (original)
+++ incubator/rat/tentacles/trunk/src/main/java/org/apache/rat/tentacles/Deauthorize.java Sun Dec 18 23:39:21 2011
@@ -93,6 +93,8 @@ public class Deauthorize {
 
             // You really can't trust text to be in the native line ending
             final String eol = (text.contains("\r\n")) ? "\r\n" : "\n";
+            final String startComment = eol + "/*";
+            final String endComment = "*/" + eol;
 
             InputStream in = new ByteArrayInputStream(text.getBytes());
 
@@ -100,15 +102,15 @@ public class Deauthorize {
             in = new ExcludeFilterInputStream(in, " * @author", eol);
 
             // Clean "empty" comments
-            final String begin = eol + "/*";
-            final String end = "*/" + eol;
-            in = new DelimitedTokenReplacementInputStream(in, begin, end, new StringTokenHandler() {
+            in = new DelimitedTokenReplacementInputStream(in, startComment, endComment, new StringTokenHandler() {
                 @Override
-                public String handleToken(String s) throws IOException {
+                public String handleToken(String commentBlock) throws IOException {
 
-                    if (s.replaceAll("[\\s*]", "").length() == 0) return eol;
+                    // Yank if empty
+                    if (commentBlock.replaceAll("[\\s*]", "").length() == 0) return eol;
 
-                    return begin + s + end;
+                    // Keep otherwise
+                    return startComment + commentBlock + endComment;
                 }
             });