auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public void run() { while (true) { try { Thread.sleep(1000); } catch (InterruptedException e) { <START> return; <END> } synchronized (closedMonitor) { if (isClosed) { return; } } final ZooKeeper.States state = zkObjectHandler.getClient().getZookeeper().getState(); if (state == ZooKeeper.States.CONNECTED) { zkObjectHandler.connectionUp(); connectingCounter = 0; continue; } zkObjectHandler.connectionDown(); if (state == ZooKeeper.States.CONNECTING) { connectingCounter++; if (connectingCounter > 10) { log.fine("Long time in connecting, forcing a close of zookeeper,."); zkObjectHandler.close(); connectingCounter = 0; } continue; } if (state == ZooKeeper.States.CLOSED) { log.fine("Retrying connection to ZooKeeper."); try { zkObjectHandler.setZooKeeper( new ZooKeeper(connectString, SESSION_TIMEOUT, this)); } catch (IOException e) { log.log(Level.SEVERE, "RetryConnection failed for some reason:" + e.getMessage(), e); } try { Thread.sleep(10000); } catch (InterruptedException e) { return; } continue; } log.severe("Unknown state " + state + " closing...."); zkObjectHandler.close(); } }</code><technical_language>return if interrupted</technical_language>

Target:
public void run() { final ZooKeeper.States state = zkObjectHandler.getClient().getZookeeper().getState(); if (state == ZooKeeper.States.CONNECTED) { zkObjectHandler.connectionUp(); connectingCounter = 0; return; } zkObjectHandler.connectionDown(); if (state == ZooKeeper.States.CONNECTING) { connectingCounter++; if (connectingCounter > 10) { log.fine("Long time in connecting, forcing a close of zookeeper client."); zkObjectHandler.close(); connectingCounter = 0; } return; } if (state == ZooKeeper.States.CLOSED) { log.fine("Retrying connection to ZooKeeper."); try { zkObjectHandler.setZooKeeper( new ZooKeeper(connectString, SESSION_TIMEOUT, this)); } catch (IOException e) { log.log(Level.SEVERE, "RetryConnection failed for some reason:" + e.getMessage(), e); } return; } log.severe("Unknown state " + state + " closing...."); zkObjectHandler.close(); }
Source:
<code><START> @Nullable public String getLicenseUrl() { <END> return license.getLicenseUrl(); }</code><technical_language>If reading this right, ImageLicense returns @NonNull license this annotation flipped. this missed previous patch</technical_language>

Target:
@NonNull public String getLicenseUrl() { return license.getLicenseUrl(); }
Source:
<code>private int getOverlappingBaseCount(final BaseExclusionHelper read1exclusions, final BaseExclusionHelper read2exclusions) { if ( read2exclusions.read.getAlignmentStart() < read1exclusions.read.getAlignmentStart() ) { return getOverlappingBaseCount(read2exclusions, read1exclusions); } if ( read1exclusions.read.getAlignmentEnd() < read2exclusions.read.getAlignmentStart() || !read1exclusions.read.getReferenceIndex().equals(read2exclusions.read.getReferenceIndex()) ) return 0; final byte[] read1quals = read1exclusions.read.getBaseQualities(); final byte[] read2quals = read2exclusions.read.getBaseQualities(); final int overlap = read1exclusions.read.getAlignmentEnd() - read2exclusions.read.getAlignmentStart() + 1; int numHighQualityOverlappingBases = 0; for (int i = 0; i < overlap; i++) { <START> if (read1quals[read1exclusions.firstTrailingClippedBaseIndex - overlap + i] >= MINIMUM_BASE_QUALITY && read2quals[read2exclusions.firstUnclippedBaseIndex + i] >= MINIMUM_BASE_QUALITY) { <END> numHighQualityOverlappingBases++; } } return numHighQualityOverlappingBases; }</code><technical_language>I a hard time understanding this is comparing bases genomic position...</technical_language>

Target:
private int getOverlappingBaseCount(final BaseExclusionHelper read1exclusions, final BaseExclusionHelper read2exclusions) { if ( read2exclusions.read.getAlignmentStart() < read1exclusions.read.getAlignmentStart() ) { return getOverlappingBaseCount(read2exclusions, read1exclusions); } if ( read1exclusions.read.getAlignmentEnd() < read2exclusions.read.getAlignmentStart() || !read1exclusions.read.getReferenceIndex().equals(read2exclusions.read.getReferenceIndex()) ) return 0; final byte[] read1quals = read1exclusions.read.getBaseQualities(); final byte[] read2quals = read2exclusions.read.getBaseQualities(); final int indexOfOverlapInFirstRead = getOffsetAtReferencePosition(read1exclusions.read, read2exclusions.read.getAlignmentStart()) - 1; final int maxPossibleOverlap = read1exclusions.firstTrailingClippedBaseIndex - indexOfOverlapInFirstRead; final int actualOverlap = Math.min(maxPossibleOverlap, read2exclusions.firstTrailingClippedBaseIndex - read2exclusions.firstUnclippedBaseIndex); int numHighQualityOverlappingBases = 0; for (int i = 0; i < actualOverlap; i++) { final int posInRead1 = read1exclusions.firstTrailingClippedBaseIndex - actualOverlap + i; final int posInRead2 = read2exclusions.firstUnclippedBaseIndex + i; if (read1quals[posInRead1] >= MINIMUM_BASE_QUALITY && read2quals[posInRead2] >= MINIMUM_BASE_QUALITY) { numHighQualityOverlappingBases++; } } return numHighQualityOverlappingBases; }
Source:
<code>TaskGroup(String containerId, List<String> taskNames) { this.containerId = containerId; <START> Collections.sort(taskNames); END> this.taskNames.addAll(taskNames); }</code><technical_language>elaborate a do this? care order construction</technical_language>

Target:
TaskGroup(String containerId, List<String> taskNames) { this.containerId = containerId; this.taskNames.addAll(taskNames); Collections.sort(this.taskNames); }
Source:
<code>public void shouldProperlyParseManifestFromJar() throws IOException { File jar = createHpiWithManifest(); final Manifest manifest = PluginManager.parsePluginManifest(jar.toURI().toURL()); assertThat("manifest should have been read from the sample", manifest, notNullValue()); <START> assertAttribute(manifest, "Created-By", "Apache Maven"); <END> assertAttribute(manifest, "Short-Name", "matrix-auth"); }</code><technical_language>If testing this is correctly parsing manifest, include a test for line wrapped attributes</technical_language>

