auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public void testInputOperator(boolean hasFailure) throws Exception { END_TUPLE message latch = new CountDownLatch(totalBrokers); int totalCount = 10000; KafkaTestProducer p = new KafkaTestProducer(TEST_TOPIC, hasMultiPartition, hasMultiCluster); p.setSendCount(totalCount); new Thread(p).start(); LocalMode lma = LocalMode.newInstance(); DAG dag = lma.getDAG(); KafkaSinglePortInputOperator node = dag.addOperator("Kafka input", KafkaSinglePortInputOperator.class); node.setInitialPartitionCount(1); node.setTopics(TEST_TOPIC); node.setInitialOffset(AbstractKafkaInputOperator.InitialOffset.EARLIEST.name()); node.setClusters(getClusterConfig()); CollectorModule collector = dag.addOperator("TestMessageCollector", new CollectorModule()); dag.addStream("Kafka message", node.outputPort, collector.inputPort).setLocality(Locality.CONTAINER_LOCAL); final LocalMode.Controller lc = lma.getController(); lc.setHeartbeatMonitoringEnabled(false); if (hasFailure) { setupHasFailureTest(node, dag); } lc.runAsync(); boolean notTimeout = latch.await(40000, TimeUnit.MILLISECONDS); Assert.assertTrue("TIMEOUT: 40s Collected " + tupleCollection, notTimeout); Assert.assertEquals("Tuple count", totalCount, tupleCollection.size()); logger.debug(String.format("Number of emitted tuples: %d", tupleCollection.size())); p.close(); lc.shutdown(); <START> Thread.sleep(5000); <END> }</code><technical_language>Check for condition instead</technical_language>

Target:
public void testInputOperator(boolean hasFailure) throws Exception { END_TUPLE message latch = new CountDownLatch(totalBrokers); int totalCount = 10000; KafkaTestProducer p = new KafkaTestProducer(TEST_TOPIC, hasMultiPartition, hasMultiCluster); p.setSendCount(totalCount); Thread t = new Thread(p); t.start(); LocalMode lma = LocalMode.newInstance(); DAG dag = lma.getDAG(); KafkaSinglePortInputOperator node = dag.addOperator("Kafka input", KafkaSinglePortInputOperator.class); node.setInitialPartitionCount(1); node.setTopics(TEST_TOPIC); node.setInitialOffset(AbstractKafkaInputOperator.InitialOffset.EARLIEST.name()); node.setClusters(getClusterConfig()); CollectorModule collector = dag.addOperator("TestMessageCollector", new CollectorModule()); dag.addStream("Kafka message", node.outputPort, collector.inputPort).setLocality(Locality.CONTAINER_LOCAL); final LocalMode.Controller lc = lma.getController(); lc.setHeartbeatMonitoringEnabled(false); if (hasFailure) { setupHasFailureTest(node, dag); } lc.runAsync(); boolean notTimeout = latch.await(40000, TimeUnit.MILLISECONDS); Assert.assertTrue("TIMEOUT: 40s Collected " + tupleCollection, notTimeout); Assert.assertEquals("Tuple count", totalCount, tupleCollection.size()); logger.debug(String.format("Number of emitted tuples: %d", tupleCollection.size())); t.join(); p.close(); lc.shutdown(); }
Source:
<code>private Repository<Entity> getRepository(String entityTypeId) { if (entityTypeId.equals(ENTITY_TYPE_META_DATA) || entityTypeId.equals(ATTRIBUTE_META_DATA)) { <START> throw new RepositoryNotCapableException(entityTypeId, WRITABLE); <END> } return metaDataService .getRepository(entityTypeId) .orElseThrow(() -> new UnknownRepositoryException(entityTypeId)); }</code><technical_language>for "GET" endpoints, "WRITABLE" is correct in cases</technical_language>

Target:
private Repository<Entity> getRepository(String entityTypeId) { if (entityTypeId.equals(ENTITY_TYPE_META_DATA) || entityTypeId.equals(ATTRIBUTE_META_DATA)) { throw new MetadataAccessException(); } return metaDataService .getRepository(entityTypeId) .orElseThrow(() -> new UnknownRepositoryException(entityTypeId)); }
Source:
<code>public void run() { try { while (true) { try { request.clearProperties(); if (app.getEventQueueId() == null) { register(); } request.setProperty("queue_id", app.getEventQueueId()); request.setProperty("last_event_id", "" + app.getLastEventId()); if (!registeredOrGotEventsThisRun) { request.setProperty("dont_block", "true"); } Response httpResponse =request.execute("GET", "v1/events"); String json = httpResponse.body().string(); JSONObject response = new JSONObject(json); JSONArray events = response.getJSONArray("events"); if (events.length() > 0) { this.processEvents(events); JSONObject lastEvent = events.getJSONObject(events .length() - 1); app.setLastEventId(lastEvent.getInt("id")); failures = 0; } if (!registeredOrGotEventsThisRun) { registeredOrGotEventsThisRun = true; activity.runOnUiThread(new Runnable() { @Override public void run() { activity.onReadyToDisplay(false); } }); } <START> if (httpResponse.code() == 400) { <END> String msg = httpResponse.message(); if (msg.contains("Bad event queue id") || msg.contains("too old")) { Log.w(ASYNC_GET_EVENTS, "Queue dead"); app.setEventQueueId(null); continue; } } } catch (SocketTimeoutException e) { e.printStackTrace(); } catch (IOException e) { if (request.aborting) { Log.i(ASYNC_GET_EVENTS, "Thread aborted"); return; } else { backoff(e); } } catch (JSONException e) { backoff(e); } } } catch (Exception e) { ZLog.logException(e); } }</code><technical_language>need check response code for success earlier, longer throws error</technical_language>

