auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>private String getExport( @NotNull String target, @Nullable ProcessAdapter processAdapter ) { try { <START> final File outputFile = FileUtil.createTempFile("pants_export_" + target.replace('/', '_') + "_run", ".out"); <END> final GeneralCommandLine commandLine = PantsUtil.defaultCommandLine(getProjectPath()); commandLine.addParameter("export"); commandLine.addParameter("--formatted"); if (myResolveSourcesAndDocsForJars) { commandLine.addParameter("--export-libraries-sources"); commandLine.addParameter("--export-libraries-javadocs"); } commandLine.addParameters(target); commandLine.addParameter("--export-output-file=" + outputFile.getPath()); LOG.debug(commandLine.toString()); final ProcessOutput processOutput = getProcessOutput(commandLine, processAdapter); if (processOutput.getStdout().contains("no such option")) { throw new ExternalSystemException("Pants doesn't have necessary APIs. Please upgrade you pants!"); } if (processOutput.checkSuccess(LOG)) { return FileUtil.loadFile(outputFile); } else { throw new PantsExecutionException("Failed to update the project!", commandLine.getCommandLineString("pants"), processOutput); } } catch (IOException | ExecutionException e) { throw new RuntimeException(e); } }</code><technical_language>a static output file name, loaded next pants run next pants run overwrite it. If want a name for run, please File.separator instead of /. com.twitter.intellij.pants.service.PantsCompileOptionsExecutor#getProjectName for example</technical_language>

Target:
private String getExport( @NotNull String target, @Nullable ProcessAdapter processAdapter ) { try { final File outputFile = FileUtil.createTempFile("pants_export_run", ".out"); final GeneralCommandLine commandLine = PantsUtil.defaultCommandLine(getProjectPath()); commandLine.addParameter("export"); commandLine.addParameter("--formatted"); if (myResolveSourcesAndDocsForJars) { commandLine.addParameter("--export-libraries-sources"); commandLine.addParameter("--export-libraries-javadocs"); } commandLine.addParameters(target); commandLine.addParameter("--export-output-file=" + outputFile.getPath()); LOG.debug(commandLine.toString()); final ProcessOutput processOutput = getProcessOutput(commandLine, processAdapter); if (processOutput.getStdout().contains("no such option")) { throw new ExternalSystemException("Pants doesn't have necessary APIs. Please upgrade you pants!"); } if (processOutput.checkSuccess(LOG)) { return FileUtil.loadFile(outputFile); } else { throw new PantsExecutionException("Failed to update the project!", commandLine.getCommandLineString("pants"), processOutput); } } catch (IOException | ExecutionException e) { throw new RuntimeException(e); } }
Source:
<code>private DiskDef.DiskBus getGuestDiskModel(final String platformEmulator) { if (platformEmulator == null) { return DiskDef.DiskBus.IDE; } else if (platformEmulator.startsWith("Other PV Virtio-SCSI")) { return DiskDef.DiskBus.SCSI; } else if (platformEmulator.startsWith("Ubuntu") || platformEmulator.startsWith("Fedora") || platformEmulator.startsWith("CentOS") || platformEmulator.startsWith("Red Hat Enterprise Linux") || platformEmulator.startsWith("Debian GNU/Linux") || platformEmulator.startsWith("FreeBSD") || platformEmulator.startsWith("Oracle") || <START> platformEmulator.startsWith("Windows PV") || <END> platformEmulator.startsWith("Other PV")) { return DiskDef.DiskBus.VIRTIO; } else { return DiskDef.DiskBus.IDE; } }</code><technical_language>@ustcweizhou select "display_name" "guest_os_name"? dont need "Windows PV" in list right</technical_language>

Target:
private DiskDef.DiskBus getGuestDiskModel(final String platformEmulator) { if (platformEmulator == null) { return DiskDef.DiskBus.IDE; } else if (platformEmulator.startsWith("Other PV Virtio-SCSI")) { return DiskDef.DiskBus.SCSI; } else if (platformEmulator.contains("Ubuntu") || platformEmulator.startsWith("Fedora") || platformEmulator.startsWith("CentOS") || platformEmulator.startsWith("Red Hat Enterprise Linux") || platformEmulator.startsWith("Debian GNU/Linux") || platformEmulator.startsWith("FreeBSD") || platformEmulator.startsWith("Oracle") || platformEmulator.startsWith("Other PV")) { return DiskDef.DiskBus.VIRTIO; } else { return DiskDef.DiskBus.IDE; } }
Source:
<code>private void addActivityCommentMessageLinks(ActivityCommentMessageDto message) { IntervalActivity activity = IntervalActivity.getIntervalActivityRepository().findById(message.getIntervalActivityId()) <START> .orElse(null); <END> Objects.requireNonNull(activity, String.format("Activity linked from activity comment message not found from sender '%s' and activity id '%s'", message.getSenderNickname(), message.getIntervalActivityId())); Goal goal = Objects.requireNonNull(activity.getGoal(), String.format("Activity getGoal() returns null for '%s' instance with id '%s' and start time '%s'", activity.getClass().getSimpleName(), activity.getId(), activity.getStartDate())); if (goalIdMapping.isUserGoal(goal.getId())) { messageController.getUserActivityController().addLinks(goalIdMapping, activity, message); } else { messageController.getBuddyActivityController().addLinks(goalIdMapping, activity, message); } }</code><technical_language>This combined next line orElseThrow</technical_language>

