{"thread":{"id":"20816","subject":"[JGIT PATCH] move the 'empty-line' check in RefDatabase#readLine down a bit to after we removed all the whitespaces.","startedAt":"2009-09-01T21:41:35Z","lastAt":"2009-09-01T21:41:35Z","messageCount":1,"participants":["Mark Struberg"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"122264","messageId":"358677.62716.qm@web27808.mail.ukl.yahoo.com","threadId":"20816","inReplyTo":null,"subject":"[JGIT PATCH] move the 'empty-line' check in RefDatabase#readLine down a bit to after we removed all the whitespaces.","fromName":"Mark Struberg","fromEmail":"struberg@yahoo.de","sentAt":"2009-09-01T21:41:35Z","receivedAt":"2009-09-01T21:41:35Z","isPatch":true,"sender":{"key":"struberg@yahoo.de","avatar":"https://gravatar.com/avatar/119742c3e8dbc8db35a92bdff0581aec8d364d415f770e60431cba262daa974f?d=mp&s=160"},"body":"This way we consistently return null regardless if the line is empty or if it does only contain whitespaces.\n\nSigned-off-by: Mark Struberg <struberg@yahoo.de>\n---\n .../src/org/spearce/jgit/lib/RefDatabase.java      |    7 ++++---\n 1 files changed, 4 insertions(+), 3 deletions(-)\n\ndiff --git a/org.spearce.jgit/src/org/spearce/jgit/lib/RefDatabase.java b/org.spearce.jgit/src/org/spearce/jgit/lib/RefDatabase.java\nindex 477dc62..acc835b 100644\n--- a/org.spearce.jgit/src/org/spearce/jgit/lib/RefDatabase.java\n+++ b/org.spearce.jgit/src/org/spearce/jgit/lib/RefDatabase.java\n@@ -498,14 +498,15 @@ private static String readLine(final File file)\n             throws FileNotFoundException, IOException {\n         final byte[] buf = NB.readFully(file, 4096);\n         int n = buf.length;\n-        if (n == 0)\n-            return null;\n         \n         // remove trailing whitespaces\n         while (n > 0 && Character.isWhitespace(buf[n - 1])) {\n             n--;\n         }\n-        \n+\n+        if (n == 0)\n+            return null;\n+\n         return RawParseUtils.decode(buf, 0, n);\n     }\n \n-- \n1.6.2.5\n\n\n      \n"}]}