38 |
|
|
39 |
package gnu.CORBA.CDR; |
package gnu.CORBA.CDR; |
40 |
|
|
41 |
|
import gnu.CORBA.Minor; |
42 |
import gnu.CORBA.ObjectCreator; |
import gnu.CORBA.ObjectCreator; |
43 |
|
|
44 |
import org.omg.CORBA.CustomMarshal; |
import org.omg.CORBA.CustomMarshal; |
239 |
catch (Exception ex) |
catch (Exception ex) |
240 |
{ |
{ |
241 |
MARSHAL m = new MARSHAL(); |
MARSHAL m = new MARSHAL(); |
242 |
|
m.minor = Minor.Value; |
243 |
m.initCause(ex); |
m.initCause(ex); |
244 |
throw m; |
throw m; |
245 |
} |
} |
315 |
{ |
{ |
316 |
if (value_class != null |
if (value_class != null |
317 |
&& !value_class.isAssignableFrom(ox.getClass())) |
&& !value_class.isAssignableFrom(ox.getClass())) |
318 |
throw new MARSHAL(ox.getClass() + " is not a " |
{ |
319 |
|
MARSHAL m = new MARSHAL(ox.getClass() + " is not a " |
320 |
+ value_class.getName()); |
+ value_class.getName()); |
321 |
|
m.minor = Minor.ClassCast; |
322 |
|
throw m; |
323 |
|
} |
324 |
} |
} |
325 |
} |
} |
326 |
else |
else |
337 |
catch (SystemException sysEx) |
catch (SystemException sysEx) |
338 |
{ |
{ |
339 |
// OK. |
// OK. |
|
sysEx.printStackTrace(); |
|
340 |
throw sysEx; |
throw sysEx; |
341 |
} |
} |
342 |
catch (Exception ex) |
catch (Exception ex) |
343 |
{ |
{ |
344 |
MARSHAL m = new MARSHAL("Cant read " + value_class); |
MARSHAL m = new MARSHAL("Cant read " + value_class); |
345 |
|
m.minor = Minor.Value; |
346 |
m.initCause(ex); |
m.initCause(ex); |
347 |
throw m; |
throw m; |
348 |
} |
} |
420 |
catch (Exception ex) |
catch (Exception ex) |
421 |
{ |
{ |
422 |
MARSHAL m = new MARSHAL(); |
MARSHAL m = new MARSHAL(); |
423 |
|
m.minor = Minor.Value; |
424 |
m.initCause(ex); |
m.initCause(ex); |
425 |
throw m; |
throw m; |
426 |
} |
} |
506 |
} |
} |
507 |
} |
} |
508 |
} |
} |
509 |
catch (Throwable ex) |
catch (IOException ex) |
510 |
{ |
{ |
|
ex.printStackTrace(); |
|
511 |
MARSHAL m = new MARSHAL("Unable to read chunks"); |
MARSHAL m = new MARSHAL("Unable to read chunks"); |
512 |
|
m.minor = Minor.Value; |
513 |
m.initCause(ex); |
m.initCause(ex); |
514 |
throw m; |
throw m; |
515 |
} |
} |
562 |
|
|
563 |
// The nested value should be aways chunked. |
// The nested value should be aways chunked. |
564 |
if ((value_tag & vf_CHUNKING) == 0) |
if ((value_tag & vf_CHUNKING) == 0) |
565 |
throw new MARSHAL("readNestedValue: must be chunked"); |
{ |
566 |
|
MARSHAL m = new MARSHAL("readNestedValue: must be chunked"); |
567 |
|
m.minor = Minor.Chunks; |
568 |
|
throw m; |
569 |
|
} |
570 |
else if (value_tag == vt_NULL) |
else if (value_tag == vt_NULL) |
571 |
throw new MARSHAL("readNestedValue: null"); |
{ |
572 |
|
MARSHAL m = new MARSHAL("readNestedValue: nul"); |
573 |
|
m.minor = Minor.Chunks; |
574 |
|
throw m; |
575 |
|
} |
576 |
else if (value_tag == vt_INDIRECTION) |
else if (value_tag == vt_INDIRECTION) |
577 |
throw new MARSHAL("readNestedValue: indirection"); |
{ |
578 |
|
MARSHAL m = new MARSHAL("readNestedValue: indirection"); |
579 |
|
m.minor = Minor.Chunks; |
580 |
|
throw m; |
581 |
|
} |
582 |
else |
else |
583 |
{ |
{ |
584 |
// Read the value. |
// Read the value. |
728 |
if (!ok) |
if (!ok) |
729 |
{ |
{ |
730 |
if (value != null) |
if (value != null) |
731 |
throw new MARSHAL(value.getClass().getName() |
{ |
732 |
|
MARSHAL m = new MARSHAL(value.getClass().getName() |
733 |
+ " must be Streamable, CustomMarshal or Serializable"); |
+ " must be Streamable, CustomMarshal or Serializable"); |
734 |
|
m.minor = Minor.UnsupportedValue; |
735 |
|
throw m; |
736 |
|
} |
737 |
else |
else |
738 |
throw new MARSHAL("Unable to instantiate " + id + ":" + list(ids) |
{ |
739 |
|
MARSHAL m = new MARSHAL("Unable to instantiate " + id + ":" + list(ids) |
740 |
+ " helper " + helper); |
+ " helper " + helper); |
741 |
|
m.minor = Minor.UnsupportedValue; |
742 |
|
throw m; |
743 |
|
} |
744 |
} |
} |
745 |
else |
else |
746 |
return (Serializable) value; |
return (Serializable) value; |
933 |
else if (runtime.target == value) |
else if (runtime.target == value) |
934 |
{ |
{ |
935 |
if (!writeSelf(output, value)) |
if (!writeSelf(output, value)) |
936 |
throw new MARSHAL("Recursive helper call for " |
throw new InternalError("Recursive helper call for " |
937 |
+ value.getClass().getName()); |
+ value.getClass().getName()); |
938 |
return; |
return; |
939 |
} |
} |
1084 |
|
|
1085 |
int offset = an_input.read_long(); |
int offset = an_input.read_long(); |
1086 |
if (offset > -INT_SIZE) |
if (offset > -INT_SIZE) |
1087 |
throw new MARSHAL("Indirection tag refers to " + offset |
{ |
1088 |
|
MARSHAL m = new MARSHAL("Indirection tag refers to " + offset |
1089 |
+ " (must be less than -" + INT_SIZE + ")"); |
+ " (must be less than -" + INT_SIZE + ")"); |
1090 |
|
m.minor = Minor.Offset; |
1091 |
|
throw m; |
1092 |
|
} |
1093 |
|
|
1094 |
int stored_at = current_pos + offset; |
int stored_at = current_pos + offset; |
1095 |
|
|
1096 |
if (in.getRunTime() == null) |
if (in.getRunTime() == null) |
1097 |
throw new MARSHAL(stored_at + " offset " + offset + ": not written"); |
{ |
1098 |
|
MARSHAL m = new MARSHAL(stored_at + " offset " + offset + ": not written"); |
1099 |
|
m.minor = Minor.Value; |
1100 |
|
throw m; |
1101 |
|
} |
1102 |
|
|
1103 |
return (Serializable) in.getRunTime().isObjectWrittenAt(stored_at, offset); |
return (Serializable) in.getRunTime().isObjectWrittenAt(stored_at, offset); |
1104 |
} |
} |
1114 |
{ |
{ |
1115 |
if ((value_tag < 0x7fffff00 || value_tag > 0x7fffffff) |
if ((value_tag < 0x7fffff00 || value_tag > 0x7fffffff) |
1116 |
&& value_tag != vt_NULL && value_tag != vt_INDIRECTION) |
&& value_tag != vt_NULL && value_tag != vt_INDIRECTION) |
1117 |
throw new MARSHAL("Invalid value record, unsupported header tag: " |
{ |
1118 |
|
MARSHAL m = new MARSHAL("Invalid value record, unsupported header tag: " |
1119 |
+ value_tag + " (0x" + Integer.toHexString(value_tag) + ")"); |
+ value_tag + " (0x" + Integer.toHexString(value_tag) + ")"); |
1120 |
|
m.minor = Minor.ValueHeaderTag; |
1121 |
|
throw m; |
1122 |
|
} |
1123 |
|
|
1124 |
if ((value_tag & vf_MULTIPLE_IDS) != 0 && (value_tag & vf_ID) == 0) |
if ((value_tag & vf_MULTIPLE_IDS) != 0 && (value_tag & vf_ID) == 0) |
1125 |
throw new MARSHAL("Invalid value record header flag combination (0x" |
{ |
1126 |
|
MARSHAL m = new MARSHAL("Invalid value record header flag combination (0x" |
1127 |
+ Integer.toHexString(value_tag) + ")"); |
+ Integer.toHexString(value_tag) + ")"); |
1128 |
|
m.minor = Minor.ValueHeaderFlags; |
1129 |
|
throw m; |
1130 |
|
} |
1131 |
} |
} |
1132 |
|
|
1133 |
/** |
/** |
1139 |
MARSHAL m = new MARSHAL(msg + ":'" + id1 + "' versus '" + id2 + "'"); |
MARSHAL m = new MARSHAL(msg + ":'" + id1 + "' versus '" + id2 + "'"); |
1140 |
if (e != null) |
if (e != null) |
1141 |
m.initCause(e); |
m.initCause(e); |
1142 |
|
m.minor = Minor.Value; |
1143 |
throw m; |
throw m; |
1144 |
} |
} |
1145 |
|
|
1221 |
catch (Exception ex) |
catch (Exception ex) |
1222 |
{ |
{ |
1223 |
MARSHAL m = new MARSHAL("Unable to instantiate " + id); |
MARSHAL m = new MARSHAL("Unable to instantiate " + id); |
1224 |
|
m.minor = Minor.Instantiation; |
1225 |
m.initCause(ex); |
m.initCause(ex); |
1226 |
throw m; |
throw m; |
1227 |
} |
} |