Target:
private void addActivityCommentMessageLinks(ActivityCommentMessageDto message) { IntervalActivity activity = IntervalActivity.getIntervalActivityRepository().findById(message.getIntervalActivityId()) .orElseThrow(() -> new IllegalStateException(String.format( "Activity linked from activity comment message not found from sender '%s' and activity id '%s'", message.getSenderNickname(), message.getIntervalActivityId()))); Goal goal = Objects.requireNonNull(activity.getGoal(), String.format("Activity getGoal() returns null for '%s' instance with id '%s' and start time '%s'", activity.getClass().getSimpleName(), activity.getId(), activity.getStartDate())); if (goalIdMapping.isUserGoal(goal.getId())) { messageController.getUserActivityController().addLinks(goalIdMapping, activity, message); } else { messageController.getBuddyActivityController().addLinks(goalIdMapping, activity, message); } }
Source:
<code>TailoredPeersClusterMap() { for (String datanodeName : datanodeNames) { String[] parts = datanodeName.split(":"); Port port = new Port(Integer.parseInt(parts[1]), PortType.PLAINTEXT); <START> List<String> mountPaths = Collections.singletonList("/" + datanodeName); <END> MockDataNodeId dataNodeId = new MockDataNodeId(parts[0], Collections.singletonList(port), mountPaths, DC_NAME); datanodes.put(datanodeName, dataNodeId); } List<MockDataNodeId> partNodes = new ArrayList<>(); partNodes.add(datanodes.get(datanodeNames[0])); partNodes.add(datanodes.get(datanodeNames[1])); partitions.add(new MockPartitionId(0, partNodes, 0)); partNodes.clear(); partNodes.add(datanodes.get(datanodeNames[0])); partNodes.add(datanodes.get(datanodeNames[1])); partitions.add(new MockPartitionId(1, partNodes, 0)); partNodes.clear(); partNodes.add(datanodes.get(datanodeNames[0])); partNodes.add(datanodes.get(datanodeNames[2])); partitions.add(new MockPartitionId(2, partNodes, 0)); partNodes.clear(); partNodes.add(datanodes.get(datanodeNames[0])); partitions.add(new MockPartitionId(3, partNodes, 0)); partNodes.clear(); partNodes.add(datanodes.get(datanodeNames[3])); partitions.add(new MockPartitionId(4, partNodes, 0)); peerMap.put(datanodeNames[0], new HashSet(Arrays.asList(datanodeNames[1], datanodeNames[2]))); peerMap.put(datanodeNames[1], new HashSet(Arrays.asList(datanodeNames[0]))); peerMap.put(datanodeNames[2], Collections.singleton(datanodeNames[0])); peerMap.put(datanodeNames[3], Collections.EMPTY_SET); }</code><technical_language>this based mountPathsArr? I find of this variable</technical_language>

Target:
TailoredPeersClusterMap() { for (String datanodeName : DATANODE_NAMES) { String[] parts = datanodeName.split(":"); Port port = new Port(Integer.parseInt(parts[1]), PortType.PLAINTEXT); List<String> mountPaths = Collections.singletonList("/" + datanodeName); MockDataNodeId dataNodeId = new MockDataNodeId(parts[0], Collections.singletonList(port), mountPaths, DC_NAME); datanodes.put(datanodeName, dataNodeId); } List<MockDataNodeId> partNodes = new ArrayList<>(); partNodes.add(datanodes.get(DATANODE_NAMES[0])); partNodes.add(datanodes.get(DATANODE_NAMES[1])); partitions.add(new MockPartitionId(0, partNodes, 0)); partNodes.clear(); partNodes.add(datanodes.get(DATANODE_NAMES[0])); partNodes.add(datanodes.get(DATANODE_NAMES[1])); partitions.add(new MockPartitionId(1, partNodes, 0)); partNodes.clear(); partNodes.add(datanodes.get(DATANODE_NAMES[0])); partNodes.add(datanodes.get(DATANODE_NAMES[2])); partitions.add(new MockPartitionId(2, partNodes, 0)); partNodes.clear(); partNodes.add(datanodes.get(DATANODE_NAMES[0])); partitions.add(new MockPartitionId(3, partNodes, 0)); partNodes.clear(); partNodes.add(datanodes.get(DATANODE_NAMES[3])); partitions.add(new MockPartitionId(4, partNodes, 0)); peerMap.put(DATANODE_NAMES[0], new HashSet(Arrays.asList(DATANODE_NAMES[1], DATANODE_NAMES[2]))); peerMap.put(DATANODE_NAMES[1], new HashSet(Arrays.asList(DATANODE_NAMES[0]))); peerMap.put(DATANODE_NAMES[2], Collections.singleton(DATANODE_NAMES[0])); peerMap.put(DATANODE_NAMES[3], Collections.EMPTY_SET); }
Source:
<code>public void setup() { for (ResourceLocation id : Block.REGISTRY.getKeys()) { Block block = Block.REGISTRY.getObject(id); if (block == null) continue; if (TrackTools.isRailBlock(block)) add(block); } for (ResourceLocation id : Item.REGISTRY.getKeys()) { Item item = Item.REGISTRY.getObject(id); <START> if (item instanceof ItemMinecart || item instanceof IMinecartItem) <END> add(item); } add(RailcraftItems.SIGNAL_BLOCK_SURVEYOR); add(RailcraftItems.SIGNAL_TUNER); add(RailcraftItems.SIGNAL_LAMP); add(RailcraftItems.CIRCUIT); add(RailcraftItems.SIGNAL_LABEL); add(RailcraftItems.MAG_GLASS); add(RailcraftItems.GOGGLES); add(RailcraftBlocks.WAY_OBJECT); add(RailcraftBlocks.DETECTOR); add(RailcraftBlocks.SIGNAL_BOX); }</code><technical_language>Do want tracks minecarts here</technical_language>

Target:
public void setup() { add(RailcraftItems.SIGNAL_BLOCK_SURVEYOR); add(RailcraftItems.SIGNAL_TUNER); add(RailcraftItems.SIGNAL_LAMP); add(RailcraftItems.CIRCUIT); add(RailcraftItems.SIGNAL_LABEL); add(RailcraftItems.MAG_GLASS); add(RailcraftItems.GOGGLES); add(RailcraftBlocks.WAY_OBJECT); add(RailcraftBlocks.DETECTOR); add(RailcraftBlocks.SIGNAL_BOX); }
Source:
<code>protected void endSuccessfullySynchronous() { VM vm = getVm(); VmHandler.UnLockVm(vm.getId()); <START> this.endDefaultOps(vm); <END> setSucceeded(true); }</code><technical_language>for this endDefaultOps is a pretty bad name (yes, I before). 'updateSnapshotOvf' 'persistSnapshotConfig' (can a separate patch concerned)</technical_language>

Target:
protected void endSuccessfullySynchronous() { VM vm = getVm(); VmHandler.UnLockVm(vm.getId()); this.endDefaultOperations(vm); setSucceeded(true); }
Source:
<code><START> static String createProcessorId(ApplicationConfig appConfig) { <END> if (appConfig.getProcessorId() != null) { return appConfig.getProcessorId(); } else if (appConfig.getAppProcessorIdGeneratorClass() != null) { ProcessorIdGenerator idGenerator = Util.getObj(appConfig.getAppProcessorIdGeneratorClass(), ProcessorIdGenerator.class); return idGenerator.generateProcessorId(appConfig); } else { throw new ConfigException(String.format("Expected either %s or %s to be configured", ApplicationConfig.PROCESSOR_ID, ApplicationConfig.APP_PROCESSOR_ID_GENERATOR_CLASS)); } }</code><technical_language>move this logic ApplicationConfig#getProcessorId pass in processorId StreamProcessor specific job coordinators' constructors? ApplicationConfig#getProcessorId called in createProcessorId methods anyway</technical_language>

