Commits

Stefan Bodewig  committed f389229

More robust handling of line-feeds - in particular make it work on Windows - thanks Uwe!

git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@149610413f79535-47bb-0310-9956-ffa450edef68

  • Participants
  • Parent commits cbd6e86

Comments (0)

Files changed (1)

File src/main/org/apache/tools/ant/taskdefs/Javadoc.java

                                             + "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);
         }
         String fileContents;
         try {
             fileContents =
-                FileUtils.safeReadFully(new InputStreamReader(fin, enc));
+                fixLineFeeds(FileUtils
+                             .safeReadFully(new InputStreamReader(fin, enc)));
         } finally {
             FileUtils.close(fin);
         }
         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);