Source:
<code>public ApiResponse handleApiAction(String name, JSONObject params) throws ApiException { switch (name) { case ACTION_SEND_TEXT_MESSAGE: try { int channelId = params.getInt(PARAM_CHANNEL_ID); WebSocketProxy proxy = extension.getWebSocketProxy(channelId); if (proxy != null) { this.sendWebSocketMessage( proxy, params.getBoolean(PARAM_OUTGOING), params.getString(PARAM_MESSAGE)); } else { throw new ApiException(ApiException.Type.DOES_NOT_EXIST, "channelId: " + channelId); } } catch (IOException e) { LOG.warn(e.getMessage(), e); throw new ApiException(ApiException.Type.INTERNAL_ERROR, e.getMessage()); } break; case ACTION_SET_BREAK_TEXT_MESSAGE: <START> ExtensionBreak extBreak = (ExtensionBreak) Control.getSingleton().getExtensionLoader().getExtension(ExtensionBreak.NAME); <END> if (extBreak != null) { Message msg = extBreak.getBreakpointManagementInterface().getMessage(); if (msg == null) { throw new ApiException(ApiException.Type.ILLEGAL_PARAMETER, "No currently intercepted message"); } else if (msg instanceof WebSocketMessageDTO) { WebSocketMessageDTO ws = (WebSocketMessageDTO)msg; ws.setPayload(params.optString(PARAM_MESSAGE, "")); extBreak.getBreakpointManagementInterface().setMessage(ws, true); } else { throw new ApiException(ApiException.Type.ILLEGAL_PARAMETER, "Intercepted message is not of the right type " + msg.getClass().getCanonicalName()); } } else { throw new ApiException(ApiException.Type.INTERNAL_ERROR, "ExtensionBreak not present"); } break; default: throw new ApiException(ApiException.Type.BAD_ACTION); } return ApiResponseElement.OK; }</code><technical_language>If this is done .class casting is necessary</technical_language>

Target:
public ApiResponse handleApiAction(String name, JSONObject params) throws ApiException { switch (name) { case ACTION_SEND_TEXT_MESSAGE: try { int channelId = params.getInt(PARAM_CHANNEL_ID); WebSocketProxy proxy = extension.getWebSocketProxy(channelId); if (proxy != null) { this.sendWebSocketMessage( proxy, params.getBoolean(PARAM_OUTGOING), params.getString(PARAM_MESSAGE)); } else { throw new ApiException(ApiException.Type.DOES_NOT_EXIST, "channelId: " + channelId); } } catch (IOException e) { LOG.warn(e.getMessage(), e); throw new ApiException(ApiException.Type.INTERNAL_ERROR, e.getMessage()); } break; case ACTION_SET_BREAK_TEXT_MESSAGE: ExtensionBreak extBreak = Control.getSingleton().getExtensionLoader().getExtension(ExtensionBreak.class); if (extBreak == null) { throw new ApiException(ApiException.Type.INTERNAL_ERROR, "ExtensionBreak not present"); } Message msg = extBreak.getBreakpointManagementInterface().getMessage(); if (msg == null) { throw new ApiException(ApiException.Type.ILLEGAL_PARAMETER, "No currently intercepted message"); } else if (msg instanceof WebSocketMessageDTO) { WebSocketMessageDTO ws = (WebSocketMessageDTO)msg; ws.payload = params.optString(PARAM_MESSAGE, ""); extBreak.getBreakpointManagementInterface().setMessage(ws, params.getBoolean(PARAM_OUTGOING)); } else { throw new ApiException(ApiException.Type.ILLEGAL_PARAMETER, "Intercepted message is not of the right type " + msg.getClass().getCanonicalName()); } break; default: throw new ApiException(ApiException.Type.BAD_ACTION); } return ApiResponseElement.OK; }