try {
skel.dispatch((Remote) ref.get(), call, op, h);
} catch (Throwable t) {
Exception ex = prepareException(m, t);
RMIObjectOutputStream oout =
(RMIObjectOutputStream) call.getResultStream(false);
oout.writeObject(ex);
}
try {
call.getOutputStream().flush();
} catch (IOException ioe) {
}
return;
}
// Using 1.2 RMI protocol version
Method m = (Method) remoteMethods.get(new Long(h));
if (m == null) {
// rmi.66=Method with hash = {0} not found.
throw new UnmarshalException(Messages.getString("rmi.66", h)); //$NON-NLS-1$
}
logServerCall(m.toString());
Object[] params = readParams(m, oin);
call.releaseInputStream();
Object toReturn = null;
Throwable toThrow = null;
// locally call the method
try {
toReturn = m.invoke(ref.get(), params);
} catch (InvocationTargetException ite) {
toThrow = prepareException(m.toString(),
((InvocationTargetException) ite).getTargetException());
} catch (Throwable t) {
toThrow = prepareException(m.toString(), t);
}
// return result of method call
RMIObjectOutputStream oout =
(RMIObjectOutputStream) call.getResultStream(toThrow == null);
try {
if (toThrow != null) {
oout.writeObject(toThrow);
} else if (toReturn != null) {
oout.writeRMIObject(toReturn, m.getReturnType());
} else if (m.getReturnType() != Void.TYPE) {
oout.writeObject(null);
}
oout.flush();
} catch (Error er) {
// rmi.67=Error occured while marshalling return value
throw new ServerError(Messages.getString("rmi.67"), er); //$NON-NLS-1$
}
}