Fix garbage in warning strings, and IllegalArgumentException on

assignments which require data type conversions.
This commit is contained in:
Sam Ruby 2000-06-30 04:48:46 +00:00
parent 3def9079fd
commit 2d8b72535f
4 changed files with 10 additions and 6 deletions

View File

@ -578,7 +578,7 @@ JNIEXPORT jlong JNICALL Java_net_php_reflect_nextElement
}
JNIEXPORT void JNICALL Java_net_php_reflect_setException
(JNIEnv *jenv, jclass self, jlong result, jstring value)
(JNIEnv *jenv, jclass self, jlong result, jbyteArray value)
{
pval *presult = (pval*)(long)result;
Java_net_php_reflect_setResultFromString(jenv, self, result, value);

View File

@ -45,7 +45,7 @@ public class reflect {
private static native void setResultFromObject(long result, Object value);
private static native void setResultFromArray(long result);
private static native long nextElement(long array);
private static native void setException(long result, String value);
private static native void setException(long result, byte value[]);
public static native void setEnv();
//
@ -94,7 +94,7 @@ public class reflect {
if (t!=null) e=t;
}
setException(result, e.toString());
setException(result, e.toString().getBytes());
}
//
@ -295,6 +295,7 @@ public class reflect {
Method method;
if (args!=null && args.length>0) {
method=props[i].getWriteMethod();
args = coerce(method.getParameterTypes(), args);
} else {
method=props[i].getReadMethod();
}
@ -307,6 +308,7 @@ public class reflect {
for (int i=0; i<jfields.length; i++) {
if (jfields[i].getName().equalsIgnoreCase(prop)) {
if (args!=null && args.length>0) {
args = coerce(new Class[] {jfields[i].getType()}, args);
jfields[i].set(object, args[0]);
} else {
setResult(result, jfields[i].get(object));

View File

@ -578,7 +578,7 @@ JNIEXPORT jlong JNICALL Java_net_php_reflect_nextElement
}
JNIEXPORT void JNICALL Java_net_php_reflect_setException
(JNIEnv *jenv, jclass self, jlong result, jstring value)
(JNIEnv *jenv, jclass self, jlong result, jbyteArray value)
{
pval *presult = (pval*)(long)result;
Java_net_php_reflect_setResultFromString(jenv, self, result, value);

View File

@ -45,7 +45,7 @@ public class reflect {
private static native void setResultFromObject(long result, Object value);
private static native void setResultFromArray(long result);
private static native long nextElement(long array);
private static native void setException(long result, String value);
private static native void setException(long result, byte value[]);
public static native void setEnv();
//
@ -94,7 +94,7 @@ public class reflect {
if (t!=null) e=t;
}
setException(result, e.toString());
setException(result, e.toString().getBytes());
}
//
@ -295,6 +295,7 @@ public class reflect {
Method method;
if (args!=null && args.length>0) {
method=props[i].getWriteMethod();
args = coerce(method.getParameterTypes(), args);
} else {
method=props[i].getReadMethod();
}
@ -307,6 +308,7 @@ public class reflect {
for (int i=0; i<jfields.length; i++) {
if (jfields[i].getName().equalsIgnoreCase(prop)) {
if (args!=null && args.length>0) {
args = coerce(new Class[] {jfields[i].getType()}, args);
jfields[i].set(object, args[0]);
} else {
setResult(result, jfields[i].get(object));