Target:
public void shouldProperlyParseManifestFromJar() throws IOException { File jar = createHpiWithManifest(); final Manifest manifest = PluginManager.parsePluginManifest(jar.toURI().toURL()); assertThat("manifest should have been read from the sample", manifest, notNullValue()); assertAttribute(manifest, "Created-By", "Apache Maven"); assertAttribute(manifest, "Short-Name", "matrix-auth"); assertAttribute(manifest, "Specification-Title", "Offers matrix-based security authorization strategies (global and per-project)."); assertAttribute(manifest, "Url", "<LINK_0>"); assertAttribute(manifest, "Plugin-Developers", null); }
Source:
<code>public String getPath(Uri uri) { String[] projection = { MediaStore.Images.Media.DATA }; Cursor cursor = managedQuery(uri, projection, null, null, null); <START> if(cursor!=null) <END> { int column_index = cursor .getColumnIndexOrThrow(MediaStore.Images.Media.DATA); cursor.moveToFirst(); return cursor.getString(column_index); } else return null; }</code><technical_language>Curly braces in line of if statement. Add spaces variables operands, cursor != null</technical_language>

Target:
public String getPath(Uri uri) { String[] projection = { MediaStore.Images.Media.DATA }; Cursor cursor = managedQuery(uri, projection, null, null, null); if(cursor != null) { int column_index = cursor .getColumnIndexOrThrow(MediaStore.Images.Media.DATA); cursor.moveToFirst(); return cursor.getString(column_index); } else { return null; } }
Source:
<code>public void registerDefaults() { addTextColor(TextFormatting.BLACK, Color.BLACK); addTextColor(TextFormatting.DARK_BLUE, Color.of(0x0000AA)); addTextColor(TextFormatting.DARK_GREEN, Color.of(0x00AA00)); addTextColor(TextFormatting.DARK_AQUA, Color.of(0x00AAAA)); addTextColor(TextFormatting.DARK_RED, Color.of(0xAA0000)); addTextColor(TextFormatting.DARK_PURPLE, Color.of(0xAA00AA)); <START> addTextColor(TextFormatting.GOLD, Color.of(0xFFAA00)); <END> addTextColor(TextFormatting.GRAY, Color.of(0xAAAAAA)); addTextColor(TextFormatting.DARK_GRAY, Color.of(0x555555)); addTextColor(TextFormatting.BLUE, Color.of(0x5555FF)); addTextColor(TextFormatting.GREEN, Color.of(0x55FF55)); addTextColor(TextFormatting.AQUA, Color.of(0x55FFFF)); addTextColor(TextFormatting.RED, Color.of(0xFF5555)); addTextColor(TextFormatting.LIGHT_PURPLE, Color.of(0xFF55FF)); addTextColor(TextFormatting.YELLOW, Color.of(0xFFFF55)); addTextColor(TextFormatting.WHITE, Color.WHITE); addTextColor(TextFormatting.RESET, Color.WHITE); textColorMappings.put("none", TextColors.NONE); }</code><technical_language>more I this, more I prefer ofRgb instead of flag of, define formatted</technical_language>

Target:
public void registerDefaults() { addTextColor(TextFormatting.BLACK, Color.BLACK); addTextColor(TextFormatting.DARK_BLUE, Color.ofRgb(0x0000AA)); addTextColor(TextFormatting.DARK_GREEN, Color.ofRgb(0x00AA00)); addTextColor(TextFormatting.DARK_AQUA, Color.ofRgb(0x00AAAA)); addTextColor(TextFormatting.DARK_RED, Color.ofRgb(0xAA0000)); addTextColor(TextFormatting.DARK_PURPLE, Color.ofRgb(0xAA00AA)); addTextColor(TextFormatting.GOLD, Color.ofRgb(0xFFAA00)); addTextColor(TextFormatting.GRAY, Color.ofRgb(0xAAAAAA)); addTextColor(TextFormatting.DARK_GRAY, Color.ofRgb(0x555555)); addTextColor(TextFormatting.BLUE, Color.ofRgb(0x5555FF)); addTextColor(TextFormatting.GREEN, Color.ofRgb(0x55FF55)); addTextColor(TextFormatting.AQUA, Color.ofRgb(0x55FFFF)); addTextColor(TextFormatting.RED, Color.ofRgb(0xFF5555)); addTextColor(TextFormatting.LIGHT_PURPLE, Color.ofRgb(0xFF55FF)); addTextColor(TextFormatting.YELLOW, Color.ofRgb(0xFFFF55)); addTextColor(TextFormatting.WHITE, Color.WHITE); addTextColor(TextFormatting.RESET, Color.WHITE); textColorMappings.put("none", TextColors.NONE); }
Source:
<code>public ActionResult<ItemStack> onItemRightClick(ItemStack itemStackIn, World worldIn, EntityPlayer playerIn, EnumHand hand) { <START> if (itemStackIn.hasCapability(CapabilityGuiProvider.GUI_PROVIDER_CAPABILITY, EnumFacing.UP)) <END> { IGuiProvider provider = itemStackIn.getCapability(CapabilityGuiProvider.GUI_PROVIDER_CAPABILITY, hand == EnumHand.MAIN_HAND ? EnumFacing.UP : EnumFacing.DOWN); playerIn.openGui(provider); return ActionResult.newResult(EnumActionResult.SUCCESS, itemStackIn); } return ActionResult.newResult(EnumActionResult.PASS, itemStackIn); }</code><technical_language>I hand for EnumFacing is fishy here. else is open gui. I null used, a block side of block is clicked</technical_language>

Target:
public ActionResult<ItemStack> onItemRightClick(ItemStack itemStackIn, World worldIn, EntityPlayer playerIn, EnumHand hand) { if (itemStackIn.hasCapability(CapabilityGuiProvider.GUI_PROVIDER_CAPABILITY, EnumFacing.UP)) { IGuiProvider provider = itemStackIn.getCapability(CapabilityGuiProvider.GUI_PROVIDER_CAPABILITY, null); playerIn.openGui(provider, hand); return ActionResult.newResult(EnumActionResult.SUCCESS, itemStackIn); } return ActionResult.newResult(EnumActionResult.PASS, itemStackIn); }
Source:
<code>protected Object getConstraintFor(ChangeBoundsRequest request, GraphicalEditPart child) { Rectangle constraint = (Rectangle) super.getConstraintFor(request, child); if (REQ_MOVE_CHILDREN.equals(request.getType())) { Optional<Dimension> optionalDim = <START> Optional.of(child.getModel()).filter(Node.class::isInstance).map(model <END> -> ((Node) model).getLayoutConstraint()).filter(Size.class::isInstance) .map(layoutConstraint -> new Dimension(((Size) layoutConstraint).getWidth(), ((Size) layoutConstraint).getHeight())); if (optionalDim.isPresent()) { constraint.setSize(optionalDim.get()); } } return constraint; }</code><technical_language>Wrong: this *fail* if child.getModel() is null. want Optional.ofNullable() in this case</technical_language>

