Source:
<code>private boolean doIt(File file) { try (CloseableHttpClient client = HttpClient.getCloseableHttpClient(proxy)) { String threadTs = null; String theChannels = channels; <START> String[] splitThread = channels.split("[:]+"); <END> if (splitThread.length > 1) { theChannels = splitThread[0]; threadTs = splitThread[1]; } MultipartEntityBuilder multipartEntityBuilder = MultipartEntityBuilder.create() .setMode(HttpMultipartMode.BROWSER_COMPATIBLE) .addBinaryBody("file", file, ContentType.DEFAULT_BINARY, file.getName()) .addTextBody("token", token, ContentType.DEFAULT_TEXT) .addTextBody("channels", theChannels, ContentType.DEFAULT_TEXT); if (initialComment != null) { multipartEntityBuilder = multipartEntityBuilder .addTextBody("initial_comment", initialComment, ContentType.DEFAULT_TEXT); } if (threadTs != null) { multipartEntityBuilder = multipartEntityBuilder .addTextBody("thread_ts", threadTs, ContentType.DEFAULT_TEXT); } HttpUriRequest request = RequestBuilder .post(API_URL) .setEntity(multipartEntityBuilder.build()) .build(); ResponseHandler<JSONObject> responseHandler = response -> { int status = response.getStatusLine().getStatusCode(); if (status >= 200 && status < 300) { HttpEntity entity = response.getEntity(); return entity != null ? new org.json.JSONObject(EntityUtils.toString(entity)) : null; } else { logger.log(Level.WARNING, "Slack upload may have failed. Response: " + status); return null; } }; org.json.JSONObject responseBody = client.execute(request, responseHandler); if (responseBody != null) { return responseBody.getBoolean("ok"); } else { return false; } } catch (Exception e) { String msg = "Exception uploading file '" + file + "' to Slack "; logger.log(Level.WARNING, msg, e); listener.getLogger().println(msg + e.getMessage()); } return false; }</code><technical_language>suggestion String[] splitThread = channels.split(":", 2);</technical_language>

Target:
private boolean doIt(File file) { try (CloseableHttpClient client = HttpClient.getCloseableHttpClient(proxy)) { String threadTs = null; String theChannels = channels; String[] splitThread = channels.split(":", 2); if (splitThread.length == 2) { theChannels = splitThread[0]; threadTs = splitThread[1]; } MultipartEntityBuilder multipartEntityBuilder = MultipartEntityBuilder.create() .setMode(HttpMultipartMode.BROWSER_COMPATIBLE) .addBinaryBody("file", file, ContentType.DEFAULT_BINARY, file.getName()) .addTextBody("token", token, ContentType.DEFAULT_TEXT) .addTextBody("channels", theChannels, ContentType.DEFAULT_TEXT); if (initialComment != null) { multipartEntityBuilder = multipartEntityBuilder .addTextBody("initial_comment", initialComment, ContentType.DEFAULT_TEXT); } if (threadTs != null) { multipartEntityBuilder = multipartEntityBuilder .addTextBody("thread_ts", threadTs, ContentType.DEFAULT_TEXT); } HttpUriRequest request = RequestBuilder .post(API_URL) .setEntity(multipartEntityBuilder.build()) .build(); ResponseHandler<JSONObject> responseHandler = response -> { int status = response.getStatusLine().getStatusCode(); if (status >= 200 && status < 300) { HttpEntity entity = response.getEntity(); return entity != null ? new org.json.JSONObject(EntityUtils.toString(entity)) : null; } else { logger.log(Level.WARNING, "Slack upload may have failed. Response: " + status); return null; } }; org.json.JSONObject responseBody = client.execute(request, responseHandler); if (responseBody != null) { return responseBody.getBoolean("ok"); } else { return false; } } catch (Exception e) { String msg = "Exception uploading file '" + file + "' to Slack "; logger.log(Level.WARNING, msg, e); listener.getLogger().println(msg + e.getMessage()); } return false; }