auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
private SketchTextArea createTextArea(RSyntaxDocument document) throws IOException { final SketchTextArea textArea = new SketchTextArea(document, editor.base.getPdeKeywords()); textArea.setName("editor"); textArea.setFocusTraversalKeysEnabled(false); textArea.setMarkOccurrences(PreferencesData.getBoolean("editor.advanced")); textArea.setMarginLineEnabled(false); textArea.setCodeFoldingEnabled(PreferencesData.getBoolean("editor.code_folding")); textArea.setAutoIndentEnabled(PreferencesData.getBoolean("editor.indent")); textArea.setCloseCurlyBraces(PreferencesData.getBoolean("editor.indent")); textArea.setAntiAliasingEnabled(PreferencesData.getBoolean("editor.antialias")); textArea.setTabsEmulated(PreferencesData.getBoolean("editor.tabs.expand")); textArea.setTabSize(PreferencesData.getInteger("editor.tabs.size")); textArea.addHyperlinkListener(evt -> { try { UpdatableBoardsLibsFakeURLsHandler boardLibHandler = new UpdatableBoardsLibsFakeURLsHandler(editor.base); boardLibHandler.openBoardLibManager(evt.getURL()); } catch (Exception e) { try { editor.platform.openURL(editor.getSketch().getFolder(), evt.getURL().toExternalForm()); } catch (Exception f) { Base.showWarning(f.getMessage(), f.getMessage(), f); } } }); textArea.addCaretListener(e -> { Element root = textArea.getDocument().getDefaultRootElement(); int lineStart = root.getElementIndex(e.getMark()); int lineEnd = root.getElementIndex(e.getDot()); editor.lineStatus.set(lineStart, lineEnd); }); ToolTipManager.sharedInstance().registerComponent(textArea); configurePopupMenu(textArea); return textArea; }

Target:
private SketchTextArea createTextArea(RSyntaxDocument document) throws IOException { final SketchTextArea textArea = new SketchTextArea(document, editor.base.getPdeKeywords()); textArea.setName("editor"); textArea.setFocusTraversalKeysEnabled(false); textArea.setMarkOccurrences(PreferencesData.getBoolean("editor.advanced")); textArea.setMarginLineEnabled(false); textArea.setCodeFoldingEnabled(PreferencesData.getBoolean("editor.code_folding")); textArea.setAutoIndentEnabled(PreferencesData.getBoolean("editor.indent")); textArea.setCloseCurlyBraces(PreferencesData.getBoolean("editor.auto_close_braces", true)); textArea.setAntiAliasingEnabled(PreferencesData.getBoolean("editor.antialias")); textArea.setTabsEmulated(PreferencesData.getBoolean("editor.tabs.expand")); textArea.setTabSize(PreferencesData.getInteger("editor.tabs.size")); textArea.addHyperlinkListener(evt -> { try { UpdatableBoardsLibsFakeURLsHandler boardLibHandler = new UpdatableBoardsLibsFakeURLsHandler(editor.base); boardLibHandler.openBoardLibManager(evt.getURL()); } catch (Exception e) { try { editor.platform.openURL(editor.getSketch().getFolder(), evt.getURL().toExternalForm()); } catch (Exception f) { Base.showWarning(f.getMessage(), f.getMessage(), f); } } }); textArea.addCaretListener(e -> { Element root = textArea.getDocument().getDefaultRootElement(); int lineStart = root.getElementIndex(e.getMark()); int lineEnd = root.getElementIndex(e.getDot()); editor.lineStatus.set(lineStart, lineEnd); }); ToolTipManager.sharedInstance().registerComponent(textArea); configurePopupMenu(textArea); return textArea; }
Source:
protected Map<Guid, KeyValuePairCompat<String, List<Guid>>> populateTemplatesMetadataForOvfUpdate(List<Guid> idsToProcess) { Map<Guid, KeyValuePairCompat<String, List<Guid>>> vmsAndTemplateMetadata = new HashMap<Guid, KeyValuePairCompat<String, List<Guid>>>(); List<VmTemplate> templates = getVmTemplateDao().getVmTemplatesByIds(idsToProcess); for (VmTemplate template : templates) { if (VmTemplateStatus.Locked != template.getstatus()) { VmTemplateHandler.UpdateDisksFromDb(template); boolean verifyDisksNotLocked = verifyDisksNotLocked(template.getDiskList()); if (verifyDisksNotLocked) { loadTemplateData(template); Long currentDbGeneration = getVmStaticDao().getDbGeneration(template.getId()); if (template.getDb_generation() == currentDbGeneration.longValue()) { buildMetadataDictionaryForTemplate(template, vmsAndTemplateMetadata); proccessedIdsInfo.add(template.getId()); proccessedOvfGenerationsInfo.add(template.getDb_generation()); } } } } return vmsAndTemplateMetadata; }

Target:
protected Map<Guid, KeyValuePairCompat<String, List<Guid>>> populateTemplatesMetadataForOvfUpdate(List<Guid> idsToProcess) { Map<Guid, KeyValuePairCompat<String, List<Guid>>> vmsAndTemplateMetadata = new HashMap<Guid, KeyValuePairCompat<String, List<Guid>>>(); List<VmTemplate> templates = getVmTemplateDao().getVmTemplatesByIds(idsToProcess); for (VmTemplate template : templates) { if (VmTemplateStatus.Locked != template.getstatus()) { updateTemplateDisksFromDb(template); boolean verifyDisksNotLocked = verifyDisksNotLocked(template.getDiskList()); if (verifyDisksNotLocked) { loadTemplateData(template); Long currentDbGeneration = getVmStaticDao().getDbGeneration(template.getId()); if (template.getDb_generation().equals(currentDbGeneration)) { buildMetadataDictionaryForTemplate(template, vmsAndTemplateMetadata); proccessedIdsInfo.add(template.getId()); proccessedOvfGenerationsInfo.add(template.getDb_generation()); } } } } return vmsAndTemplateMetadata; }
Source:
public void changePassword_admin_Async_nonLooperThreadThrows() { SyncUser user = createTestUser(); thrown.expect(IllegalStateException.class); user.changePasswordAsync("old", "new", new SyncUser.Callback() { @Override public void onSuccess(SyncUser user) { fail(); } @Override public void onError(ObjectServerError error) { fail(); } }); }