Target:
protected Object getConstraintFor(ChangeBoundsRequest request, GraphicalEditPart child) { Rectangle constraint = (Rectangle) super.getConstraintFor(request, child); if (REQ_MOVE_CHILDREN.equals(request.getType())) { Optional<Size> optionalSize = Optional.ofNullable(child.getModel()).filter(Node.class::isInstance).map(model -> ((Node) model).getLayoutConstraint()).filter(Size.class::isInstance) .map(Size.class::cast); if (optionalSize.isPresent()) { Dimension dimension = new Dimension(optionalSize.get().getWidth(), optionalSize.get().getHeight()); constraint.setSize(dimension); } } return constraint; }
Source:
<code>protected TaskScheduled sendToEngine(Task task) { <START> if (task.getId() == 2) { <END> testFailed = true; this.task.cancel(true); return TaskScheduled.ERROR; } scheduledCounter += 1; if (scheduledCounter > scheduleLimit) { testFailed = false; this.task.cancel(true); } return TaskScheduled.SUCCESS; }</code><technical_language>OK, please changes I wrote ? stop test failing iterate later. Thank you</technical_language>

Target:
protected TaskScheduled sendToEngine(Task task) { if (task.isSourceUpdated() && !task.isPropagationForced()) { testFailed = true; this.task.cancel(true); return TaskScheduled.ERROR; } scheduledCounter += 1; if (scheduledCounter >= scheduleLimit) { testFailed = false; this.task.cancel(true); stop(); } return TaskScheduled.SUCCESS; }
Source:
<code>public Configuration(Properties props) throws Exception { <START> CuratorFramework curator = CuratorUtil.getCurator(props.getProperty(ConnectionProperties.ZOOKEEPER_CONNECT_PROP), <END> Integer.parseInt(props.getProperty(ConnectionProperties.ZOOKEEPER_TIMEOUT_PROP))); String zooDir = props.getProperty(ConnectionProperties.ZOOKEEPER_ROOT_PROP); Connector conn = new ZooKeeperInstance(props.getProperty(ConnectionProperties.ACCUMULO_INSTANCE_PROP), props.getProperty(ConnectionProperties.ZOOKEEPER_CONNECT_PROP)).getConnector( props.getProperty(ConnectionProperties.ACCUMULO_USER_PROP), new PasswordToken(props.getProperty(ConnectionProperties.ACCUMULO_PASSWORD_PROP)) ); int oraclePort = Integer.parseInt(props.getProperty(OracleProperties.ORACLE_PORT_PROP, OracleProperties.ORACLE_DEFAULT_PORT + "")); curator.start(); init(curator, zooDir, conn, oraclePort); curator.close(); }</code><technical_language>try resources here</technical_language>

Target:
public Configuration(Properties props) throws Exception { try (CuratorFramework curator = CuratorUtil.getCurator(props.getProperty(ConnectionProperties.ZOOKEEPER_CONNECT_PROP), Integer.parseInt(props.getProperty(ConnectionProperties.ZOOKEEPER_TIMEOUT_PROP)))) { String zooDir = props.getProperty(ConnectionProperties.ZOOKEEPER_ROOT_PROP); Connector conn = new ZooKeeperInstance(props.getProperty(ConnectionProperties.ACCUMULO_INSTANCE_PROP), props.getProperty(ConnectionProperties.ZOOKEEPER_CONNECT_PROP)).getConnector( props.getProperty(ConnectionProperties.ACCUMULO_USER_PROP), new PasswordToken(props.getProperty(ConnectionProperties.ACCUMULO_PASSWORD_PROP)) ); int oraclePort = Integer.parseInt(props.getProperty(OracleProperties.ORACLE_PORT_PROP, OracleProperties.ORACLE_DEFAULT_PORT + "")); curator.start(); init(curator, zooDir, conn, oraclePort); } }
Source:
<code>public static boolean deepEquals(Object obj1, Object obj2) { if (obj1 instanceof JSONArray) { if (!(obj2 instanceof JSONArray)) { return false; } return deepEqualArrays((JSONArray) obj1, (JSONArray) obj2); } else if (obj1 instanceof JSONObject) { if (!(obj2 instanceof JSONObject)) { return false; } return deepEqualObjects((JSONObject) obj1, (JSONObject) obj2); } else if (obj1 instanceof Number) { if (!(obj2 instanceof Number)) { return false; } else if (!obj1.getClass().equals(obj2.getClass())) { <START> String obj1AsString = obj1 instanceof Double && (Double) obj1 >= 10000000 ? numberFormat.format(obj1) : JSONObject.numberToString((Number) obj1); <END> String obj2AsString = obj2 instanceof Double && (Double) obj2 >= 10000000 ? numberFormat.format(obj2) : JSONObject.numberToString((Number) obj2); return obj1AsString.equals(obj2AsString); } } return Objects.equals(obj1, obj2); }</code><technical_language>choose 10000000 treshold? Is specific reason</technical_language>

Target:
public static boolean deepEquals(Object obj1, Object obj2) { if (obj1 instanceof JSONArray) { if (!(obj2 instanceof JSONArray)) { return false; } return deepEqualArrays((JSONArray) obj1, (JSONArray) obj2); } else if (obj1 instanceof JSONObject) { if (!(obj2 instanceof JSONObject)) { return false; } return deepEqualObjects((JSONObject) obj1, (JSONObject) obj2); } else if (obj1 instanceof Number) { if (!(obj2 instanceof Number)) { return false; } else if (obj1.getClass() != obj2.getClass()) { return getAsBigDecimal(obj1).compareTo(getAsBigDecimal(obj2)) == 0; } } return Objects.equals(obj1, obj2); }
Source:
<code>public void testFeatureAfterExcludingFolder() throws Exception { String fileNameForExcluding = "AppController.java"; String pathToJavaFile = format("%s/src/main/java/org/eclipse/qa/examples/AppController.java", PROJECT_NAME); <START> String currentTimeInMs = Long.toString(System.currentTimeMillis()); <END> doFileWatcherExcludeOperation( PROJECT_NAME + "/" + FOLDER_NAME_FOR_EXCLUDE, ADD_TO_FILE_WATCHER_EXCLUDES); projectExplorer.waitItem(PROJECT_NAME); projectExplorer.openItemByVisibleNameInExplorer(fileNameForExcluding); editor.waitActive(); testProjectServiceClient.updateFile(testWorkspace.getId(), pathToJavaFile, currentTimeInMs); editor.selectTabByName("AppController"); editor.waitTextNotPresentIntoEditor(currentTimeInMs); editor.clickOnCloseFileIcon("AppController"); projectExplorer.openItemByVisibleNameInExplorer(fileNameForExcluding); editor.waitActive(); editor.waitTextIntoEditor(currentTimeInMs); }</code><technical_language>currentTimeIn**Ms** > currentTimeIn**Millis**</technical_language>

