Source:
<code>public void handleEvent(EventItem eventItem) { <START> if (eventItem != null) { <END> boolean isCallScene = true; String isCallStr = eventItem.getName(); if (isCallStr != null) { isCallScene = isCallStr.equals(EventNames.CALL_SCENE); } boolean isDeviceCall = false; String deviceCallStr = eventItem.getSource().get(EventResponseEnum.IS_DEVICE); if (deviceCallStr != null) { isDeviceCall = Boolean.parseBoolean(deviceCallStr); } if (isDeviceCall) { String dsidStr = null; dsidStr = eventItem.getSource().get(EventResponseEnum.DSID); short sceneId = -1; String sceneStr = eventItem.getProperties().get(EventResponseEnum.SCENEID); if (sceneStr != null) { try { sceneId = Short.parseShort(sceneStr); } catch (java.lang.NumberFormatException e) { logger.error("An exception occurred, while handling event at parsing sceneID: {}", sceneStr, e); } } if (!isEcho(dsidStr, sceneId)) { logger.debug("{} event for device: {}", eventItem.getName(), dsidStr); if (isCallScene) { this.callDeviceScene(dsidStr, sceneId); } else { this.undoDeviceScene(dsidStr); } } } else { String intSceneID = null; String zoneIDStr = eventItem.getSource().get(EventResponseEnum.ZONEID); String groupIDStr = eventItem.getSource().get(EventResponseEnum.GROUPID); String sceneIDStr = eventItem.getProperties().get(EventResponseEnum.SCENEID); if (zoneIDStr != null && sceneIDStr != null && groupIDStr != null) { intSceneID = zoneIDStr + "-" + groupIDStr + "-" + sceneIDStr; if (!isEcho(intSceneID)) { logger.debug("{} event for scene: {}-{}-{}", eventItem.getName(), zoneIDStr, groupIDStr, sceneIDStr); if (isCallScene) { this.callInternalScene(intSceneID); } else { this.undoInternalScene(intSceneID); } } } } } }</code><technical_language>if (eventItem == null) { return; } ? saves a lot of indentation</technical_language>

Target:
public void handleEvent(EventItem eventItem) { if (eventItem == null) { return; } boolean isCallScene = true; String isCallStr = eventItem.getName(); if (isCallStr != null) { isCallScene = isCallStr.equals(EventNames.CALL_SCENE); } boolean isDeviceCall = false; String deviceCallStr = eventItem.getSource().get(EventResponseEnum.IS_DEVICE); if (deviceCallStr != null) { isDeviceCall = Boolean.parseBoolean(deviceCallStr); } if (isDeviceCall) { String dsidStr = null; dsidStr = eventItem.getSource().get(EventResponseEnum.DSID); short sceneId = -1; String sceneStr = eventItem.getProperties().get(EventResponseEnum.SCENEID); if (sceneStr != null) { try { sceneId = Short.parseShort(sceneStr); } catch (java.lang.NumberFormatException e) { logger.error("An exception occurred, while handling event at parsing sceneID: {}", sceneStr, e); } } if (!isEcho(dsidStr, sceneId)) { logger.debug("{} event for device: {}", eventItem.getName(), dsidStr); if (isCallScene) { this.callDeviceScene(dsidStr, sceneId); } else { this.undoDeviceScene(dsidStr); } } } else { String intSceneID = null; String zoneIDStr = eventItem.getSource().get(EventResponseEnum.ZONEID); String groupIDStr = eventItem.getSource().get(EventResponseEnum.GROUPID); String sceneIDStr = eventItem.getProperties().get(EventResponseEnum.SCENEID); if (zoneIDStr != null && sceneIDStr != null && groupIDStr != null) { intSceneID = zoneIDStr + "-" + groupIDStr + "-" + sceneIDStr; if (!isEcho(intSceneID)) { logger.debug("{} event for scene: {}-{}-{}", eventItem.getName(), zoneIDStr, groupIDStr, sceneIDStr); if (isCallScene) { this.callInternalScene(intSceneID); } else { this.undoInternalScene(intSceneID); } } } } }