Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix #1702 FILE READ from URL resource stream size issue #1703

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
7 changes: 6 additions & 1 deletion h2/src/main/org/h2/store/fs/FilePathDisk.java
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,12 @@ public long size() {
return 0;
}
}
return new File(name).length();
File localResource = new File(name);
if (localResource.exists()){
return localResource.length();
} else {
return -1;
}
}

/**
Expand Down
4 changes: 4 additions & 0 deletions h2/src/test/org/h2/test/db/TestFunctions.java
Original file line number Diff line number Diff line change
Expand Up @@ -662,6 +662,10 @@ private void testFileRead() throws Exception {
rs.next();
int fileSize = rs.getInt(1);
assertTrue(fileSize > 0);
rs = stat.executeQuery("SELECT LENGTH(FILE_READ('https://github.com')) LEN");
rs.next();
int webResourceSize = rs.getInt(1);
assertTrue(webResourceSize > 0);
conn.close();
igor-suhorukov marked this conversation as resolved.
Show resolved Hide resolved
}

Expand Down