Target:
public void changePassword_admin_Async_nonLooperThreadThrows() { SyncUser user = createTestUser(); thrown.expect(IllegalStateException.class); user.changePasswordAsync("user-id", "new", new SyncUser.Callback() { @Override public void onSuccess(SyncUser user) { fail(); } @Override public void onError(ObjectServerError error) { fail(); } }); }
Source:
public SimpleResourceDefinition(Parameters parameters) { this.pathElement = parameters.pathElement; this.descriptionResolver = parameters.descriptionResolver; this.addHandler = parameters.addHandler; this.removeHandler = parameters.removeHandler; this.addRestartLevel = parameters.addRestartLevel; this.removeRestartLevel = parameters.removeRestartLevel; this.deprecationData = parameters.deprecationData; this.runtime = parameters.runtime; this.orderedChild = parameters.orderedChildResource; this.descriptionProvider = null; this.capabilities = parameters.capabilities != null ? parameters.capabilities : NO_CAPABILITIES ; this.incorporatingCapabilities = parameters.incorporatingCapabilities; if (parameters.accessConstraints != null) { this.accessConstraints = Arrays.asList(parameters.accessConstraints); } else { this.accessConstraints = Collections.emptyList(); } if(parameters.requirements != null) { this.requirements = new HashSet<>(parameters.requirements); } else { this.requirements = Collections.emptySet(); } this.minOccurs = parameters.minOccurs; this.maxOccurs = parameters.maxOccurs; }

Target:
public SimpleResourceDefinition(Parameters parameters) { this.pathElement = parameters.pathElement; this.descriptionResolver = parameters.descriptionResolver; this.addHandler = parameters.addHandler; this.removeHandler = parameters.removeHandler; this.addRestartLevel = parameters.addRestartLevel; this.removeRestartLevel = parameters.removeRestartLevel; this.deprecationData = parameters.deprecationData; this.runtime = parameters.runtime; this.orderedChild = parameters.orderedChildResource; this.descriptionProvider = null; this.capabilities = parameters.capabilities != null ? parameters.capabilities : NO_CAPABILITIES ; this.incorporatingCapabilities = parameters.incorporatingCapabilities; if (parameters.accessConstraints != null) { this.accessConstraints = Arrays.asList(parameters.accessConstraints); } else { this.accessConstraints = Collections.emptyList(); } this.requirements = new HashSet<>(parameters.requirements); this.minOccurs = parameters.minOccurs; this.maxOccurs = parameters.maxOccurs; }
Source:
public void setAttribute(PerunSession sess, Resource resource, Member member, Attribute attribute) throws PrivilegeException, ResourceNotExistsException, InternalErrorException, MemberNotExistsException, AttributeNotExistsException, WrongAttributeValueException, WrongAttributeAssignmentException, WrongReferenceAttributeValueException { Utils.checkPerunSession(sess); getPerunBl().getResourcesManagerBl().checkResourceExists(sess, resource); getPerunBl().getMembersManagerBl().checkMemberExists(sess, member); attribute = this.perunBl.getAttributesManagerBl().convertBlankStringIntoNullInAttrValue(sess, attribute); getAttributesManagerBl().checkAttributeExists(sess, attribute); if(!AuthzResolver.isAuthorizedForAttribute(sess, ActionType.WRITE, attribute, resource, member)) throw new PrivilegeException("Principal has no access to set attribute = " + new AttributeDefinition(attribute)); getAttributesManagerBl().setAttribute(sess, resource, member, attribute); }

Target:
public void setAttribute(PerunSession sess, Resource resource, Member member, Attribute attribute) throws PrivilegeException, ResourceNotExistsException, InternalErrorException, MemberNotExistsException, AttributeNotExistsException, WrongAttributeValueException, WrongAttributeAssignmentException, WrongReferenceAttributeValueException { Utils.checkPerunSession(sess); getAttributesManagerBl().checkAttributeExists(sess, attribute); getPerunBl().getResourcesManagerBl().checkResourceExists(sess, resource); getPerunBl().getMembersManagerBl().checkMemberExists(sess, member); attribute = this.perunBl.getAttributesManagerBl().convertEmptyStringIntoNullInAttrValue(sess, attribute); if(!AuthzResolver.isAuthorizedForAttribute(sess, ActionType.WRITE, attribute, resource, member)) throw new PrivilegeException("Principal has no access to set attribute = " + new AttributeDefinition(attribute)); getAttributesManagerBl().setAttribute(sess, resource, member, attribute); }
Source:
public void onPrepareOptionsMenu(Menu menu) { menu.clear(); if (isClientActive) { menu.add(Menu.NONE, MENU_ITEM_DATA_TABLES, Menu.NONE, Constants .DATA_TABLE_CLIENTS_NAME); menu.add(Menu.NONE, MENU_ITEM_PIN_POINT, Menu.NONE, getString(R.string.pinpoint)); menu.add(Menu.NONE, MENU_ITEM_CLIENT_CHARGES, Menu.NONE, getString(R.string.charges)); menu.add(Menu.NONE, MENU_ITEM_ADD_SAVINGS_ACCOUNT, Menu.NONE, getString(R.string .savings_account)); menu.add(Menu.NONE, MENU_ITEM_ADD_LOAN_ACCOUNT, Menu.NONE, getString(R.string.add_loan)); menu.add(Menu.NONE, MENU_ITEM_DOCUMENTS, Menu.NONE, getString(R.string.documents)); menu.add(Menu.NONE, MENU_ITEM_UPLOAD_SIGN, Menu.NONE, R.string.upload_sign); menu.add(Menu.NONE, MENU_ITEM_IDENTIFIERS, Menu.NONE, getString(R.string.identifiers)); menu.add(Menu.NONE, MENU_ITEM_NOTE, Menu.NONE, getString(R.string.note)); } menu.add(Menu.NONE, MENU_ITEM_SURVEYS, Menu.NONE, getString(R.string.survey)); super.onPrepareOptionsMenu(menu); }

