From df47b3f8f15ecfaccf090cc8565d9a386ffb9896 Mon Sep 17 00:00:00 2001 From: Caleb Hulbert Date: Tue, 17 Dec 2024 11:37:38 -0500 Subject: [PATCH 1/2] fix: assumption that the first deepListHelper result is always self It seems that on some systems (e.g. github actions) the order of the deepListHelper results is not gauranteed such that the first entry is always self. When it is not, we throw away a needed result, and later get an error as we try to process a result which *is* self, and is an empty string. This causes the substring method to throw an error, though generally it is swallowed later, and rarely seen (another problem) --- src/main/java/org/janelia/saalfeldlab/n5/N5Reader.java | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/main/java/org/janelia/saalfeldlab/n5/N5Reader.java b/src/main/java/org/janelia/saalfeldlab/n5/N5Reader.java index 0377d741..89d89021 100644 --- a/src/main/java/org/janelia/saalfeldlab/n5/N5Reader.java +++ b/src/main/java/org/janelia/saalfeldlab/n5/N5Reader.java @@ -565,10 +565,9 @@ default String[] deepList( final LinkedBlockingQueue> datasetFutures = new LinkedBlockingQueue<>(); deepListHelper(this, normalPathName, false, filter, executor, datasetFutures); - datasetFutures.poll().get(); // skip self while (!datasetFutures.isEmpty()) { final String result = datasetFutures.poll().get(); - if (result != null) + if (result != null && !result.isEmpty()) results.add(result.substring(normalPathName.length() + groupSeparator.length())); } From d0e24ba6c57b72d3df3d35e7e9a444c1429e9a51 Mon Sep 17 00:00:00 2001 From: Caleb Hulbert Date: Tue, 17 Dec 2024 11:44:50 -0500 Subject: [PATCH 2/2] fix: can't assume self is always empty, need to check equality --- src/main/java/org/janelia/saalfeldlab/n5/N5Reader.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/org/janelia/saalfeldlab/n5/N5Reader.java b/src/main/java/org/janelia/saalfeldlab/n5/N5Reader.java index 89d89021..010e757f 100644 --- a/src/main/java/org/janelia/saalfeldlab/n5/N5Reader.java +++ b/src/main/java/org/janelia/saalfeldlab/n5/N5Reader.java @@ -567,7 +567,7 @@ default String[] deepList( while (!datasetFutures.isEmpty()) { final String result = datasetFutures.poll().get(); - if (result != null && !result.isEmpty()) + if (result != null && !result.equals(normalPathName)) results.add(result.substring(normalPathName.length() + groupSeparator.length())); }