Skip to content

Commit

Permalink
fix: DatasetDiscoverer should skipParsingIfPresent by default
Browse files Browse the repository at this point in the history
  • Loading branch information
bogovicj committed Dec 16, 2024
1 parent 7a198dc commit 5eaa8b9
Showing 1 changed file with 6 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -454,9 +454,7 @@ public N5TreeNode discoverAndParseRecursive(final N5TreeNode root, final Consume
}
callback.accept(root);

// because we did a shallow metadata parsing already, skip parsing for this node
// when parsing recursively
parseMetadataRecursive(root, callback, true);
parseMetadataRecursive(root, callback);
sortAndTrimRecursive(root, callback);

return root;
Expand Down Expand Up @@ -542,13 +540,16 @@ public void parseMetadataRecursive(final N5TreeNode rootNode) {
* @param callback the callback function
*/
public void parseMetadataRecursive(final N5TreeNode rootNode, final Consumer<N5TreeNode> callback) {
parseMetadataRecursive(rootNode, callback, false);
parseMetadataRecursive(rootNode, callback, true);
}

/**
* Parses metadata for the given node and all children in parallel using this
* object's executor. The given function is called for every node after parsing
* is completed, successful or not.
* <p>
* The skipParsingIfPresent argument allows parsing to be skipped if metadata for this node
* are already present. This should generally be true.
*
* @param rootNode the root node
* @param callback the callback function
Expand Down Expand Up @@ -596,7 +597,7 @@ public void parseMetadataRecursive(final N5TreeNode rootNode, final Consumer<N5T

// Parse if either explicitly requested (not skipping)
// or if metadata are not present
if( !skipParsingIfPresent || rootNode.getMetadata() == null ) {
if (!skipParsingIfPresent || rootNode.getMetadata() == null) {
try {
N5DatasetDiscoverer.parseMetadata(n5, rootNode, metadataParsers, groupParsers);
} catch (final Exception e) {
Expand Down

0 comments on commit 5eaa8b9

Please sign in to comment.