Target:
public void onPrepareOptionsMenu(Menu menu) { menu.clear(); if (isClientActive) { menu.add(Menu.NONE, MENU_ITEM_DATA_TABLES, Menu.NONE, Constants .DATA_TABLE_CLIENTS_NAME); menu.add(Menu.NONE, MENU_ITEM_PIN_POINT, Menu.NONE, getString(R.string.pinpoint)); menu.add(Menu.NONE, MENU_ITEM_CLIENT_CHARGES, Menu.NONE, getString(R.string.charges)); menu.add(Menu.NONE, MENU_ITEM_ADD_SAVINGS_ACCOUNT, Menu.NONE, getString(R.string .savings_account)); menu.add(Menu.NONE, MENU_ITEM_ADD_LOAN_ACCOUNT, Menu.NONE, getString(R.string.add_loan)); menu.add(Menu.NONE, MENU_ITEM_DOCUMENTS, Menu.NONE, getString(R.string.documents)); menu.add(Menu.NONE, MENU_ITEM_UPLOAD_SIGN, Menu.NONE, R.string.upload_sign); menu.add(Menu.NONE, MENU_ITEM_IDENTIFIERS, Menu.NONE, getString(R.string.identifiers)); menu.add(Menu.NONE, MENU_ITEM_SURVEYS, Menu.NONE, getString(R.string.survey)); menu.add(Menu.NONE, MENU_ITEM_NOTE, Menu.NONE, getString(R.string.note)); } super.onPrepareOptionsMenu(menu); }
Source:
public AuditLogType getAuditLogTypeValue() { this.addCustomValue("DiskAlias", getDiskImage().getDiskAlias()); return getSucceeded() ? AuditLogType.USER_REGISTER_DISK_FINISHED_SUCCESS : AuditLogType.USER_REGISTER_DISK_FINISHED_FAILURE; }

Target:
public AuditLogType getAuditLogTypeValue() { addCustomValue("DiskAlias", getDiskImage().getDiskAlias()); return getSucceeded() ? AuditLogType.USER_REGISTER_DISK_FINISHED_SUCCESS : AuditLogType.USER_REGISTER_DISK_FINISHED_FAILURE; }
Source:
private void testDropTable() throws SQLException { for (final boolean stdDropTableRestrict : new boolean[] { true, false }) { _testDropTable(stdDropTableRestrict); } }

Target:
private void testDropTable() throws SQLException { trace("testDropTable"); final boolean[] booleans = new boolean[] { true, false }; for (final boolean stdDropTableRestrict : booleans) { for (final boolean restrict : booleans) { testDropTableNoReference(stdDropTableRestrict, restrict); testDropTableViewReference(stdDropTableRestrict, restrict); testDropTableForeignKeyReference(stdDropTableRestrict, restrict); } } }
Source:
public Optional<String> getToscaType(String type, String version) { try { CatalogEntitySummary catalogEntitySummary = brooklynApi.getCatalogApi().getEntity(type, version); for (Object o : catalogEntitySummary.getTags()) { Map<String, ?> map = (Map<String, ?>) o; if (map.containsKey("traits")) { List<String> traits = (List<String>) map.get("traits"); for (String key : typeMapping.keySet()) { if (traits.contains(key)) { return Optional.of(typeMapping.get(key)); } } } } } catch (Exception e) { } return Optional.fromNullable(typeMapping.get(type)); }

Target:
public Optional<String> getToscaType(String type, String version) { try { CatalogEntitySummary catalogEntitySummary = brooklynApi.getCatalogApi().getEntity(type, version); Collection<Object> tags = Objects.firstNonNull(catalogEntitySummary.getTags(), ImmutableList.of()); for (Object o : tags) { Map<String, ?> map = (Map<String, ?>) o; if (map.containsKey("traits")) { Collection<String> traits = ImmutableSet.copyOf((Collection<String>) map.get("traits")); for (String key : typeMapping.keySet()) { if (traits.contains(key)) { return Optional.of(typeMapping.get(key)); } } } } } catch (Exception e) { LOG.info("Error getting entity {}: {}", type, e); } return Optional.fromNullable(typeMapping.get(type)); }
Source:
protected String[] validate(Object value, int arrayLength, String message) { if (!Object[].class.isInstance(value)) { throw new NuxeoException(String.format("Expected %s found %s", Object[].class, value.getClass()), SC_BAD_REQUEST); } Object[] values = Object[].class.cast(value); if (values.length != arrayLength) { throw new NuxeoException(String.format("Hint:%s requires %s parameters: %s", getClass().getSimpleName(), arrayLength, message), SC_BAD_REQUEST); } return Arrays.stream(values).toArray(String[]::new); }

Target:
protected String[] validate(Object value, int arrayLength, String message) { if (!(value instanceof Object[])) { throw new NuxeoException(String.format("Expected an array, found %s", value.getClass()), SC_BAD_REQUEST); } Object[] values = (Object[]) value; if (values.length != arrayLength) { throw new NuxeoException(String.format("Hints: %s requires %s parameters: %s", getClass().getSimpleName(), arrayLength, message), SC_BAD_REQUEST); } return Arrays.asList(values).toArray(new String[0]); }
Source:
char fixMnemonic (String string, boolean replace, boolean removeAppended) { int length = string.length (); char text = new char [length]; string.getChars (0, length, text, 0); int i = 0, j = 0; char result = new char [length * 2]; while (i < length) { switch (text [i]) { case '&': if (i + 1 < length && text [i + 1] == '&') { result [j++] = text [i++]; } else { if (replace) result [j++] = '_'; } i++; break; case '(': if (removeAppended && i + 4 == string.length () && text [i + 1] == '&' && text [i + 3] == ')') { if (replace) result [j++] = ' '; i += 4; } else { for (int k = i; k < i + 4 && k < length; k++) { result[j++] = text[k]; } i = i + 4; } break; case '_': if (text [i] == '_' && replace) result [j++] = '_'; default: result [j++] = text [i++]; } } return result; }

Target:
char fixMnemonic (String string, boolean replace, boolean removeAppended) { int length = string.length (); char text = new char [length]; string.getChars (0, length, text, 0); int i = 0, j = 0; char result = new char [length * 2]; while (i < length) { switch (text [i]) { case '&': if (i + 1 < length && text [i + 1] == '&') { result [j++] = text [i++]; } else { if (replace) result [j++] = '_'; } i++; break; case '(': if (removeAppended && i + 4 == string.length () && text [i + 1] == '&' && text [i + 3] == ')') { if (replace) result [j++] = ' '; i += 4; break; } case '_': if (replace) result [j++] = '_'; default: result [j++] = text [i++]; } } return result; }
Source:
protected void editTextAndVerify(ResourceAddress address, String identifier, String attributeName, String value) throws IOException, InterruptedException { ConfigFragment config = page.getConfigFragment(); config.edit().text(identifier, value); config.save(); reloadIfRequiredAndWaitForRunning(); verifier.verifyAttribute(address, attributeName, value); }