Target:
public void testFeatureAfterExcludingFolder() throws Exception { String fileNameForExcluding = "AppController.java"; String pathToJavaFile = format("%s/src/main/java/org/eclipse/qa/examples/AppController.java", PROJECT_NAME); String currentTimeInMillis = Long.toString(System.currentTimeMillis()); doFileWatcherExcludeOperation( PROJECT_NAME + "/" + FOLDER_NAME_FOR_EXCLUDE, ADD_TO_FILE_WATCHER_EXCLUDES); projectExplorer.waitItem(PROJECT_NAME); projectExplorer.openItemByVisibleNameInExplorer(fileNameForExcluding); editor.waitActive(); testProjectServiceClient.updateFile(testWorkspace.getId(), pathToJavaFile, currentTimeInMillis); editor.selectTabByName("AppController"); editor.waitTextNotPresentIntoEditor(currentTimeInMillis); editor.clickOnCloseFileIcon("AppController"); projectExplorer.openItemByVisibleNameInExplorer(fileNameForExcluding); editor.waitActive(); editor.waitTextIntoEditor(currentTimeInMillis); }
Source:
<code>protected void beforeSpringSecurityFilterChain(ServletContext servletContext) { Dynamic forwardedHeaderFilter = servletContext.addFilter("forwardedHeaderFilter", ForwardedHeaderFilter.class); forwardedHeaderFilter.setAsyncSupported(true); <START> forwardedHeaderFilter.addMappingForUrlPatterns(EnumSet.of(REQUEST, FORWARD, ASYNC), false, "*"); <END> }</code><technical_language>add 'FORWARD'</technical_language>

Target:
protected void beforeSpringSecurityFilterChain(ServletContext servletContext) { Dynamic forwardedHeaderFilter = servletContext.addFilter("forwardedHeaderFilter", ForwardedHeaderFilter.class); forwardedHeaderFilter.setAsyncSupported(true); forwardedHeaderFilter.addMappingForUrlPatterns(EnumSet.of(REQUEST, ERROR, ASYNC), false, "*"); }
Source:
<code>public ParsedMessage parse(Message message) throws Exception { String[] partitions = extractPartitions(message); <START> MessageTransformers msgTransformer = ReflectionUtil <END> .createMessageTransformer(mConfig.getMessageTransformerClass(), mConfig); byte[] transformedMsg = msgTransformer.transform(message.getPayload()); return new ParsedMessage(message.getTopic(), message.getKafkaPartition(), message.getOffset(), transformedMsg, partitions); }</code><technical_language>Creating a new transformer for message inefficient</technical_language>

Target:
public ParsedMessage parse(Message message) throws Exception { String[] partitions = extractPartitions(message); return new ParsedMessage(message.getTopic(), message.getKafkaPartition(), message.getOffset(), message.getKafkaKey(), message.getPayload(), partitions); }
Source:
<code><START> public void sendBannerChange(Location location, CompoundTag nbt) throws NullPointerException { <END> sendBlockEntityChange(location, nbt, GlowBlockEntity.BANNER); }</code><technical_language>throws is required</technical_language>

Target:
public void sendBannerChange(Location location, CompoundTag nbt) { sendBlockEntityChange(location, nbt, GlowBlockEntity.BANNER); }
Source:
<code>protected void checkAccessControl() { if (authType.getLevel() < getMinAuthLevel().getLevel()) { throw new UnauthorizedAccessException(); } if (getMinAuthLevel() == AuthType.PUBLIC) { return; } if (authType == AuthType.ALL_ACCESS) { return; } <START> if (!checkSpecificAccessControl()) { <END> throw new UnauthorizedAccessException(); } }</code><technical_language>checkSpecificAccessControl() throw UnauthorizedAccessException directly? P.S. check* sounds a action returns a boolean</technical_language>

Target:
public void checkAccessControl() { if (authType.getLevel() < getMinAuthLevel().getLevel()) { throw new UnauthorizedAccessException(); } if (authType == AuthType.ALL_ACCESS) { return; } checkSpecificAccessControl(); }
Source:
<code>public <T> T retryTransaction(final TransactionCallback<T> callback, final int quietTries, final int maxTries) { try { <START> return RetryUtils.retry(() -> getDBI().inTransaction(callback), shouldRetry, quietTries, maxTries, null, null); <END> } catch (Exception e) { throw Throwables.propagate(e); } }</code><technical_language>pass null? is overload</technical_language>

Target:
public <T> T retryTransaction(final TransactionCallback<T> callback, final int quietTries, final int maxTries) { try { return RetryUtils.retry(() -> getDBI().inTransaction(callback), shouldRetry, quietTries, maxTries); } catch (Exception e) { throw Throwables.propagate(e); } }
Source:
<code>public void start() throws SamzaException { LOG.info("Restore started"); this.taskStorageManagers.values().forEach(taskStorageManager -> taskStorageManager.init()); this.systemConsumers.values().forEach(systemConsumer -> systemConsumer.start()); ExecutorService executorService = Executors.newFixedThreadPool(this.parallelRestoreThreadPoolSize, new ThreadFactoryBuilder().setNameFormat(RESTORE_THREAD_NAME).build()); List<Future> futureList = new ArrayList<>(this.taskStorageManagers.entrySet().size()); <START> this.taskStorageManagers.entrySet().forEach(task -> { <END> futureList.add( executorService.submit(new TaskRestoreRunnable(this.samzaContainerMetrics, task.getKey(), task.getValue()))); }); for (Future future : futureList) { try { future.get(); } catch (Exception e) { LOG.error("Exception when restoring ", e); throw new SamzaException("Exception when restoring ", e); } } executorService.shutdown(); this.systemConsumers.values().forEach(systemConsumer -> systemConsumer.stop()); LOG.info("Restore complete"); }</code><technical_language>map.forEach() variant takes in a BiConsumer function</technical_language>

