Skip to content

Commit

Permalink
Add nullable annotations to methods that can return null
Browse files Browse the repository at this point in the history
  • Loading branch information
tdrwenski committed Oct 3, 2024
1 parent a87cba1 commit f2fd598
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
5 changes: 5 additions & 0 deletions cdm/core/src/main/java/thredds/filesystem/ControllerOS.java
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@
import thredds.inventory.CollectionConfig;
import thredds.inventory.MController;
import thredds.inventory.MFile;

import javax.annotation.Nullable;
import javax.annotation.concurrent.ThreadSafe;
import java.io.File;
import java.util.*;
Expand All @@ -53,6 +55,7 @@ public class ControllerOS implements MController {

////////////////////////////////////////

@Nullable
@Override
public Iterator<MFile> getInventoryAll(CollectionConfig mc, boolean recheck) {
String path = mc.getDirectoryName();
Expand All @@ -68,6 +71,7 @@ public Iterator<MFile> getInventoryAll(CollectionConfig mc, boolean recheck) {
return new FilteredIterator(mc, new MFileIteratorAll(cd), false);
}

@Nullable
@Override
public Iterator<MFile> getInventoryTop(CollectionConfig mc, boolean recheck) {
String path = mc.getDirectoryName();
Expand All @@ -83,6 +87,7 @@ public Iterator<MFile> getInventoryTop(CollectionConfig mc, boolean recheck) {
return new FilteredIterator(mc, new MFileIterator(cd), false); // removes subdirs
}

@Nullable
public Iterator<MFile> getSubdirs(CollectionConfig mc, boolean recheck) {
String path = mc.getDirectoryName();
if (path.startsWith("file:")) {
Expand Down
4 changes: 4 additions & 0 deletions cdm/core/src/main/java/thredds/inventory/MController.java
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@

package thredds.inventory;

import javax.annotation.Nullable;
import java.io.IOException;
import java.util.Iterator;

Expand All @@ -23,6 +24,7 @@ public interface MController {
* @param recheck if false, may use cached results. otherwise must sync with File OS
* @return iterator over Mfiles, or null if collection does not exist
*/
@Nullable
Iterator<MFile> getInventoryAll(CollectionConfig mc, boolean recheck);

/**
Expand All @@ -32,6 +34,7 @@ public interface MController {
* @param recheck if false, may use cached results. otherwise must sync with File OS
* @return iterator over Mfiles, or null if collection does not exist
*/
@Nullable
Iterator<MFile> getInventoryTop(CollectionConfig mc, boolean recheck) throws IOException;

/**
Expand All @@ -41,6 +44,7 @@ public interface MController {
* @param recheck if false, may use cached results. otherwise must sync with File OS
* @return iterator over Mfiles, or null if collection does not exist
*/
@Nullable
Iterator<MFile> getSubdirs(CollectionConfig mc, boolean recheck);

void close();
Expand Down

0 comments on commit f2fd598

Please sign in to comment.