Skip to content

Commit 9522543

Browse files
committed
Fix a bug introduced by migrating handles
A DataHandle has some length even if the location to which it points does not exist. Instead use hand.exists() for that check.
1 parent 415bc7d commit 9522543

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

src/main/java/net/imagej/table/DefaultTableIOPlugin.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -193,10 +193,10 @@ public GenericTable open(final String source) throws IOException {
193193
final Location sourceLocation = new FileLocation(source);
194194
final DataHandle<? extends Location> handle = //
195195
dataHandleService.create(sourceLocation);
196-
long length = handle.length();
197-
if (length == 0) {
196+
if (!handle.exists()) {
198197
throw new IOException("Cannot open source");
199198
}
199+
long length = handle.length();
200200

201201
final byte[] buffer = new byte[(int) length];
202202
handle.read(buffer);

0 commit comments

Comments
 (0)