Target:
static String createProcessorId(ApplicationConfig appConfig) { if (StringUtils.isNotBlank(appConfig.getProcessorId())) { return appConfig.getProcessorId(); } else if (StringUtils.isNotBlank(appConfig.getAppProcessorIdGeneratorClass())) { ProcessorIdGenerator idGenerator = Util.getObj(appConfig.getAppProcessorIdGeneratorClass(), ProcessorIdGenerator.class); return idGenerator.generateProcessorId(appConfig); } else { throw new ConfigException(String.format("Expected either %s or %s to be configured", ApplicationConfig.PROCESSOR_ID, ApplicationConfig.APP_PROCESSOR_ID_GENERATOR_CLASS)); } }
Source:
<code>public V apply(EntryView.ReadWriteEntryView<K, V> entry) { V merged = value; if (entry.find().isPresent()) { <START> merged = remappingFunction.apply(entry.get(), value); <END> } if (merged == null) { entry.remove(); } else { entry.set(merged); } return merged; }</code><technical_language>fyi, entry.set(null) work entry.remove()</technical_language>

Target:
public V apply(EntryView.ReadWriteEntryView<K, V> entry) { try { V merged = value; if (entry.find().isPresent()) { merged = remappingFunction.apply(entry.get(), value); } if (merged == null) { entry.set(merged); } else { entry.set(merged, metadata); } return merged; } catch (Exception ex) { throw new UserRaisedFunctionalException(ex); } }
Source:
<code>private void disconnect() throws XAException { try { xaConnection.close(); } catch (JMSException e) { LOGGER.warn("Failed to close connection", e); <START> throw new XAException(XAException.XAER_PROTO); <END> } finally { xaConnection = null; xaSession = null; delegate = null; } }</code><technical_language>RMFAIL</technical_language>

Target:
private void disconnect() { try { xaConnection.close(); } catch (JMSException e) { LOGGER.warn("Failed to close connection", e); } finally { xaConnection = null; xaSession = null; delegate = null; } }
Source:
<code>public BackendlessCollection<GeoPoint> getPoints( BackendlessGeoQuery geoQuery ) throws BackendlessException { checkGeoQuery( geoQuery ); CollectionAdaptingPolicy<GeoPoint> adaptingPolicy = new CollectionAdaptingPolicy<GeoPoint>(); BackendlessCollection<GeoPoint> result = (BackendlessCollection<GeoPoint>) Invoker.invokeSync( GEO_MANAGER_SERVER_ALIAS, "getPoints", new Object[] { Backendless.getApplicationId(), Backendless.getVersion(), geoQuery }, new AdaptingResponder<GeoPoint>( GeoPoint.class, adaptingPolicy ) ); if( result instanceof BackendlessGeoCollection ) { <START> Backendless.Cache.put( Messaging.DEVICE_ID + "." + BackendlessGeoQuery.class.getSimpleName(), geoQuery ); <END> } result.setQuery( geoQuery ); result.setType( GeoPoint.class ); return result; }</code><technical_language>this do? do reference Messaging.DEVICE_ID? do put server-side cache client-side</technical_language>

Target:
public BackendlessCollection<GeoPoint> getPoints( BackendlessGeoQuery geoQuery ) throws BackendlessException { checkGeoQuery( geoQuery ); CollectionAdaptingPolicy<GeoPoint> adaptingPolicy = new CollectionAdaptingPolicy<GeoPoint>(); BackendlessCollection<GeoPoint> result = (BackendlessCollection<GeoPoint>) Invoker.invokeSync( GEO_MANAGER_SERVER_ALIAS, "getPoints", new Object[] { Backendless.getApplicationId(), Backendless.getVersion(), geoQuery }, new AdaptingResponder<GeoPoint>( GeoPoint.class, adaptingPolicy ) ); result.setQuery( geoQuery ); result.setType( GeoPoint.class ); if( geoQuery.getDpp() != null && geoQuery.getDpp() > 0 ) { setReferenceToCluster( result ); } return result; }
Source:
<code>public void handleScheduleRepeatingJobEvent(MotechEvent event) { Map<String, Object> parameters = event.getParameters(); Map<String, Object> metadata = event.getMetadata(); String jobSubject = (String) metadata.get(JOB_SUBJECT); parameters.remove(JOB_SUBJECT); Integer repeatCount = (Integer) metadata.get(REPEAT_COUNT); parameters.remove(REPEAT_COUNT); Integer repeatIntervalInSeconds = (Integer) metadata.get(REPEAT_INTERVAL_TIME); <START> parameters.remove(REPEAT_COUNT); <END> MotechEvent jobEvent = new MotechEvent(jobSubject, parameters, null, metadata); RepeatingSchedulableJob repeatingJob = new RepeatingSchedulableJob(jobEvent, repeatCount, repeatIntervalInSeconds, DateTime.now(), null, false); schedulerService.scheduleRepeatingJob(repeatingJob); }</code><technical_language>wrong do remove this parameters ? I assume in metadata</technical_language>

Target:
public void handleScheduleRepeatingJobEvent(MotechEvent event) { Map<String, Object> parameters = event.getParameters(); Map<String, Object> metadata = event.getMetadata(); String jobSubject = (String) metadata.get(JOB_SUBJECT); Integer repeatCount = (Integer) metadata.get(REPEAT_COUNT); Integer repeatIntervalInSeconds = (Integer) metadata.get(REPEAT_INTERVAL_TIME); MotechEvent jobEvent = new MotechEvent(jobSubject, parameters, null, metadata); RepeatingSchedulableJob repeatingJob = new RepeatingSchedulableJob(jobEvent, repeatCount, repeatIntervalInSeconds, DateTime.now(), null, false); schedulerService.scheduleRepeatingJob(repeatingJob); }
Source:
<code><START> public void updatePathGroup(List<Variable> <END> variables, IPath node, IPath selection) { final int segmentsSelection = selection.segmentCount(); for (final Variable variable : variables) if (variable.getPath().uptoSegment(segmentsSelection).equals(selection.makeAbsolute())) { final IPath oldPath = variable.getPath(); final int count = selection.segmentCount(); variable.setPath(buildPath(oldPath, node, count)); } }</code><technical_language>static</technical_language>

