/** * Send return error method. * * @param msgAddress Address structure to use for return message. * @param srcHdr Message header to use as reference for return messages header. * @param rspnInteractionStage Interaction stage to use on the response. * @param error Response message error. * @return The sent MAL message. */ public MALMessage returnError(final Address msgAddress, final MALMessageHeader srcHdr, final UOctet rspnInteractionStage, final MALException error) { return initiateReturnError(msgAddress, srcHdr, srcHdr.getQoSlevel(), rspnInteractionStage, new MALStandardError(MALHelper.INTERNAL_ERROR_NUMBER, new Union(error.getLocalizedMessage()))); }
private void internalHandleInvoke(final MALMessage msg, final Address address) throws MALInteractionException { InvokeInteractionImpl interaction = new InvokeInteractionImpl(sender, address, msg); try { try { MALContextFactoryImpl.LOGGER.log(Level.FINE, "internalHandleInvoke for {0} type {1}", new Object[] { msg.getHeader().getTransactionId(), address.handler }); address.handler.handleInvoke(interaction, msg.getBody()); } catch (MALInteractionException ex) { interaction.sendError(ex.getStandardError()); } } catch (MALException ex) { try { interaction.sendError(new MALStandardError(MALHelper.INTERNAL_ERROR_NUMBER, new Union(ex.getLocalizedMessage()))); } catch (MALException noex) { // this exception cannot actually be thrown in this implmentation, therefore we can safely ignore it } } }
private void internalHandleProgress(final MALMessage msg, final Address address) throws MALInteractionException { ProgressInteractionImpl interaction = new ProgressInteractionImpl(sender, address, msg); try { try { MALContextFactoryImpl.LOGGER.log(Level.FINE, "internalHandleProgresss for {0} type {1}", new Object[] { msg.getHeader().getTransactionId(), address.handler }); address.handler.handleProgress(interaction, msg.getBody()); } catch (MALInteractionException ex) { interaction.sendError(ex.getStandardError()); } } catch (MALException ex) { try { interaction.sendError(new MALStandardError(MALHelper.INTERNAL_ERROR_NUMBER, new Union(ex.getLocalizedMessage()))); } catch (MALException noex) { // this exception cannot actually be thrown in this implmentation, therefore we can safely ignore it } } }
throw new MALTransmitErrorException(msg.getHeader(), new MALStandardError(MALHelper.BAD_ENCODING_ERROR_NUMBER, new Union(ex.getLocalizedMessage())), msg.getQoSProperties());