Example #1
0
 def fn():
     x = ArrayList()
     try:
         x.get_Item(0)
         return "Impossible!"
     except SystemException, e:
         ex = native_exc(e)
         return ex.get_Message()
Example #2
0
def call_method(space, b_obj, b_type, name, w_args, startfrom):
    b_args, b_paramtypes = rewrap_args(space, w_args, startfrom)
    b_meth = get_method(space, b_type, name, b_paramtypes)
    try:
        # for an explanation of the box() call, see the log message for revision 35167
        b_res = box(b_meth.Invoke(b_obj, b_args))
    except TargetInvocationException, e:
        b_inner = native_exc(e).get_InnerException()
        message = str(b_inner.get_Message())
        # TODO: use the appropriate exception, not StandardError
        raise OperationError(space.w_StandardError, space.wrap(message))
Example #3
0
def cli_object_new(space, w_subtype, typename, w_args):
    b_type = System.Type.GetType(typename)
    b_args, b_paramtypes = rewrap_args(space, w_args, 0)
    b_ctor = get_constructor(space, b_type, b_paramtypes)
    try:
        b_obj = b_ctor.Invoke(b_args)
    except TargetInvocationException, e:
        b_inner = native_exc(e).get_InnerException()
        message = str(b_inner.get_Message())
        # TODO: use the appropriate exception, not StandardError
        raise OperationError(space.w_StandardError, space.wrap(message))
Example #4
0
 def fn():
     x = ArrayList()
     t = x.GetType()
     meth = t.GetMethod('get_Item')
     args = init_array(System.Object, box(0))
     try:
         meth.Invoke(x, args)
         return "Impossible!"
     except TargetInvocationException, e:
         inner = native_exc(e).get_InnerException()
         message = str(inner.get_Message())
         return message