Target:
protected void editTextAndVerify(ResourceAddress address, String identifier, String attributeName, String value) throws IOException, InterruptedException { page.getConfigFragment().editTextAndSave(identifier, value); reloadIfRequiredAndWaitForRunning(); verifier.verifyAttribute(address, attributeName, value); }
Source:
private Future<Void> dkimFuture(Context context, EncodedPart encodedPart) { Promise<Void> promise = Promise.promise(); List<Future> dkimFutures = new ArrayList<>(); dkimSigners.forEach(dkim -> dkimFutures.add(dkim.signEmail(context, encodedPart))); CompositeFuture.all(dkimFutures).setHandler(r -> { if (r.succeeded()) { try { List<String> dkimHeaders = dkimFutures.stream().map(f -> f.result().toString()).collect(Collectors.toList()); encodedPart.headers().add(DKIMSigner.DKIM_SIGNATURE_HEADER, dkimHeaders); } finally { promise.complete(); } } else { promise.fail(r.cause()); } }); return promise.future(); }

Target:
private Future<Void> dkimFuture(Context context, EncodedPart encodedPart) { List<Future> dkimFutures = new ArrayList<>(); dkimSigners.forEach(dkim -> dkimFutures.add(dkim.signEmail(context, encodedPart))); return CompositeFuture.all(dkimFutures).map(f -> { List<String> dkimHeaders = dkimFutures.stream().map(fr -> fr.result().toString()).collect(Collectors.toList()); encodedPart.headers().add(DKIMSigner.DKIM_SIGNATURE_HEADER, dkimHeaders); return null; }); }
Source:
public String describe() { StringBuffer sb = new StringBuffer("KafkaIndexWriter\n"); sb.append("\t").append(KafkaConstants.HOST).append(" : hostname \n"); sb.append("\t").append(KafkaConstants.PORT).append(" : port \n"); sb.append("\t").append(KafkaConstants.INDEX) .append(" : Kafka index command \n"); return sb.toString(); }

Target:
public Map<String, Map.Entry<String, Object>> describe() { Map<String, Map.Entry<String, Object>> properties = new LinkedHashMap<>(); properties.put(KafkaConstants.HOST, new AbstractMap.SimpleEntry<>( "Location of the host Kafka cluster to connect to using producerConfig", this.host)); properties.put(KafkaConstants.PORT, new AbstractMap.SimpleEntry<>( "The port to connect to using the producerConfig", this.port)); properties.put(KafkaConstants.TOPIC, new AbstractMap.SimpleEntry<>( "Default index to attach to documents", this.topic)); properties.put(KafkaConstants.KEY_SERIALIZER, new AbstractMap.SimpleEntry<>( "instruct how to turn the key object the user provides with their ProducerRecord into bytes", this.keySerializer)); properties.put(KafkaConstants.VALUE_SERIALIZER, new AbstractMap.SimpleEntry<>( "instruct how to turn the value object the user provides with their ProducerRecord into bytes", this.valueSerializer)); properties.put(KafkaConstants.MAX_DOC_COUNT, new AbstractMap.SimpleEntry<>( "Maximum number of documents before a commit is forced", this.maxDocCount)); return properties; }
Source:
public String toString() { StringBuilder buffer = new StringBuilder(); for (byte fBit : fBits) appendByteString(buffer, fBit); return buffer.toString(); }

Target:
public String toString() { StringBuilder buffer = new StringBuilder(); for (byte bit : fBits) appendByteString(buffer, bit); return buffer.toString(); }
Source:
public void expandsCompositeValueAsList() { UriTemplate template = new UriTemplate("/foo{&bar,foobar*}"); assertVariables(template, new TemplateVariable("bar", VariableType.REQUEST_PARAM_CONTINUED), new TemplateVariable("foobar", VariableType.COMPOSITE_PARAM)); String expandedTemplate = template.expand(new HashMap<String, Object>(){{ put("bar", "barExpanded"); put("foobar", new ArrayList<String>(){{ add("foo1"); add("foo2"); }}); }}).toString(); assertThat(expandedTemplate, is("/foo?bar=barExpanded&foobar=foo1&foobar=foo2")); }

Target:
public void expandsCompositeValueAsList() { UriTemplate template = new UriTemplate("/foo{&bar,foobar*}"); String expandedTemplate = template.expand(new HashMap<String, Object>(){{ put("bar", "barExpanded"); put("foobar", Arrays.asList("foo1", "foo2")); }}).toString(); assertThat(expandedTemplate, is("/foo?bar=barExpanded&foobar=foo1&foobar=foo2")); }
Source:
public boolean start(@NotNull final JmxConnect jmxConnect) { if (!super.start(jmxConnect)) { return false; } LOGGER.info("Initiated repair job for keyspaces {}", getRemainingKeyspaces()); return true; }

Target:
public boolean start(@NotNull final JmxConnect jmxConnect) { if (!super.start(jmxConnect)) { return false; } LOGGER.info("Initiated backup job for keyspaces {}", getRemainingKeyspaces()); return true; }
Source:
public void theEntityDeviceModelExists(final Map<String, String> expectedEntity) throws Throwable { final Manufacturer manufacturer = new Manufacturer(); final String modelCode = getString(expectedEntity, Keys.KEY_DEVICE_MODEL_MODELCODE, Defaults.DEFAULT_DEVICE_MODEL_MODEL_CODE); final String modelDescription = getString(expectedEntity, Keys.KEY_DEVICE_MODEL_DESCRIPTION, Defaults.DEFAULT_DEVICE_MODEL_DESCRIPTION); final boolean modelMetered = getBoolean(expectedEntity, Keys.KEY_DEVICE_MODEL_METERED, Defaults.DEFAULT_DEVICE_MODEL_METERED); manufacturer .setManufacturerId(getString(expectedEntity, Keys.MANUFACTURER_ID, Defaults.DEFAULT_MANUFACTURER_ID)); final List<DeviceModel> entityList = this.repo.findByManufacturerId(manufacturer); for (final DeviceModel deviceModel : entityList) { if (deviceModel.getModelCode().equals(modelCode)) { Assert.assertEquals(modelDescription, deviceModel.getDescription()); Assert.assertEquals(modelMetered, deviceModel.isMetered()); return; } } Assert.assertFalse(true); }