Target:
public void run() { try { while (true) { try { request.clearProperties(); if (app.getEventQueueId() == null) { register(); } request.setProperty("queue_id", app.getEventQueueId()); request.setProperty("last_event_id", "" + app.getLastEventId()); if (!registeredOrGotEventsThisRun) { request.setProperty("dont_block", "true"); } request.setMethodAndUrl("GET", "v1/events"); Response httpResponse = request.execute(); String json = httpResponse.body().string(); if (!httpResponse.isSuccessful()) { String msg = httpResponse.message(); if (msg.contains("Bad event queue id") || msg.contains("too old")) { Log.w(ASYNC_GET_EVENTS, "Queue dead"); app.setEventQueueId(null); } Log.i("WRONG", "run: " + json); continue; } else { Log.i("OkHttp200GE", json); } JSONObject response = new JSONObject(json); JSONArray events = response.getJSONArray("events"); if (events.length() > 0) { this.processEvents(events); JSONObject lastEvent = events.getJSONObject(events .length() - 1); app.setLastEventId(lastEvent.getInt("id")); failures = 0; } if (!registeredOrGotEventsThisRun) { registeredOrGotEventsThisRun = true; activity.runOnUiThread(new Runnable() { @Override public void run() { activity.onReadyToDisplay(false); } }); } } catch (SocketTimeoutException e) { Log.e(TAG, e.getMessage(), e); ZLog.logException(e); } catch (IOException e) { if (request.aborting) { Log.i(ASYNC_GET_EVENTS, "Thread aborted"); return; } else { backoff(e); } } catch (JSONException e) { backoff(e); } Thread.sleep(1000); } } catch (Exception e) { ZLog.logException(e); } }
Source:
<code>protected LeshanServerBuilder createServerBuilder(int clientAwakeTime) { <START> LeshanServerBuilder builder = new LeshanServerBuilder(); <END> builder.setObjectModelProvider(new StaticModelProvider(createObjectModels())); builder.setLocalAddress(new InetSocketAddress(InetAddress.getLoopbackAddress(), 0)); builder.setLocalSecureAddress(new InetSocketAddress(InetAddress.getLoopbackAddress(), 0)); builder.setSecurityStore(new InMemorySecurityStore()); builder.setClientAwakeTimeProvider(new StaticClientAwakeTimeProvider(clientAwakeTime)); return builder; }</code><technical_language>super.createServerBuilder() avoid some duplicate code</technical_language>

Target:
protected LeshanServerBuilder createServerBuilder(int clientAwakeTime) { LeshanServerBuilder builder = super.createServerBuilder(); builder.setClientAwakeTimeProvider(new StaticClientAwakeTimeProvider(clientAwakeTime)); return builder; }
Source:
<code>public Predicate<Cell> apply(Cell deleteMarker) { <START> checkArgument(CellUtil.isDelete(deleteMarker), "expecting delete marker cell."); <END> switch (KeyValue.Type.codeToType(deleteMarker.getTypeByte())) { case Delete: return new ExactTimestampPredicate(false , deleteMarker); case DeleteFamilyVersion: return new ExactTimestampPredicate(true , deleteMarker); case DeleteColumn: return new TimestampRangePredicate(false , deleteMarker); case DeleteFamily: return new TimestampRangePredicate(true , deleteMarker); default: throw new IllegalStateException( "Unexpected type byte: " + deleteMarker.getTypeByte()); } }</code><technical_language>this: <LINK_0> if keyValue.Type is DeleteFamilyVersion, this check fail. Remove this checkArgument()</technical_language>

Target:
public Predicate<Cell> apply(Cell deleteMarker) { checkArgument(CellUtil.isDelete(deleteMarker), "expecting delete marker cell."); switch (KeyValue.Type.codeToType(deleteMarker.getTypeByte())) { case Delete: return Predicates.and( new MatchQualifier(deleteMarker), new MatchExactTimestamp(deleteMarker)); case DeleteFamilyVersion: return new MatchExactTimestamp(deleteMarker); case DeleteColumn: return Predicates.and( new MatchQualifier(deleteMarker), new MatchTimestampRangeByUpperBound(deleteMarker)); case DeleteFamily: return new MatchTimestampRangeByUpperBound(deleteMarker); default: throw new IllegalStateException( "Unexpected type byte: " + deleteMarker.getTypeByte()); } }
Source:
<code>private void uninstallAllFeatures(Application application) { try { Set<Feature> features = application.getFeatures(); for (Feature feature : features) { if (featuresService.isInstalled(feature) && isPermittedToViewFeature(feature.getName())) { tryUninstallFeature(feature); } } } catch (ApplicationServiceException ase) { LOGGER.warn("Error obtaining feature list from application", ase); <START> } <END> }</code><technical_language>a nice streaming moved exception handling in new tryUninstallfeature() method</technical_language>

Target:
private void uninstallAllFeatures(Application application) { try { application .getFeatures() .stream() .filter(Objects::nonNull) .filter(featuresService::isInstalled) .filter(f -> isPermittedToViewFeature(f.getName())) .forEach(this::tryUninstallFeature); } catch (ApplicationServiceException ase) { LOGGER.warn("Error obtaining feature list from application", ase); } }
Source:
<code>public void deserializeOnto(Object target, Map<FieldMetadata<?, ?>, PersistedData> values, DeserializationContext context, DeserializeFieldCheck check) { <START> values.entrySet().stream().filter(field -> check.shouldDeserialize(classMetadata, field.getKey())).forEach(field -> { <END> deserializeOnto(target, field.getKey(), field.getValue(), context); }); }</code><technical_language>original version, I find easier read called often</technical_language>

Target:
public void deserializeOnto(Object target, Map<FieldMetadata<?, ?>, PersistedData> values, DeserializationContext context, DeserializeFieldCheck check) { for (Map.Entry<FieldMetadata<?, ?>, PersistedData> field : values.entrySet()) { if (check.shouldDeserialize(classMetadata, field.getKey())) { deserializeOnto(target, field.getKey(), field.getValue(), context); } } }
Source:
<code>public Object execute(ExecutionEvent event) throws ExecutionException { Repository[] repos = getRepositories(event); <START> if (repos.length != repos.length) <END> return null; GitSynchronizeDataSet gsdSet = new GitSynchronizeDataSet(); for (Repository repo : repos) { try { gsdSet.add(new GitSynchronizeData(repo, HEAD, HEAD, true)); } catch (IOException e) { Activator.handleError(e.getMessage(), e, true); } } GitModelSynchronize.launch(gsdSet, getSelectedResources(event)); return null; }</code><technical_language>achive repos.length != repos.length repos.length == 0</technical_language>

