Skip to content

Commit a795473

Browse files
committed
Ensure bufr table is a file in addLookupFile()
Starting in Java 25, the exsits method on File will return true for an empty string (which is interperted as the current user directory).
1 parent 8c29812 commit a795473

1 file changed

Lines changed: 2 additions & 0 deletions

File tree

bufr/src/main/java/ucar/nc2/iosp/bufr/tables/BufrTables.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -140,6 +140,8 @@ public static synchronized void addLookupFile(String filename) throws FileNotFou
140140
if (lookups == null)
141141
lookups = new ArrayList<>();
142142
File f = new File(filename);
143+
if (f.isDirectory())
144+
throw new FileNotFoundException(filename + " is a directory");
143145
if (!f.exists())
144146
throw new FileNotFoundException(filename + " not found");
145147
lookups.add(filename);

0 commit comments

Comments
 (0)