Target:
public static void updatePathGroup(List<Variable> variables, IPath node, IPath selection) { final int segmentsSelection = selection.segmentCount(); for (final Variable variable : variables) if (variable.getPath().uptoSegment(segmentsSelection).equals(selection.makeAbsolute())) { final IPath oldPath = variable.getPath(); final int count = selection.segmentCount(); variable.setPath(buildPath(oldPath, node, count)); } }
Source:
<code>static <T> WorkProcessor<T> mergeSorted(Iterable<WorkProcessor<T>> processorIterable, Comparator<T> comparator) { requireNonNull(comparator, "comparator is null"); Iterator<WorkProcessor<T>> processorIterator = requireNonNull(processorIterable, "processorIterable is null").iterator(); checkArgument(processorIterator.hasNext(), "There must be at least one base processor"); PriorityQueue<ElementAndProcessor<T>> queue = new PriorityQueue<>(2, comparing(ElementAndProcessor::getElement, comparator)); return create(new WorkProcessor.Process<T>() { WorkProcessor<T> processor = processorIterator.next(); @Override public ProcessorState<T> process() { while (true) { if (processor.process()) { if (!processor.isFinished()) { queue.add(new ElementAndProcessor<>(processor.getResult(), processor)); <START> } <END> } else if (processor.isBlocked()) { return ProcessorState.blocked(processor.getBlockedFuture()); } else { return ProcessorState.yield(); } if (processorIterator.hasNext()) { processor = processorIterator.next(); continue; } if (queue.isEmpty()) { return ProcessorState.finished(); } ElementAndProcessor<T> elementAndProcessor = queue.poll(); processor = elementAndProcessor.getProcessor(); return ProcessorState.ofResult(elementAndProcessor.getElement()); } } }); }</code><technical_language>call processor.process() if processor.isBlocked() of processor.isFinished() already</technical_language>

Target:
static <T> WorkProcessor<T> mergeSorted(Iterable<WorkProcessor<T>> processorIterable, Comparator<T> comparator) { requireNonNull(comparator, "comparator is null"); Iterator<WorkProcessor<T>> processorIterator = requireNonNull(processorIterable, "processorIterable is null").iterator(); checkArgument(processorIterator.hasNext(), "There must be at least one base processor"); PriorityQueue<ElementAndProcessor<T>> queue = new PriorityQueue<>(2, comparing(ElementAndProcessor::getElement, comparator)); return create(new WorkProcessor.Process<T>() { WorkProcessor<T> processor = requireNonNull(processorIterator.next()); @Override public ProcessorState<T> process() { while (true) { if (processor.process()) { if (!processor.isFinished()) { queue.add(new ElementAndProcessor<>(processor.getResult(), processor)); } } else if (processor.isBlocked()) { return ProcessorState.blocked(processor.getBlockedFuture()); } else { return ProcessorState.yield(); } if (processorIterator.hasNext()) { processor = processorIterator.next(); continue; } if (queue.isEmpty()) { return ProcessorState.finished(); } ElementAndProcessor<T> elementAndProcessor = queue.poll(); processor = elementAndProcessor.getProcessor(); return ProcessorState.ofResult(elementAndProcessor.getElement()); } } }); }
Source:
<code>public void recordConnectionAcquiredNanos(long elapsedAcquiredNanos) { <START> super.recordConnectionAcquiredNanos(elapsedAcquiredNanos); <END> }</code><technical_language>capture in a summary</technical_language>

Target:
public void recordConnectionAcquiredNanos(long elapsedAcquiredNanos) { elapsedAcquiredSummary.observe(elapsedAcquiredNanos); }
Source:
<code>public List<Location> getLocations() { final ArrayList<Location> locations = new ArrayList<>(); final Location top = this.getLocation(); <START> if (this.getBase() == null) { <END> return locations; } final Location iterLoc = this.getBase().getLocation(); final double ySpacing = 2; while (iterLoc.getY() <= top.getY()) { locations.add(iterLoc.clone()); iterLoc.add(0, ySpacing, 0); } return locations; }</code><technical_language>return a new ArrayList creating variables this</technical_language>

Target:
public List<Location> getLocations() { if (this.getBase() == null) { return new ArrayList<>(); } final ArrayList<Location> locations = new ArrayList<>(); final Location top = this.getLocation(); final Location iterLoc = this.getBase().getLocation(); final double ySpacing = 2; while (iterLoc.getY() <= top.getY()) { locations.add(iterLoc.clone()); iterLoc.add(0, ySpacing, 0); } return locations; }
Source:
<code>public String shell(PyObject[] args, String[] kws) { ArgParser ap = JythonUtils.createArgParser(args, kws); Preconditions.checkNotNull(ap); String cmd = ap.getString(0); <START> if(args.length == 2) <END> return impl.shell(cmd, ap.getInt(1)); else return impl.shell(cmd); }</code><technical_language>needs a space if needs else</technical_language>

Target:
public String shell(PyObject[] args, String[] kws) { ArgParser ap = JythonUtils.createArgParser(args, kws); Preconditions.checkNotNull(ap); String cmd = ap.getString(0); if (args.length == 2) { return impl.shell(cmd, ap.getInt(1)); } else { return impl.shell(cmd); } }
Source:
<code>public void renameList() { onBrickAtPosition(0).checkShowsText(R.string.brick_when_started); onBrickAtPosition(1).checkShowsText(R.string.brick_change_size_by); onBrickAtPosition(1).onChildView(withId(R.id.brick_change_size_by_edit_text)).perform(click()); onView(withId(R.id.formula_editor_keyboard_data)).perform(click()); onView(withId(R.id.button_add)).perform(click()); <START> onView(withId(R.id.dialog_formula_editor_data_is_list_checkbox)).perform(setCheckboxChecked(true)); <END> onView(withId(R.id.dialog_formula_editor_data_name_edit_text)).perform(typeText(variableNameOld)); onView(withText(R.string.ok)).perform(click()); onView(withText(variableNameOld)).perform(click()); onView(withId(R.id.formula_editor_edit_field)).check(matches(withText(getUserListEditText(variableNameOld)))); onView(withId(R.id.formula_editor_keyboard_data)).perform(click()); onView(withText(variableNameOld)).perform(longClick()); onView(withText(R.string.rename)).perform(click()); onView(withId(R.id.dialog_formula_rename_variable_name_edit_text)) .perform(clearText(), typeText(variableNameNew)); onView(withText(R.string.ok)).perform(click()); pressBack(); onView(withId(R.id.formula_editor_edit_field)).check(matches(withText(getUserListEditText(variableNameNew)))); }</code><technical_language>please enter variableName first, right close soft keyboard that, fix problem checkbox clicked..</technical_language>

