Fix PatchScript's mapping of lines below the last edit

For comments below the last edit block of a PatchScript, the formulae
to obtain the line number shifts between sides subtracted one side's
end, but added the other side's beginning (instead of also the
end). This mismatch could cause the client to fetch lines beyond a
file's end and thereby cause an ArrayIndexofBoundException.

We now use the difference of the last edit block's ends to map lines
below the last edit.

Change-Id: I67d2baa0f5ede3af7348c609034de81e8acf9c17
diff --git a/gerrit-httpd/src/main/java/com/google/gerrit/httpd/rpc/patch/PatchScriptBuilder.java b/gerrit-httpd/src/main/java/com/google/gerrit/httpd/rpc/patch/PatchScriptBuilder.java
index 5019403..9a4b89f 100644
--- a/gerrit-httpd/src/main/java/com/google/gerrit/httpd/rpc/patch/PatchScriptBuilder.java
+++ b/gerrit-httpd/src/main/java/com/google/gerrit/httpd/rpc/patch/PatchScriptBuilder.java
@@ -346,7 +346,7 @@
     }
 
     final Edit last = edits.get(edits.size() - 1);
-    return last.getBeginB() + (a - last.getEndA());
+    return last.getEndB() + (a - last.getEndA());
   }
 
   private int mapB2A(final int b) {
@@ -372,7 +372,7 @@
     }
 
     final Edit last = edits.get(edits.size() - 1);
-    return last.getBeginA() + (b - last.getEndB());
+    return last.getEndA() + (b - last.getEndB());
   }
 
   private void packContent(boolean ignoredWhitespace) {