Target:
public void start() throws SamzaException { LOG.info("Restore started"); this.taskStorageManagers.values().forEach(taskStorageManager -> taskStorageManager.init()); this.systemConsumers.values().forEach(systemConsumer -> systemConsumer.start()); ExecutorService executorService = Executors.newFixedThreadPool(this.parallelRestoreThreadPoolSize, new ThreadFactoryBuilder().setNameFormat(RESTORE_THREAD_NAME).build()); List<Future> taskRestoreFutures = new ArrayList<>(this.taskStorageManagers.entrySet().size()); this.taskStorageManagers.forEach((taskInstance, taskStorageManager) -> { taskRestoreFutures.add( executorService.submit(new TaskRestoreCallable(this.samzaContainerMetrics, taskInstance, taskStorageManager))); }); for (Future future : taskRestoreFutures) { try { future.get(); } catch (Exception e) { LOG.error("Exception when restoring ", e); throw new SamzaException("Exception when restoring ", e); } } executorService.shutdown(); this.systemConsumers.values().forEach(systemConsumer -> systemConsumer.stop()); LOG.info("Restore complete"); }
Source:
<code>static boolean validatePinningAndMigration(List<String> reasons, VmStatic vmStaticData, String cpuPinning) { final boolean cpuPinMigrationEnabled = Boolean.TRUE.equals(Config.<Boolean> getValue(ConfigValues.CpuPinMigrationEnabled)); if (!cpuPinMigrationEnabled && (vmStaticData.getMigrationSupport() == MigrationSupport.MIGRATABLE || vmStaticData.getMigrationSupport() == MigrationSupport.IMPLICITLY_NON_MIGRATABLE) && StringUtils.isNotEmpty(cpuPinning)) { reasons.add(EngineMessage.ACTION_TYPE_FAILED_VM_CANNOT_BE_PINNED_TO_CPU_AND_MIGRATABLE.toString()); return false; } if (vmStaticData.isAutoStartup() <START> && (vmStaticData.getMigrationSupport() != MigrationSupport.MIGRATABLE <END> && vmStaticData.getDedicatedVmForVdsList().size() != 1)) { reasons.add(EngineMessage.ACTION_TYPE_FAILED_VM_CANNOT_BE_HIGHLY_AVAILABLE_AND_PINNED_TO_HOST.toString()); return false; } return true; }</code><technical_language>reminder - agnostic migration support</technical_language>

Target:
static boolean validatePinningAndMigration(List<String> reasons, VmStatic vmStaticData, String cpuPinning) { final boolean cpuPinMigrationEnabled = Boolean.TRUE.equals(Config.<Boolean> getValue(ConfigValues.CpuPinMigrationEnabled)); if (!cpuPinMigrationEnabled && (vmStaticData.getMigrationSupport() == MigrationSupport.MIGRATABLE || vmStaticData.getMigrationSupport() == MigrationSupport.IMPLICITLY_NON_MIGRATABLE) && StringUtils.isNotEmpty(cpuPinning)) { reasons.add(EngineMessage.ACTION_TYPE_FAILED_VM_CANNOT_BE_PINNED_TO_CPU_AND_MIGRATABLE.toString()); return false; } if (vmStaticData.isAutoStartup() && (vmStaticData.getMigrationSupport() != MigrationSupport.MIGRATABLE && vmStaticData.getDedicatedVmForVdsList().size() == 1)) { reasons.add(EngineMessage.ACTION_TYPE_FAILED_VM_CANNOT_BE_HIGHLY_AVAILABLE_AND_PINNED_TO_HOST.toString()); return false; } return true; }
Source:
<code>public void validate_shouldRejectAVisitIfItHasLessThanMinOccursOfAnAttributeWhenExpectedExactlyOne() throws Exception { executeDataSet("org/openmrs/validator/include/VisitValidatorTest-additionalAttributeType1.xml"); Visit visit = makeVisit(); try { ValidateUtil.validate(visit); } catch (ValidationException e) { Errors errors = e.getErrors(); <START> assertEquals(1, errors.getErrorCount()); <END> assertEquals("error.required", errors.getFieldError("activeAttributes").getCode()); } }</code><technical_language>If validation exception is thrown, assertions get executed</technical_language>

Target:
public void validate_shouldRejectAVisitIfItHasLessThanMinOccursOfAnAttributeWhenExpectedExactlyOne() throws Exception { executeDataSet("org/openmrs/validator/include/VisitValidatorTest-additionalAttributeType1.xml"); Visit visit = makeVisit(); try { ValidateUtil.validate(visit); fail(); } catch (ValidationException e) { Errors errors = e.getErrors(); assertEquals(1, errors.getErrorCount()); assertEquals("error.required", errors.getFieldError("activeAttributes").getCode()); } }
Source:
<code><START> public boolean needsQuoting(String alias, String identifierQuoteString) { <END> boolean result = false; if (alias != null && identifierQuoteString != null) { if (alias.indexOf(identifierQuoteString) == -1) { for (int i = 0; i < SPECIAL_ALIAS_CHARACTERS.length(); i++) { char specialCharacter = SPECIAL_ALIAS_CHARACTERS.charAt(i); if (alias.indexOf(specialCharacter) != -1) { result = true; break; } } } } if (logger.isDebugEnabled()) { logger.debug("needsQuoting(" + alias + "," + identifierQuoteString + ") = " + result); } return result; }</code><technical_language>I suggest protected scope instead of public</technical_language>

Target:
protected boolean needsQuoting(String alias, String identifierQuoteString) { boolean result = false; if (alias != null && identifierQuoteString != null) { if (alias.indexOf(identifierQuoteString) == -1) { for (int i = 0; i < SPECIAL_ALIAS_CHARACTERS.length(); i++) { char specialCharacter = SPECIAL_ALIAS_CHARACTERS.charAt(i); if (alias.indexOf(specialCharacter) != -1) { result = true; break; } } } } if (logger.isDebugEnabled()) { logger.debug("needsQuoting(" + alias + "," + identifierQuoteString + ") = " + result); } return result; }
Source:
<code>public ResultSet getColumns() throws SQLException { <START> ResultSet rs = getMetaData().getProcedureColumns(null, name.getSchemaName(), name.getObjectName(), "%"); <END> return rs; }</code><technical_language>Do need rs variable</technical_language>