Target:
public void theEntityDeviceModelExists(final Map<String, String> expectedEntity) throws Throwable { final String modelCode = getString(expectedEntity, Keys.KEY_DEVICE_MODEL_MODELCODE, Defaults.DEFAULT_DEVICE_MODEL_MODEL_CODE); final String modelDescription = getString(expectedEntity, Keys.KEY_DEVICE_MODEL_DESCRIPTION, Defaults.DEFAULT_DEVICE_MODEL_DESCRIPTION); final boolean modelMetered = getBoolean(expectedEntity, Keys.KEY_DEVICE_MODEL_METERED, Defaults.DEFAULT_DEVICE_MODEL_METERED); final Manufacturer manufacturer = new Manufacturer(); manufacturer .setManufacturerId(getString(expectedEntity, Keys.MANUFACTURER_ID, Defaults.DEFAULT_MANUFACTURER_ID)); final List<DeviceModel> entityList = this.repo.findByManufacturerId(manufacturer); for (final DeviceModel deviceModel : entityList) { if (deviceModel.getModelCode().equals(modelCode)) { Assert.assertEquals(modelDescription, deviceModel.getDescription()); Assert.assertEquals(modelMetered, deviceModel.isMetered()); return; } } Assert.assertFalse(true); }
Source:
protected void onResume() { super.onResume();; if (mCurrentCard == null || mIndex < 0) { Timber.e("CardTemplatePreviewer started with empty card list or invalid index"); finishWithoutAnimation(); } }

Target:
protected void onResume() { super.onResume(); if (mCurrentCard == null || mOrdinal < 0) { Timber.e("CardTemplatePreviewer started with empty card list or invalid index"); finishWithoutAnimation(); return; } }
Source:
public void testWaitForPortFreeWhenNotAbortingOnTimeout() throws Exception { ServerSocket serverSocket = openServerSocket(); try { int port = serverSocket.getLocalPort(); String cmd = BashCommands.waitForPortFree(port, Duration.ONE_SECOND, false); ProcessTaskWrapper<String> t = SshTasks.newSshExecTaskFactory(loc, cmd) .requiringZeroAndReturningStdout().newTask(); String output = exec.submit(t).get(); assertTrue(output.contains(port+" still in use"), "output="+output); serverSocket.close(); assertTrue(Networking.isPortAvailable(port)); String cmd2 = BashCommands.waitForPortFree(port, Duration.ONE_SECOND, false); ProcessTaskWrapper<String> t2 = SshTasks.newSshExecTaskFactory(loc, cmd2) .requiringZeroAndReturningStdout().newTask(); String output2 = exec.submit(t2).get(); assertFalse(output2.contains("still in use"), "output="+output2); } finally { serverSocket.close(); } }

Target:
public void testWaitForPortFreeWhenNotAbortingOnTimeout() throws Exception { ServerSocket serverSocket = openServerSocket(); try { int port = serverSocket.getLocalPort(); String cmd = BashCommands.waitForPortFree(port, Duration.ONE_SECOND, false); String output = execRequiringZeroAndReturningStdout(loc, cmd).get(); assertTrue(output.contains(port+" still in use"), "output="+output); serverSocket.close(); assertTrue(Networking.isPortAvailable(port)); String output2 = execRequiringZeroAndReturningStdout(loc, cmd).get(); assertFalse(output2.contains("still in use"), "output="+output2); } finally { serverSocket.close(); } }
Source:
public void clearJob(JobID jobID) throws IOException { checkNotNull(jobID); try { kubeClient.checkAndUpdateConfigMap( configMapName, configMap -> { if (KubernetesLeaderElector.hasLeadership(configMap, lockIdentity)) { configMap.getData().remove(getKeyForJobId(jobID)); return Optional.of(configMap); } return Optional.empty(); } ).get(); } catch (Exception e) { throw new IOException("Failed to clear job state in ConfigMap " + configMapName + " for job " + jobID, e); } }

Target:
public void clearJob(JobID jobID) throws IOException { checkNotNull(jobID); try { kubeClient.checkAndUpdateConfigMap( configMapName, configMap -> { if (KubernetesLeaderElector.hasLeadership(configMap, lockIdentity)) { if (configMap.getData().remove(getKeyForJobId(jobID)) != null) { return Optional.of(configMap); } } return Optional.empty(); } ).get(); } catch (Exception e) { throw new IOException("Failed to clear job state in ConfigMap " + configMapName + " for job " + jobID, e); } }
Source:
public static byte[] hashPassword(final char[] password, final byte[] salt, final int iterations) { try { SecretKeyFactory keyFactory = SecretKeyFactory.getInstance(ALGORITHM); SecretKey key = keyFactory.generateSecret( new PBEKeySpec( password, salt, iterations, KEY_LENGTH ) ); return key.getEncoded(); } catch (InvalidKeySpecException ikse) { log.error("WTF? invalid keyspec"); throw new RuntimeException(ikse); } catch (NoSuchAlgorithmException nsae) { log.error("%s not supported on this system.", ALGORITHM); throw new RuntimeException(nsae); } }

Target:
public static byte[] hashPassword(final char[] password, final byte[] salt, final int iterations) { try { SecretKeyFactory keyFactory = SecretKeyFactory.getInstance(ALGORITHM); SecretKey key = keyFactory.generateSecret( new PBEKeySpec( password, salt, iterations, KEY_LENGTH ) ); return key.getEncoded(); } catch (InvalidKeySpecException ikse) { log.error("WTF? invalid keyspec"); throw new RuntimeException("WTF? invalid keyspec", ikse); } catch (NoSuchAlgorithmException nsae) { log.error("%s not supported on this system.", ALGORITHM); throw new RuntimeException(StringUtils.format("%s not supported on this system.", ALGORITHM), nsae); } }
Source:
private void lookupGetChildrenMethod() { if (_getChildrenMethod != null) { return; } try { if (GETCHILDREN_PAGINATION_DISABLED) { lookupNonPaginatedGetChildren(); } else { _getChildrenMethod = ZooKeeper.class.getMethod("getAllChildrenPaginated", String.class, boolean.class); } } catch (NoSuchMethodException e1) { lookupNonPaginatedGetChildren(); } LOG.info("Pagination config {}={}, method to be invoked: {}", ZkSystemPropertyKeys.ZK_GETCHILDREN_PAGINATION_DISABLED, GETCHILDREN_PAGINATION_DISABLED, _getChildrenMethod.getName()); }

Target:
private void lookupGetChildrenMethod() { _getChildrenMethod = doLookUpGetChildrenMethod(); LOG.info("Pagination config {}={}, method to be invoked: {}", ZkSystemPropertyKeys.ZK_GETCHILDREN_PAGINATION_DISABLED, GETCHILDREN_PAGINATION_DISABLED, _getChildrenMethod.getName()); }
Source:
public void processLeftData(final MistDataEvent input) { S state = initializeStateFunc.apply(null); final Collection<IN> value = (Collection<IN>) input.getValue(); final Iterator<IN> iterator = value.iterator(); while(iterator.hasNext()) { final IN data = iterator.next(); state = updateStateFunc.apply(data, state); } input.setValue(produceResultFunc.apply(state)); outputEmitter.emitData(input); }

