public static MessageException of(String message, Throwable cause) { return new MessageException(message, cause); }
public static MessageException ofL10n(String l10nKey, Object... l10nParams) { return new MessageException(null, l10nKey, l10nParams); }
public static MessageException of(String message) { return new MessageException(message); }
public static MessageException of(String message) { return new MessageException(message); }
public static MessageException ofL10n(String l10nKey, Object... l10nParams) { return new MessageException(null, l10nKey, l10nParams); }
public static MessageException of(String message, Throwable cause) { return new MessageException(message, cause); }
public static MessageException ofL10n(String l10nKey, Object... l10nParams) { return new MessageException(null, l10nKey, l10nParams); }
public static MessageException of(String message) { return new MessageException(message); }
private final Class<INTERACTION> interactionType; private final Class<INVOCATION> invocationType; private final Constructor<INTERACTION> interactionConstructor; public AbstractInitializer(final Class<INTERACTION> interactionType, final Class<INVOCATION> invocationType) throws NoSuchMethodException { this.interactionType = interactionType; this.invocationType = invocationType; interactionConstructor = interactionType.getConstructor(invocationType); } public INTERACTION handle(Message message) throws IOException, MessageException, InvocationTargetException, InstantiationException, IllegalAccessException { checkMessageIsNotNull(message); INVOCATION invocation = construct(message.getBody().toString()); l.debug("handling in initializer... {}", invocation); return interactionConstructor.newInstance(invocation); } public INVOCATION construct(String message) throws IOException, MessageException { ObjectMapper mapper = new ObjectMapper(); INVOCATION invocation; try { invocation = mapper.readValue(message, invocationType); } catch (IOException e) { throw new MessageException("Can't deserialize message", e); } return invocation; }
int version = amfIn.readUnsignedShort(); // Treat FMS's AMF1 as AMF0. if (version == MessageIOConstants.AMF1) version = MessageIOConstants.AMF0; // <LOOK_HERE> if (version != MessageIOConstants.AMF0 && version != MessageIOConstants.AMF3) { //Unsupported AMF version {version}. MessageException ex = new MessageException(); ex.setMessage(UNSUPPORTED_AMF_VERSION, new Object[] {new Integer(version)}); ex.setCode(CODE_VERSION_MISMATCH); throw ex; }