Target:
public ResultSet getColumns() throws SQLException { return getDbMetaData().getProcedureColumns(null, name.getSchemaName(), name.getObjectName(), "%"); }
Source:
<code>GeoFilterPanel() { numberModel = new SpinnerNumberModel(10, 1, Integer.MAX_VALUE, 1); initComponents(); checkboxPanel = new CheckBoxListPanel<>(); checkboxPanel.setPanelTitle(Bundle.GeoFilterPanel_DataSource_List_Title()); checkboxPanel.setPanelTitleIcon(new ImageIcon(getClass().getResource("/org/sleuthkit/autopsy/images/image.png"))); checkboxPanel.setSetAllSelected(true); GridBagConstraints gridBagConstraints = new GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.gridy = 3; gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST; gridBagConstraints.weightx = 1.0; gridBagConstraints.weighty = 1.0; gridBagConstraints.insets = new java.awt.Insets(0, 15, 0, 15); add(checkboxPanel, gridBagConstraints); try { <START> initCheckboxList(); <END> } catch (TskCoreException ex) { logger.log(Level.WARNING, "Failed to initialize the CheckboxListPane", ex); } }</code><technical_language>need initalize list of checkboxes based current case some other time. If close case open another populated data sources original case. Richard points out in email is open case a top component is constructed this panel is constructed in top component constructor</technical_language>

Target:
GeoFilterPanel() { numberModel = new SpinnerNumberModel(10, 1, Integer.MAX_VALUE, 1); initComponents(); checkboxPanel = new CheckBoxListPanel<>(); checkboxPanel.setPanelTitle(Bundle.GeoFilterPanel_DataSource_List_Title()); checkboxPanel.setPanelTitleIcon(new ImageIcon(getClass().getResource("/org/sleuthkit/autopsy/images/image.png"))); checkboxPanel.setSetAllSelected(true); GridBagConstraints gridBagConstraints = new GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.gridy = 3; gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST; gridBagConstraints.weightx = 1.0; gridBagConstraints.weighty = 1.0; gridBagConstraints.insets = new java.awt.Insets(0, 15, 0, 15); add(checkboxPanel, gridBagConstraints); }
Source:
<code>private TestObjectStreamMarshaller marshaller() { <START> if (marshaller == null) { <END> marshaller = new TestObjectStreamMarshaller(); } return marshaller; }</code><technical_language>Is a reason this class is this lazy initialization instead of a BeforeMethod/BeforeTest other classes</technical_language>

Target:
private TestObjectStreamMarshaller marshaller() { return marshaller; }
Source:
<code><START> public ContainerProvider getContainerProvider() { <END> return this.containerProvider; }</code><technical_language>@Nullable</technical_language>

Target:
@Nullable public ContainerProvider getContainerProvider() { return this.containerProvider; }
Source:
<code>private String userCn(String username) { <START> if (username.contains("@")) { <END> try (LDAPResource ldap = new LDAPResource()) { Entry user = ldap.findUserByEmail(username); if (user != null) { return user.getDn().getName(); } } catch (LdapException | IOException e) { logger.debug("LDAP connection error", e); throw new AuthenticationException(LDAP_AUTH, "LDAP connection error", e); } } String sanitizedUser = username.replaceAll("[,=]", ""); String cn = "cn=" + sanitizedUser + "," + userDn; return cn; }</code><technical_language>I selection more configurable supporting email cn implicitly. mamute.properties file LDAP attribute a user</technical_language>

Target:
private String userCn(String username) { if (lookupAttrs.length > 0) { try (LDAPResource ldap = new LDAPResource()) { Entry user = ldap.lookupUser(username); if (user != null) { return user.getDn().getName(); } } catch (LdapException | IOException e) { logger.debug("LDAP connection error", e); throw new AuthenticationException(LDAP_AUTH, "LDAP connection error", e); } } String sanitizedUser = username.replaceAll("[,=]", ""); String cn = "cn=" + sanitizedUser + "," + userDn; return cn; }
Source:
<code>private void resetOptionSettings(IHoldsOptions holder) { IOption[] opts = holder.getOptions(); for (IOption opt : opts) { Object val = opt.getDefaultValue(); if (val instanceof Boolean) { ManagedBuildManager.setOption(toolChain.getParent(), holder, opt, (Boolean)val); } else if (val instanceof String[]) { ManagedBuildManager.setOption(toolChain.getParent(), holder, opt, (String[])val); } else if (val instanceof String){ ManagedBuildManager.setOption(toolChain.getParent(), holder, opt, (String)val); <START> } <END> } }</code><technical_language>} else if (val == null) { holder.removeOption(opt); } else { Activator.log("Unknown type of "+val.class+" for "+opt); }</technical_language>

Target:
private void resetOptionSettings(IHoldsOptions holder) { IOption[] opts = holder.getOptions(); for (IOption opt : opts) { Object val = opt.getDefaultValue(); if (val instanceof Boolean) { ManagedBuildManager.setOption(toolChain.getParent(), holder, opt, (Boolean)val); } else if (val instanceof String[]) { ManagedBuildManager.setOption(toolChain.getParent(), holder, opt, (String[])val); } else if (val instanceof String){ ManagedBuildManager.setOption(toolChain.getParent(), holder, opt, (String)val); } else if (val == null) { holder.removeOption(opt); } else { ManagedBuilderCorePlugin.error("Unknown type of value " + val + " for " + opt); } } }
Source:
<code>public GeoOverlay parse() throws InvalidStructureException, IOException, XmlPullParserException { DisplayUnit title = null; DisplayUnit coordinates = null; while (nextTagInBlock(NAME_GEO_OVERLAY)) { String tagName = parser.getName().toLowerCase(); if (NAME_COORDINATES.contentEquals(tagName)) { nextTagInBlock(NAME_COORDINATES); coordinates = new DisplayUnit(new TextParser(parser).parse()); <START> } else if (NAME_TITLE.contentEquals(tagName)) { <END> nextTagInBlock(NAME_TITLE); title = new DisplayUnit(new TextParser(parser).parse()); } } return new GeoOverlay(title, coordinates); }</code><technical_language>Nitpick: call this "label", "title". Title is in suite a meaning, get confusing</technical_language>

Target:
public GeoOverlay parse() throws InvalidStructureException, IOException, XmlPullParserException { DisplayUnit title = null; DisplayUnit coordinates = null; while (nextTagInBlock(NAME_GEO_OVERLAY)) { String tagName = parser.getName().toLowerCase(); if (NAME_COORDINATES.contentEquals(tagName)) { nextTagInBlock(NAME_COORDINATES); coordinates = new DisplayUnit(new TextParser(parser).parse()); } else if (NAME_LABEL.contentEquals(tagName)) { nextTagInBlock(NAME_LABEL); title = new DisplayUnit(new TextParser(parser).parse()); } } return new GeoOverlay(title, coordinates); }
Source:
<code>private boolean <START> hasRuntimeAnnotation(@Nonnull <END> JDefinedClassOrInterface type) { if (containsRuntimeAnnotation(type.getAnnotationTypes())) { return true; } for (JField field : type.getFields()) { if (containsRuntimeAnnotation(field.getAnnotationTypes())) { return true; } } for (JMethod method : type.getMethods()) { if (containsRuntimeAnnotation(method.getAnnotationTypes())) { return true; } for (JParameter param : method.getParams()) { if (containsRuntimeAnnotation(param.getAnnotationTypes())) { return true; } } } return false; }</code><technical_language>not. clear. private, code is simple</technical_language>