Target:
public Object execute(ExecutionEvent event) throws ExecutionException { Repository[] repos = getRepositories(event); if (repos.length == 0) return null; GitSynchronizeDataSet gsdSet = new GitSynchronizeDataSet(); for (Repository repo : repos) { try { gsdSet.add(new GitSynchronizeData(repo, HEAD, HEAD, true)); } catch (IOException e) { Activator.handleError(e.getMessage(), e, true); } } GitModelSynchronize.launch(gsdSet, getSelectedResources(event)); return null; }
Source:
<code>protected void waitForTasksToBeCleared() throws InterruptedException { log.info("waiting for all tasks related to domain {0} to be cleared (if exist) before attempting to deactivate", getStorageDomainId()); while (true) { TimeUnit.SECONDS.sleep(3); List<Guid> tasks = getDbFacade().getAsyncTaskDao().getAsyncTaskIdsByEntity(getStorageDomainId()); if (tasks.isEmpty()) { log.info("no tasks for the deactivated domain {0}, proceeding with deactivation", getStorageDomainId()); return; } else { <START> log.info("tasks {0} were found for domain {1}, waiting before attempting to deactivate", tasks, getStorageDomainId()); <END> } } }</code><technical_language>logging infra changed - please instead of numbered params</technical_language>

Target:
protected void waitForTasksToBeCleared() throws InterruptedException { log.info("waiting for all tasks related to domain to be cleared (if exist) before attempting to deactivate", getStorageDomainId()); while (true) { TimeUnit.SECONDS.sleep(3); List<Guid> tasks = getDbFacade().getAsyncTaskDao().getAsyncTaskIdsByEntity(getStorageDomainId()); if (tasks.isEmpty()) { log.info("no tasks for the deactivated domain {}, proceeding with deactivation", getStorageDomainId()); return; } else { log.info("tasks were found for domain {}, waiting before attempting to deactivate", tasks, getStorageDomainId()); } } }
Source:
<code>public void whenQueryWithAggregation_thenReturnCustomResult() { List<CommentCount> commentsYear = commentRepository.countTotalCommentsByYearClass(); CommentCount countYear2019 = commentsYear.get(0); Assert.assertTrue(countYear2019.getYear().equals(2019)); Assert.assertEquals(countYear2019.getTotal().longValue(), 1l); CommentCount countYear2018 = commentsYear.get(1); Assert.assertTrue(countYear2018.getYear().equals(2018)); Assert.assertEquals(countYear2018.getTotal().longValue(), 2l); CommentCount countYear2017 = commentsYear.get(2); Assert.assertTrue(countYear2017.getYear().equals(2017)); <START> Assert.assertEquals(countYear2017.getTotal().longValue(), 1l); <END> }</code><technical_language>static import Assert here. assertTrue do job of assertEquals. Note assertEquals - expected first</technical_language>

Target:
public void whenQueryWithAggregation_thenReturnCustomResult() { List<CommentCount> commentCountsByYear = commentRepository.countTotalCommentsByYearClass(); CommentCount countYear2019 = commentCountsByYear.get(0); assertThat(countYear2019.getYear(), is(Integer.valueOf(2019))); assertThat(countYear2019.getTotal(), is(1l)); CommentCount countYear2018 = commentCountsByYear.get(1); assertThat(countYear2018.getYear(), is(Integer.valueOf(2018))); assertThat(countYear2018.getTotal(), is(2l)); CommentCount countYear2017 = commentCountsByYear.get(2); assertThat(countYear2017.getYear(), is(Integer.valueOf(2017))); assertThat(countYear2017.getTotal(), is(1l)); }
Source:
<code>public void newLabel() { logger.info("Navigating to New Label page"); <START> if (isBrowserActive()) { <END> runBrowserOperation(() -> { if (!driver.getCurrentUrl().equals(GitHubURL.getPathForNewLabel())) { driver.get(GitHubURL.getPathForNewLabel()); } }); } else { resetBrowser(); newLabel(); } }</code><technical_language>move this check runBrowserOperation. update in place time. guaranteed of driver.getCurrentUrl() null/empty in body of tasks, etc</technical_language>

Target:
public void newLabel() { logger.info("Navigating to New Label page"); runBrowserOperation(() -> { if (!driver.getCurrentUrl().equals(GitHubURL.getPathForNewLabel())) { driver.get(GitHubURL.getPathForNewLabel()); } }); }
Source:
<code>public BiomeBlockReplacerConfig createBiomeBlockReplacerConfig() { BiomeBlockReplacerConfig conf = new BiomeBlockReplacerConfig(); conf.fillDefaults(); <START> conf.set(CubicChunks.MODID, "ocean_height", this.waterLevel); <END> return conf; }</code><technical_language>"ocean_height" instead of water level? is a height of a body of water. closest height depth, want</technical_language>

Target:
public BiomeBlockReplacerConfig createBiomeBlockReplacerConfig() { BiomeBlockReplacerConfig conf = new BiomeBlockReplacerConfig(); conf.fillDefaults(); conf.set(CubicChunks.MODID, "ocean_level", this.waterLevel); return conf; }
Source:
<code>public void handleEvent(MotechEvent event) { LOGGER.info("Daily password reset reminder triggered"); if (settingService.isPasswordResetReminderEnabled()) { int daysTilReminder = daysTilReminder(); <START> for (MotechUser user : allUsers.retrieveAll()) { <END> if (daysWithoutPasswordChange(user) == daysTilReminder) { sendPasswordReminderEvent(user); } } } }</code><technical_language>debug username, variables comparing line 42</technical_language>