Target:
public void processLeftData(final MistDataEvent input) { S state = initializeStateSup.get(); if (input.getValue() instanceof Collection) { final Collection<IN> value = (Collection<IN>) input.getValue(); final Iterator<IN> iterator = value.iterator(); while (iterator.hasNext()) { final IN data = iterator.next(); state = updateStateFunc.apply(data, state); } input.setValue(produceResultFunc.apply(state)); outputEmitter.emitData(input); } else { throw new TypeMismatchException( "The input value for aggregate window operator is not an instance of collection."); } }
Source:
private List<VMWithPlugInfo> getVmsWithPlugInfo(Guid id) { List<VMWithPlugInfo> vmsWithPlugInfo = getCallsHandler().executeReadList ("GetVmsByDiskId", VMWithPlugInfoRowMapper.instance, getCustomMapSqlParameterSource().addValue("disk_guid", id)); return vmsWithPlugInfo; }

Target:
private List<VMWithPlugInfo> getVmsWithPlugInfo(Guid id) { return getCallsHandler().executeReadList ("GetVmsByDiskId", VMWithPlugInfoRowMapper.instance, getCustomMapSqlParameterSource().addValue("disk_guid", id)); }
Source:
public void updatePartitionStatistics(String databaseName, String tableName, String partitionName, Function<PartitionStatistics, PartitionStatistics> update) { PartitionStatistics currentStatistics = requireNonNull( getPartitionStatistics(databaseName, tableName, ImmutableSet.of(partitionName)).get(partitionName), "getPartitionStatistics() returned null"); PartitionStatistics updatedStatistics = update.apply(currentStatistics); if (!updatedStatistics.getColumnStatistics().isEmpty()) { throw new PrestoException(NOT_SUPPORTED, "glue metastore does not support column level statistics"); } List<String> partitionValues = toPartitionValues(partitionName); Partition partition = getPartition(databaseName, tableName, partitionValues) .orElseThrow(() -> new PartitionNotFoundException(new SchemaTableName(databaseName, tableName), partitionValues)); try { PartitionInput partitionInput = GlueInputConverter.convertPartition(partition); partitionInput.setParameters(updateStatisticParameters(partition.getParameters(), updatedStatistics.getBasicStatistics())); glueClient.updatePartition(new UpdatePartitionRequest() .withDatabaseName(databaseName) .withTableName(tableName) .withPartitionValueList(partition.getValues()) .withPartitionInput(partitionInput)); } catch (EntityNotFoundException e) { throw new PartitionNotFoundException(new SchemaTableName(databaseName, tableName), partitionValues); } catch (AmazonServiceException e) { throw new PrestoException(HIVE_METASTORE_ERROR, e); } }

Target:
public void updatePartitionStatistics(String databaseName, String tableName, String partitionName, Function<PartitionStatistics, PartitionStatistics> update) { PartitionStatistics currentStatistics = getPartitionStatistics(databaseName, tableName, ImmutableSet.of(partitionName)).get(partitionName); if (currentStatistics == null) { throw new PrestoException(HIVE_PARTITION_DROPPED_DURING_QUERY, "Statistics result does not contain entry for partition: " + partitionName); } PartitionStatistics updatedStatistics = update.apply(currentStatistics); if (!updatedStatistics.getColumnStatistics().isEmpty()) { throw new PrestoException(NOT_SUPPORTED, "Glue metastore does not support column level statistics"); } List<String> partitionValues = toPartitionValues(partitionName); Partition partition = getPartition(databaseName, tableName, partitionValues) .orElseThrow(() -> new PartitionNotFoundException(new SchemaTableName(databaseName, tableName), partitionValues)); try { PartitionInput partitionInput = GlueInputConverter.convertPartition(partition); partitionInput.setParameters(updateStatisticsParameters(partition.getParameters(), updatedStatistics.getBasicStatistics())); glueClient.updatePartition(new UpdatePartitionRequest() .withDatabaseName(databaseName) .withTableName(tableName) .withPartitionValueList(partition.getValues()) .withPartitionInput(partitionInput)); } catch (EntityNotFoundException e) { throw new PartitionNotFoundException(new SchemaTableName(databaseName, tableName), partitionValues); } catch (AmazonServiceException e) { throw new PrestoException(HIVE_METASTORE_ERROR, e); } }
Source:
void processFontTags(Document doc) { Elements font = doc.select("font"); for (Element e : font) { Attributes attrs = e.attributes().clone(); String styleString = ""; String theSizeString = ""; for (Attribute attribute : attrs) { String attributeName = attribute.getKey(); String attributeValue = attribute.getValue(); if (attributeName.equalsIgnoreCase("face")) { styleString = String.format("%s font-family: %s", styleString, attributeValue); } else if (attributeName.equalsIgnoreCase("size")) { String numericSize = attributeValue.trim(); int theSize = Integer.valueOf(numericSize); theSizeString = getFontSize(theSize, true); } else if (attributeName.equalsIgnoreCase("color")) { styleString = String.format("%s color: %s", styleString, attributeValue); } else if (attributeName.equalsIgnoreCase("style")) { int size = attributeValue.indexOf("font-size:"); if (size != -1) { size += "font-size:".length(); theSizeString = getFontSize(attributeValue.substring(size)); } } e.removeAttr(attributeName); } if (!Strings.isNullOrEmpty(theSizeString)) { styleString = String.format("%s font-size: %s", styleString, theSizeString); } e.tagName("span"); e.attr("style", styleString); } }

Target:
void processFontTags(Document doc) { Elements font = doc.select("font"); for (Element e : font) { Attributes attrs = e.attributes().clone(); String styleString = ""; StringBuffer theSizeString = new StringBuffer(""); for (Attribute attribute : attrs) { String attributeName = attribute.getKey(); String attributeValue = attribute.getValue(); if (attributeName.equalsIgnoreCase("face")) { styleString = String.format("%s font-family: %s", styleString, attributeValue); } else if (attributeName.equalsIgnoreCase("size")) { int theSize = Integer.valueOf(attributeValue.trim()); if (theSize <= FONT_VALUES.length) { theSizeString.replace(0, theSizeString.length(), FONT_VALUES[theSize - 1]); } } else if (attributeName.equalsIgnoreCase("color")) { styleString = String.format("%s color: %s", styleString, attributeValue); } else if (attributeName.equalsIgnoreCase("style")) { int size = attributeValue.indexOf("font-size:"); if (size != -1) { size += "font-size:".length(); theSizeString.replace(0, theSizeString.length(), getFontSize(attributeValue.substring(size))); } } e.removeAttr(attributeName); } if (theSizeString.length() > 0) { styleString = String.format("%s font-size: %s", styleString, theSizeString); } e.tagName("span"); e.attr("style", styleString); } }
Source:
public static String noQueryId(final String queryId) { return "Fail: There is no " + queryId; }

