File tree Expand file tree Collapse file tree
main/java/thredds/filesystem Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -88,9 +88,11 @@ public String getName() {
8888 return file .getName ();
8989 }
9090
91+ @ Nullable
9192 @ Override
9293 public MFile getParent () {
93- return new MFileOS (file .getParentFile ());
94+ File parent = file .getParentFile ();
95+ return parent == null ? null : new MFileOS (parent );
9496 }
9597
9698 @ Override
Original file line number Diff line number Diff line change 55
66package ucar .nc2 .util ;
77
8+ import static com .google .common .truth .Truth .assertThat ;
9+
810import java .lang .invoke .MethodHandles ;
911import org .junit .Test ;
1012import org .slf4j .Logger ;
@@ -30,6 +32,14 @@ public void testResolve() {
3032 testResolve ("file://test/me/" , "file:/wanna" , "file:/wanna" );
3133 testResolve ("file://test/me/" , "C:/wanna" , "C:/wanna" );
3234 testResolve ("http://test/me/" , "file:wanna" , "file:wanna" );
35+
36+ testResolve ("urlWithoutSlash" , "file:///path/with/slash" , "file:///path/with/slash" );
37+ }
38+
39+ @ Test
40+ public void testResolveFile () {
41+ assertThat (URLnaming .resolveFile ("urlWithoutSlash" , "file:///path/with/slash" ))
42+ .isEqualTo ("file:///path/with/slash" );
3343 }
3444
3545 private void testResolve (String base , String rel , String result ) {
You can’t perform that action at this time.
0 commit comments