Source:
<code>public void processMessage(final ObjectMessage message) throws JMSException { LOGGER.debug("Processing smart metering default response message"); String correlationUid = null; String messageType = null; String organisationIdentification = null; String deviceIdentification = null; ResponseMessage responseMessage = null; ResponseMessageResultType responseMessageResultType = null; OsgpException osgpException = null; PeriodicMeterReadsContainer periodicMeterReadsContainer = null; try { correlationUid = message.getJMSCorrelationID(); messageType = message.getJMSType(); organisationIdentification = message.getStringProperty(Constants.ORGANISATION_IDENTIFICATION); deviceIdentification = message.getStringProperty(Constants.DEVICE_IDENTIFICATION); responseMessage = (ResponseMessage) message.getObject(); responseMessageResultType = responseMessage.getResult(); osgpException = responseMessage.getOsgpException(); } catch (final JMSException e) { LOGGER.error("UNRECOVERABLE ERROR, unable to read ObjectMessage instance, giving up.", e); LOGGER.debug("correlationUid: {}", correlationUid); LOGGER.debug("messageType: {}", messageType); LOGGER.debug("organisationIdentification: {}", organisationIdentification); LOGGER.debug("deviceIdentification: {}", deviceIdentification); LOGGER.debug("responseMessageResultType: {}", responseMessageResultType); LOGGER.debug("deviceIdentification: {}", deviceIdentification); LOGGER.debug("osgpException: {}", osgpException); return; } try { LOGGER.info("Calling application service function to handle response: {}", messageType); final Object dataObject = responseMessage.getDataObject(); <START> if (dataObject instanceof Exception) { <END> this.handleError((Exception) dataObject, correlationUid, organisationIdentification, deviceIdentification, messageType); } else { periodicMeterReadsContainer = (PeriodicMeterReadsContainer) responseMessage.getDataObject(); this.monitoringService.handlePeriodicMeterReadsresponse(deviceIdentification, organisationIdentification, correlationUid, messageType, responseMessageResultType, osgpException, periodicMeterReadsContainer); } } catch (final Exception e) { this.handleError(e, correlationUid, organisationIdentification, deviceIdentification, messageType); } }</code><technical_language>Check if dataObject exception, adjust in line other classes</technical_language>

Target:
public void processMessage(final ObjectMessage message) throws JMSException { LOGGER.debug("Processing smart metering default response message"); String correlationUid = null; String messageType = null; String organisationIdentification = null; String deviceIdentification = null; ResponseMessage responseMessage = null; ResponseMessageResultType responseMessageResultType = null; OsgpException osgpException = null; PeriodicMeterReadsContainer periodicMeterReadsContainer = null; try { correlationUid = message.getJMSCorrelationID(); messageType = message.getJMSType(); organisationIdentification = message.getStringProperty(Constants.ORGANISATION_IDENTIFICATION); deviceIdentification = message.getStringProperty(Constants.DEVICE_IDENTIFICATION); responseMessage = (ResponseMessage) message.getObject(); responseMessageResultType = responseMessage.getResult(); osgpException = responseMessage.getOsgpException(); } catch (final JMSException e) { LOGGER.error("UNRECOVERABLE ERROR, unable to read ObjectMessage instance, giving up.", e); LOGGER.debug("correlationUid: {}", correlationUid); LOGGER.debug("messageType: {}", messageType); LOGGER.debug("organisationIdentification: {}", organisationIdentification); LOGGER.debug("deviceIdentification: {}", deviceIdentification); LOGGER.debug("responseMessageResultType: {}", responseMessageResultType); LOGGER.debug("deviceIdentification: {}", deviceIdentification); LOGGER.debug("osgpException: {}", osgpException); return; } try { LOGGER.info("Calling application service function to handle response: {}", messageType); periodicMeterReadsContainer = (PeriodicMeterReadsContainer) responseMessage.getDataObject(); this.monitoringService.handlePeriodicMeterReadsresponse(deviceIdentification, organisationIdentification, correlationUid, messageType, responseMessageResultType, osgpException, periodicMeterReadsContainer); } catch (final Exception e) { this.handleError(e, correlationUid, organisationIdentification, deviceIdentification, messageType); } }