Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 3 additions & 5 deletions src/main/java/loci/common/Location.java
Original file line number Diff line number Diff line change
Expand Up @@ -125,11 +125,11 @@ public Location(File file) {
}

public Location(String parent, String child) {
this(parent == null ? child : parent + File.separator + child);
this(parent + File.separator + child);
}

public Location(Location parent, String child) {
this(parent == null ? (String) null : parent.getAbsolutePath(), child);
this(parent.getAbsolutePath(), child);
}

// -- Location API methods --
Expand Down Expand Up @@ -620,9 +620,7 @@ public String getParent() {

/* @see java.io.File#getParentFile() */
public Location getParentFile() {
String parent = this.getParent();
if (parent == null) return null;
return new Location(parent);
return new Location(getParent());
}

/* @see java.io.File#getPath() */
Expand Down
9 changes: 0 additions & 9 deletions src/test/java/loci/common/utests/LocationTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@
package loci.common.utests;

import static org.testng.AssertJUnit.assertEquals;
import static org.testng.AssertJUnit.assertNull;

import java.io.File;
import java.io.IOException;
Expand Down Expand Up @@ -176,14 +175,6 @@ public void testParent() {
file.getParentFile().getAbsolutePath());
}
}

@Test
public void testParentNull() {
Location nullParent = new Location((String) null, "nullParentFile");
assertNull(nullParent.getParentFile());
nullParent = new Location((Location) null, "nullParentFile");
assertNull(nullParent.getParentFile());
}

@Test
public void testIsDirectory() {
Expand Down