Issue 1024: Comparing patchsets when file is missing in the second patchset errors with "Internal Server Error"
Status:  New
Owner: ----
Reported by di...@google.com, Jun 27, 2011
Affected Version: 2.1.8

What steps will reproduce the problem?
1. Create a commit that adds a file and push it for review.
2. Amend the first commit by moving the file in another location and update the existing code review with the new patch set.
3. Click on "side-by-side" diff view of the added file on the _first_ patch set
4. Expand "Patch History" and check "Patch Set 2" for the new version (both panels become empty) and check "Patch Set 1" for the old version

What is the expected output? What do you see instead?
Should probably show as if the file is completely removed (right panel all red?) but instead it displays an "Internal Server Error" and logs:
[2011-06-27 17:37:07,560] WARN  /g : Error in patchScript
java.lang.ArrayIndexOutOfBoundsException: Array index out of range: 2
	at org.eclipse.jgit.util.IntList.get(IntList.java:82)
	at org.eclipse.jgit.diff.RawText.getEnd(RawText.java:215)
	at org.eclipse.jgit.diff.RawText.getString(RawText.java:187)
	at org.eclipse.jgit.diff.RawText.getString(RawText.java:166)
	at com.google.gerrit.httpd.rpc.patch.PatchScriptBuilder.packContent(PatchScriptBuilder.java:384)
	at com.google.gerrit.httpd.rpc.patch.PatchScriptBuilder.build(PatchScriptBuilder.java:207)
	at com.google.gerrit.httpd.rpc.patch.PatchScriptBuilder.toPatchScript(PatchScriptBuilder.java:125)
	at com.google.gerrit.httpd.rpc.patch.PatchScriptFactory.call(PatchScriptFactory.java:155)
	at com.google.gerrit.httpd.rpc.patch.PatchScriptFactory.call(PatchScriptFactory.java:60)
	at com.google.gerrit.httpd.rpc.Handler.to(Handler.java:65)
	at com.google.gerrit.httpd.rpc.patch.PatchDetailServiceImpl.patchScript(PatchDetailServiceImpl.java:101)
	at sun.reflect.GeneratedMethodAccessor19.invoke(Unknown Source)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:616)
	at com.google.gwtjsonrpc.server.MethodHandle.invoke(MethodHandle.java:91)
	at com.google.gwtjsonrpc.server.JsonServlet.doService(JsonServlet.java:382)
	at com.google.gwtjsonrpc.server.JsonServlet.service(JsonServlet.java:268)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
	at com.google.inject.servlet.ServletDefinition.doService(ServletDefinition.java:216)
	at com.google.inject.servlet.ServletDefinition.service(ServletDefinition.java:141)
	at com.google.inject.servlet.ManagedServletPipeline.service(ManagedServletPipeline.java:93)
	at com.google.inject.servlet.FilterChainInvocation.doFilter(FilterChainInvocation.java:63)
	at com.google.inject.servlet.FilterDefinition.doFilter(FilterDefinition.java:134)
	at com.google.inject.servlet.FilterChainInvocation.doFilter(FilterChainInvocation.java:59)
	at com.google.inject.servlet.FilterDefinition.doFilter(FilterDefinition.java:134)
	at com.google.inject.servlet.FilterChainInvocation.doFilter(FilterChainInvocation.java:59)
	at com.google.inject.servlet.FilterDefinition.doFilter(FilterDefinition.java:134)
	at com.google.inject.servlet.FilterChainInvocation.doFilter(FilterChainInvocation.java:59)
	at com.google.gwtexpui.server.CacheControlFilter.doFilter(CacheControlFilter.java:76)
	at com.google.inject.servlet.FilterDefinition.doFilter(FilterDefinition.java:129)
	at com.google.inject.servlet.FilterChainInvocation.doFilter(FilterChainInvocation.java:59)
	at com.google.inject.servlet.FilterDefinition.doFilter(FilterDefinition.java:134)
	at com.google.inject.servlet.FilterChainInvocation.doFilter(FilterChainInvocation.java:59)
	at com.google.gerrit.httpd.RequireSslFilter.doFilter(RequireSslFilter.java:68)
	at com.google.inject.servlet.FilterDefinition.doFilter(FilterDefinition.java:129)
	at com.google.inject.servlet.FilterChainInvocation.doFilter(FilterChainInvocation.java:59)
	at com.google.gerrit.httpd.RequestCleanupFilter.doFilter(RequestCleanupFilter.java:54)
	at com.google.inject.servlet.FilterDefinition.doFilter(FilterDefinition.java:129)
	at com.google.inject.servlet.FilterChainInvocation.doFilter(FilterChainInvocation.java:59)
	at com.google.inject.servlet.ManagedFilterPipeline.dispatch(ManagedFilterPipeline.java:122)
	at com.google.inject.servlet.GuiceFilter.doFilter(GuiceFilter.java:110)
	at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1322)
	at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:473)
	at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:921)
	at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:403)
	at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:856)
	at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:117)
	at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:114)
	at org.eclipse.jetty.server.Server.handle(Server.java:352)
	at org.eclipse.jetty.server.HttpConnection.handleRequest(HttpConnection.java:596)
	at org.eclipse.jetty.server.HttpConnection$RequestHandler.content(HttpConnection.java:1069)
	at org.eclipse.jetty.http.HttpParser.parseNext(HttpParser.java:805)
	at org.eclipse.jetty.http.HttpParser.parseAvailable(HttpParser.java:218)
	at org.eclipse.jetty.server.HttpConnection.handle(HttpConnection.java:426)
	at org.eclipse.jetty.io.nio.SelectChannelEndPoint.handle(SelectChannelEndPoint.java:510)
	at org.eclipse.jetty.io.nio.SelectChannelEndPoint.access$000(SelectChannelEndPoint.java:34)
	at org.eclipse.jetty.io.nio.SelectChannelEndPoint$1.run(SelectChannelEndPoint.java:40)
	at org.eclipse.jetty.util.thread.QueuedThreadPool$2.run(QueuedThreadPool.java:450)
	at java.lang.Thread.run(Thread.java:636)

Please provide any additional information below.
It doesn't seem to happen for all files in that situation. In the same change there were 2 files that were added by the first patch set and moved in the second and when I try to view the diff of the other file that one shows as expected.
Jan 24, 2013
Project Member #1 edwin.ke...@gmail.com
 Issue 1242  has been merged into this issue.
Jan 24, 2013
Project Member #2 edwin.ke...@gmail.com
see also  issue 786