mirror of
https://github.com/corda/corda.git
synced 2025-06-06 01:11:45 +00:00
fix some API compatibility issues in the class library
This commit is contained in:
parent
1cb9d0327a
commit
14e2513590
@ -161,16 +161,17 @@ Java_java_io_File_createNewFile(JNIEnv* e, jclass, jstring path)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
extern "C" JNIEXPORT jboolean JNICALL
|
extern "C" JNIEXPORT void JNICALL
|
||||||
Java_java_io_File_delete(JNIEnv* e, jclass, jstring path)
|
Java_java_io_File_delete(JNIEnv* e, jclass, jstring path)
|
||||||
{
|
{
|
||||||
const char* chars = e->GetStringUTFChars(path, 0);
|
const char* chars = e->GetStringUTFChars(path, 0);
|
||||||
int r = -1;
|
|
||||||
if (chars) {
|
if (chars) {
|
||||||
r = UNLINK(chars);
|
int r = UNLINK(chars);
|
||||||
|
if (r != 0) {
|
||||||
|
throwNew(e, "java/io/IOException", strerror(errno));
|
||||||
|
}
|
||||||
e->ReleaseStringUTFChars(path, chars);
|
e->ReleaseStringUTFChars(path, chars);
|
||||||
}
|
}
|
||||||
return r == 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
extern "C" JNIEXPORT jboolean JNICALL
|
extern "C" JNIEXPORT jboolean JNICALL
|
||||||
|
@ -94,21 +94,36 @@ public class File {
|
|||||||
return exists(path);
|
return exists(path);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static native void mkdir(String path);
|
private static native void mkdir(String path) throws IOException;
|
||||||
|
|
||||||
public void mkdir() {
|
public boolean mkdir() {
|
||||||
|
try {
|
||||||
mkdir(path);
|
mkdir(path);
|
||||||
|
return true;
|
||||||
|
} catch (IOException e) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private static native void createNewFile(String path);
|
private static native void createNewFile(String path) throws IOException;
|
||||||
|
|
||||||
public void createNewFile() {
|
public boolean createNewFile() {
|
||||||
|
try {
|
||||||
createNewFile(path);
|
createNewFile(path);
|
||||||
|
return true;
|
||||||
|
} catch (IOException e) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static native boolean delete(String path);
|
public static native void delete(String path) throws IOException;
|
||||||
|
|
||||||
public boolean delete() {
|
public boolean delete() {
|
||||||
return delete(path);
|
try {
|
||||||
|
delete(path);
|
||||||
|
return true;
|
||||||
|
} catch (IOException e) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -30,8 +30,8 @@ public class Logger {
|
|||||||
this.name = name;
|
this.name = name;
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<Handler> getHandlers() {
|
public Handler[] getHandlers() {
|
||||||
return new ArrayList<Handler>(handlers);
|
return handlers.toArray(new Handler[handlers.size()]);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void addHandler(Handler handler) {
|
public void addHandler(Handler handler) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user