mirror of
https://github.com/corda/corda.git
synced 2025-01-07 13:38:47 +00:00
Merge remote-tracking branch 'origin/master' into ios
This commit is contained in:
commit
4c47f4fae8
26
classpath/avian/Iso88591.java
Normal file
26
classpath/avian/Iso88591.java
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
|
||||||
|
/* Copyright (c) 2011, Avian Contributors
|
||||||
|
|
||||||
|
Permission to use, copy, modify, and/or distribute this software
|
||||||
|
for any purpose with or without fee is hereby granted, provided
|
||||||
|
that the above copyright notice and this permission notice appear
|
||||||
|
in all copies.
|
||||||
|
|
||||||
|
There is NO WARRANTY for this software. See license.txt for
|
||||||
|
details. */
|
||||||
|
|
||||||
|
package avian;
|
||||||
|
|
||||||
|
import java.io.ByteArrayOutputStream;
|
||||||
|
|
||||||
|
public class Iso88591 {
|
||||||
|
|
||||||
|
public static byte[] encode(char[] s16, int offset, int length) {
|
||||||
|
ByteArrayOutputStream buf = new ByteArrayOutputStream();
|
||||||
|
for (int i = offset; i < offset+length; ++i) {
|
||||||
|
// ISO-88591-1/Latin-1 is the same as UTF-16 under 0x100
|
||||||
|
buf.write(s16[i]);
|
||||||
|
}
|
||||||
|
return buf.toByteArray();
|
||||||
|
}
|
||||||
|
}
|
@ -314,10 +314,29 @@ Java_java_io_File_toCanonicalPath(JNIEnv* /*e*/, jclass, jstring path)
|
|||||||
}
|
}
|
||||||
|
|
||||||
extern "C" JNIEXPORT jstring JNICALL
|
extern "C" JNIEXPORT jstring JNICALL
|
||||||
Java_java_io_File_toAbsolutePath(JNIEnv* /*e*/, jclass, jstring path)
|
Java_java_io_File_toAbsolutePath(JNIEnv* e UNUSED, jclass, jstring path)
|
||||||
{
|
{
|
||||||
|
#ifdef PLATFORM_WINDOWS
|
||||||
// todo
|
// todo
|
||||||
return path;
|
return path;
|
||||||
|
#else
|
||||||
|
jstring result = path;
|
||||||
|
string_t chars = getChars(e, path);
|
||||||
|
if (chars) {
|
||||||
|
if (chars[0] != '/') {
|
||||||
|
char* cwd = getcwd(NULL, 0);
|
||||||
|
if (cwd) {
|
||||||
|
unsigned size = strlen(cwd) + strlen(chars) + 2;
|
||||||
|
RUNTIME_ARRAY(char, buffer, size);
|
||||||
|
snprintf(RUNTIME_ARRAY_BODY(buffer), size, "%s/%s", cwd, chars);
|
||||||
|
result = e->NewStringUTF(RUNTIME_ARRAY_BODY(buffer));
|
||||||
|
free(cwd);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
releaseChars(e, path, chars);
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
extern "C" JNIEXPORT jlong JNICALL
|
extern "C" JNIEXPORT jlong JNICALL
|
||||||
|
@ -413,8 +413,8 @@ Java_java_lang_Runtime_exec(JNIEnv* e, jclass,
|
|||||||
execvp(argv[0], argv);
|
execvp(argv[0], argv);
|
||||||
|
|
||||||
// Error if here
|
// Error if here
|
||||||
char c = errno;
|
int val = errno;
|
||||||
ssize_t rv UNUSED = write(msg[1], &c, 1);
|
ssize_t rv UNUSED = write(msg[1], &val, sizeof(val));
|
||||||
exit(127);
|
exit(127);
|
||||||
} break;
|
} break;
|
||||||
|
|
||||||
@ -427,12 +427,13 @@ Java_java_lang_Runtime_exec(JNIEnv* e, jclass,
|
|||||||
safeClose(err[1]);
|
safeClose(err[1]);
|
||||||
safeClose(msg[1]);
|
safeClose(msg[1]);
|
||||||
|
|
||||||
char c;
|
int val;
|
||||||
int r = read(msg[0], &c, 1);
|
int r = read(msg[0], &val, sizeof(val));
|
||||||
if(r == -1) {
|
if(r == -1) {
|
||||||
throwNewErrno(e, "java/io/IOException");
|
throwNewErrno(e, "java/io/IOException");
|
||||||
return;
|
return;
|
||||||
} else if(r) {
|
} else if(r) {
|
||||||
|
errno = val;
|
||||||
throwNewErrno(e, "java/io/IOException");
|
throwNewErrno(e, "java/io/IOException");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -120,6 +120,10 @@ public class File implements Serializable {
|
|||||||
return toAbsolutePath(path);
|
return toAbsolutePath(path);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public File getAbsoluteFile() {
|
||||||
|
return new File(getAbsolutePath());
|
||||||
|
}
|
||||||
|
|
||||||
private static native long length(String path);
|
private static native long length(String path);
|
||||||
|
|
||||||
public long length() {
|
public long length() {
|
||||||
|
@ -161,7 +161,7 @@ public class ObjectInputStream extends InputStream {
|
|||||||
case 'n':
|
case 'n':
|
||||||
return null;
|
return null;
|
||||||
case 'z':
|
case 'z':
|
||||||
return (readLongToken() == 0);
|
return (readLongToken() != 0);
|
||||||
case 'b':
|
case 'b':
|
||||||
return (byte) readLongToken();
|
return (byte) readLongToken();
|
||||||
case 'c':
|
case 'c':
|
||||||
|
@ -103,7 +103,8 @@ public class Runtime {
|
|||||||
|
|
||||||
if (exception[0] != null) {
|
if (exception[0] != null) {
|
||||||
if (exception[0] instanceof IOException) {
|
if (exception[0] instanceof IOException) {
|
||||||
throw new IOException(exception[0]);
|
String message = "Failed to run \"" + command[0] + "\": " + exception[0].getMessage();
|
||||||
|
throw new IOException(message);
|
||||||
} else {
|
} else {
|
||||||
throw new RuntimeException(exception[0]);
|
throw new RuntimeException(exception[0]);
|
||||||
}
|
}
|
||||||
|
@ -16,10 +16,16 @@ import java.util.Comparator;
|
|||||||
import java.util.Locale;
|
import java.util.Locale;
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
import avian.Utf8;
|
import avian.Utf8;
|
||||||
|
import avian.Iso88591;
|
||||||
|
|
||||||
public final class String
|
public final class String
|
||||||
implements Comparable<String>, CharSequence, Serializable
|
implements Comparable<String>, CharSequence, Serializable
|
||||||
{
|
{
|
||||||
|
private static final String UTF_8_ENCODING = "UTF-8";
|
||||||
|
private static final String ISO_8859_1_ENCODING = "ISO-8859-1";
|
||||||
|
private static final String LATIN_1_ENCODING = "LATIN-1";
|
||||||
|
private static final String DEFAULT_ENCODING = UTF_8_ENCODING;
|
||||||
|
|
||||||
public static Comparator<String> CASE_INSENSITIVE_ORDER
|
public static Comparator<String> CASE_INSENSITIVE_ORDER
|
||||||
= new Comparator<String>() {
|
= new Comparator<String>() {
|
||||||
public int compare(String a, String b) {
|
public int compare(String a, String b) {
|
||||||
@ -52,8 +58,8 @@ public final class String
|
|||||||
throws UnsupportedEncodingException
|
throws UnsupportedEncodingException
|
||||||
{
|
{
|
||||||
this(bytes, offset, length);
|
this(bytes, offset, length);
|
||||||
if (! (charsetName.equalsIgnoreCase("UTF-8")
|
if (! (charsetName.equalsIgnoreCase(UTF_8_ENCODING)
|
||||||
|| charsetName.equalsIgnoreCase("ISO-8859-1")))
|
|| charsetName.equalsIgnoreCase(ISO_8859_1_ENCODING)))
|
||||||
{
|
{
|
||||||
throw new UnsupportedEncodingException(charsetName);
|
throw new UnsupportedEncodingException(charsetName);
|
||||||
}
|
}
|
||||||
@ -421,18 +427,31 @@ public final class String
|
|||||||
}
|
}
|
||||||
|
|
||||||
public byte[] getBytes() {
|
public byte[] getBytes() {
|
||||||
if(data instanceof byte[]) {
|
try {
|
||||||
byte[] b = new byte[length];
|
return getBytes(DEFAULT_ENCODING);
|
||||||
getBytes(0, length, b, 0);
|
} catch (java.io.UnsupportedEncodingException ex) {
|
||||||
return b;
|
throw new RuntimeException(
|
||||||
|
"Default '" + DEFAULT_ENCODING + "' encoding not handled", ex);
|
||||||
}
|
}
|
||||||
return Utf8.encode((char[])data, offset, length);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public byte[] getBytes(String format)
|
public byte[] getBytes(String format)
|
||||||
throws java.io.UnsupportedEncodingException
|
throws java.io.UnsupportedEncodingException
|
||||||
{
|
{
|
||||||
return getBytes();
|
if(data instanceof byte[]) {
|
||||||
|
byte[] b = new byte[length];
|
||||||
|
getBytes(0, length, b, 0);
|
||||||
|
return b;
|
||||||
|
}
|
||||||
|
String fmt = format.trim().toUpperCase();
|
||||||
|
if (DEFAULT_ENCODING.equals(fmt)) {
|
||||||
|
return Utf8.encode((char[])data, offset, length);
|
||||||
|
} else if (ISO_8859_1_ENCODING.equals(fmt) || LATIN_1_ENCODING.equals(fmt)) {
|
||||||
|
return Iso88591.encode((char[])data, offset, length);
|
||||||
|
} else {
|
||||||
|
throw new java.io.UnsupportedEncodingException(
|
||||||
|
"Encoding " + format + " not supported");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void getChars(int srcOffset, int srcEnd,
|
public void getChars(int srcOffset, int srcEnd,
|
||||||
|
@ -12,4 +12,14 @@ package java.util;
|
|||||||
|
|
||||||
public abstract class AbstractList<T> extends AbstractCollection<T>
|
public abstract class AbstractList<T> extends AbstractCollection<T>
|
||||||
implements List<T>
|
implements List<T>
|
||||||
{ }
|
{
|
||||||
|
protected int modCount;
|
||||||
|
|
||||||
|
public Iterator<T> iterator() {
|
||||||
|
return listIterator();
|
||||||
|
}
|
||||||
|
|
||||||
|
public ListIterator<T> listIterator() {
|
||||||
|
return new Collections.ArrayListIterator(this);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
13
classpath/java/util/AbstractMap.java
Normal file
13
classpath/java/util/AbstractMap.java
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
/* Copyright (c) 2008-2011, Avian Contributors
|
||||||
|
|
||||||
|
Permission to use, copy, modify, and/or distribute this software
|
||||||
|
for any purpose with or without fee is hereby granted, provided
|
||||||
|
that the above copyright notice and this permission notice appear
|
||||||
|
in all copies.
|
||||||
|
|
||||||
|
There is NO WARRANTY for this software. See license.txt for
|
||||||
|
details. */
|
||||||
|
|
||||||
|
package java.util;
|
||||||
|
|
||||||
|
public abstract class AbstractMap<K,V> extends Object implements Map<K,V> { }
|
@ -1,4 +1,4 @@
|
|||||||
Copyright (c) 2008-2010, Avian Contributors
|
Copyright (c) 2008-2011, Avian Contributors
|
||||||
|
|
||||||
Permission to use, copy, modify, and/or distribute this software for any
|
Permission to use, copy, modify, and/or distribute this software for any
|
||||||
purpose with or without fee is hereby granted, provided that the above
|
purpose with or without fee is hereby granted, provided that the above
|
||||||
|
@ -308,7 +308,7 @@ it on various OSes:
|
|||||||
# http://download.java.net/openjdk/jdk6/promoted/, e.g.:
|
# http://download.java.net/openjdk/jdk6/promoted/, e.g.:
|
||||||
wget http://download.java.net/openjdk/jdk6/promoted/b21/openjdk-6-src-b21-20_jan_2011.tar.gz
|
wget http://download.java.net/openjdk/jdk6/promoted/b21/openjdk-6-src-b21-20_jan_2011.tar.gz
|
||||||
mkdir openjdk
|
mkdir openjdk
|
||||||
(cd openjdk && tar xzf openjdk-6-src-b21-20_jan_2011.tar.gz)
|
(cd openjdk && tar xzf ../openjdk-6-src-b21-20_jan_2011.tar.gz)
|
||||||
make openjdk=/cygdrive/c/OpenSCG/openjdk-6.21 \
|
make openjdk=/cygdrive/c/OpenSCG/openjdk-6.21 \
|
||||||
openjdk-src=$(pwd)/openjdk/jdk/src \
|
openjdk-src=$(pwd)/openjdk/jdk/src \
|
||||||
test
|
test
|
||||||
|
@ -2266,9 +2266,22 @@ resolveMethod(Thread* t, object pair)
|
|||||||
findMethodInClass, Machine::NoSuchMethodErrorType);
|
findMethodInClass, Machine::NoSuchMethodErrorType);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool
|
||||||
|
methodAbstract(Thread* t, object method)
|
||||||
|
{
|
||||||
|
return methodCode(t, method) == 0
|
||||||
|
and (methodFlags(t, method) & ACC_NATIVE) == 0;
|
||||||
|
}
|
||||||
|
|
||||||
int64_t
|
int64_t
|
||||||
prepareMethodForCall(MyThread* t, object target)
|
prepareMethodForCall(MyThread* t, object target)
|
||||||
{
|
{
|
||||||
|
if (methodAbstract(t, target)) {
|
||||||
|
throwNew(t, Machine::AbstractMethodErrorType, "%s.%s%s",
|
||||||
|
&byteArrayBody(t, className(t, methodClass(t, target)), 0),
|
||||||
|
&byteArrayBody(t, methodName(t, target), 0),
|
||||||
|
&byteArrayBody(t, methodSpec(t, target), 0));
|
||||||
|
} else {
|
||||||
if (unresolved(t, methodAddress(t, target))) {
|
if (unresolved(t, methodAddress(t, target))) {
|
||||||
PROTECT(t, target);
|
PROTECT(t, target);
|
||||||
|
|
||||||
@ -2278,8 +2291,10 @@ prepareMethodForCall(MyThread* t, object target)
|
|||||||
if (methodFlags(t, target) & ACC_NATIVE) {
|
if (methodFlags(t, target) & ACC_NATIVE) {
|
||||||
t->trace->nativeMethod = target;
|
t->trace->nativeMethod = target;
|
||||||
}
|
}
|
||||||
|
|
||||||
return methodAddress(t, target);
|
return methodAddress(t, target);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
int64_t
|
int64_t
|
||||||
findInterfaceMethodFromInstance(MyThread* t, object method, object instance)
|
findInterfaceMethodFromInstance(MyThread* t, object method, object instance)
|
||||||
@ -2344,25 +2359,11 @@ findVirtualMethodFromReference(MyThread* t, object pair, object instance)
|
|||||||
return prepareMethodForCall(t, target);
|
return prepareMethodForCall(t, target);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool
|
|
||||||
methodAbstract(Thread* t, object method)
|
|
||||||
{
|
|
||||||
return methodCode(t, method) == 0
|
|
||||||
and (methodFlags(t, method) & ACC_NATIVE) == 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
int64_t
|
int64_t
|
||||||
getMethodAddress(MyThread* t, object target)
|
getMethodAddress(MyThread* t, object target)
|
||||||
{
|
{
|
||||||
if (methodAbstract(t, target)) {
|
|
||||||
throwNew(t, Machine::AbstractMethodErrorType, "%s.%s%s",
|
|
||||||
&byteArrayBody(t, className(t, methodClass(t, target)), 0),
|
|
||||||
&byteArrayBody(t, methodName(t, target), 0),
|
|
||||||
&byteArrayBody(t, methodSpec(t, target), 0));
|
|
||||||
} else {
|
|
||||||
return prepareMethodForCall(t, target);
|
return prepareMethodForCall(t, target);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
int64_t
|
int64_t
|
||||||
getJClassFromReference(MyThread* t, object pair)
|
getJClassFromReference(MyThread* t, object pair)
|
||||||
|
Loading…
Reference in New Issue
Block a user