Target:
public static String noQueryId(final String queryId) { return String.format("Fail: There is no %s.", queryId); }
Source:
private void handleSelection(Menu menu, MenuItem shareItem) { if (WikipediaApp.getInstance().isFeatureSelectTextAndShareTutorialEnabled() && WikipediaApp.getInstance().getOnboardingStateMachine().isShareTutorialEnabled()) { showShareOnboarding(shareItem); WikipediaApp.getInstance().getOnboardingStateMachine().setShareTutorial(); } shareItem.setOnMenuItemClickListener(new RequestTextSelectOnMenuItemClickListener(PAYLOAD_PURPOSE_SHARE)); MenuItem copyItem = menu.findItem(R.id.menu_text_select_copy); copyItem.setOnMenuItemClickListener(new RequestTextSelectOnMenuItemClickListener(PAYLOAD_PURPOSE_COPY)); MenuItem defineItem = menu.findItem(R.id.menu_text_select_define); if (shouldEnableWiktionaryDialog()) { defineItem.setVisible(true); defineItem.setEnabled(true); defineItem.setOnMenuItemClickListener(new RequestTextSelectOnMenuItemClickListener(PAYLOAD_PURPOSE_DEFINE)); } createFunnel(); funnel.logHighlight(); }

Target:
private void handleSelection(Menu menu, MenuItem shareItem) { if (WikipediaApp.getInstance().isFeatureSelectTextAndShareTutorialEnabled() && WikipediaApp.getInstance().getOnboardingStateMachine().isShareTutorialEnabled()) { showShareOnboarding(shareItem); WikipediaApp.getInstance().getOnboardingStateMachine().setShareTutorial(); } shareItem.setOnMenuItemClickListener(new RequestTextSelectOnMenuItemClickListener(PAYLOAD_PURPOSE_SHARE)); MenuItem copyItem = menu.findItem(R.id.menu_text_select_copy); copyItem.setOnMenuItemClickListener(new RequestTextSelectOnMenuItemClickListener(PAYLOAD_PURPOSE_COPY)); MenuItem defineItem = menu.findItem(R.id.menu_text_select_define); if (shouldEnableWiktionaryDialog()) { defineItem.setVisible(true); defineItem.setOnMenuItemClickListener(new RequestTextSelectOnMenuItemClickListener(PAYLOAD_PURPOSE_DEFINE)); } createFunnel(); funnel.logHighlight(); }
Source:
public void sendSerialDataAsync(XBee64BitAddress address, byte[] data) throws XBeeException { if (address == null) throw new NullPointerException("Address cannot be null"); if (data == null) throw new NullPointerException("Data cannot be null"); if (!connectionInterface.isOpen()) throw new InterfaceNotOpenException(); XBeePacket xbeePacket; logger.info(toString() + "Sending serial data asynchronously to >> {}.", address, HexUtils.prettyHexString(data)); switch (getXBeeProtocol()) { case RAW_802_15_4: xbeePacket = new TX64Packet(getNextFrameID(), address, XBeeTransmitOptions.NONE, data); try { sendXBeePacketAsync(xbeePacket); } catch (IOException e) { throw new XBeeException("Error writing in the communication interface.", e); } break; default: xbeePacket = new TransmitPacket(getNextFrameID(), address, XBee16BitAddress.UNKNOWN_ADDRESS, 0, XBeeTransmitOptions.NONE, data); try { sendXBeePacketAsync(xbeePacket); } catch (IOException e) { throw new XBeeException("Error writing in the communication interface.", e); } } }

Target:
public void sendSerialDataAsync(XBee64BitAddress address, byte[] data) throws XBeeException { if (address == null) throw new NullPointerException("Address cannot be null"); if (data == null) throw new NullPointerException("Data cannot be null"); if (!connectionInterface.isOpen()) throw new InterfaceNotOpenException(); XBeePacket xbeePacket; logger.info(toString() + "Sending serial data asynchronously to >> {}.", address, HexUtils.prettyHexString(data)); switch (getXBeeProtocol()) { case RAW_802_15_4: xbeePacket = new TX64Packet(getNextFrameID(), address, XBeeTransmitOptions.NONE, data); break; default: xbeePacket = new TransmitPacket(getNextFrameID(), address, XBee16BitAddress.UNKNOWN_ADDRESS, 0, XBeeTransmitOptions.NONE, data); } sendAndCheckXBeePacket(xbeePacket, true); }
Source:
public void eventReceived(Watcher.Action action, Pod pod) { if (action == Watcher.Action.DELETED) { String ns = pod.getMetadata().getNamespace(); String name = pod.getMetadata().getName(); Jenkins jenkins = Jenkins.getInstanceOrNull(); if (jenkins != null) { for (Node n : new ArrayList<>(jenkins.getNodes())) { if (!(n instanceof KubernetesSlave)) { continue; } KubernetesSlave ks = (KubernetesSlave) n; if (StringUtils.equals(ks.getNamespace(), ns) && StringUtils.equals(ks.getPodName(), name)) { LOGGER.info(() -> ns + "/" + name + " was just deleted, so removing corresponding Jenkins agent"); try { jenkins.removeNode(ks); return; } catch (Exception x) { LOGGER.log(Level.WARNING, "failed to reap " + ns + "/" + name, x); } } } } LOGGER.fine(() -> "received deletion notice for " + ns + "/" + name + " which does not seem to correspond to any Jenkins agent"); } }

Target:
public void eventReceived(Watcher.Action action, Pod pod) { if (action == Watcher.Action.DELETED) { String ns = pod.getMetadata().getNamespace(); String name = pod.getMetadata().getName(); Jenkins jenkins = Jenkins.getInstanceOrNull(); if (jenkins != null) { for (Node n : new ArrayList<>(jenkins.getNodes())) { if (!(n instanceof KubernetesSlave)) { continue; } KubernetesSlave ks = (KubernetesSlave) n; if (Objects.equals(ks.getNamespace(), ns) && Objects.equals(ks.getPodName(), name)) { LOGGER.info(() -> ns + "/" + name + " was just deleted, so removing corresponding Jenkins agent"); try { jenkins.removeNode(ks); return; } catch (Exception x) { LOGGER.log(Level.WARNING, "failed to reap " + ns + "/" + name, x); } } } } LOGGER.fine(() -> "received deletion notice for " + ns + "/" + name + " which does not seem to correspond to any Jenkins agent"); } }
Source:
public CustomizedViewMonitor(String clusterName) { _clusterName = clusterName; _sensorName = String.format("%s.%s", MonitorDomainNames.AggregatedView.name(), _clusterName); _updateToAggregationLatencyGauge = new HistogramDynamicMetric(UPDATE_TO_AGGREGATION_LATENCY_GAUGE, new Histogram( new SlidingTimeWindowArrayReservoir(getResetIntervalInMs(), TimeUnit.MILLISECONDS))); }

