lweitzendorf commented on code in PR #2393:
URL: https://github.com/apache/jackrabbit-oak/pull/2393#discussion_r2240732923


##########
oak-segment-tar/src/main/java/org/apache/jackrabbit/oak/segment/file/tar/SegmentTarReader.java:
##########
@@ -129,25 +128,18 @@ public static Index loadAndValidateIndex(RandomAccessFile 
file, String name) thr
     }
 
     @Override
-    public Buffer getGraph() throws IOException {
+    public @NotNull SegmentGraph getGraph() throws IOException {
         int end = access.length() - 2 * BLOCK_SIZE - getIndexEntrySize();
-        Buffer graph = GraphLoader.loadGraph((whence, amount) -> 
access.read(end - whence, amount));
-        hasGraph = graph != null;
-        return graph;
-    }
-
-    @Override
-    public boolean hasGraph() {
-        if (hasGraph == null) {
-            try {
-                getGraph();
-            } catch (IOException ignore) { }
+        SegmentGraph graph = SegmentGraph.load((whence, amount) -> 
access.read(end - whence, amount));
+        if (graph == null) {
+            log.warn("Recomputing missing graph for {}.", name);
+            graph = SegmentGraph.compute(this);
         }
-        return hasGraph;
+        return graph;
     }
 
     @Override
-    public Buffer getBinaryReferences() throws IOException {
+    public @NotNull Buffer getBinaryReferences() throws IOException {

Review Comment:
   As far as I can tell, all code paths in that implementation will either 
throw an exception or return a Buffer instance.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: oak-dev-unsubscr...@jackrabbit.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to