mirror of
https://github.com/corda/corda.git
synced 2025-01-19 11:16:54 +00:00
fix access violation introduced in last commit
This commit is contained in:
parent
446c09dd33
commit
916c96c2b9
@ -346,14 +346,15 @@ Java_java_io_File_length(JNIEnv* e, jclass, jstring path)
|
|||||||
#ifdef PLATFORM_WINDOWS
|
#ifdef PLATFORM_WINDOWS
|
||||||
|
|
||||||
LARGE_INTEGER fileSize;
|
LARGE_INTEGER fileSize;
|
||||||
HANDLE file = CreateFileW((wchar_t *)e->GetStringChars(path, 0), FILE_READ_DATA, FILE_SHARE_READ, 0,
|
string_t chars = getChars(e, path);
|
||||||
OPEN_EXISTING, 0, 0);
|
HANDLE file = CreateFileW
|
||||||
e->ReleaseStringChars(path, 0);
|
(chars, FILE_READ_DATA, FILE_SHARE_READ, 0, OPEN_EXISTING, 0, 0);
|
||||||
|
releaseChars(e, path, chars);
|
||||||
if (file != INVALID_HANDLE_VALUE)
|
if (file != INVALID_HANDLE_VALUE)
|
||||||
GetFileSizeEx(file, &fileSize);
|
GetFileSizeEx(file, &fileSize);
|
||||||
else return -1;
|
else return 0;
|
||||||
CloseHandle(file);
|
CloseHandle(file);
|
||||||
return (jlong)fileSize.QuadPart;
|
return static_cast<jlong>(fileSize.QuadPart);
|
||||||
|
|
||||||
#else
|
#else
|
||||||
|
|
||||||
|
@ -10,6 +10,9 @@ public class Zip {
|
|||||||
for (File file: directory.listFiles()) {
|
for (File file: directory.listFiles()) {
|
||||||
if (file.isFile()) {
|
if (file.isFile()) {
|
||||||
if (file.getName().endsWith(".jar")) {
|
if (file.getName().endsWith(".jar")) {
|
||||||
|
System.out.println
|
||||||
|
("found " + file.getAbsolutePath() + " length " + file.length());
|
||||||
|
|
||||||
return file.getAbsolutePath();
|
return file.getAbsolutePath();
|
||||||
}
|
}
|
||||||
} else if (file.isDirectory()) {
|
} else if (file.isDirectory()) {
|
||||||
|
Loading…
Reference in New Issue
Block a user