Issue 645: Server Error which trying to view a file from a merge that has no difference between Base and a particular Patch Set
Status:  Released
Owner: ----
Closed:  Aug 2010
Project Member Reported by jaysoff...@gmail.com, Jul 29, 2010
Affected Version: 2.1.3

What steps will reproduce the problem?
1. Upload a merge which has a single conflicting file that was resolved in such a way as to create output in "git show". In my case, I'd accidentally resolved a conflicted region toward the second parent but deleted a nearby line as had been done in the first parent.
2. Upload the merge commit as Patch Set 1.
3. Realize the accidental change and amend the merge such that it no longer shows any output in "git show". Upload the amended commit as Patch Set 2.
4. In Gerrit, select Unified for the relevant file under Patch Set 1.
5. Under Patch History, notice that you can view the diff between Base and Patch Set 1, or between Patch Set 1 and Patch Set 2, but trying to view the diff between Base and Patch Set 2 (which would be nothing), you get a Server Error.

What is the expected output? What do you see instead?
Expect not to get a Server Error. Perhaps some indication that there is nothing to show.

Please provide any additional information below.

[2010-07-29 23:45:22,552] ERROR /r : Error in patchScript
java.lang.NullPointerException
	at org.eclipse.jgit.lib.ObjectIdSubclassMap.index(ObjectIdSubclassMap.java:172)
	at org.eclipse.jgit.lib.ObjectIdSubclassMap.get(ObjectIdSubclassMap.java:89)
	at org.eclipse.jgit.revwalk.RevWalk.parseAny(RevWalk.java:729)
	at org.eclipse.jgit.revwalk.RevWalk.parseTree(RevWalk.java:693)
	at com.google.gerrit.httpd.rpc.patch.PatchScriptBuilder$Side.find(PatchScriptBuilder.java:435)
	at com.google.gerrit.httpd.rpc.patch.PatchScriptBuilder$Side.resolve(PatchScriptBuilder.java:369)
	at com.google.gerrit.httpd.rpc.patch.PatchScriptBuilder.toPatchScript(PatchScriptBuilder.java:127)
	at com.google.gerrit.httpd.rpc.patch.PatchScriptFactory.call(PatchScriptFactory.java:156)
	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.GeneratedMethodAccessor5.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.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.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.FilterDefinition.doFilter(FilterDefinition.java:134)
	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:1190)
	at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:424)
	at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:931)
	at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:361)
	at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:867)
	at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:117)
	at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:113)
	at org.eclipse.jetty.server.Server.handle(Server.java:337)
	at org.eclipse.jetty.server.HttpConnection.handleRequest(HttpConnection.java:581)
	at org.eclipse.jetty.server.HttpConnection$RequestHandler.content(HttpConnection.java:1020)
	at org.eclipse.jetty.http.HttpParser.parseNext(HttpParser.java:775)
	at org.eclipse.jetty.http.HttpParser.parseAvailable(HttpParser.java:228)
	at org.eclipse.jetty.server.HttpConnection.handle(HttpConnection.java:417)
	at org.eclipse.jetty.io.nio.SelectChannelEndPoint.run(SelectChannelEndPoint.java:474)
	at org.eclipse.jetty.util.thread.QueuedThreadPool$2.run(QueuedThreadPool.java:437)
	at java.lang.Thread.run(Thread.java:636)

Aug 13, 2010
Project Member #1 mf...@codeaurora.org
Hmmm, I cannot reproduce the exact same problem, but I can reproduce something similar, with the same error.  When I do what I think you are suggesting, I end up with a change that does not have a file associated with it in gerrit (yet my git repo clearly show a difference for that file).  So, perhaps there is an additional bug here?  When I do this, then mangle the URL to attempt to show the diff on this file (since I don't get a link to it), then I get the same (NPE) result.
Aug 25, 2010
Project Member #2 mf...@codeaurora.org
Try this, see if it helps: 
https://review.source.android.com/#change,16694
Aug 25, 2010
#3 sop@google.com
(No comment was entered for this change.)
Status: Submitted
Labels: FixedIn-2.1.6
Dec 15, 2010
#4 sop@google.com
(No comment was entered for this change.)
Status: Released