提交 78cff7cf 编写于 作者: M msheppar

8076376: Enhance IIOP operations

Reviewed-by: rriggs, coffeys, ahgross, skoivu
上级 e69ac325
...@@ -2417,8 +2417,8 @@ public class IIOPInputStream ...@@ -2417,8 +2417,8 @@ public class IIOPInputStream
private void throwAwayData(ValueMember[] fields, private void throwAwayData(ValueMember[] fields,
com.sun.org.omg.SendingContext.CodeBase sender) com.sun.org.omg.SendingContext.CodeBase sender)
throws InvalidClassException, StreamCorruptedException, throws InvalidClassException, StreamCorruptedException,
ClassNotFoundException, IOException ClassNotFoundException, IOException {
{
for (int i = 0; i < fields.length; ++i) { for (int i = 0; i < fields.length; ++i) {
try { try {
...@@ -2553,8 +2553,7 @@ public class IIOPInputStream ...@@ -2553,8 +2553,7 @@ public class IIOPInputStream
} }
private static void setObjectField(Object o, Class c, String fieldName, Object v) private static void setObjectField(Object o, Class c, String fieldName, Object v) {
{
try { try {
Field fld = c.getDeclaredField( fieldName ) ; Field fld = c.getDeclaredField( fieldName ) ;
Class fieldCl = fld.getType(); Class fieldCl = fld.getType();
...@@ -2564,9 +2563,15 @@ public class IIOPInputStream ...@@ -2564,9 +2563,15 @@ public class IIOPInputStream
long key = bridge.objectFieldOffset( fld ) ; long key = bridge.objectFieldOffset( fld ) ;
bridge.putObject( o, key, v ) ; bridge.putObject( o, key, v ) ;
} catch (Exception e) { } catch (Exception e) {
throw utilWrapper.errorSetObjectField( e, fieldName, if (o != null) {
o.toString(), throw utilWrapper.errorSetObjectField( e, fieldName,
v.toString() ) ; o.toString(),
v.toString() ) ;
} else {
throw utilWrapper.errorSetObjectField( e, fieldName,
"null " + c.getName() + " object",
v.toString() ) ;
}
} }
} }
...@@ -2574,12 +2579,22 @@ public class IIOPInputStream ...@@ -2574,12 +2579,22 @@ public class IIOPInputStream
{ {
try { try {
Field fld = c.getDeclaredField( fieldName ) ; Field fld = c.getDeclaredField( fieldName ) ;
long key = bridge.objectFieldOffset( fld ) ; if ((fld != null) && (fld.getType() == Boolean.TYPE)) {
bridge.putBoolean( o, key, v ) ; long key = bridge.objectFieldOffset( fld ) ;
bridge.putBoolean( o, key, v ) ;
} else {
throw new InvalidObjectException("Field Type mismatch");
}
} catch (Exception e) { } catch (Exception e) {
if (o != null) {
throw utilWrapper.errorSetBooleanField( e, fieldName, throw utilWrapper.errorSetBooleanField( e, fieldName,
o.toString(), o.toString(),
new Boolean(v) ) ; new Boolean(v) ) ;
} else {
throw utilWrapper.errorSetBooleanField( e, fieldName,
"null " + c.getName() + " object",
new Boolean(v) ) ;
}
} }
} }
...@@ -2587,12 +2602,22 @@ public class IIOPInputStream ...@@ -2587,12 +2602,22 @@ public class IIOPInputStream
{ {
try { try {
Field fld = c.getDeclaredField( fieldName ) ; Field fld = c.getDeclaredField( fieldName ) ;
long key = bridge.objectFieldOffset( fld ) ; if ((fld != null) && (fld.getType() == Byte.TYPE)) {
bridge.putByte( o, key, v ) ; long key = bridge.objectFieldOffset( fld ) ;
bridge.putByte( o, key, v ) ;
} else {
throw new InvalidObjectException("Field Type mismatch");
}
} catch (Exception e) { } catch (Exception e) {
throw utilWrapper.errorSetByteField( e, fieldName, if (o != null) {
o.toString(), throw utilWrapper.errorSetByteField( e, fieldName,
new Byte(v) ) ; o.toString(),
new Byte(v) ) ;
} else {
throw utilWrapper.errorSetByteField( e, fieldName,
"null " + c.getName() + " object",
new Byte(v) ) ;
}
} }
} }
...@@ -2600,12 +2625,22 @@ public class IIOPInputStream ...@@ -2600,12 +2625,22 @@ public class IIOPInputStream
{ {
try { try {
Field fld = c.getDeclaredField( fieldName ) ; Field fld = c.getDeclaredField( fieldName ) ;
long key = bridge.objectFieldOffset( fld ) ; if ((fld != null) && (fld.getType() == Character.TYPE)) {
bridge.putChar( o, key, v ) ; long key = bridge.objectFieldOffset( fld ) ;
bridge.putChar( o, key, v ) ;
} else {
throw new InvalidObjectException("Field Type mismatch");
}
} catch (Exception e) { } catch (Exception e) {
throw utilWrapper.errorSetCharField( e, fieldName, if (o != null) {
o.toString(), throw utilWrapper.errorSetCharField( e, fieldName,
new Character(v) ) ; o.toString(),
new Character(v) ) ;
} else {
throw utilWrapper.errorSetCharField( e, fieldName,
"null " + c.getName() + " object",
new Character(v) ) ;
}
} }
} }
...@@ -2613,12 +2648,22 @@ public class IIOPInputStream ...@@ -2613,12 +2648,22 @@ public class IIOPInputStream
{ {
try { try {
Field fld = c.getDeclaredField( fieldName ) ; Field fld = c.getDeclaredField( fieldName ) ;
long key = bridge.objectFieldOffset( fld ) ; if ((fld != null) && (fld.getType() == Short.TYPE)) {
bridge.putShort( o, key, v ) ; long key = bridge.objectFieldOffset( fld ) ;
bridge.putShort( o, key, v ) ;
} else {
throw new InvalidObjectException("Field Type mismatch");
}
} catch (Exception e) { } catch (Exception e) {
if (o != null) {
throw utilWrapper.errorSetShortField( e, fieldName, throw utilWrapper.errorSetShortField( e, fieldName,
o.toString(), o.toString(),
new Short(v) ) ; new Short(v) ) ;
} else {
throw utilWrapper.errorSetShortField( e, fieldName,
"null " + c.getName() + " object",
new Short(v) ) ;
}
} }
} }
...@@ -2626,12 +2671,22 @@ public class IIOPInputStream ...@@ -2626,12 +2671,22 @@ public class IIOPInputStream
{ {
try { try {
Field fld = c.getDeclaredField( fieldName ) ; Field fld = c.getDeclaredField( fieldName ) ;
long key = bridge.objectFieldOffset( fld ) ; if ((fld != null) && (fld.getType() == Integer.TYPE)) {
bridge.putInt( o, key, v ) ; long key = bridge.objectFieldOffset( fld ) ;
bridge.putInt( o, key, v ) ;
} else {
throw new InvalidObjectException("Field Type mismatch");
}
} catch (Exception e) { } catch (Exception e) {
throw utilWrapper.errorSetIntField( e, fieldName, if (o != null) {
o.toString(), throw utilWrapper.errorSetIntField( e, fieldName,
new Integer(v) ) ; o.toString(),
new Integer(v) ) ;
} else {
throw utilWrapper.errorSetIntField( e, fieldName,
"null " + c.getName() + " object",
new Integer(v) ) ;
}
} }
} }
...@@ -2639,12 +2694,22 @@ public class IIOPInputStream ...@@ -2639,12 +2694,22 @@ public class IIOPInputStream
{ {
try { try {
Field fld = c.getDeclaredField( fieldName ) ; Field fld = c.getDeclaredField( fieldName ) ;
long key = bridge.objectFieldOffset( fld ) ; if ((fld != null) && (fld.getType() == Long.TYPE)) {
bridge.putLong( o, key, v ) ; long key = bridge.objectFieldOffset( fld ) ;
bridge.putLong( o, key, v ) ;
} else {
throw new InvalidObjectException("Field Type mismatch");
}
} catch (Exception e) { } catch (Exception e) {
throw utilWrapper.errorSetLongField( e, fieldName, if (o != null) {
o.toString(), throw utilWrapper.errorSetLongField( e, fieldName,
new Long(v) ) ; o.toString(),
new Long(v) ) ;
} else {
throw utilWrapper.errorSetLongField( e, fieldName,
"null " + c.getName() + " object",
new Long(v) ) ;
}
} }
} }
...@@ -2652,12 +2717,22 @@ public class IIOPInputStream ...@@ -2652,12 +2717,22 @@ public class IIOPInputStream
{ {
try { try {
Field fld = c.getDeclaredField( fieldName ) ; Field fld = c.getDeclaredField( fieldName ) ;
long key = bridge.objectFieldOffset( fld ) ; if ((fld != null) && (fld.getType() == Float.TYPE)) {
bridge.putFloat( o, key, v ) ; long key = bridge.objectFieldOffset( fld ) ;
bridge.putFloat( o, key, v ) ;
} else {
throw new InvalidObjectException("Field Type mismatch");
}
} catch (Exception e) { } catch (Exception e) {
throw utilWrapper.errorSetFloatField( e, fieldName, if (o != null) {
o.toString(), throw utilWrapper.errorSetFloatField( e, fieldName,
new Float(v) ) ; o.toString(),
new Float(v) ) ;
} else {
throw utilWrapper.errorSetFloatField( e, fieldName,
"null " + c.getName() + " object",
new Float(v) ) ;
}
} }
} }
...@@ -2665,12 +2740,22 @@ public class IIOPInputStream ...@@ -2665,12 +2740,22 @@ public class IIOPInputStream
{ {
try { try {
Field fld = c.getDeclaredField( fieldName ) ; Field fld = c.getDeclaredField( fieldName ) ;
long key = bridge.objectFieldOffset( fld ) ; if ((fld != null) && (fld.getType() == Double.TYPE)) {
bridge.putDouble( o, key, v ) ; long key = bridge.objectFieldOffset( fld ) ;
bridge.putDouble( o, key, v ) ;
} else {
throw new InvalidObjectException("Field Type mismatch");
}
} catch (Exception e) { } catch (Exception e) {
throw utilWrapper.errorSetDoubleField( e, fieldName, if (o != null) {
o.toString(), throw utilWrapper.errorSetDoubleField( e, fieldName,
new Double(v) ) ; o.toString(),
new Double(v) ) ;
} else {
throw utilWrapper.errorSetDoubleField( e, fieldName,
"null " + c.getName() + " object",
new Double(v) ) ;
}
} }
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册