Source:
<code>private static boolean sendPush(String botName, String recipient, String title, String body, String type) { boolean result = false; logger.trace(" Botname is '{}'", botName); PushbulletBot bot = bots.get(botName); if (bot == null) { logger.warn("Unconfigured pushbullet bot, please check configuration"); return false; } logger.trace(" Bot is '{}'", bot); logger.trace(" Recipient is '{}'", recipient); logger.trace(" Title is '{}'", title); logger.trace(" Message is '{}'", body); Push push = new Push(); push.setTitle(title); push.setBody(body); push.setType(type); if (recipient != null) { if (isValidEmail(recipient)) { logger.trace(" Recipient is an email address"); <START> push.setEmail(recipient); <END> } else if (isValidChannel(recipient)) { logger.trace(" Recipient is a channel tag"); push.setChannel(recipient); } } logger.trace(" Push: {}", push); String request = gson.toJson(push); logger.trace(" Packed Request: {}", request); try (InputStream stream = new ByteArrayInputStream(request.getBytes(StandardCharsets.UTF_8))) { Properties headers = new Properties(); headers.put("User-Agent", "openHAB / pushbullet action " + VERSION.toString()); headers.put("Access-Token", bot.getToken()); String responseString = HttpUtil.executeUrl(METHOD, API_URL_PUSHES, headers, stream, CONTENT_TYPE, TIMEOUT); logger.trace(" Got Response: {}", responseString); PushResponse response = gson.fromJson(responseString, PushResponse.class); logger.trace(" Unpacked Response: {}", response); stream.close(); if ((null != response) && (null == response.getPushError())) { result = true; } } catch (IOException e) { logger.warn("IO problems pushing note: {}", e.getMessage()); } return result; }</code><technical_language>else ? if recipient is null? a throw in case</technical_language>

Target:
private static boolean sendPush(String botName, String recipient, String title, String body, String type) { boolean result = false; logger.trace(" Botname is '{}'", botName); PushbulletBot bot = bots.get(botName); if (bot == null) { logger.warn("Unconfigured pushbullet bot, please check configuration"); return false; } logger.trace(" Bot is '{}'", bot); logger.trace(" Recipient is '{}'", recipient); logger.trace(" Title is '{}'", title); logger.trace(" Message is '{}'", body); Push push = new Push(); push.setTitle(title); push.setBody(body); push.setType(type); if (recipient != null) { if (isValidEmail(recipient)) { logger.trace(" Recipient is an email address"); push.setEmail(recipient); } else if (isValidChannel(recipient)) { logger.trace(" Recipient is a channel tag"); push.setChannel(recipient); } else { logger.warn("Invalid recipient: {}", recipient); logger.warn("Message will be broadcast to all user's devices."); } } logger.trace(" Push: {}", push); String request = gson.toJson(push); logger.trace(" Packed Request: {}", request); try (InputStream stream = new ByteArrayInputStream(request.getBytes(StandardCharsets.UTF_8))) { Properties headers = new Properties(); headers.put("User-Agent", "openHAB / pushbullet action " + VERSION.toString()); headers.put("Access-Token", bot.getToken()); String responseString = HttpUtil.executeUrl(METHOD, API_URL_PUSHES, headers, stream, CONTENT_TYPE, TIMEOUT); logger.trace(" Got Response: {}", responseString); PushResponse response = gson.fromJson(responseString, PushResponse.class); logger.trace(" Unpacked Response: {}", response); stream.close(); if ((null != response) && (null == response.getPushError())) { result = true; } } catch (IOException e) { logger.warn("IO problems pushing note: {}", e.getMessage()); } return result; }