// its ok to call this multiple times, as xstream ignores duplicate calls
localXStream.processAnnotations(responseClass);
final String responseAlias = exchange.getProperty(RESPONSE_ALIAS, String.class);
if (responseAlias != null) {
// extremely dirty, need to flush entire cache if its holding on to an old alias!!!
final CachingMapper mapper = (CachingMapper) localXStream.getMapper();
try {
if (mapper.realClass(responseAlias) != responseClass) {
mapper.flushCache();
}
} catch (CannotResolveClassException ignore) {
// recent XStream versions add a ClassNotFoundException to cache
mapper.flushCache();
}
localXStream.alias(responseAlias, responseClass);
}
response = responseClass.newInstance();
localXStream.fromXML(responseEntity, response);