ant-notifications mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bode...@apache.org
Subject svn commit: r1496104 - /ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/Javadoc.java
Date Mon, 24 Jun 2013 15:50:56 GMT
Author: bodewig
Date: Mon Jun 24 15:50:56 2013
New Revision: 1496104

URL: http://svn.apache.org/r1496104
Log:
More robust handling of line-feeds - in particular make it work on Windows - thanks Uwe!

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

Modified: ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/Javadoc.java
URL: http://svn.apache.org/viewvc/ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/Javadoc.java?rev=1496104&r1=1496103&r2=1496104&view=diff
==============================================================================
--- ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/Javadoc.java (original)
+++ ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/Javadoc.java Mon Jun 24 15:50:56
2013
@@ -2456,9 +2456,10 @@ public class Javadoc extends Task {
                                             + "classpath.");
         }
         try {
-            fixData = FileUtils.readFully(new InputStreamReader(in, "US-ASCII")).trim()
-                .replace("\r\n", StringUtils.LINE_SEP)
-                .replace("\n", StringUtils.LINE_SEP);
+            fixData =
+                fixLineFeeds(FileUtils
+                             .readFully(new InputStreamReader(in, "US-ASCII")))
+                .trim();
         } finally {
             FileUtils.close(in);
         }
@@ -2490,7 +2491,8 @@ public class Javadoc extends Task {
         String fileContents;
         try {
             fileContents =
-                FileUtils.safeReadFully(new InputStreamReader(fin, enc));
+                fixLineFeeds(FileUtils
+                             .safeReadFully(new InputStreamReader(fin, enc)));
         } finally {
             FileUtils.close(fin);
         }
@@ -2515,6 +2517,11 @@ public class Javadoc extends Task {
         return 0;
     }
 
+    private String fixLineFeeds(String orig) {
+        return orig.replace("\r\n", "\n")
+            .replace("\n", StringUtils.LINE_SEP);
+    }
+
     private String patchContent(String fileContents, String fixData) {
         // using regexes here looks like overkill
         int start = fileContents.indexOf(LOAD_FRAME);



Mime
View raw message