Target:
public void renameList() { onBrickAtPosition(whenBrickPosition).checkShowsText(R.string.brick_when_started); onBrickAtPosition(changeSizeBrickPosition).checkShowsText(R.string.brick_change_size_by); onBrickAtPosition(changeSizeBrickPosition).onChildView(withId(R.id.brick_change_size_by_edit_text)) .perform(click()); onView(withId(R.id.formula_editor_keyboard_data)) .perform(click()); onView(withId(R.id.button_add)) .perform(click()); onView(withId(R.id.dialog_formula_editor_data_name_edit_text)) .perform(replaceText(variableNameOld), closeSoftKeyboard()); onView(withId(R.id.dialog_formula_editor_data_is_list_checkbox)) .perform(click()); onView(withText(R.string.ok)) .perform(click()); onView(withText(variableNameOld)) .perform(click()); onView(withId(R.id.formula_editor_edit_field)) .check(matches(withText(getUserListEditText(variableNameOld)))); onView(withId(R.id.formula_editor_keyboard_data)) .perform(click()); onView(withText(variableNameOld)) .perform(longClick()); onView(withText(R.string.rename)) .perform(click()); onView(withId(R.id.dialog_formula_rename_variable_name_edit_text)) .perform(replaceText(variableNameNew), closeSoftKeyboard()); onView(withText(R.string.ok)) .perform(click()); pressBack(); onView(withId(R.id.formula_editor_edit_field)).check(matches(withText(getUserListEditText(variableNameNew)))); }
Source:
<code>public void setSamples(List<String> samples) { int i = 0; int size = samples == null? 0 : samples.size(); sampleIds = new HashMap<>(size); idSamples = new HashMap<>(size); <START> if (samples != null) { <END> for (String sample : samples) { sampleIds.put(sample, i); idSamples.put(i, sample); i++; } } }</code><technical_language>want create assert instead of a condition</technical_language>

Target:
public void setSamples(List<String> samples) { int i = 0; assert samples != null; int size = samples.size(); sampleIds = new HashMap<>(size); idSamples = new HashMap<>(size); for (String sample : samples) { sampleIds.put(sample, i); idSamples.put(i, sample); i++; } }
Source:
<code>AzureClient(String storageConnectionString) { try { account = CloudStorageAccount.parse(storageConnectionString); blobClient = account.createCloudBlobClient(); tableClient = account.createCloudTableClient(); } catch (IllegalArgumentException | URISyntaxException e) { <START> LOG.info("\nConnection string specifies an invalid URI."); <END> LOG.info("Please confirm the connection string is in the Azure connection string format."); throw new SamzaException(e); } catch (InvalidKeyException e) { LOG.info("\nConnection string specifies an invalid key."); LOG.info("Please confirm the AccountName and AccountKey in the connection string are valid."); throw new SamzaException(e); } }</code><technical_language>error</technical_language>

Target:
AzureClient(String storageConnectionString) { try { account = CloudStorageAccount.parse(storageConnectionString); blobClient = account.createCloudBlobClient(); tableClient = account.createCloudTableClient(); } catch (IllegalArgumentException | URISyntaxException e) { LOG.error("\nConnection string specifies an invalid URI.", storageConnectionString); LOG.error("Please confirm the connection string is in the Azure connection string format."); throw new SamzaException(e); } catch (InvalidKeyException e) { LOG.error("\nConnection string specifies an invalid key.", storageConnectionString); LOG.error("Please confirm the AccountName and AccountKey in the connection string are valid."); throw new SamzaException(e); } }
Source:
<code>protected void unregisterVersioningFilter(VersioningFilterDescriptor contrib) { versioningFiltersRegistry.removeContribution(contrib); <START> log.info("Unregistered versioning policy: " + contrib.getId()); <END> recompute(); }</code><technical_language>policy -> filter</technical_language>

Target:
protected void unregisterVersioningFilter(VersioningFilterDescriptor contrib) { versioningFiltersRegistry.removeContribution(contrib); log.info("Unregistered versioning filter: " + contrib.getId()); recompute(); }
Source:
<code>public DatagramSocketImpl(VertxInternal vertx, DatagramSocketOptions options) { super(vertx, createChannel(copiedOptions(options)), vertx.getOrCreateContext(), new DatagramMetrics(vertx)); ContextImpl creatingContext = vertx.getContext(); if (creatingContext != null && creatingContext.isMultithreaded()) { throw new IllegalStateException("Cannot use DatagramSocket in a multi-threaded worker verticle"); <START> } <END> context.getEventLoop().register(channel); channel.pipeline().addLast("handler", new DatagramServerHandler(this.vertx, this)); channel().config().setMaxMessagesPerRead(1); }</code><technical_language>Is this related metrics? else</technical_language>

Target:
public DatagramSocketImpl(VertxInternal vertx, DatagramSocketOptions options) { super(vertx, createChannel(options.isIpV6() ? io.vertx.core.datagram.impl.InternetProtocolFamily.IPv6 : io.vertx.core.datagram.impl.InternetProtocolFamily.IPv4, DatagramSocketOptions.copiedOptions(options)), vertx.getOrCreateContext(), vertx.metricsSPI().register(null, options)); ContextImpl creatingContext = vertx.getContext(); if (creatingContext != null && creatingContext.isMultithreaded()) { throw new IllegalStateException("Cannot use DatagramSocket in a multi-threaded worker verticle"); } channel().config().setOption(ChannelOption.DATAGRAM_CHANNEL_ACTIVE_ON_REGISTRATION, true); context.getEventLoop().register(channel); channel.pipeline().addLast("handler", new DatagramServerHandler(this.vertx, this)); channel().config().setMaxMessagesPerRead(1); }
Source:
<code>public static boolean hasUnresolvedCalls(@NotNull List<GoExpression> expressionList) { for (GoExpression expression : expressionList) { if (expression instanceof GoCallExpr) { expression = ((GoCallExpr)expression).getExpression(); if (expression.getGoType(null) == null) { if (expression.getReference() != null) { <START> if (expression.getReference().resolve() == null) { <END> return true; } continue; } return true; } } } return false; }</code><technical_language>Please simplify</technical_language>

Target:
public static boolean hasUnresolvedCalls(@NotNull List<GoExpression> expressionList) { for (GoExpression expression : expressionList) { if (!(expression instanceof GoCallExpr)) continue; expression = ((GoCallExpr)expression).getExpression(); if (expression.getGoType(null) != null) continue; PsiReference ref = expression.getReference(); if (ref == null || ref.resolve() == null) return true; } return false; }
Source:
<code>public JsonNode getEventSchema(String eventString) { <START> JsonNode event = this.schemaLoader.parse(eventString, false); <END> return this.getEventSchema(event); }</code><technical_language>Well, adding classes for semantics, ok inspecting event then. some.trim().startsWith("{") do right</technical_language>

