Notedb: Fix loading of range comments that start at char 0

For range comments we persist startLine, startCharacter, endLine and
endCharacter. For range comments that start at the beginning of a line
the startCharacter is 0. Loading such a range comment failed because
on read the return value 0 was interpreted as error.

Change-Id: I400d27a91a161c3b653cff78d64a618a494be973
Signed-off-by: Edwin Kempin <ekempin@google.com>
This commit is contained in:
Edwin Kempin
2015-10-19 12:05:07 +02:00
parent ff236acb0b
commit 4f8f11df4a
2 changed files with 2 additions and 5 deletions

View File

@@ -243,9 +243,6 @@ public class CommentsInNotesUtil {
}
int startChar = RawParseUtils.parseBase10(note, ptr.value, ptr);
if (startChar == 0) {
return null;
}
if (note[ptr.value] == '-') {
range.setStartCharacter(startChar);
ptr.value += 1;

View File

@@ -690,7 +690,7 @@ public class ChangeNotesTest extends AbstractChangeNotesTest {
update.commit();
update = newUpdate(c, otherUser);
CommentRange range3 = new CommentRange(3, 1, 4, 1);
CommentRange range3 = new CommentRange(3, 0, 4, 1);
PatchLineComment comment3 = newPublishedComment(psId, "file2",
uuid3, range3, range3.getEndLine(), otherUser, null, time3, message3,
(short) 1, "abcd1234abcd1234abcd1234abcd1234abcd1234");
@@ -729,7 +729,7 @@ public class ChangeNotesTest extends AbstractChangeNotesTest {
+ "\n"
+ "File: file2\n"
+ "\n"
+ "3:1-4:1\n"
+ "3:0-4:1\n"
+ CommentsInNotesUtil.formatTime(serverIdent, time3) + "\n"
+ "Author: Other Account <2@gerrit>\n"
+ "UUID: uuid3\n"