[Anthill-dev] Anthill OS patch: newline-at-end-of-version-file

Jim Hague jim.hague at acm.org
Mon Oct 29 05:43:18 CST 2007


# HG changeset patch
# User Jim Hague <jim.hague at icc-atcsolutions.com>
# Date 1193654689 0
# Node ID 2e05a10db3b6f9cd70ddd2c7b7515d23b2040769
# Parent  1b81fccfec8bab44a3c00e527a2da1327f28d63d
The version file can get written without a trailing newline. This
causes unnecessary diff chatter, so add one.

diff -r 1b81fccfec8b -r 2e05a10db3b6 
source/main/java/com/urbancode/anthill/adapter/VersionModifier.java
--- a/source/main/java/com/urbancode/anthill/adapter/VersionModifier.java	Mon 
Oct 29 10:44:49 2007 +0000
+++ b/source/main/java/com/urbancode/anthill/adapter/VersionModifier.java	Mon 
Oct 29 10:44:49 2007 +0000
@@ -143,6 +143,7 @@ public class VersionModifier {
             bw.write(specVersion);
             bw.newLine();
             bw.write(implVersion);
+            bw.newLine();
         }
         catch (Exception e) {
             throw new IllegalArgumentException("Trouble updating version 
file.");
@@ -164,14 +165,18 @@ public class VersionModifier {
             throw new IllegalArgumentException("VersionStr parameter " + 
                                                "can't be null.");
         }
-        FileWriter writer = null;
+        BufferedWriter bw = null;
         try {
-            writer = new FileWriter(versionFile);
-            writer.write(versionStr);
+            bw = new BufferedWriter(new FileWriter(versionFile));
+            bw.write(versionStr);
+            bw.newLine();
+        }
+        catch (Exception e) {
+            throw new IllegalArgumentException("Trouble updating version 
file.");
         } finally {
-            if (writer != null) {
+            if (bw != null) {
                 try {
-                    writer.close();
+                    bw.close();
                 } catch (Exception e) {}
             }
         }

-- 
Jim Hague - jim.hague at acm.org          Never trust a computer you can't lift.


More information about the Anthill-dev mailing list