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


##########
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:
   Why is this annotated with `NotNull`? What happens when a tar file does not 
have binary references?



-- 
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