Target:
public void handleEvent(MotechEvent event) { LOGGER.info("Daily password reset reminder triggered"); if (settingService.isPasswordResetReminderEnabled()) { int daysTillPasswordChange = settingService.getNumberOfDaysToChangePassword(); int daysTillReminder = daysTillPasswordChange - settingService.getNumberOfDaysForReminder(); for (MotechUser user : allUsers.retrieveAll()) { int daysWithoutPasswordChange = daysWithoutPasswordChange(user); LOGGER.debug("User hasn't changed password in days. Notification should be sent at day {}", user.getUserName(), daysWithoutPasswordChange, daysTillReminder); if (daysWithoutPasswordChange == daysTillReminder) { sendPasswordReminderEvent(user, daysTillPasswordChange); } } } }
Source:
<code>public void should_decode_list_with_null_elements() { when(elementCodec.decode(Bytes.fromHexString("0x0002"), ProtocolVersion.DEFAULT)).thenReturn(2); <START> assertThat(decode("0x" + "00000002" + "FFFFFFFF" + "000000020002")).containsExactly(null, 2); <END> }</code><technical_language>This is cryptic, about: assertThat( decode( "0x" + "00000002" // number of elements + "FFFFFFFF" // size of element 1 (null) + "00000002" // size of element 2 (2 bytes) + "0002" // element 2 )) .containsExactly(null, 2);</technical_language>

Target:
public void should_decode_list_with_null_elements() { when(elementCodec.decode(Bytes.fromHexString("0x0002"), ProtocolVersion.DEFAULT)).thenReturn(2); assertThat( decode( "0x" + "00000002" + "FFFFFFFF" + "00000002" + "0002" )) .containsExactly(null, 2); }
Source:
<code><START> public static final KeyValueStoreListener create() { <END> return new ClientKeyValueStoreListener(); }</code><technical_language>need final in static methods</technical_language>

Target:
public static KeyValueStoreListener create() { return new ClientKeyValueStoreListener(); }
Source:
<code>public void testBuilderWithNullValues() { FeedbackResponseCommentAttributes feedbackAttributes = FeedbackResponseCommentAttributes .builder("course", "name", "questionId", <START> "responseId", "email") <END> .withShowGiverNameTo(null) .withShowCommentTo(null) .withLastEditorEmail(null) .withReceiverSection(null) .withGiverSection(null) .withCommentText(null) .withCreatedAt(new Date()) .withLastEditedAt(null) .withFeedbackResponseCommentId(null) .withVisibilityFollowingFeedbackQuestion(null) .build(); assertEquals(feedbackAttributes.giverSection, "None"); assertEquals(feedbackAttributes.receiverSection, "None"); assertEquals(feedbackAttributes.lastEditorEmail, feedbackAttributes.giverEmail); assertEquals(feedbackAttributes.lastEditedAt, feedbackAttributes.createdAt); assertEquals(feedbackAttributes.commentText, new Text("")); assertTrue(feedbackAttributes.isVisibilityFollowingFeedbackQuestion); }</code><technical_language>This fine previous line</technical_language>

Target:
public void testBuilderWithNullValues() { FeedbackResponseCommentAttributes feedbackAttributes = FeedbackResponseCommentAttributes .builder("course", "name", "email", new Text("")) .withFeedbackResponseId(null) .withFeedbackQuestionId(null) .withShowGiverNameTo(null) .withShowCommentTo(null) .withLastEditorEmail(null) .withReceiverSection(null) .withGiverSection(null) .withCreatedAt(new Date()) .withLastEditedAt(null) .withFeedbackResponseCommentId(null) .withVisibilityFollowingFeedbackQuestion(null) .build(); assertEquals(feedbackAttributes.giverSection, "None"); assertEquals(feedbackAttributes.receiverSection, "None"); assertEquals(feedbackAttributes.lastEditorEmail, feedbackAttributes.giverEmail); assertEquals(feedbackAttributes.lastEditedAt, feedbackAttributes.createdAt); assertTrue(feedbackAttributes.isVisibilityFollowingFeedbackQuestion); }
Source:
<code><START> public boolean restartApp(int appId) { <END> return true; }</code><technical_language>log some message restart cmd is supported</technical_language>

Target:
public boolean restartApp(int appId) { String message = "Restarting the whole topology is not supported yet. " + "Please kill and resubmit the topology."; LOG.log(Level.SEVERE, message); return false; }
Source:
<code>protected void doDeletePath(RepositoryPath repositoryPath, boolean force) throws IOException { Repository repository = repositoryPath.getFileSystem().getRepository(); if (!repository.isTrashEnabled()) { Files.deleteIfExists(repositoryPath.getTarget()); return; } RepositoryPath trashPath = getTrashPath(repositoryPath); Files.move(repositoryPath.getTarget(), trashPath.getTarget(), StandardCopyOption.REPLACE_EXISTING); <START> if (force && repository.isAllowsDelete()) <END> { deleteTrash(repositoryPath); } }</code><technical_language>If I remember correctly exact **force delete** feature, **delete**. @carlspring note this</technical_language>

Target:
protected void doDeletePath(RepositoryPath repositoryPath, boolean force) throws IOException { Repository repository = repositoryPath.getFileSystem().getRepository(); if (!repository.isTrashEnabled()) { Files.deleteIfExists(repositoryPath.getTarget()); return; } RepositoryPath trashPath = getTrashPath(repositoryPath); Files.move(repositoryPath.getTarget(), trashPath.getTarget(), StandardCopyOption.REPLACE_EXISTING); if (force && repository.allowsForceDeletion()) { deleteTrash(repositoryPath); } }
Source:
<code>public Optional<FactoryDto> createFactoryFromDevfile( String devfileLocation, FileContentProvider fileContentProvider) throws BadRequestException, ServerException { if (devfileLocation == null) { return Optional.empty(); } final String devfileYamlContent = urlFetcher.fetchSafely(devfileLocation); if (isNullOrEmpty(devfileYamlContent)) { return Optional.empty(); } try { Devfile devfile = devfileManager.parse(devfileYamlContent); WorkspaceConfigImpl wsConfig = devfileManager.createWorkspaceConfig(devfile, fileContentProvider); return Optional.of( newDto(FactoryDto.class) .withV(CURRENT_VERSION) .withWorkspace(DtoConverter.asDto(wsConfig))); } catch (DevfileException e) { throw new BadRequestException( <START> "Error occurred during creation a workspace from workspace located at `" <END> + devfileLocation + "`. Cause: " + e.getMessage()); } }</code><technical_language>Workspace workspace</technical_language>

Target:
public Optional<FactoryDto> createFactoryFromDevfile( String devfileLocation, FileContentProvider fileContentProvider) throws BadRequestException, ServerException { if (devfileLocation == null) { return Optional.empty(); } final String devfileYamlContent = urlFetcher.fetchSafely(devfileLocation); if (isNullOrEmpty(devfileYamlContent)) { return Optional.empty(); } try { Devfile devfile = devfileManager.parse(devfileYamlContent); WorkspaceConfigImpl wsConfig = devfileManager.createWorkspaceConfig(devfile, fileContentProvider); return Optional.of( newDto(FactoryDto.class) .withV(CURRENT_VERSION) .withWorkspace(DtoConverter.asDto(wsConfig))); } catch (DevfileException e) { throw new BadRequestException( "Error occurred during creation a workspace from devfile located at `" + devfileLocation + "`. Cause: " + e.getMessage()); } }
Source:
<code>private Map<ExecutionResultNode, List<ExecutionResultZipper>> zipperWithSameParent(List<ExecutionResultZipper> zippers) { return zippers.stream().collect(Collectors.groupingBy(ExecutionResultZipper::getParent)); <START> } <END></code><technical_language>TODO ^ I put in a supplier of Map</technical_language>

Target:
private Map<ExecutionResultNode, List<ExecutionResultZipper>> zipperWithSameParent(List<ExecutionResultZipper> zippers) { return zippers.stream().collect(Collectors.groupingBy(ExecutionResultZipper::getParent, LinkedHashMap::new, mapping(Function.identity(), toList()))); }
Source:
<code>public Object postProcessAfterInitialization(Object bean, String beanName) throws BeansException { <START> if (bean instanceof Advised) { <END> for (Advisor advisor : ((Advised) bean).getAdvisors()) { Advice advice = advisor.getAdvice(); if (advice instanceof MessageHandlerMetrics) { return bean; } } } if (IntegrationContextUtils.INTEGRATION_MESSAGE_HISTORY_CONFIGURER_BEAN_NAME.equals(beanName) && bean instanceof MessageHistoryConfigurer) { this.messageHistoryConfigurer = (MessageHistoryConfigurer) bean; return bean; } if (bean instanceof MessageHandlerMetrics) { if (this.handlerInAnonymousWrapper(bean) != null) { if (logger.isDebugEnabled()) { logger.debug("Skipping " + beanName + " because it wraps another handler"); } return bean; } MessageHandlerMetrics monitor = (MessageHandlerMetrics) extractTarget(bean); monitor.enableStats(true); handlers.add(monitor); } if (bean instanceof MessageSourceMetrics) { MessageSourceMetrics monitor = (MessageSourceMetrics) extractTarget(bean); monitor.enableCounts(true); sources.add(monitor); } if (bean instanceof MessageChannel && bean instanceof MessageChannelMetrics && bean instanceof NamedComponent) { MessageChannelMetrics monitor = (MessageChannelMetrics) extractTarget(bean); monitor.enableStats(true); channels.add(monitor); } if (bean instanceof MessageProducer && bean instanceof Lifecycle) { Lifecycle target = (Lifecycle) extractTarget(bean); if (!(target instanceof AbstractReplyProducingMessageHandler)) { this.inboundLifecycleMessageProducers.add(target); } } return bean; }</code><technical_language>this if is redundant already</technical_language>

Target:
public Object postProcessAfterInitialization(Object bean, String beanName) throws BeansException { if (IntegrationContextUtils.INTEGRATION_MESSAGE_HISTORY_CONFIGURER_BEAN_NAME.equals(beanName) && bean instanceof MessageHistoryConfigurer) { this.messageHistoryConfigurer = (MessageHistoryConfigurer) bean; return bean; } if (bean instanceof MessageHandlerMetrics) { if (this.handlerInAnonymousWrapper(bean) != null) { if (logger.isDebugEnabled()) { logger.debug("Skipping " + beanName + " because it wraps another handler"); } return bean; } MessageHandlerMetrics monitor = (MessageHandlerMetrics) extractTarget(bean); handlers.add(monitor); } if (bean instanceof MessageSourceMetrics) { MessageSourceMetrics monitor = (MessageSourceMetrics) extractTarget(bean); sources.add(monitor); } if (bean instanceof MessageChannel && bean instanceof MessageChannelMetrics && bean instanceof NamedComponent) { MessageChannelMetrics monitor = (MessageChannelMetrics) extractTarget(bean); channels.add(monitor); } if (bean instanceof MessageProducer && bean instanceof Lifecycle) { Lifecycle target = (Lifecycle) extractTarget(bean); if (!(target instanceof AbstractReplyProducingMessageHandler)) { this.inboundLifecycleMessageProducers.add(target); } } return bean; }
Source:
<code>public void Case() { <START> <<<<<<< HEAD <END> assertEquals(ImmutableList.of(1, 2, 2, 2, 2, 2), query().from(cat).orderBy(cat.id.asc()) .select(cat.name.when("Bob123").then(1).otherwise(2)).fetch()); }</code><technical_language>committed merge markers</technical_language>

Target:
public void Case() { assertEquals(ImmutableList.of(1, 2, 2, 2, 2, 2), query().from(cat).orderBy(cat.id.asc()) .select(cat.name.when("Bob123").then(1).otherwise(2)).fetch()); }
Source:
<code>public Object getValue() throws CouldNotGenerateValueException { try { return fMethod.invokeExplosively(null); } catch (IllegalArgumentException e) { throw new RuntimeException( "unexpected: argument length is checked"); } catch (IllegalAccessException e) { throw new RuntimeException( "unexpected: getMethods returned an inaccessible method"); } catch (Throwable t) { DataPoint annotation = fMethod.getAnnotation(DataPoint.class); if (annotation != null) { for (Class<? extends Throwable> ignorable : annotation.ignoredExceptions()) { <START> Assume.assumeThat(t, not(instanceOf(ignorable))); <END> } } throw new CouldNotGenerateValueException(t); } }</code><technical_language>Clever</technical_language>

Target:
public Object getValue() throws CouldNotGenerateValueException { try { return fMethod.invokeExplosively(null); } catch (IllegalArgumentException e) { throw new RuntimeException( "unexpected: argument length is checked"); } catch (IllegalAccessException e) { throw new RuntimeException( "unexpected: getMethods returned an inaccessible method"); } catch (Throwable throwable) { DataPoint annotation = fMethod.getAnnotation(DataPoint.class); Assume.assumeTrue(annotation == null || !isAssignableToAnyOf(annotation.ignoredExceptions(), throwable)); throw new CouldNotGenerateValueException(throwable); } }
Source:
<code>public void run() { super.run(); Bugsnag.addMetadata("persist", "keep", "foo"); Bugsnag.addMetadata("persist", "remove", "bar"); Bugsnag.addMetadata("remove", "foo", "bar"); activate(); Handler main = new Handler(Looper.getMainLooper()); main.postDelayed(new Runnable() { @Override public void run() { Bugsnag.clearMetadata("remove"); Bugsnag.clearMetadata("persist", "remove"); activate(); } <START> }, 1500); <END> }</code><technical_language>this reduced smaller, e.g. 150</technical_language>

Target:
public void run() { super.run(); Bugsnag.addMetadata("persist", "keep", "foo"); Bugsnag.addMetadata("persist", "remove", "bar"); Bugsnag.addMetadata("remove", "foo", "bar"); activate(); Handler main = new Handler(Looper.getMainLooper()); main.postDelayed(new Runnable() { @Override public void run() { Bugsnag.clearMetadata("remove"); Bugsnag.clearMetadata("persist", "remove"); activate(); } }, 150); }
Source:
<code>public void init() throws ServiceInitializationException { <START> File containersDirectory = playOnLinuxContext.makeContainersPath(); <END> containersDirectoryObservable = new DirectoryWatcherFiles(executorService, containersDirectory); containersDirectoryObservable.setOnChange(this::update); }</code><technical_language>Please final</technical_language>

Target:
public void init() throws ServiceInitializationException { final File containersDirectory = playOnLinuxContext.makeContainersPath(); containersDirectoryObservable = new DirectoryWatcherFiles(executorService, containersDirectory); containersDirectoryObservable.setOnChange(this::update); }
Source:
<code>public void closeConnection() { try { if (reader != null) reader.stopserver(); } catch (IOException e) { <START> e.printStackTrace(); <END> } }</code><technical_language>please remove TODO - please propper logging instead of printStackTrace()</technical_language>

Target:
public void closeConnection() { try { if (reader != null) reader.stopserver(); } catch (IOException e) { logger.error("Error at closeconnection", e); } }
Source:
<code>public void onReceive(Context context, Intent intent) { <START> MixpanelAPI.trackPushNotificationEventFromIntent( <END> context, intent, "$push_notification_dismissed" ); }</code><technical_language>check action intent here? common practice to: if (intent.getAction() == ...) { }</technical_language>

Target:
public void onReceive(Context context, Intent intent) { String action = intent.getAction(); if (action != null && action.equals(MixpanelPushNotification.PUSH_DISMISS_ACTION)) { MixpanelAPI.trackPushNotificationEventFromIntent( context, intent, "$push_notification_dismissed" ); } }
Source:
<code>public int getNumberOfChildProcesses(int processId) { try { <START> return ServiceManager.getProcessService().getById(processId).getChildren().size(); <END> } catch (DAOException e) { Helper.setErrorMessage(ERROR_LOADING_ONE, new Object[] {ObjectType.PROCESS.getTranslationSingular(), processId }, logger, e); return 0; } }</code><technical_language>Please write a method ProcessService.getNumberOfChildren(process) is calling ProcessDAO count database</technical_language>

Target:
public int getNumberOfChildProcesses(int processId) { try { return ServiceManager.getProcessService().getNumberOfChildren(processId); } catch (DAOException e) { Helper.setErrorMessage(ERROR_LOADING_ONE, new Object[] {ObjectType.PROCESS.getTranslationSingular(), processId }, logger, e); return 0; } }
Source:
<code>private void setupDispatcherChain(double startGain, double startBpm, double secondsToSkip) throws EncoderException, LineUnavailableException { inputStream = Streamer.stream(track.getPath(), attributes); tarsosStream = new JVMAudioInputStream(inputStream); audioPlayer = new AudioPlayer(format); wsola = new WaveformSimilarityBasedOverlapAdd(newParameters()); gainProcessor = new GainProcessor(startGain); dispatcher = new CustomAudioDispatcher(tarsosStream, wsola.getInputBufferSize(), wsola.getOverlap()); progressProcessor = new ProgressProcessor(); <START> progressProcessor.setUp(track.getDuration(), this.secondsToSkip, pcc); <END> final TrackProcessor thisProcessor = this; skipProcessor = new SkipAudioProcessor(secondsToSkip, true, new SkipAudioProcessorCallback() { @Override public void onFinished() { thisProcessor.setState(PlayerState.READY); } }); dispatcher.addAudioProcessor(this); dispatcher.addAudioProcessor(skipProcessor); wsola.setDispatcher(dispatcher); dispatcher.addAudioProcessor(wsola); dispatcher.addAudioProcessor(gainProcessor); dispatcher.addAudioProcessor(progressProcessor); dispatcher.addAudioProcessor(audioPlayer); thread = new Thread(dispatcher); thread.start(); }</code><technical_language>I remove setUp method move of this constructor</technical_language>

Target:
private void setupDispatcherChain(double startGain, double startBpm, double secondsToSkip) throws EncoderException, LineUnavailableException { inputStream = Streamer.stream(track.getPath(), attributes); tarsosStream = new JVMAudioInputStream(inputStream); audioPlayer = new AudioPlayer(format); wsola = new WaveformSimilarityBasedOverlapAdd(newParameters()); gainProcessor = new GainProcessor(startGain); dispatcher = new CustomAudioDispatcher(tarsosStream, wsola.getInputBufferSize(), wsola.getOverlap()); progressProcessor = new ProgressProcessor(transitionTime, this.secondsToSkip, pcc); final TrackProcessor thisProcessor = this; skipProcessor = new SkipAudioProcessor(secondsToSkip, true, new SkipAudioProcessorCallback() { @Override public void onFinished() { thisProcessor.setState(PlayerState.READY); } }); dispatcher.addAudioProcessor(this); dispatcher.addAudioProcessor(skipProcessor); wsola.setDispatcher(dispatcher); dispatcher.addAudioProcessor(wsola); dispatcher.addAudioProcessor(gainProcessor); dispatcher.addAudioProcessor(progressProcessor); dispatcher.addAudioProcessor(audioPlayer); thread = new Thread(dispatcher); thread.start(); }
Source:
<code>public void rightClickAir(GlowPlayer player, ItemStack holding) { if (player.getCurrentFishingHook() == null) { Location location = calculateSpawnLocation(player); FishHook fishHook = new GlowFishingHook(location, holding); fishHook.setShooter(player); player.setCurrentFishingHook((GlowFishingHook) fishHook); } else { player.getCurrentFishingHook().reelIn(); player.setCurrentFishingHook(null); } <START> <END> }</code><technical_language>Remove whitespace</technical_language>

Target:
public void rightClickAir(GlowPlayer player, ItemStack holding) { if (player.getCurrentFishingHook() == null) { Location location = calculateSpawnLocation(player); FishHook fishHook = new GlowFishingHook(location, holding, player); fishHook.setShooter(player); player.setCurrentFishingHook((GlowFishingHook) fishHook); } else { player.getCurrentFishingHook().reelIn(); player.setCurrentFishingHook(null); } }
Source:
<code>public CatalogKey getKey() { <START> return api$key; <END> }</code><technical_language>this</technical_language>

Target:
public CatalogKey getKey() { return this.api$key; }
Source:
<code>public void setUp() throws IOException { DfsRepositoryDescription desc = new DfsRepositoryDescription("test"); git = new TestRepository<>(new InMemoryRepository(desc)); repo = git.getRepository(); odb = repo.getObjectDatabase(); ticks = 0; mockSystemReader = new MockSystemReader() { @Override public long getCurrentTime() { <START> return super.getCurrentTime() + ticks++; <END> } }; SystemReader.setInstance(mockSystemReader); }</code><technical_language>tick() for this: tick(1); return super.getCurrentTime(); TestRepository operations call tick mockSystemReader, is a more resilient (since behavior change based number of times getCurrentTime called). TestRepository this MockSystemReader? Repository db = new InMemoryRepository(desc); git = new TestRepository<>(db, new RevWalk(db), mockSystemReader);</technical_language>

Target:
public void setUp() throws IOException { DfsRepositoryDescription desc = new DfsRepositoryDescription("test"); git = new TestRepository<>(new InMemoryRepository(desc)); repo = git.getRepository(); odb = repo.getObjectDatabase(); mockSystemReader = new MockSystemReader(); SystemReader.setInstance(mockSystemReader); }
Source:
<code>public void executePatchRequest() throws Exception { final GhJson json = new GhJson( new FakeRequest().withBody("{\"body\":\"hi\"}") ); json.patch( Json.createObjectBuilder() .add("content", "hi you!") .build() ); <START> MatcherAssert.assertThat( <END> json.fetch().toString(), Matchers.containsString("hi") ); }</code><technical_language>testing patch() good. Instead of calling fetch() [MkContainer](<LINK_0>, give ability assert, HTTP request required JSON</technical_language>

Target:
public void executePatchRequest() throws Exception { final MkContainer container = new MkGrizzlyContainer().next( new MkAnswer.Simple(HttpURLConnection.HTTP_OK, "{\"body\":\"hj\"}") ).start(); final GhJson json = new GhJson(new ApacheRequest(container.home())); json.patch( Json.createObjectBuilder() .add("content", "hi you!") .build() ); MatcherAssert.assertThat( container.take().method(), Matchers.equalTo("PATCH") ); container.stop(); }
Source:
<code>public Map<String, Object> prepareGlusterDisk(VM vm, DiskImage diskImage, Map<String, Object> struct) { <START> this.getNetworkDiskType(vm, <END> diskImage).ifPresent((diskType) -> struct.put(VdsProperties.DiskType, diskType)); return struct; }</code><technical_language>project's conventions, drop "this" here</technical_language>

Target:
public Map<String, Object> prepareGlusterDisk(VM vm, DiskImage diskImage, Map<String, Object> struct) { getNetworkDiskType(vm, diskImage).ifPresent((diskType) -> struct.put(VdsProperties.DiskType, diskType)); return struct; }
Source:
<code>public List<AdminEmailAttributes> getSentAdminEmails(){ List<AdminEmailAttributes> list = new LinkedList<AdminEmailAttributes>(); Query q = getPM().newQuery(AdminEmail.class); q.declareParameters("boolean isInTrashBinParam"); q.setFilter("isInTrashBin == isInTrashBinParam && sendDate != null"); @SuppressWarnings("unchecked") List<AdminEmail> adminEmailList = (List<AdminEmail>) q.execute(false); if (adminEmailList.isEmpty() || JDOHelper.isDeleted(adminEmailList.get(0))) { return list; } Iterator<AdminEmail> it = adminEmailList.iterator(); while(it.hasNext()){ AdminEmail adminEmail = it.next(); <START> if (!JDOHelper.isDeleted(adminEmail)) { <END> list.add(new AdminEmailAttributes(adminEmail)); } } return list; }</code><technical_language>line 226, another check for JDOHelper.isDeleted, is relevant</technical_language>

Target:
public List<AdminEmailAttributes> getSentAdminEmails(){ List<AdminEmailAttributes> list = new LinkedList<AdminEmailAttributes>(); Query q = getPM().newQuery(AdminEmail.class); q.declareParameters("boolean isInTrashBinParam"); q.setFilter("isInTrashBin == isInTrashBinParam && sendDate != null"); @SuppressWarnings("unchecked") List<AdminEmail> adminEmailList = (List<AdminEmail>) q.execute(false); if (adminEmailList.isEmpty()) { return list; } Iterator<AdminEmail> it = adminEmailList.iterator(); while(it.hasNext()){ AdminEmail adminEmail = it.next(); if (!JDOHelper.isDeleted(adminEmail)) { list.add(new AdminEmailAttributes(adminEmail)); } } return list; }
Source:
<code>public static void assertThrows( String message, Class<? extends Exception> expected, Callable callable) { try { callable.call(); Assert.fail("No exception was thrown (" + message + "), expected: " + expected.getName()); } catch (Exception actual) { if (!actual.equals(expected)) { System.err.println("Caught an unexpected exception:"); actual.printStackTrace(System.err); } <START> Assert.assertEquals(message, expected, actual.getClass()); <END> } }</code><technical_language>possibly addSuppressed exception thrown assertEquals</technical_language>

Target:
public static void assertThrows( String message, Class<? extends Exception> expected, Callable callable) { try { callable.call(); Assert.fail("No exception was thrown (" + message + "), expected: " + expected.getName()); } catch (Exception actual) { try { Assert.assertEquals(message, expected, actual.getClass()); } catch (AssertionError e) { e.addSuppressed(actual); throw e; } } }
Source:
<code>public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { rootView = inflater.inflate(R.layout.fragment_syncpayload, container, false); ButterKnife.bind(this, rootView); mSyncLoanRepaymentTransactionPresenter.attachView(this); LinearLayoutManager mLayoutManager = new LinearLayoutManager(getActivity()); mLayoutManager.setOrientation(LinearLayoutManager.VERTICAL); rv_loan_repayment.setLayoutManager(mLayoutManager); rv_loan_repayment.setHasFixedSize(true); rv_loan_repayment.setAdapter(mSyncLoanRepaymentAdapter); <START> swipeRefreshLayout.setColorSchemeResources(R.color.blue_light, R.color.green_light, R <END> .color.orange_light, R.color.red_light); swipeRefreshLayout.setOnRefreshListener(new SwipeRefreshLayout.OnRefreshListener() { @Override public void onRefresh() { mSyncLoanRepaymentTransactionPresenter.loadDatabaseLoanRepaymentTransactions(); mSyncLoanRepaymentTransactionPresenter.loanPaymentTypeOption(); if (swipeRefreshLayout.isRefreshing()) swipeRefreshLayout.setRefreshing(false); } }); mSyncLoanRepaymentTransactionPresenter.loadDatabaseLoanRepaymentTransactions(); mSyncLoanRepaymentTransactionPresenter.loanPaymentTypeOption(); return rootView; }</code><technical_language>Pass array instead of typing colors here. this <resources> <array name="swipeRefreshColors"> <item>@color/pink</item> <item>@color/green</item> </array> </resources> swipeRefreshLayout.setColorSchemeColors(getResources().getIntArray(R.array.swipeRefreshColors));</technical_language>

Target:
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { rootView = inflater.inflate(R.layout.fragment_syncpayload, container, false); ButterKnife.bind(this, rootView); mSyncLoanRepaymentTransactionPresenter.attachView(this); LinearLayoutManager mLayoutManager = new LinearLayoutManager(getActivity()); mLayoutManager.setOrientation(LinearLayoutManager.VERTICAL); rv_loan_repayment.setLayoutManager(mLayoutManager); rv_loan_repayment.setHasFixedSize(true); rv_loan_repayment.setAdapter(mSyncLoanRepaymentAdapter); swipeRefreshLayout.setColorSchemeColors(getActivity() .getResources().getIntArray(R.array.swipeRefreshColors)); swipeRefreshLayout.setOnRefreshListener(new SwipeRefreshLayout.OnRefreshListener() { @Override public void onRefresh() { mSyncLoanRepaymentTransactionPresenter.loadDatabaseLoanRepaymentTransactions(); mSyncLoanRepaymentTransactionPresenter.loanPaymentTypeOption(); if (swipeRefreshLayout.isRefreshing()) swipeRefreshLayout.setRefreshing(false); } }); mSyncLoanRepaymentTransactionPresenter.loadDatabaseLoanRepaymentTransactions(); mSyncLoanRepaymentTransactionPresenter.loanPaymentTypeOption(); return rootView; }
Source:
<code>private SelectionAdapter onExplanationClicked(final Control connectionsPane, final Control explanationPane) { return new SelectionAdapter() { public void widgetSelected(SelectionEvent e) { ConnectionWizard wizard = new ConnectionWizard(); <START> wizard.setWindowTitle("New OpenShift Connection"); <END> WizardDialog dialog = new WizardDialog(PlatformUI.getWorkbench().getModalDialogShellProvider() .getShell(), wizard); if (dialog.open() == Window.OK) { showConnectionsOrExplanations(connectionsPane, explanationPane); } } }; }</code><technical_language>@mlabuda this is right API-call I put constructor of ConnectionWizard this fixed for other cases, invoked explorer: <LINK_0></technical_language>

Target:
private SelectionAdapter onExplanationClicked(final Control connectionsPane, final Control explanationPane) { return new SelectionAdapter() { public void widgetSelected(SelectionEvent e) { ConnectionWizard wizard = new ConnectionWizard(); WizardDialog dialog = new WizardDialog(PlatformUI.getWorkbench().getModalDialogShellProvider() .getShell(), wizard); if (dialog.open() == Window.OK) { showConnectionsOrExplanations(connectionsPane, explanationPane); } } }; }
Source:
<code>private void qos(Network network, VdsNetworkInterface iface, NetworkQoS expectedQos, boolean hostNetworkQosSupported) { configRule.mockConfigValue(ConfigValues.HostNetworkQosSupported, version, hostNetworkQosSupported); SetupNetworksVdsCommandParameters parameters = new SetupNetworksVdsCommandParameters(Guid.newGuid(), Collections.singletonList(network), Collections.<String> emptyList(), Collections.<VdsNetworkInterface> emptyList(), Collections.<String> emptySet(), Collections.singletonList(iface)); createCommand(parameters).execute(); verifyMethodPassedToHost(); Map<String, Object> networkStruct = assertNeworkWasSent(network); NetworkQosMapper qosMapper = new NetworkQosMapper(networkStruct, VdsProperties.HOST_QOS_INBOUND, VdsProperties.HOST_QOS_OUTBOUND); NetworkQoS deserialize = qosMapper.deserialize(); <START> assertTrue((expectedQos == null && deserialize == null) || expectedQos.equalValues(deserialize)); <END> }</code><technical_language>NPE, check if expectedQos is null in part</technical_language>

Target:
private void qos(Network network, VdsNetworkInterface iface, NetworkQoS expectedQos, boolean hostNetworkQosSupported) { configRule.mockConfigValue(ConfigValues.HostNetworkQosSupported, version, hostNetworkQosSupported); SetupNetworksVdsCommandParameters parameters = new SetupNetworksVdsCommandParameters(Guid.newGuid(), Collections.singletonList(network), Collections.<String> emptyList(), Collections.<VdsNetworkInterface> emptyList(), Collections.<String> emptySet(), Collections.singletonList(iface)); createCommand(parameters).execute(); verifyMethodPassedToHost(); Map<String, Object> networkStruct = assertNeworkWasSent(network); NetworkQosMapper qosMapper = new NetworkQosMapper(networkStruct, VdsProperties.HOST_QOS_INBOUND, VdsProperties.HOST_QOS_OUTBOUND); NetworkQoS deserialize = qosMapper.deserialize(); assertTrue((expectedQos == null && deserialize == null) || (expectedQos != null && expectedQos.equalValues(deserialize))); }
Source:
<code>public void reload(boolean adminOnly,int timeout){ executeReload(adminOnly); <START> waitForLiveServerToReload(timeout); END> }</code><technical_language>org.jboss.as.test.integration.management.util.ServerReload, ported full core</technical_language>

Target:
public void reload(boolean adminOnly, int timeout) { reload(adminOnly, timeout, null); }