mirror of
https://github.com/corda/corda.git
synced 2025-06-17 22:58:19 +00:00
re-implement System.getProperty to separate vm-specific properties from others
This commit is contained in:
@ -3,26 +3,30 @@
|
||||
#include "time.h"
|
||||
#include "string.h"
|
||||
#include "jni.h"
|
||||
#include "jni-util.h"
|
||||
|
||||
#undef JNIEXPORT
|
||||
#define JNIEXPORT __attribute__ ((visibility("default")))
|
||||
|
||||
extern "C" JNIEXPORT jstring JNICALL
|
||||
Java_java_lang_System_getProperty(JNIEnv* e, jclass, jstring key)
|
||||
Java_java_lang_System_getProperty(JNIEnv* e, jclass, jint code)
|
||||
{
|
||||
jstring value = 0;
|
||||
enum {
|
||||
LineSeparator = 100,
|
||||
OsName = 101
|
||||
};
|
||||
|
||||
const char* chars = e->GetStringUTFChars(key, 0);
|
||||
if (chars) {
|
||||
if (strcmp(chars, "line.separator") == 0) {
|
||||
value = e->NewStringUTF("\n");
|
||||
} else if (strcmp(chars, "os.name") == 0) {
|
||||
value = e->NewStringUTF("posix");
|
||||
}
|
||||
e->ReleaseStringUTFChars(key, chars);
|
||||
switch (code) {
|
||||
case LineSeparator:
|
||||
return e->NewStringUTF("\n");
|
||||
|
||||
case OsName:
|
||||
return e->NewStringUTF("posix");
|
||||
|
||||
default:
|
||||
throwNew(e, "java/lang/RuntimeException", 0);
|
||||
return 0;
|
||||
}
|
||||
|
||||
return value;
|
||||
}
|
||||
|
||||
extern "C" JNIEXPORT jlong JNICALL
|
||||
|
Reference in New Issue
Block a user