use of org.opensmartgridplatform.adapter.protocol.dlms.exceptions.SilentException in project open-smart-grid-platform by OSGP.
the class GetFirmwareFileResponseMessageProcessor method processMessageTasks.
@SuppressWarnings(// SilentException cannot be caught since it does not extend Exception.
"squid:S1193")
void processMessageTasks(final Serializable messageObject, final MessageMetadata messageMetadata, final DlmsConnectionManager conn) throws OsgpException {
try {
final DlmsDevice device = this.domainHelperService.findDlmsDevice(messageMetadata);
LOGGER.info("{} called for device: {} for organisation: {}", messageMetadata.getMessageType(), messageMetadata.getDeviceIdentification(), messageMetadata.getOrganisationIdentification());
final Serializable response;
response = this.handleMessage(conn, device, messageObject);
// Send response
this.sendResponseMessage(messageMetadata, ResponseMessageResultType.OK, null, this.responseMessageSender, response);
} catch (final Exception exception) {
// Return original request + exception
if (!(exception instanceof SilentException)) {
LOGGER.error("Unexpected exception during {}", this.messageType.name(), exception);
}
this.sendResponseMessage(messageMetadata, ResponseMessageResultType.NOT_OK, exception, this.responseMessageSender, this.createUpdateFirmwareRequestDto(messageObject));
} finally {
final DlmsDevice device = this.domainHelperService.findDlmsDevice(messageMetadata);
this.doConnectionPostProcessing(device, conn, messageMetadata);
}
}
use of org.opensmartgridplatform.adapter.protocol.dlms.exceptions.SilentException in project open-smart-grid-platform by OSGP.
the class OsgpResponseMessageProcessor method processMessageTask.
// SilentException cannot be caught since
@SuppressWarnings("squid:S1193")
private // it does not extend Exception.
void processMessageTask(final Serializable messageObject, final MessageMetadata messageMetadata, final DlmsConnectionManager conn) throws OsgpException {
try {
final DlmsDevice device = this.domainHelperService.findDlmsDevice(messageMetadata);
LOGGER.info("{} called for device: {} for organisation: {}", messageMetadata.getMessageType(), messageMetadata.getDeviceIdentification(), messageMetadata.getOrganisationIdentification());
if (this.usesDeviceConnection()) {
this.handleMessage(conn, this.domainHelperService.findDlmsDevice(messageMetadata), messageObject);
} else {
this.handleMessage(device, messageObject);
}
} catch (final Exception exception) {
// Return original request + exception
if (!(exception instanceof SilentException)) {
LOGGER.error("Unexpected exception during {}", this.messageType.name(), exception);
}
this.sendResponseMessage(messageMetadata, ResponseMessageResultType.NOT_OK, exception, this.responseMessageSender, messageObject);
} finally {
final DlmsDevice device = this.domainHelperService.findDlmsDevice(messageMetadata);
this.doConnectionPostProcessing(device, conn, messageMetadata);
}
}
Aggregations