log.trace("Obtained matching event class " + dstPayloadClass.getName() + " in application " + applicationId + " for event " + eventName);
}
}
catch (ClassNotFoundException e)
{
return new ErrorResponse("The application " + applicationId + " does not have access to the event payload class"
+ srcPayloadClassName, e);
}
catch (NoClassDefFoundError e)
{
return new ErrorResponse("The application " + applicationId + " does not have access to the event payload class"
+ srcPayloadClassName, e);
}
}
// We need maybe to perform some serialization to the classloader
if (dstPayloadClass != srcPayload.getClass())
{
if (trace)
{
log.trace("Need to convert event payload from class " + srcPayloadClassName + " to " + dstPayloadClass.getName());
}
try
{
dstPayload = IOTools.clone(srcPayload, applicationClassLoader);
}
catch (ClassNotFoundException e)
{
return new ErrorResponse("Could not convert the event payload from class " + srcPayloadClassName + " to class " + dstPayloadClass.getName(), e);
}
catch (IOException e)
{
// The cause is likely a non compatible changes in class version
return new ErrorResponse("Could not convert the event payload from class " + srcPayloadClassName + " to class " + dstPayloadClass.getName(), e);
}
}
else
{
dstPayload = srcPayload;