// Try to encode the caught exception
Throwable cause = e.getCause();
// Don't allow random RuntimeExceptions to be thrown back to the client
if (!RPCServletUtils.isExpectedException(serviceMethod, cause)) {
throw new UnexpectedException("Service method '"
+ getSourceRepresentation(serviceMethod)
+ "' threw an unexpected exception: " + cause.toString(), cause);
}
streamResponse(clientOracle, cause, sink, true);