Source:
public static void sendSMS(String telNumber, String message) throws InternalErrorException { log.debug("Sending SMS with text \"" + message + "\" to tel. number " + telNumber + "."); try { List<String> processProperties = new ArrayList<>(); processProperties.add(BeansUtils.getCoreConfig().getSmsProgram()); processProperties.add("-p"); processProperties.add(telNumber); processProperties.add("-m"); processProperties.add(message); ProcessBuilder pb = new ProcessBuilder(processProperties); Process process; process = pb.start(); int exitValue; try { exitValue = process.waitFor(); } catch (InterruptedException ex) { String errMsg = "The external process for sending sms was interrupted."; log.error("Sending SMS with text \"" + message + "\" to tel. number " + telNumber + " failed."); throw new InternalErrorException(errMsg, ex); } if (exitValue == 0) { log.debug("SMS with text \"" + message + "\" to tel. number " + telNumber + " successfully sent."); } else if ((exitValue == 1) || (exitValue == 2)) { String errMsg = getStringFromInputStream(process.getErrorStream()); log.info("Sending SMS with text \"" + message + "\" to tel. number " + telNumber + " failed."); throw new cz.metacentrum.perun.core.api.exceptions.IllegalArgumentException(errMsg); } else if (exitValue > 2) { String errMsg = getStringFromInputStream(process.getErrorStream()); log.error("Sending SMS with text \"" + message + "\" to tel. number " + telNumber + " failed."); throw new InternalErrorException(errMsg); } } catch (IOException ex) { log.info("Sending SMS with text \"" + message + "\" to tel. number " + telNumber + " failed."); throw new InternalErrorException("Cannot access the sms external application.", ex); } }

Target:
public static void sendSMS(String telNumber, String message) throws InternalErrorException { log.debug("Sending SMS with text \"{}\" to tel. number {}.", message, telNumber); try { List<String> processProperties = new ArrayList<>(); processProperties.add(BeansUtils.getCoreConfig().getSmsProgram()); processProperties.add("-p"); processProperties.add(telNumber); processProperties.add("-m"); processProperties.add(message); ProcessBuilder pb = new ProcessBuilder(processProperties); Process process; process = pb.start(); int exitValue; try { exitValue = process.waitFor(); } catch (InterruptedException ex) { String errMsg = "The external process for sending sms was interrupted."; log.error("Sending SMS with text \"{}\" to tel. number failed.", message, telNumber); throw new InternalErrorException(errMsg, ex); } if (exitValue == 0) { log.debug("SMS with text \"{}\" to tel. number successfully sent.", message, telNumber); } else if ((exitValue == 1) || (exitValue == 2)) { String errMsg = getStringFromInputStream(process.getErrorStream()); log.error("Sending SMS with text \"{}\" to tel. number failed.", message, telNumber); throw new cz.metacentrum.perun.core.api.exceptions.IllegalArgumentException(errMsg); } else if (exitValue > 2) { String errMsg = getStringFromInputStream(process.getErrorStream()); log.error("Sending SMS with text \"{}\" to tel. number failed.", message, telNumber); throw new InternalErrorException(errMsg); } } catch (IOException ex) { log.warn("Sending SMS with text \"{}\" to tel. number failed.", message, telNumber); throw new InternalErrorException("Cannot access the sms external application.", ex); } }