/** * Get the magic from the node. * * @param receiveTimeout * the timeout in milliseconds used to wait for a response from the node. If null the default timeout is * used. * @return the magic * @throws ProtocolException */ @Override public int getMagic(Integer receiveTimeout) throws ProtocolException { LOGGER.trace("Get magic from root node!"); int magic = super.getMagic(receiveTimeout); LOGGER.info("Get magic from root node returns: {}", magic); if (BIDIB_MAGIC_UNKNOWN == magic) { LOGGER.warn("The interface did not respond the get magic request!"); StringBuilder sb = new StringBuilder("The interface did not respond the get magic request!"); String errorInfo = getMessageReceiver().getErrorInformation(); if (StringUtils.isNotBlank(errorInfo)) { LOGGER.warn("Found received data that was not identifed as BiDiB messages: {}", errorInfo); sb.append("\r\n"); sb.append(errorInfo); } NoAnswerException ex = new NoAnswerException("Establish communication with interface failed."); ex.setDescription(sb.toString()); LOGGER.warn("Prepared exception to throw:", ex); throw ex; } return magic; }
throw new NoAnswerException(naex.getMessage());