try {
//connected = connect(address[0], Integer.parseInt(address[1]));
connected = connect(ip_board, port_board);
} catch (ArrayIndexOutOfBoundsException outEx) {
LOG.log(Level.SEVERE, "The object address ''{0}'' is not properly formatted. Check it!", c.getProperty("address"));
throw new UnableToExecuteException();
} catch (NumberFormatException numberFormatException) {
LOG.log(Level.SEVERE, "{0} is not a valid ethernet port to connect to", port_board);
throw new UnableToExecuteException();
}
if (connected) {
String message = createMessage(c);
String expectedReply = c.getProperty("expected-reply");
try {
String reply = sendToBoard(message);
if ((reply != null) && (!reply.equals(expectedReply))) {
//TODO: implement reply check
}
} catch (IOException iOException) {
setDescription("Unable to send the message to host " + address[0] + " on port " + address[1]);
LOG.log(Level.SEVERE, "Unable to send the message to host {0} on port {1}", new Object[]{address[0], address[1]});
throw new UnableToExecuteException();
} finally {
disconnect();
}
} else {
throw new UnableToExecuteException();
}
}