Target:
public JsonNode getEventSchema(String eventString) { JsonNode event = this.schemaLoader.parse(eventString); return this.getEventSchema(event); }
Source:
<code>public Float getFinishedPercentage() { <START> return (float) (finalFeatureList.size() == 0?0:1); <END> }</code><technical_language>Returning 0 1 is a good estimate progress of algorithm. a way</technical_language>

Target:
public Float getFinishedPercentage() { if (objPeakDetection != null) return objPeakDetection.getFinishedPercent(); else return (float) 0; }
Source:
<code>public synchronized String get(String key) { synchronized (LOCK) { if (isPersistenceEnabled) { final String actualKey = key + SHARED_PREFERENCES_DATA_IDENTIFIER_SUFFIX; if (!sharedPreferences.contains(actualKey)) { return null; } <START> final int keyValueStoreVersion = Integer.parseInt( <END> sharedPreferences .getString(actualKey + SHARED_PREFERENCES_STORE_VERSION_SUFFIX, null)); if (keyValueStoreVersion != AWS_KEY_VALUE_STORE_VERSION) { logger.error("The version of the data read from SharedPreferences for " + key + " does not match the version of the store."); return null; } final String encryptedData = sharedPreferences.getString(actualKey, null); byte[] iv = getInitializationVector(actualKey); try { String decryptedDataInString = decrypt(apiLevel >= ANDROID_API_LEVEL_23 ? new GCMParameterSpec(CIPHER_AES_GCM_NOPADDING_TAG_LENGTH_LENGTH_IN_BITS, iv) : new IvParameterSpec(iv), encryptedData); cache.put(key, decryptedDataInString); return decryptedDataInString; } catch (Exception ex) { logger.error("Error in decrypting data. ", ex); return null; } } else { return cache.get(key); } } }</code><technical_language>try catch</technical_language>

Target:
public synchronized String get(String key) { synchronized (LOCK) { if (isPersistenceEnabled) { final String actualKey = key + SHARED_PREFERENCES_DATA_IDENTIFIER_SUFFIX; if (!sharedPreferences.contains(actualKey)) { return null; } try { final int keyValueStoreVersion = Integer.parseInt( sharedPreferences .getString(actualKey + SHARED_PREFERENCES_STORE_VERSION_SUFFIX, null)); if (keyValueStoreVersion != AWS_KEY_VALUE_STORE_VERSION) { logger.error("The version of the data read from SharedPreferences for " + key + " does not match the version of the store."); return null; } final String encryptedData = sharedPreferences.getString(actualKey, null); byte[] iv = getInitializationVector(actualKey); String decryptedDataInString = decrypt(apiLevel >= ANDROID_API_LEVEL_23 ? new GCMParameterSpec(CIPHER_AES_GCM_NOPADDING_TAG_LENGTH_LENGTH_IN_BITS, iv) : new IvParameterSpec(iv), encryptedData); cache.put(key, decryptedDataInString); return decryptedDataInString; } catch (Exception ex) { logger.error("Error in decrypting data. ", ex); return null; } } else { return cache.get(key); } } }
Source:
<code>public static long hammingDistance(@SqlType("varchar(x)") Slice left, @SqlType("varchar(y)") Slice right) { int[] leftCodePoints = castToCodePoints(left); <START> int[] rightCodePoints = castToCodePoints(right); <END> checkCondition( leftCodePoints.length == rightCodePoints.length, INVALID_FUNCTION_ARGUMENT, "The input strings for Hamming distance must have the same length"); int distance = 0; for (int i = 0; i < leftCodePoints.length; i++) { if (leftCodePoints[i] != rightCodePoints[i]) { distance++; } } return distance; }</code><technical_language>tryGetCodePointAt avoid construction of arrays</technical_language>

Target:
public static long hammingDistance(@SqlType("varchar(x)") Slice left, @SqlType("varchar(y)") Slice right) { int distance = 0; int leftPosition = 0; int rightPosition = 0; while (leftPosition < left.length() && rightPosition < right.length()) { int codePointLeft = tryGetCodePointAt(left, leftPosition); int codePointRight = tryGetCodePointAt(right, rightPosition); if (codePointLeft != codePointRight) { distance++; } leftPosition += codePointLeft > 0 ? lengthOfCodePoint(codePointLeft) : -codePointLeft; rightPosition += codePointRight > 0 ? lengthOfCodePoint(codePointRight) : -codePointRight; } checkCondition( leftPosition == left.length() && rightPosition == right.length(), INVALID_FUNCTION_ARGUMENT, "The input strings to hamming_distance function must have the same length"); return distance; }
Source:
<code><START> public ImportNetworksModel(final com.google.inject.Provider<CommonModel> commonModelProvider, <END> NetworkListModel sourceListModel) { this(sourceListModel, commonModelProvider); }</code><technical_language>Instead of adding this injected ctor here, I add a new class extends ImportNetworksModel this ctor. base class general ctor children injected explicit model type. is implemented is a bit confusing</technical_language>

Target:
public ImportNetworksModel(final com.google.inject.Provider<CommonModel> commonModelProvider, NetworkListModel sourceListModel) { super(sourceListModel, commonModelProvider); }
Source:
<code>public void registerSchemaDefinitions(SchemaDefinitions sd) { this.sd = sd; sd.validateSchema(); RemoteCache<String,String> protobufCache = getProtobufCache(); sd.deploySchema( schemaFileName, protobufCache, schemaCapture, schemaOverrideService ); try { marshaller.getSerializationContext().registerProtoFiles( sd.asFileDescriptorSource() ); } catch (DescriptorParserException | IOException e) { throw log.errorAtProtobufParsing( e ); } this.sequences = new HotRodSequenceHandler( this, marshaller, sd.getSequenceDefinitions() ); if ( createCachesEnabled ) { cacheHandler = new HotRodCacheCreationHandler( cacheConfiguration, sd.getCacheConfigurationByName() ); <START> } <END> else { cacheHandler = new HotRodCacheValidationHandler( sd.getCacheConfigurationByName().keySet() ); } cacheHandler.startAndValidateCaches( hotrodClient ); perCacheSchemaMappers = sd.generateSchemaMappingAdapters( this, sd, marshaller ); }</code><technical_language>I generally prefer similar constructors similar signature, this: new HotRodCacheCreationHandler( sd.getCacheConfigurationByName(), cacheConfiguration ); new HotRodCacheValidationHandler( sd.getCacheConfigurationByName() ); easier spot differences</technical_language>

