Object content = dataHandler.getContent();
// System.out.println(content.getClass().getName());
objStream = new ObjectInputStream((InputStream) content);
resultCargo = (ServiceDataCargo) objStream.readObject();
} catch (IOException e) {
throw new ResourceServiceException(e);
} catch (ClassNotFoundException e) {
throw new ResourceServiceException(e);
} finally {
if (objStream != null) {
try {
objStream.close();
} catch (IOException e) {
throw new ResourceServiceException(e);
}
}
}
} else if (result instanceof ServiceDataCargo) // direct return
{
resultCargo = (ServiceDataCargo) result;
} else {
throw new ResourceServiceException(
ResourceServiceException.UNEXPECTED_SERVICE_RETURN_VALUE_TYPE, new Object[] {
ServiceDataCargo.class.getName(),
resultCargo == null ? "null" : resultCargo.getClass().getName() });
}
// unmarshal analysis results into the original AnalysisProcessData object
// (do not replace CAS type system, as it should not have been changed
// by the service)
resultCargo.unmarshalCas(aCAS, false);
} catch (ServiceException e) {
throw new ResourceServiceException(e);
} catch (java.rmi.RemoteException e) {
throw new ResourceServiceException(e);
} catch (CASException e) {
throw new ResourceServiceException(e);
}
}