Merge
This commit is contained in:
commit
d28bdcda09
@ -567,6 +567,11 @@ public class IIOPInputStream
|
|||||||
// XXX I18N, logging needed.
|
// XXX I18N, logging needed.
|
||||||
throw new NotActiveException("defaultReadObjectDelegate");
|
throw new NotActiveException("defaultReadObjectDelegate");
|
||||||
|
|
||||||
|
if (!currentClassDesc.forClass().isAssignableFrom(
|
||||||
|
currentObject.getClass())) {
|
||||||
|
throw new IOException("Object Type mismatch");
|
||||||
|
}
|
||||||
|
|
||||||
// The array will be null unless fields were retrieved
|
// The array will be null unless fields were retrieved
|
||||||
// remotely because of a serializable version difference.
|
// remotely because of a serializable version difference.
|
||||||
// Bug fix for 4365188. See the definition of
|
// Bug fix for 4365188. See the definition of
|
||||||
@ -1063,6 +1068,9 @@ public class IIOPInputStream
|
|||||||
|
|
||||||
int spBase = spClass; // current top of stack
|
int spBase = spClass; // current top of stack
|
||||||
|
|
||||||
|
if (currentClass.getName().equals("java.lang.String")) {
|
||||||
|
return this.readUTF();
|
||||||
|
}
|
||||||
/* The object's classes should be processed from supertype to subtype
|
/* The object's classes should be processed from supertype to subtype
|
||||||
* Push all the clases of the current object onto a stack.
|
* Push all the clases of the current object onto a stack.
|
||||||
* Note that only the serializable classes are represented
|
* Note that only the serializable classes are represented
|
||||||
@ -2257,6 +2265,27 @@ public class IIOPInputStream
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
Class fieldCl = fields[i].getClazz();
|
Class fieldCl = fields[i].getClazz();
|
||||||
|
if ((objectValue != null)
|
||||||
|
&& (!fieldCl.isAssignableFrom(
|
||||||
|
objectValue.getClass()))) {
|
||||||
|
throw new IllegalArgumentException("Field mismatch");
|
||||||
|
}
|
||||||
|
Field classField = null;
|
||||||
|
try {
|
||||||
|
classField = cl.getDeclaredField(fields[i].getName());
|
||||||
|
} catch (NoSuchFieldException nsfEx) {
|
||||||
|
throw new IllegalArgumentException(nsfEx);
|
||||||
|
} catch (SecurityException secEx) {
|
||||||
|
throw new IllegalArgumentException(secEx.getCause());
|
||||||
|
}
|
||||||
|
Class<?> declaredFieldClass = classField.getType();
|
||||||
|
|
||||||
|
// check input field type is a declared field type
|
||||||
|
// input field is a subclass of the declared field
|
||||||
|
if (!declaredFieldClass.isAssignableFrom(fieldCl)) {
|
||||||
|
throw new IllegalArgumentException(
|
||||||
|
"Field Type mismatch");
|
||||||
|
}
|
||||||
if (objectValue != null && !fieldCl.isInstance(objectValue)) {
|
if (objectValue != null && !fieldCl.isInstance(objectValue)) {
|
||||||
throw new IllegalArgumentException();
|
throw new IllegalArgumentException();
|
||||||
}
|
}
|
||||||
|
@ -559,6 +559,10 @@ public class IIOPOutputStream
|
|||||||
* Push all the clases of the current object onto a stack.
|
* Push all the clases of the current object onto a stack.
|
||||||
* Remember the stack pointer where this set of classes is being pushed.
|
* Remember the stack pointer where this set of classes is being pushed.
|
||||||
*/
|
*/
|
||||||
|
if (currentClassDesc.forClass().getName().equals("java.lang.String")) {
|
||||||
|
this.writeUTF((String)obj);
|
||||||
|
return;
|
||||||
|
}
|
||||||
int stackMark = classDescStack.size();
|
int stackMark = classDescStack.size();
|
||||||
try {
|
try {
|
||||||
ObjectStreamClass next;
|
ObjectStreamClass next;
|
||||||
|
@ -446,6 +446,9 @@ public class StubGenerator extends sun.rmi.rmic.iiop.Generator {
|
|||||||
if (emitPermissionCheck) {
|
if (emitPermissionCheck) {
|
||||||
|
|
||||||
// produce the following generated code for example
|
// produce the following generated code for example
|
||||||
|
//
|
||||||
|
// private transient boolean _instantiated = false;
|
||||||
|
//
|
||||||
// private static Void checkPermission() {
|
// private static Void checkPermission() {
|
||||||
// SecurityManager sm = System.getSecurityManager();
|
// SecurityManager sm = System.getSecurityManager();
|
||||||
// if (sm != null) {
|
// if (sm != null) {
|
||||||
@ -460,11 +463,21 @@ public class StubGenerator extends sun.rmi.rmic.iiop.Generator {
|
|||||||
//
|
//
|
||||||
// public _XXXXX_Stub() {
|
// public _XXXXX_Stub() {
|
||||||
// this(checkPermission());
|
// this(checkPermission());
|
||||||
|
// _instantiated = true;
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// private void readObject(java.io.ObjectInputStream s) throws IOException, ClassNotFoundException {
|
||||||
|
// checkPermission();
|
||||||
|
// s.defaultReadObject();
|
||||||
|
// _instantiated = true;
|
||||||
// }
|
// }
|
||||||
//
|
//
|
||||||
// where XXXXX is the name of the remote interface
|
// where XXXXX is the name of the remote interface
|
||||||
|
|
||||||
p.pln();
|
p.pln();
|
||||||
|
p.plnI("private transient boolean _instantiated = false;");
|
||||||
|
p.pln();
|
||||||
|
p.pO();
|
||||||
p.plnI("private static Void checkPermission() {");
|
p.plnI("private static Void checkPermission() {");
|
||||||
p.plnI("SecurityManager sm = System.getSecurityManager();");
|
p.plnI("SecurityManager sm = System.getSecurityManager();");
|
||||||
p.pln("if (sm != null) {");
|
p.pln("if (sm != null) {");
|
||||||
@ -481,13 +494,23 @@ public class StubGenerator extends sun.rmi.rmic.iiop.Generator {
|
|||||||
p.pO();
|
p.pO();
|
||||||
|
|
||||||
p.pI();
|
p.pI();
|
||||||
p.pln("private " + currentClass + "(Void ignore) { }");
|
p.plnI("private " + currentClass + "(Void ignore) { }");
|
||||||
p.pln();
|
p.pln();
|
||||||
|
p.pO();
|
||||||
|
|
||||||
p.plnI("public " + currentClass + "() { ");
|
p.plnI("public " + currentClass + "() { ");
|
||||||
p.pln("this(checkPermission());");
|
p.pln("this(checkPermission());");
|
||||||
|
p.pln("_instantiated = true;");
|
||||||
p.pOln("}");
|
p.pOln("}");
|
||||||
p.pln();
|
p.pln();
|
||||||
|
p.plnI("private void readObject(java.io.ObjectInputStream s) throws IOException, ClassNotFoundException {");
|
||||||
|
p.plnI("checkPermission();");
|
||||||
|
p.pO();
|
||||||
|
p.pln("s.defaultReadObject();");
|
||||||
|
p.pln("_instantiated = true;");
|
||||||
|
p.pOln("}");
|
||||||
|
p.pln();
|
||||||
|
//p.pO();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!emitPermissionCheck) {
|
if (!emitPermissionCheck) {
|
||||||
@ -894,6 +917,7 @@ public class StubGenerator extends sun.rmi.rmic.iiop.Generator {
|
|||||||
String paramNames[] = method.getArgumentNames();
|
String paramNames[] = method.getArgumentNames();
|
||||||
Type returnType = method.getReturnType();
|
Type returnType = method.getReturnType();
|
||||||
ValueType[] exceptions = getStubExceptions(method,false);
|
ValueType[] exceptions = getStubExceptions(method,false);
|
||||||
|
boolean hasIOException = false;
|
||||||
|
|
||||||
addNamesInUse(method);
|
addNamesInUse(method);
|
||||||
addNameInUse("_type_ids");
|
addNameInUse("_type_ids");
|
||||||
@ -921,6 +945,13 @@ public class StubGenerator extends sun.rmi.rmic.iiop.Generator {
|
|||||||
p.plnI(" {");
|
p.plnI(" {");
|
||||||
|
|
||||||
// Now create the method body...
|
// Now create the method body...
|
||||||
|
if (emitPermissionCheck) {
|
||||||
|
p.pln("if ((System.getSecurityManager() != null) && (!_instantiated)) {");
|
||||||
|
p.plnI(" throw new java.io.IOError(new java.io.IOException(\"InvalidObject \"));");
|
||||||
|
p.pOln("}");
|
||||||
|
p.pln();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
if (localStubs) {
|
if (localStubs) {
|
||||||
writeLocalStubMethodBody(p,method,theType);
|
writeLocalStubMethodBody(p,method,theType);
|
||||||
|
Loading…
Reference in New Issue
Block a user