Target:
private boolean hasRuntimeAnnotation(@Nonnull JDefinedClassOrInterface type) { if (isAnnotatedByRuntimeAnnotation(type)) { return true; } for (JField field : type.getFields()) { if (isAnnotatedByRuntimeAnnotation(field)) { return true; } } for (JMethod method : type.getMethods()) { if (isAnnotatedByRuntimeAnnotation(method)) { return true; } for (JParameter param : method.getParams()) { if (isAnnotatedByRuntimeAnnotation(param)) { return true; } } } return false; }
Source:
<code>public void DoPrePublish(Collection collection, String encryptionPassword) throws IOException { try { BeginPublish(collection, encryptionPassword); SendManifest(collection, encryptionPassword); } catch (IOException e) { SlackNotification.alarm(String.format("Exception on the pre-publish of collection: %s: %s", collection.description.name, e.getMessage())); <START> logError(e, "exception on the pre-publish of collection").collectionName(collection); <END> throw e; } finally { collection.save(); } }</code><technical_language>add .log()</technical_language>

Target:
public void DoPrePublish(Collection collection, String encryptionPassword) throws IOException { try { BeginPublish(collection, encryptionPassword); SendManifest(collection, encryptionPassword); } catch (IOException e) { SlackNotification.alarm(String.format("Exception on the pre-publish of collection: %s: %s", collection.getDescription().getName(), e.getMessage())); logError(e, "exception on the pre-publish of collection").collectionName(collection).log(); throw e; } finally { collection.save(); } }
Source:
<code>public void connectionStatusResponse(){ new Thread(new Runnable() { @Override public void run() { synchronized (serviceControllerLock) { while (mServiceRequestController == null) { try { this.wait(); <START> } catch (InterruptedException e) { <END> } } } if (mServiceRequestController.isConnected()) { onServerConnected(); } else { onServerDisconnected(); } } }).start(); }</code><technical_language>Rename e if used</technical_language>

Target:
public void connectionStatusResponse(){ new Thread(new Runnable() { @Override public void run() { synchronized (serviceControllerLock) { while (mServiceRequestController == null) { try { this.wait(); } catch (InterruptedException e) { Log.d("Y:" + this.getClass().getName(), "Stopped waiting for request controller" + e.getMessage()); } } } if (mServiceRequestController.isConnected()) { onServerConnected(); } else { onServerDisconnected(); } } }).start(); }
Source:
<code>public void executeCommand(UICommand command) { super.executeCommand(command); if (command.equals(getRestoreSnapshotCommand())) { restoreSnapshot(); } else if (command.equals(getDeleteSnapshotCommand())) { deleteSnapshot(); } else if (command.equals(getDeleteAllSnapshotsCommand())) { deleteAllSnapshots(); } else if (command.equals(getActivateSnapshotCommand())) { activateSnapshot(); } else if (command.equals(getDeactivateSnapshotCommand())) { deactivateSnapshot(); } else if (command.getName().equals("onRestoreSnapshot")) { onRestoreSnapshot(); } else if (command.getName().equals("onDeleteSnapshot")) { onDeleteSnapshot(); } else if (command.getName().equals("onDeleteAllSnapshots")) { onDeleteAllSnapshots(); } else if (command.getName().equals("onActivateSnapshot")) { onActivateSnapshot(); } else if (command.getName().equals("onDeactivateSnapshot")) { onDeactivateSnapshot(); } else if (command.getName().equals("cancelConfirmation")) { setConfirmWindow(null); } else if (command.equals(getNewSnapshotCommand())) { newSnapshot(); } else if (command.getName().equalsIgnoreCase("onCreateSnapshot")) { <START> onCreateSnapshot(); <END> } else if (command.getName().equalsIgnoreCase("cancel")) { setWindow(null); } else if (command.equals(getEditSnapshotScheduleCommand())) { editSnapshotSchedule(); } else if (command.getName().equalsIgnoreCase("onEditSnapshotSchedule")) { onEditSnapshotSchedule(); } }</code><technical_language>consistent names for newSnapshot onCreateSnapshot. createSnapshot onCreateSnapshot</technical_language>

Target:
public void executeCommand(UICommand command) { super.executeCommand(command); if (command.equals(getRestoreSnapshotCommand())) { restoreSnapshot(); } else if (command.equals(getDeleteSnapshotCommand())) { deleteSnapshot(); } else if (command.equals(getDeleteAllSnapshotsCommand())) { deleteAllSnapshots(); } else if (command.equals(getActivateSnapshotCommand())) { activateSnapshot(); } else if (command.equals(getDeactivateSnapshotCommand())) { deactivateSnapshot(); } else if (command.getName().equals("onRestoreSnapshot")) { onRestoreSnapshot(); } else if (command.getName().equals("onDeleteSnapshot")) { onDeleteSnapshot(); } else if (command.getName().equals("onDeleteAllSnapshots")) { onDeleteAllSnapshots(); } else if (command.getName().equals("onActivateSnapshot")) { onActivateSnapshot(); } else if (command.getName().equals("onDeactivateSnapshot")) { onDeactivateSnapshot(); } else if (command.getName().equals("cancelConfirmation")) { setConfirmWindow(null); } else if (command.equals(getCreateSnapshotCommand())) { createSnapshot(); } else if (command.getName().equalsIgnoreCase("onCreateSnapshot")) { onCreateSnapshot(); } else if (command.getName().equalsIgnoreCase("cancel")) { setWindow(null); } else if (command.equals(getEditSnapshotScheduleCommand())) { editSnapshotSchedule(); } else if (command.getName().equalsIgnoreCase("onEditSnapshotSchedule")) { onEditSnapshotSchedule(); } }
Source:
<code><START> public static void processScheduledDeletions(SaveHandler saveHandler) <END> { for (String folderName : foldersScheduledForDeletion) { File folder = new File(saveHandler.getWorldDirectory(), folderName); try { FileUtils.deleteDirectory(folder); LOGGER.info(DIMMGR, "Modded dimension directory scheduled for deletion was deleted.", folderName); } catch (Exception e) { LOGGER.error(DIMMGR, "Failed to delete modded dimension directory that was scheduled for deletion.", folderName, e); } } foldersScheduledForDeletion.clear(); }</code><technical_language>Is a add a confirmation screen similiar registry issues one? I idea of deleting files in bulk atleast a confirmation. Also, filter this list a folder.exists() warn deleting folders gone</technical_language>

