use of com.orientechnologies.orient.enterprise.channel.binary.OResponseProcessingException in project orientdb by orientechnologies.
the class OChannelBinaryAsynchClient method throwSerializedException.
private void throwSerializedException(final byte[] serializedException) throws IOException {
final OMemoryInputStream inputStream = new OMemoryInputStream(serializedException);
final ObjectInputStream objectInputStream = new ObjectInputStream(inputStream);
Object throwable = null;
try {
throwable = objectInputStream.readObject();
} catch (ClassNotFoundException e) {
OLogManager.instance().error(this, "Error during exception deserialization", e);
throw new IOException("Error during exception deserialization: " + e.toString());
}
objectInputStream.close();
if (throwable instanceof OException) {
try {
final Class<? extends OException> cls = (Class<? extends OException>) throwable.getClass();
final Constructor<? extends OException> constructor;
constructor = cls.getConstructor(cls);
final OException proxyInstance = constructor.newInstance(throwable);
throw proxyInstance;
} catch (NoSuchMethodException e) {
OLogManager.instance().error(this, "Error during exception deserialization", e);
} catch (InvocationTargetException e) {
OLogManager.instance().error(this, "Error during exception deserialization", e);
} catch (InstantiationException e) {
OLogManager.instance().error(this, "Error during exception deserialization", e);
} catch (IllegalAccessException e) {
OLogManager.instance().error(this, "Error during exception deserialization", e);
}
}
if (throwable instanceof Throwable) {
throw new OResponseProcessingException("Exception during response processing", (Throwable) throwable);
} else
// WRAP IT
OLogManager.instance().error(this, "Error during exception serialization, serialized exception is not Throwable, exception type is " + (throwable != null ? throwable.getClass().getName() : "null"));
}
use of com.orientechnologies.orient.enterprise.channel.binary.OResponseProcessingException in project orientdb by orientechnologies.
the class OChannelBinaryClientAbstract method throwSerializedException.
protected void throwSerializedException(final byte[] serializedException) throws IOException {
final OMemoryInputStream inputStream = new OMemoryInputStream(serializedException);
final ObjectInputStream objectInputStream = new ObjectInputStream(inputStream);
Object throwable = null;
try {
throwable = objectInputStream.readObject();
} catch (ClassNotFoundException e) {
OLogManager.instance().error(this, "Error during exception deserialization", e);
throw new IOException("Error during exception deserialization: " + e.toString());
}
objectInputStream.close();
if (throwable instanceof OException) {
try {
final Class<? extends OException> cls = (Class<? extends OException>) throwable.getClass();
final Constructor<? extends OException> constructor;
constructor = cls.getConstructor(cls);
final OException proxyInstance = constructor.newInstance(throwable);
throw proxyInstance;
} catch (NoSuchMethodException e) {
OLogManager.instance().error(this, "Error during exception deserialization", e);
} catch (InvocationTargetException e) {
OLogManager.instance().error(this, "Error during exception deserialization", e);
} catch (InstantiationException e) {
OLogManager.instance().error(this, "Error during exception deserialization", e);
} catch (IllegalAccessException e) {
OLogManager.instance().error(this, "Error during exception deserialization", e);
}
}
if (throwable instanceof Throwable) {
throw new OResponseProcessingException("Exception during response processing", (Throwable) throwable);
} else
// WRAP IT
OLogManager.instance().error(this, "Error during exception serialization, serialized exception is not Throwable, exception type is " + (throwable != null ? throwable.getClass().getName() : "null"));
}
Aggregations