Avoid loading Patch object in /cat/ servlet

We don't actually need the Patch object, we only used it to obtain
the file name, but the key we used to locate the Patch object has
the file name embedded as part of it.

Change-Id: I9a0a6928de438ab80af0577c20538ae47818f1ed
Signed-off-by: Shawn O. Pearce <sop@google.com>
diff --git a/src/main/java/com/google/gerrit/client/reviewdb/Patch.java b/src/main/java/com/google/gerrit/client/reviewdb/Patch.java
index 751028f..174e856 100644
--- a/src/main/java/com/google/gerrit/client/reviewdb/Patch.java
+++ b/src/main/java/com/google/gerrit/client/reviewdb/Patch.java
@@ -58,6 +58,10 @@
       r.fromString(str);
       return r;
     }
+
+    public String getFileName() {
+      return get();
+    }
   }
 
   /** Type of modification made to the file path. */
diff --git a/src/main/java/com/google/gerrit/server/http/CatServlet.java b/src/main/java/com/google/gerrit/server/http/CatServlet.java
index 55a00da..22d61d4 100644
--- a/src/main/java/com/google/gerrit/server/http/CatServlet.java
+++ b/src/main/java/com/google/gerrit/server/http/CatServlet.java
@@ -134,15 +134,13 @@
     final Change.Id changeId = patchKey.getParentKey().getParentKey();
     final Project project;
     final PatchSet patchSet;
-    final Patch patch;
     try {
       final ReviewDb db = requestDb.get();
       final ChangeControl control = changeControl.validateFor(changeId);
 
       project = control.getProject();
       patchSet = db.patchSets().get(patchKey.getParentKey());
-      patch = db.patches().get(patchKey);
-      if (patchSet == null || patch == null) {
+      if (patchSet == null) {
         rsp.sendError(HttpServletResponse.SC_NOT_FOUND);
         return;
       }
@@ -167,7 +165,7 @@
     final byte[] blobData;
     final RevCommit fromCommit;
     final String suffix;
-    final String path = patch.getFileName();
+    final String path = patchKey.getFileName();
     try {
       final RevWalk rw = new RevWalk(repo);
       final RevCommit c;