Target:
public void registerSchemaDefinitions(SchemaDefinitions sd) { this.sd = sd; sd.validateSchema(); RemoteCache<String,String> protobufCache = getProtobufCache(); sd.deploySchema( schemaFileName, protobufCache, schemaCapture, schemaOverrideService ); try { marshaller.getSerializationContext().registerProtoFiles( sd.asFileDescriptorSource() ); } catch (DescriptorParserException | IOException e) { throw log.errorAtProtobufParsing( e ); } this.sequences = new HotRodSequenceHandler( this, marshaller, sd.getSequenceDefinitions() ); if ( createCachesEnabled ) { cacheHandler = new HotRodCacheCreationHandler( cacheConfiguration, sd.getCacheConfigurationByName() ); } else { cacheHandler = new HotRodCacheValidationHandler( sd.getCacheConfigurationByName().keySet() ); } try { cacheHandler.startAndValidateCaches( hotrodClient ); } catch ( HotRodClientException ex ) { log.errorAtCachesStart( ex ); } perCacheSchemaMappers = sd.generateSchemaMappingAdapters( this, sd, marshaller ); }
Source:
<code>public Object decode(Response response, Type type) throws IOException, FeignException { if (response.status() == 204 && Types.getRawType(type).equals(Optional.class)) { return Optional.absent(); } else { System.out.println("here I am"); <START> if (isOptional(type)) { <END> Type innerType = getInnerType(type); return Optional.of(delegate.decode(response, innerType)); } return delegate.decode(response, type); } }</code><technical_language>about: if (Types.getRawType(type).equals(Optional.class)) { if (response.status() == 204) { return Optional.absent(); } else { return Optional.of(delegate.decode(response, getInnerType(type))); } } else { return delegate.decode(response, type); }</technical_language>

Target:
public Object decode(Response response, Type type) throws IOException, FeignException { if (Types.getRawType(type).equals(Optional.class)) { if (response.status() == 204) { return Optional.absent(); } else { Object decoded = checkNotNull(delegate.decode(response, getInnerType(type)), "Unexpected null content for response status %d", response.status()); return Optional.of(decoded); } } else { return delegate.decode(response, type); } }
Source:
<code>protected boolean canDoAction() { if (!super.canDoAction()) { return false; } if <START> (!getParameters().isForceAction() && getParameters().getAction() != GlusterTaskOperation.COMMIT) { <END> addCanDoActionMessage(VdcBllMessages.ACTION_TYPE_NOT_SUPPORTED_FOR_GLUSTER); return false; } if (getGlusterVolume().getVolumeType().isReplicatedType()) { addCanDoActionMessage(VdcBllMessages.ACTION_TYPE_NOT_SUPPORTED_FOR_VOLUME_TYPE); return false; } if (!getGlusterVolume().isOnline()) { addCanDoActionMessage(VdcBllMessages.ACTION_TYPE_FAILED_GLUSTER_VOLUME_IS_DOWN); return false; } if (getParameters().getExistingBrick() == null || getParameters().getNewBrick() == null) { addCanDoActionMessage(VdcBllMessages.ACTION_TYPE_FAILED_BRICKS_REQUIRED); return false; } if (!updateBrickServerAndInterfaceName(getParameters().getExistingBrick(), true)) { return false; } if (!updateBrickServerAndInterfaceName(getParameters().getNewBrick(), true)) { return false; } if (!isValidVolumeBrick(getParameters().getExistingBrick())) { addCanDoActionMessage(VdcBllMessages.ACTION_TYPE_FAILED_NOT_A_GLUSTER_VOLUME_BRICK); return false; } return true; }</code><technical_language>reason force commit operation</technical_language>

Target:
protected boolean canDoAction() { if (!super.canDoAction()) { return false; } if (!getGlusterVolume().getVolumeType().isReplicatedType()) { addCanDoActionMessage(EngineMessage.ACTION_TYPE_NOT_SUPPORTED_FOR_VOLUME_TYPE); return false; } if (!getGlusterVolume().isOnline()) { addCanDoActionMessage(EngineMessage.ACTION_TYPE_FAILED_GLUSTER_VOLUME_IS_DOWN); return false; } if (getGlusterVolume().getAsyncTask() != null && getGlusterVolume().getAsyncTask().getStatus() == JobExecutionStatus.STARTED) { addCanDoActionMessage(EngineMessage.ACTION_TYPE_FAILED_GLUSTER_VOLUME_HAS_RUNNING_TASKS); return false; } if (getParameters().getExistingBrick() == null || getParameters().getNewBrick() == null) { addCanDoActionMessage(EngineMessage.ACTION_TYPE_FAILED_BRICKS_REQUIRED); return false; } if (!updateBrickServerAndInterfaceName(getParameters().getExistingBrick(), true)) { return false; } if (!updateBrickServerAndInterfaceName(getParameters().getNewBrick(), true)) { return false; } if (!isValidVolumeBrick(getParameters().getExistingBrick())) { addCanDoActionMessage(EngineMessage.ACTION_TYPE_FAILED_NOT_A_GLUSTER_VOLUME_BRICK); return false; } return true; }
Source:
<code>protected void initialiseRoleIds(ContentEntity entity) { <START> this.roleIds = entity.getRoleAccessIds(); <END> this.inheritedRoleIds = entity.getInheritedRoleAccessIds(); }</code><technical_language>I this authz groups loaded viewing contentresource. I hoping rely authz checks viewing ListItem changes roles editing item load authzgroup/roles</technical_language>

Target:
protected void initialiseRoleIds(ContentEntity entity) { for (String roleId : availableRoleIds()) { if (contentService.isInheritingRoleView(entity.getId(), roleId)) { this.inheritedRoleIds.add(roleId); } else if (contentService.isRoleView(entity.getId(), roleId)) { this.roleIds.add(roleId); } } }
Source:
<code>private static HttpUriRequest getDownloadFileRequest(URI uri, int socketTimeoutMs) { RequestBuilder requestBuilder = RequestBuilder.get(uri).setVersion(HttpVersion.HTTP_1_1); setTimeout(requestBuilder, socketTimeoutMs); <START> if (uri.getUserInfo() != null) { <END> String encoded = Base64.encodeBase64String(StringUtil.encodeUtf8(uri.getUserInfo())); String authHeader = "Basic " + encoded; requestBuilder.addHeader(HttpHeaders.AUTHORIZATION, authHeader); } return requestBuilder.build(); }</code><technical_language>create a variable for uri.getUserInfo</technical_language>

