Lato Client
public void printMessageDialog(IOException exception) {
ByteArrayOutputStream os;
ObjectOutputStream oos;
try {
os = new ByteArrayOutputStream();
oos = new ObjectOutputStream(os);
oos.writeObject(exception);
invokeULC("printMessageDialog", new Object[] { os.toByteArray() });
oos.close();
} catch (FileNotFoundException e) {
logger.error("Unable to send message to server", e);
} catch (IOException e) {
logger.error("Unable to send message to server", e);
}
}
Lato Server
public void printMessageDialog(byte[] bytes) {
ByteArrayInputStream bis = new ByteArrayInputStream(bytes);
ObjectInputStream ois;
try {
ois = new ObjectInputStream(bis);
IOException e = (IOException) ois.readObject();
MessageDialogs.error(owner, "Errore nella creazione del file", e.getMessage(), e)
.show();
} catch (IOException e) {
logger.error("Unable to deserialize message object", e);
} catch (ClassNotFoundException e) {
logger.error("Unable to deserialize message object", e);
}
}
Nessun commento:
Posta un commento