Target:
public CustomizedViewMonitor(String clusterName) { _clusterName = clusterName; _sensorName = String .format("%s:%s=%s,%s=%s", MonitorDomainNames.AggregatedView.name(), TYPE_KEY, CUSTOMIZED_VIEW, CLUSTER_KEY, _clusterName); _updateToAggregationLatencyGauge = new HistogramDynamicMetric(UPDATE_TO_AGGREGATION_LATENCY_GAUGE, new Histogram( new SlidingTimeWindowArrayReservoir(getResetIntervalInMs(), TimeUnit.MILLISECONDS))); }
Source:
public int readBatch() { buffer.readerIndex(0).touch(); int result = 0; for (int i = 0; i < 8; i++) { result += buffer.readByte(); } return result; }

Target:
public int readBatch() { buffer.readerIndex(0).touch(); int result = 0; for (int i = 0, size = batchSize; i < size; i++) { result += buffer.readByte(); } return result; }
Source:
public void testGetAllByStoragePoolAndConnection() { List<StorageDomain> result = dao.getAllByStoragePoolAndConnection(EXISTING_STORAGE_POOL_ID, "10.35.64.25:/export/share"); assertGetAllForStoragePoolResult(result, EXISTING_STORAGE_POOL_ID); }

Target:
public void testGetAllByStoragePoolAndConnection() { List<StorageDomain> result = dao.getAllByStoragePoolAndConnection(EXISTING_STORAGE_POOL_ID, EXISTING_CONNECTION); assertGetAllForStoragePoolResult(result, EXISTING_STORAGE_POOL_ID); }
Source:
private Map<Long, LogData> FetchGarbageEntryBatch(Iterable<Long> addresses, RuntimeLayout runtimeLayout) { Map<String, List<Long>> serverToAddressMap = new HashMap<>(); for (Long address : addresses) { List<String> logServers = runtimeLayout.getLayout().getStripe(address).getLogServers(); String logServer = logServers.get(0); List<Long> addressList = serverToAddressMap.computeIfAbsent(logServer, s -> new ArrayList<>()); addressList.add(address); } List<CompletableFuture<ReadResponse>> futures = serverToAddressMap.entrySet().stream() .map(entry -> runtimeLayout.getLogUnitClient(entry.getKey()).readGarbageEntries(entry.getValue())) .collect(Collectors.toList()); return futures.stream() .map(future -> CFUtils.getUninterruptibly(future).getAddresses()) .reduce(new HashMap<>(), (map1, map2) -> { map1.putAll(map2); return map1; }); }

Target:
private Map<Long, LogData> FetchGarbageEntryBatch(Iterable<Long> addresses, RuntimeLayout runtimeLayout) { Map<String, List<Long>> serverToAddressMap = new HashMap<>(); for (Long address : addresses) { List<String> logServers = runtimeLayout.getLayout().getStripe(address).getLogServers(); String logServer = logServers.get(logServers.size() - 1); List<Long> addressList = serverToAddressMap.computeIfAbsent(logServer, s -> new ArrayList<>()); addressList.add(address); } List<CompletableFuture<ReadResponse>> futures = serverToAddressMap.entrySet().stream() .map(entry -> runtimeLayout.getLogUnitClient(entry.getKey()).readGarbageEntries(entry.getValue())) .collect(Collectors.toList()); return futures.stream() .map(future -> CFUtils.getUninterruptibly(future).getAddresses()) .reduce(new HashMap<>(), (map1, map2) -> { map1.putAll(map2); return map1; }); }
Source:
public CloseFuture close(boolean immediately) { if (!immediately && (out != null)) { try { if (log.isDebugEnabled()) { log.debug("Closing ChannelOutputStream: {}", TcpipServerChannel.this); } out.close(); } catch (IOException ignored) { if (log.isErrorEnabled()) { log.error("Error closing ChannelOutputStream: {}", TcpipServerChannel.this, ignored); } } } CloseFuture closingFeature = super.close(immediately); ExecutorService service = getExecutorService(); ExecutorService executors = (service == null) ? ThreadUtils.newSingleThreadExecutor("TcpIpServerChannel-ConnectorCleanup[" + getSession() + "]") : service; boolean shutdown = (executors != service) || isShutdownOnExit(); return builder().when(closingFeature).run(toString(), () -> { executors.submit(() -> { try { if (log.isDebugEnabled()) { log.debug("disposing connector: for: {}", connector, TcpipServerChannel.this); } connector.close(immediately); } finally { if (shutdown && (!executors.isShutdown())) { Collection<Runnable> runners = executors.shutdownNow(); if (log.isDebugEnabled()) { log.debug("destroy({}) - shutdown executor service - runners count={}", TcpipServerChannel.this, runners.size()); } } } }); }).build().close(false); }

Target:
public CloseFuture close(boolean immediately) { if ((!immediately) && (out != null)) { try { if (log.isDebugEnabled()) { log.debug("Closing ChannelOutputStream: {}", TcpipServerChannel.this); } out.close(); } catch (IOException ignored) { if (log.isDebugEnabled()) { log.debug("Error closing ChannelOutputStream: {}", TcpipServerChannel.this, ignored); } } } CloseFuture closingFeature = super.close(immediately); ExecutorService service = getExecutorService(); ExecutorService executors = (service == null) ? ThreadUtils.newSingleThreadExecutor("TcpIpServerChannel-ConnectorCleanup[" + getSession() + "]") : service; boolean shutdown = (executors != service) || isShutdownOnExit(); return builder().when(closingFeature).run(toString(), () -> { executors.submit(() -> { try { if (log.isDebugEnabled()) { log.debug("disposing connector: for: {}", connector, TcpipServerChannel.this); } connector.close(immediately); } finally { if (shutdown && (!executors.isShutdown())) { Collection<Runnable> runners = executors.shutdownNow(); if (log.isDebugEnabled()) { log.debug("destroy({}) - shutdown executor service - runners count={}", TcpipServerChannel.this, runners.size()); } } } }); }).build().close(false); }