From 4f346afa1a173c7fc864c119ba1cbb95bbc7edba Mon Sep 17 00:00:00 2001
From: "Shawn O. Pearce" <spearce@spearce.org>
Date: Fri, 28 May 2010 14:30:27 -0700
Subject: [PATCH] eclipse-ipzilla: Correctly parse result with empty last field

If the last field of our IPzilla query comes back empty, we were
skipping over and not including it in the result List, causing an
IndexOutOfBoundsException when it was read into our data model.

If the last field is empty, actually add the empty string.

Change-Id: Ib18b335990c73e036b185199d0004f4ffc395867
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
---
 org.eclipse.jgit.iplog/src/org/eclipse/jgit/iplog/CSV.java | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/org.eclipse.jgit.iplog/src/org/eclipse/jgit/iplog/CSV.java b/org.eclipse.jgit.iplog/src/org/eclipse/jgit/iplog/CSV.java
index 3f80c7d1f..12dbf47f7 100644
--- a/org.eclipse.jgit.iplog/src/org/eclipse/jgit/iplog/CSV.java
+++ b/org.eclipse.jgit.iplog/src/org/eclipse/jgit/iplog/CSV.java
@@ -116,6 +116,8 @@ private List<String> readLine() throws IOException {
 			} else if (line.charAt(p) == ',') {
 				row.add("");
 				p++;
+				if (p == line.length())
+					row.add("");
 
 			} else {
 				int comma = line.indexOf(',', p);
-- 
GitLab