Target:
public static void processScheduledDeletions(SaveHandler saveHandler) { List<String> toDelete = new ArrayList<>(foldersScheduledForDeletion); foldersScheduledForDeletion.clear(); if (!toDelete.isEmpty()) { StringBuilder text = new StringBuilder(); text.append("The following dimensions are marked for deletion by their owning mod. Proceed?\n\n"); for (String folder : toDelete) { text.append(folder).append('\n'); } if (!StartupQuery.confirm(text.toString())) { StartupQuery.abort(); return; } } for (String folderName : toDelete) { File folder = new File(saveHandler.getWorldDirectory(), folderName); try { FileUtils.deleteDirectory(folder); LOGGER.info(DIMMGR, "Modded dimension directory scheduled for deletion was deleted.", folderName); } catch (Exception e) { LOGGER.error(DIMMGR, "Failed to delete modded dimension directory that was scheduled for deletion.", folderName, e); } } }
Source:
<code>protected List<Object> identifyClearGarbage(Object locator) { List<Object> garbage = new ArrayList<>(); <START> garbage.addAll(locatorStore.clearUnsafe()); <END> return garbage; }</code><technical_language>consistent other two</technical_language>

Target:
protected List<Object> identifyClearGarbage(Object locator) { return new ArrayList<>(locatorStore.clearUnsafe()); }
Source:
<code>public void onDirectTabChange(TabChangeEvent tEvent) { Tab selectedTab = tEvent.getTab(); <START> if (selectedTab.getId().equalsIgnoreCase(DIRECTDOMAINTAB)) { <END> directTabIndex = 0; } else if (selectedTab.getId().equalsIgnoreCase(DIRECTAGENTTAB)) { directTabIndex = 1; } else if (selectedTab.getId().equalsIgnoreCase(DIRECTCERTTAB)) { directTabIndex = 2; } else { directTabIndex = 3; } }</code><technical_language>Optional: DIRECTDOMAINTAB.equalsIgnoreCase(selectedTab.getId()) prevent NPE if operator is null</technical_language>

Target:
public void onDirectTabChange(TabChangeEvent tEvent) { Tab selectedTab = tEvent.getTab(); if (DIRECTDOMAINTAB.equalsIgnoreCase(selectedTab.getId())) { directTabIndex = 0; } else if (DIRECTAGENTTAB.equalsIgnoreCase(selectedTab.getId())) { directTabIndex = 1; } else if (DIRECTCERTTAB.equalsIgnoreCase(selectedTab.getId())) { directTabIndex = 2; } else { directTabIndex = 3; } }
Source:
<code><START> public Builder setOnAudioFocusChangeListener( <END> @NonNull OnAudioFocusChangeListener listener, @NonNull Handler handler) { mOnAudioFocusChangeListener = listener; mFocusChangeHandler = handler; return this; }</code><technical_language>nullcheck</technical_language>

Target:
public Builder setOnAudioFocusChangeListener( @NonNull OnAudioFocusChangeListener listener, @NonNull Handler handler) { if (listener == null) { throw new IllegalArgumentException( "OnAudioFocusChangeListener must not be null"); } if (handler == null) { throw new IllegalArgumentException( "Handler must not be null"); } mOnAudioFocusChangeListener = listener; mFocusChangeHandler = handler; return this; }
Source:
<code>public void removeContainer(final RemoveContainerParams params) throws IOException { String containerId = params.getContainer(); Pod pod = getChePodByContainerId(containerId); String deploymentName = pod.getMetadata().getLabels().get(OPENSHIFT_DEPLOYMENT_LABEL); Deployment d = getDeploymentByName(deploymentName); ReplicaSet rs = getReplicaSetByLabel(OPENSHIFT_DEPLOYMENT_LABEL, deploymentName); Service svc = getCheServiceBySelector(OPENSHIFT_DEPLOYMENT_LABEL, deploymentName); if (svc != null) { <START> LOG.info("Removing OpenShift Service " + svc.getMetadata().getName()); <END> openShiftClient.resource(svc).delete(); } if (d != null) { LOG.info("Removing OpenShift Deployment " + d.getMetadata().getName()); openShiftClient.resource(d).delete(); } if (rs!= null) { LOG.info("Removing Replica Set " + rs.getMetadata().getName()); openShiftClient.resource(rs).delete(); } if (pod != null) { LOG.info("Removing OpenShift Pod " + pod.getMetadata().getName()); openShiftClient.resource(pod).delete(); } }</code><technical_language>{} parameters instead of string concatenation is info log trace</technical_language>

Target:
public void removeContainer(final RemoveContainerParams params) throws IOException { String containerId = params.getContainer(); Pod pod = getChePodByContainerId(containerId); String deploymentName = pod.getMetadata().getLabels().get(OPENSHIFT_DEPLOYMENT_LABEL); Deployment deployment = getDeploymentByName(deploymentName); ReplicaSet replicaSet = getReplicaSetByLabel(OPENSHIFT_DEPLOYMENT_LABEL, deploymentName); Service service = getCheServiceBySelector(OPENSHIFT_DEPLOYMENT_LABEL, deploymentName); if (service != null) { LOG.info("Removing OpenShift Service {}", service.getMetadata().getName()); openShiftClient.resource(service).delete(); } if (deployment != null) { LOG.info("Removing OpenShift Deployment {}", deployment.getMetadata().getName()); openShiftClient.resource(deployment).delete(); } if (replicaSet != null) { LOG.info("Removing Replica Set {}", replicaSet.getMetadata().getName()); openShiftClient.resource(replicaSet).delete(); } LOG.info("Removing OpenShift Pod {}", pod.getMetadata().getName()); openShiftClient.resource(pod).delete(); }
Source:
<code>static void cancelOperation() throws IOException { <START> String operationFullId = "projects/[projectId]/locations/us-central1/operations/[operationId]"; <END> cancelOperation(operationFullId); }</code><technical_language>String.fmt error prone</technical_language>

Target:
static void cancelOperation() throws IOException { String projectId = "YOUR_PROJECT_ID"; String location = "us-central1"; String operationId = "YOUR_OPERATION_ID"; String operationFullId = String.format("projects/%s/locations/%s/operations/%s", projectId, location, operationId); cancelOperation(operationFullId); }