Target:
private static HttpUriRequest getDownloadFileRequest(URI uri, int socketTimeoutMs) { RequestBuilder requestBuilder = RequestBuilder.get(uri).setVersion(HttpVersion.HTTP_1_1); setTimeout(requestBuilder, socketTimeoutMs); String userInfo = uri.getUserInfo(); if (userInfo != null) { String encoded = Base64.encodeBase64String(StringUtil.encodeUtf8(userInfo)); String authHeader = "Basic " + encoded; requestBuilder.addHeader(HttpHeaders.AUTHORIZATION, authHeader); } return requestBuilder.build(); }
Source:
<code><START> private AnnotatedTypeMirror getTypeVariableFromDeclaration( <END> AnnotatedTypeVariable type, AnnotatedTypeFactory f) { TypeVariable typeVar = type.getUnderlyingType(); TypeParameterElement tpe = (TypeParameterElement) typeVar.asElement(); Element elt = tpe.getGenericElement(); if (elt instanceof TypeElement) { TypeElement typeElt = (TypeElement) elt; int idx = typeElt.getTypeParameters().indexOf(tpe); ClassTree cls = (ClassTree) f.declarationFromElement(typeElt); if (cls == null || cls.getTypeParameters().isEmpty()) { return type.asUse(); } return visitTypeParameter(cls.getTypeParameters().get(idx), f).asUse(); } else if (elt instanceof ExecutableElement) { ExecutableElement exElt = (ExecutableElement) elt; int idx = exElt.getTypeParameters().indexOf(tpe); MethodTree meth = (MethodTree) f.declarationFromElement(exElt); if (meth == null) { return type.asUse(); } AnnotatedTypeVariable result = visitTypeParameter(meth.getTypeParameters().get(idx), f).shallowCopy(); result.setDeclaration(false); return result; } else if (TypesUtils.isCaptured(typeVar)) { return type.asUse(); } else { throw new BugInCF("TypeFromTree.forTypeVariable: not a supported element: " + elt); } }</code><technical_language>return type AnnotatedTypeVariable</technical_language>

Target:
private AnnotatedTypeVariable getTypeVariableFromDeclaration( AnnotatedTypeVariable type, AnnotatedTypeFactory f) { TypeVariable typeVar = type.getUnderlyingType(); TypeParameterElement tpe = (TypeParameterElement) typeVar.asElement(); Element elt = tpe.getGenericElement(); if (elt instanceof TypeElement) { TypeElement typeElt = (TypeElement) elt; int idx = typeElt.getTypeParameters().indexOf(tpe); ClassTree cls = (ClassTree) f.declarationFromElement(typeElt); if (cls == null || cls.getTypeParameters().isEmpty()) { return type.asUse(); } return visitTypeParameter(cls.getTypeParameters().get(idx), f).asUse(); } else if (elt instanceof ExecutableElement) { ExecutableElement exElt = (ExecutableElement) elt; int idx = exElt.getTypeParameters().indexOf(tpe); MethodTree meth = (MethodTree) f.declarationFromElement(exElt); if (meth == null) { return type.asUse(); } AnnotatedTypeVariable result = visitTypeParameter(meth.getTypeParameters().get(idx), f).shallowCopy(); result.setDeclaration(false); return result; } else if (TypesUtils.isCaptured(typeVar)) { return type.asUse(); } else { throw new BugInCF("TypeFromTree.forTypeVariable: not a supported element: " + elt); } }
Source:
<code>protected SQLTranslation findOrCreateTranslation(@Nonnull Mapping field, String lang, String text) { if (!isValidLanguage(lang, field.getName())) { <START> return null; <END> } Optional<SQLTranslation> translation = fetchTranslation(field, lang); if (translation.isPresent()) { return translation.get(); } else { SQLTranslation sqlTranslation = new SQLTranslation(); sqlTranslation.getTranslationData().setOwner(owner.getUniqueName()); sqlTranslation.getTranslationData().setField(field.getName()); sqlTranslation.getTranslationData().setLang(lang); return sqlTranslation; } }</code><technical_language>unreachable code</technical_language>

Target:
protected SQLTranslation findOrCreateTranslation(@Nonnull Mapping field, String lang, String text) { assertValidLanguage(lang, field.getName()); Optional<SQLTranslation> translation = fetchTranslation(field, lang); if (translation.isPresent()) { return translation.get(); } else { SQLTranslation sqlTranslation = new SQLTranslation(); sqlTranslation.getTranslationData().setOwner(owner.getUniqueName()); sqlTranslation.getTranslationData().setField(field.getName()); sqlTranslation.getTranslationData().setLang(lang); return sqlTranslation; } }
Source:
<code>public static String readStream(InputStream is) { StringBuffer sb = new StringBuffer(""); try { byte[] b = new byte[4096]; while (true) { int l = is.read(b, 0, b.length); if (l < 0) break; sb.append(new String(b, 0, l)); } <START> is.close(); <END> } catch (IOException e) { e.printStackTrace(); Assert.fail(e.getMessage()); } return sb.toString(); }</code><technical_language>is.close() in finally block</technical_language>

Target:
public static String readStream(InputStream is) { StringBuffer sb = new StringBuffer(""); try { byte[] b = new byte[4096]; while (true) { int l = is.read(b, 0, b.length); if (l < 0) break; sb.append(new String(b, 0, l)); } } catch (IOException e) { e.printStackTrace(); Assert.fail(e.getMessage()); } finally { try { is.close(); } catch (IOException e) { e.printStackTrace(); Assert.fail(e.getMessage()); } } return sb.toString(); }
Source:
<code>private void untrackHashInvalidationForEventualCache(InvalidationCompleteMessage message) { <START> ehcacheStateService.getInvalidationTracker(message.getCacheId()).getInvalidationMap().computeIfPresent(message.getKey(), (key, count) -> { <END> if (count == 1) { return null; } return count--; }); }</code><technical_language>Slightly unrelated count-- count++ a lines replaced count - 1 count + 1 modify count value</technical_language>

Target:
private void untrackHashInvalidationForEventualCache(InvalidationCompleteMessage message) { ehcacheStateService.getInvalidationTracker(message.getCacheId()).getInvalidationMap().computeIfPresent(message.getKey(), (key, count) -> { if (count == 1) { return null; } return count - 1; }); }