auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public void is_ListView_created() { String descriptionText = "This is the description of testView"; String jobDslScript = "listView('"+ LIST_VIEW_NAME +"') {\n" + " description('"+descriptionText+"')\n" + "}"; <START> openNewlyCreatedListView(jobDslScript, LIST_VIEW_NAME); <END> WebElement description = find(By.xpath(" Assert.assertThat(description.getText(), containsString(descriptionText)); }</code><technical_language>this method return created view</technical_language>

Target:
public void is_ListView_created() { String descriptionText = "This is the description of testView"; String jobDslScript = "listView('"+ LIST_VIEW_NAME +"') {\n" + " description('"+descriptionText+"')\n" + "}"; View view = openNewlyCreatedListView(jobDslScript, LIST_VIEW_NAME); checkDescription(view, descriptionText); }
Source:
<code>public synchronized void handleAfterUndeploy(@Observes AfterUnDeploy afterDeploy, final Container container) throws Exception { if(deployed == null) { return; } Integer count = deployed.get(container.getName()); if (count == null) { <START> return; <END> } deployed.put(container.getName(), --count); if (count == 0 && afterClassRun) { for (int i = setupTasksInForce.size() - 1; i >= 0; i--) { try { setupTasksInForce.get(i).tearDown(managementClient.get(), container.getName()); } catch (Exception e) { log.error("Setup task failed during tear down. Offending class '" + setupTasksAll.get(i) + "'", e); } } active.remove(container.getName()); deployed.remove(container.getName()); } if (deployed.isEmpty()) { deployed = null; setupTasksAll.clear(); setupTasksInForce.clear(); afterClassRun = false; } }</code><technical_language>do adding some debug logging container appears removed is skipped</technical_language>

Target:
public synchronized void handleAfterUndeploy(@Observes AfterUnDeploy afterDeploy, final Container container) throws Exception { if(deployed == null) { return; } Integer count = deployed.get(container.getName()); if (count == null) { log.debugf("No deployments found for container %s.", container.getName()); return; } deployed.put(container.getName(), --count); if (count == 0 && afterClassRun) { for (int i = setupTasksInForce.size() - 1; i >= 0; i--) { try { setupTasksInForce.get(i).tearDown(managementClient.get(), container.getName()); } catch (Exception e) { log.error("Setup task failed during tear down. Offending class '" + setupTasksAll.get(i) + "'", e); } } active.remove(container.getName()); deployed.remove(container.getName()); } if (deployed.isEmpty()) { deployed = null; setupTasksAll.clear(); setupTasksInForce.clear(); afterClassRun = false; } }
Source:
<code>private List<String> getPorts(InstanceGroupType type) { List<String> ret = new ArrayList<>(); ret.add("22"); <START> if (InstanceGroupType.GATEWAY.equals(type)) { <END> ret.add("443"); } return ret; }</code><technical_language>I InstanceGroupType.GATEWAY == type is equivalent InstanceGroupType.GATEWAY.equals(type) I == in case of enum comparison</technical_language>

Target:
private List<String> getPorts(InstanceGroupType type) { List<String> ret = new ArrayList<>(); ret.add("22"); if (InstanceGroupType.GATEWAY == type) { ret.add("443"); } return ret; }
Source:
<code>public void onPropertyUpdateRemovesTheOldVertexFromTheIndexBeforeAddingTheNewOne() { IndexHandler indexHandler = mock(IndexHandler.class); GraphWrapper graphWrapper = newGraph() .withVertex("newVertex", v -> v .withProperty("vrecoll_name", "new") ) .withVertex(v -> v .withProperty("vrecoll_name", "old") <START> .withOutgoingRelation("VERSION_OF", "newVertex") <END> ) .wrap(); FulltextIndexChangeListener instance = new FulltextIndexChangeListener(indexHandler, graphWrapper); Collection collection = new VresBuilder() .withVre("thevre", "vre", vre -> vre .withCollection("vrecolls", coll -> coll .withDisplayName(localProperty("vrecoll_name")) ) ) .build().getCollection("vrecolls").get(); Vertex oldVertex = graphWrapper.getGraph().traversal().V().has("vrecoll_name", "old").next(); Vertex newVertex = graphWrapper.getGraph().traversal().V().has("vrecoll_name", "new").next(); instance.onPropertyUpdate(collection, Optional.of(oldVertex), newVertex); InOrder inOrder = inOrder(indexHandler); inOrder.verify(indexHandler).removeFromQuickSearchIndex(collection, oldVertex); inOrder.verify(indexHandler).addToQuickSearchIndex(collection, "new", newVertex); }</code><technical_language>I this is necessary for test is it? Vertex is a token. able pass mock(Vertex.class) This code suggests a dependency readers of test changing database model a bit harder (cause change this test well)</technical_language>

Target:
public void onPropertyUpdateRemovesTheOldVertexFromTheIndexBeforeAddingTheNewOne() { IndexHandler indexHandler = mock(IndexHandler.class); GraphWrapper graphWrapper = newGraph() .withVertex("newVertex", v -> v .withProperty("vrecoll_name", "new") ) .withVertex(v -> v .withProperty("vrecoll_name", "old") .withOutgoingRelation("VERSION_OF", "newVertex") ) .wrap(); FulltextIndexChangeListener instance = new FulltextIndexChangeListener(indexHandler, graphWrapper); Collection collection = new VresBuilder() .withVre("thevre", "vre", vre -> vre .withCollection("vrecolls", coll -> coll .withDisplayName(localProperty("vrecoll_name")) ) ) .build().getCollection("vrecolls").get(); Vertex oldVertex = graphWrapper.getGraph().traversal().V().has("vrecoll_name", "old").next(); Vertex newVertex = graphWrapper.getGraph().traversal().V().has("vrecoll_name", "new").next(); instance.onPropertyUpdate(collection, Optional.of(oldVertex), newVertex); InOrder inOrder = inOrder(indexHandler); inOrder.verify(indexHandler).removeFromQuickSearchIndex(collection, oldVertex); inOrder.verify(indexHandler).insertIntoQuickSearchIndex(collection, "new", newVertex); }
Source:
<code>public void testIndexing() throws Exception { List<Page> pages = readPages(new File("src/test/resources/wat-18.warc")); JavaRDD<Page> pagesRDD = sc.parallelize(pages); IndexStats stats = new IndexStats(sc); JavaPairRDD<RowColumn, Bytes> linkIndex = IndexUtil.createLinkIndex(stats, pagesRDD); List<Tuple2<RowColumn, Bytes>> linkIndexList = linkIndex.collect(); JavaPairRDD<RowColumn, Bytes> linkIndexNoRank = IndexUtil.filterRank(linkIndex); Assert.assertEquals(4, pagesRDD.count()); Assert.assertEquals(126, linkIndex.count()); try (FluoClient client = FluoFactory.newClient(miniFluo.getClientConfiguration())) { try (LoaderExecutor le = client.newLoaderExecutor()) { for (Page page : pages) { log.debug("Loading page with links", page.getUrl(), page.getOutboundLinks().size()); le.execute(PageUpdate.updatePage(page)); } } miniFluo.waitForObservers(); boolean foundDiff = false; foundDiff |= diffExportTable(linkIndexList); foundDiff |= diffFluoTable(client, linkIndexNoRank.collect()); if (foundDiff) { dump(client); dumpExportTable(); print(linkIndexList); } Assert.assertFalse(foundDiff); String url = "<LINK_3>"; log.info("Deleting page {}", url); try (LoaderExecutor le = client.newLoaderExecutor()) { le.execute(PageUpdate.deletePage(url)); } <START> miniFluo.waitForObservers(); <END> } }</code><technical_language>some sort of verification correct updates for deleting this page</technical_language>

Target:
public void testIndexing() throws Exception { Map<String, Page> pages = readPages(new File("src/test/resources/wat-18.warc")); try (FluoClient client = FluoFactory.newClient(miniFluo.getClientConfiguration())) { try (LoaderExecutor le = client.newLoaderExecutor()) { for (Page page : pages.values()) { log.debug("Loading page with links", page.getUrl(), page.getOutboundLinks().size()); le.execute(PageUpdate.updatePage(page)); } } miniFluo.waitForObservers(); assertOutput(pages.values(), client); String deleteUrl = "<LINK_3>"; log.info("Deleting page {}", deleteUrl); try (LoaderExecutor le = client.newLoaderExecutor()) { le.execute(PageUpdate.deletePage(deleteUrl)); } miniFluo.waitForObservers(); int numPages = pages.size(); Assert.assertNotNull(pages.remove(deleteUrl)); Assert.assertEquals(numPages-1, pages.size()); assertOutput(pages.values(), client); String updateUrl = "<LINK_2>"; Page updatePage = pages.get(updateUrl); long numLinks = updatePage.getNumOutbound(); Assert.assertTrue(updatePage.addOutboundLink("<LINK_0>", "Example")); Assert.assertEquals(numLinks+1, (long)updatePage.getNumOutbound()); Assert.assertTrue(updatePage.removeOutboundLink("<LINK_1>")); Assert.assertEquals(numLinks, (long)updatePage.getNumOutbound()); try (LoaderExecutor le = client.newLoaderExecutor()) { le.execute(PageUpdate.updatePage(updatePage)); } miniFluo.waitForObservers(); Assert.assertNotNull(pages.put(updateUrl, updatePage)); assertOutput(pages.values(), client); } }
Source:
<code><START> default KeyStore createCertForHost(String hostname) <END> throws NoSuchAlgorithmException, InvalidKeyException, CertificateException, NoSuchProviderException, SignatureException, KeyStoreException, IOException, UnrecoverableKeyException{ return createCertForHost(new CertData(hostname)); }</code><technical_language>This other around, default new method call method (older implementations new method)</technical_language>

Target:
KeyStore createCertForHost(String hostname) throws NoSuchAlgorithmException, InvalidKeyException, CertificateException, NoSuchProviderException, SignatureException, KeyStoreException, IOException, UnrecoverableKeyException; default KeyStore createCertForHost(CertData certData) throws NoSuchAlgorithmException, InvalidKeyException, CertificateException, NoSuchProviderException, SignatureException, KeyStoreException, IOException, UnrecoverableKeyException{ return createCertForHost(certData.getCommonName()); }
Source:
<code>public Condition(String key, String[] values) { super(); if ("VRIF".equals(key)) { key = "verified"; } <START> if ("CRVW".equals(key)) { <END> key = "code-review"; } this.key = key; this.val = values; }</code><technical_language>This "else if" avoid redundant checks. both, if check passes point second</technical_language>

Target:
public Condition(String key, String[] values) { super(); this.key = GerritHookFilterChangeState.this.translateConditionKey(key); this.val = values; }
Source:
<code>public void testSendGelfMessage() throws Exception { final ImmutableList<String> typenames = ImmutableList.of(); final Map<String,Object> settings = new HashMap<String,Object>(); final Map<String, Object> additionalFields = new HashMap<>(); additionalFields.put("test", "test"); final GelfWriter gelfWriter; try { gelfWriter = new GelfWriter( typenames, true, true, settings, "gelf.example.com", null, additionalFields, "TEST", null, null, null, null, null, null, null, null, null, null ); <START> } catch (final NullPointerException e) { <END> throw new RuntimeException("Unexpected failure to create gelfwriter for test", e); } gelfWriter.start(); gelfWriter.doWrite(dummyServer(), dummyQuery(), ImmutableList.<Result>of(result)); Assert.assertTrue( "Transport hasn't been called", MockGelfTransport.calls.size() > 0 ); Assert.assertEquals( "Additional fields not set", "test", MockGelfTransport.calls.get(0).getAdditionalFields().get("test") ); }</code><technical_language>catching NPE adds a lot of clarity. If want do it, please rethrow a new NPE, a RuntimeException (we in a case of a null pointer exception)</technical_language>

Target:
public void testSendGelfMessage() throws Exception { final ImmutableList<String> typenames = ImmutableList.of(); final Map<String, Object> settings = new HashMap<>(); doNothing().when(gelfTransport).send( messageArgumentCaptor.capture() ); final GelfWriter gelfWriter; gelfWriter = new GelfWriter( typenames, ImmutableMap.of("type", (Object) "jmx"), gelfTransport ); gelfWriter.start(); gelfWriter.doWrite(dummyServer(), dummyQuery(), ResultFixtures.singleNumericResult()); final GelfMessage gelfMessage = messageArgumentCaptor.getValue(); assertThat(gelfMessage.getAdditionalFields()) .containsEntry("type", "jmx") .as("Additional fields were not checked"); assertThat(gelfMessage.getFullMessage()) .isNotEmpty() .as("Invalid full message"); assertThat(gelfMessage.getMessage()) .isNotEmpty() .as("Invalid message"); verify( gelfTransport, times(1) ).send(isA(GelfMessage.class)); }
Source:
<code>public DefaultEventContext(FlowConstruct flow, ComponentLocation location, String correlationId, Optional<CompletableFuture<Void>> externalCompletion) { <START> this(flow, NullExceptionHandler.getInstance(), location, correlationId, externalCompletion); <END> }</code><technical_language>is place in a null exception handler is set? If answer is no, simply remove concept here</technical_language>

Target:
public DefaultEventContext(FlowConstruct flow, ComponentLocation location, String correlationId, Optional<CompletableFuture<Void>> externalCompletion) { super(NullExceptionHandler.getInstance(), 0, externalCompletion); this.id = flow.getUniqueIdString(); this.serverId = flow.getServerId(); this.location = location; this.processingTime = ProcessingTime.newInstance(flow); this.correlationId = correlationId; if (flow != null && flow.getMuleContext() != null) { eventContextMaintain(flow.getMuleContext().getEventContextService()); } this.flowCallStack = new DefaultFlowCallStack(); createStreamingState(); }
Source:
<code>public boolean shouldRetry() { <START> return retriesOnFailure.decrementAndGet() > 0; <END> }</code><technical_language>return retriesOnFailure.decrementAndGet() >= 0;? returns updated value, retriesOnFailure = 1 lead retries</technical_language>

Target:
public boolean shouldRetry() { return retriesOnFailure.decrementAndGet() >= 0; }
Source:
<code>public String getBranchName() { <START> return spaceName; <END> }</code><technical_language>please fix this branchName</technical_language>

Target:
public String getBranchName() { return branchName; }
Source:
<code>public void put(MessageWriteSet messageSetToWrite) throws StoreException { synchronized (lock) { checkStarted(); try { for (MessageInfo info : messageSetToWrite.getMessageSetInfo()) { if (index.exist(info.getStoreKey())) { throw new StoreException("key already exist in store. cannot be overwritten", StoreErrorCodes.Already_Exist); } } long writeStartOffset = log.getLogEndOffset(); messageSetToWrite.writeTo(log); List<MessageInfo> messageInfo = messageSetToWrite.getMessageSetInfo(); ArrayList<BlobIndexEntry> indexEntries = new ArrayList<BlobIndexEntry>(messageInfo.size()); for (MessageInfo info : messageInfo) { BlobIndexValue value = new BlobIndexValue(info.getSize(), <START> writeStartOffset, <END> (byte)0, info.getTimeToLiveInMs()); BlobIndexEntry entry = new BlobIndexEntry(info.getStoreKey(), value); indexEntries.add(entry) ; writeStartOffset += info.getSize(); } index.addToIndex(indexEntries, log.getLogEndOffset()); metrics.writes.inc(1); } catch (IOException e) { throw new StoreException("io error while trying to fetch blobs : " + e, StoreErrorCodes.IOError); } } }</code><technical_language>whitespace / tab weirdness</technical_language>

Target:
public void put(MessageWriteSet messageSetToWrite) throws StoreException { synchronized (lock) { checkStarted(); try { for (MessageInfo info : messageSetToWrite.getMessageSetInfo()) { if (index.exists(info.getStoreKey())) { throw new StoreException("key already exist in store. cannot be overwritten", StoreErrorCodes.Already_Exist); } } long writeStartOffset = log.getLogEndOffset(); messageSetToWrite.writeTo(log); List<MessageInfo> messageInfo = messageSetToWrite.getMessageSetInfo(); ArrayList<BlobIndexEntry> indexEntries = new ArrayList<BlobIndexEntry>(messageInfo.size()); for (MessageInfo info : messageInfo) { BlobIndexValue value = new BlobIndexValue(info.getSize(), writeStartOffset, (byte)0, info.getTimeToLiveInMs()); BlobIndexEntry entry = new BlobIndexEntry(info.getStoreKey(), value); indexEntries.add(entry) ; writeStartOffset += info.getSize(); } index.addToIndex(indexEntries, log.getLogEndOffset()); metrics.writes.inc(1); } catch (IOException e) { throw new StoreException("io error while trying to fetch blobs : " + e, StoreErrorCodes.IOError); } } }
Source:
<code>private static void loadDistributionsFromJson(String jsonString) { <START> DISTRIBUTIONS = <END> Lists.newArrayList(); Type fullRevisionType = new TypeToken<FullRevision>(){}.getType(); GsonBuilder gsonBuilder = new GsonBuilder() .registerTypeAdapter(fullRevisionType, new JsonDeserializer<FullRevision>() { @Override public FullRevision deserialize(JsonElement json, Type typeOfT, JsonDeserializationContext context) throws JsonParseException { return FullRevision.parseRevision(json.getAsString()); } }); Gson gson = gsonBuilder.create(); Type listType = new TypeToken<ArrayList<Distribution>>() {}.getType(); try { DISTRIBUTIONS = gson.fromJson(jsonString, listType); } catch (JsonParseException e) { LOG.error(e); } }</code><technical_language>this line needed</technical_language>

Target:
private static List<Distribution> loadDistributionsFromJson(String jsonString) { Type fullRevisionType = new TypeToken<FullRevision>(){}.getType(); GsonBuilder gsonBuilder = new GsonBuilder() .registerTypeAdapter(fullRevisionType, new JsonDeserializer<FullRevision>() { @Override public FullRevision deserialize(JsonElement json, Type typeOfT, JsonDeserializationContext context) throws JsonParseException { return FullRevision.parseRevision(json.getAsString()); } }); Gson gson = gsonBuilder.create(); Type listType = new TypeToken<ArrayList<Distribution>>() {}.getType(); try { return gson.fromJson(jsonString, listType); } catch (JsonParseException e) { LOG.error(e); } return null; }
Source:
<code>public void sendEmail( final String jobId ) throws GenieException { try { log.debug("Got a job finished event. Sending email."); final JobRequest jobRequest = this.jobSearchService.getJobRequest(jobId); final Job job = this.jobSearchService.getJob(jobId); <START> if (org.apache.commons.lang3.StringUtils.isNotBlank(jobRequest.getEmail())) { <END> final String message = new StringBuilder() .append("Job with id [") .append(jobId).append("] finished with status ") .append(job.getStatus()) .toString(); this.mailServiceImpl.sendEmail( jobRequest.getEmail(), message, message ); } } catch (Exception e) { log.debug("Could not send email for job: {}", jobId, e); } }</code><technical_language>fully qualified usage why</technical_language>

Target:
public void sendEmail( final String jobId ) throws GenieException { try { log.debug("Got a job finished event. Sending email."); final JobRequest jobRequest = this.jobSearchService.getJobRequest(jobId); final Job job = this.jobSearchService.getJob(jobId); if (StringUtils.isNotBlank(jobRequest.getEmail())) { final String message = new StringBuilder() .append("Job with id [") .append(jobId).append("] finished with status ") .append(job.getStatus()) .toString(); this.mailServiceImpl.sendEmail( jobRequest.getEmail(), message, message ); } } catch (Exception e) { log.debug("Could not send email for job: {}", jobId, e); } }
Source:
<code>public static void main(final String[] args) throws Exception { final JavaConfigurationBuilder jcb = Tang.Factory.getTang().newConfigurationBuilder(); final CommandLine commandLine = MISTExampleUtils.getDefaultCommandLine(jcb) <START> .registerShortNameOfClass(NettySourceAddress.class) END> .processCommandLine(args); if (commandLine == null) { return; } Thread sinkServer = new Thread(MISTExampleUtils.getSinkServer()); sinkServer.start(); final APIQueryControlResult result = submitQuery(jcb.build()); System.out.println("Query submission result: " + result.getQueryId()); }</code><technical_language>is used</technical_language>

Target:
public static void main(final String[] args) throws Exception { final JavaConfigurationBuilder jcb = Tang.Factory.getTang().newConfigurationBuilder(); final CommandLine commandLine = MISTExampleUtils.getDefaultCommandLine(jcb) .processCommandLine(args); if (commandLine == null) { return; } Thread sinkServer = new Thread(MISTExampleUtils.getSinkServer()); sinkServer.start(); final APIQueryControlResult result = submitQuery(jcb.build()); System.out.println("Query submission result: " + result.getQueryId()); }
Source:
<code><START> @Override public void testSiteBuildWithForkedMojo() throws Exception { <END> }</code><technical_language>Please follow existed coding style put new line Override</technical_language>

Target:
public void testSiteBuildWithForkedMojo() throws Exception { }
Source:
<code>@Test public void testRequestMalformed() throws Throwable { enqueueFromFile("announce_malformed.json"); AnnouncementClient.Callback cb = mock(AnnouncementClient.Callback.class); request(cb); server().takeRequest(); verify(cb, <START> never()).success(eq(new ArrayList<Card>())); <END> verify(cb).error(any(Throwable.class)); }</code><technical_language>I this any(List)</technical_language>

Target:
@Test public void testRequestMalformed() throws Throwable { server().enqueue("Jimmy crack corn, and I don't care."); Callback cb = mock(Callback.class); request(cb); server().takeRequest(); verify(cb, never()).success(anyListOf(Card.class)); verify(cb).error(any(Throwable.class)); }
Source:
<code><START> public void markDuplicatesWithRemovingDuplicatesIntegrationTest(final String input) { <END> final File outputDir = IOUtil.createTempDir(TEST_BASE_NAME + ".", ".tmp"); outputDir.deleteOnExit(); final List<String> args = new ArrayList<>(); args.add("INPUT=" + new File(TEST_DATA_DIR,input).getAbsolutePath()); final File output = new File(outputDir, TEST_BASE_NAME + ".sam"); args.add("OUTPUT=" + output.getAbsolutePath()); final File metrics = new File(outputDir, TEST_BASE_NAME + ".integration_metrics"); args.add("METRICS_FILE=" + metrics.getAbsolutePath()); args.add("REMOVE_DUPLICATES=true"); Assert.assertEquals(runPicardCommandLine(args), 0); examineDuplicationMetrics(input, output, metrics, true); }</code><technical_language>markDuplicatesWithRemovingDuplicatesIntegrationTest secondarySupplementaryUnmappedWithRemovingDuplicatesIntegrationTest same. contents of test pulled out test separate data providers line methods call abstracted test</technical_language>

Target:
public void markDuplicatesWithRemovingDuplicatesIntegrationTest(final String input) { removingDuplicatesIntegrationTest(input); }
Source:
<code>public void onEnter() { TracingService.activateSpan(getContext().getCurrentSpan(), false); try { getContext().unregisterAuthorizationUpdates(); } catch (final RuntimeException ex) { TracingService.logErrorInSpan(getContext().getCurrentSpan(), "Unexpected fail during removing callback for registration updates " + ex.getMessage()); getLog().error("Unexpected fail during removing callback for registration updates", ex); } try { if (null != exception) { getOut().onException(exception); } } finally { try { getContext().unregisterSession(); } finally { switchState(StreamingContext.DEAD_STATE); } try { getContext().getZkClient().close(); } catch (final IOException e) { <START> TracingService.logErrorInSpan(getContext().getCurrentSpan(), <END> "Unexpected fail to release zk connection " + e.getMessage()); getLog().error("Unexpected fail to release zk connection", e); } getContext().getCurrentSpan().finish(); } }</code><technical_language>user need it, is internal exception, track in logs</technical_language>

Target:
public void onEnter() { try { getContext().unregisterAuthorizationUpdates(); } catch (final RuntimeException ex) { getLog().error("Unexpected fail during removing callback for registration updates", ex); } try { if (null != exception) { getOut().onException(exception); } } finally { try { getContext().unregisterSession(); } finally { switchState(StreamingContext.DEAD_STATE); } try { getContext().getZkClient().close(); } catch (final IOException e) { getLog().error("Unexpected fail to release zk connection", e); } getContext().getCurrentSpan().finish(); } }
Source:
<code>public boolean equals(Object o) { if (this == o) { return true; } if (!(o instanceof IssueTracker)) { return false; } IssueTracker that = (IssueTracker) o; <START> if (!Objects.equals(name, that.name)) { <END> return false; } return Objects.equals(version, that.version); }</code><technical_language>simplified to: return (Objects.equals(name, that.name) && Objects.equals(version, that.version));</technical_language>

Target:
public boolean equals(Object o) { if (this == o) { return true; } if (!(o instanceof IssueTracker)) { return false; } IssueTracker that = (IssueTracker) o; return Objects.equals(name, that.name) && Objects.equals(version, that.version); }
Source:
<code>protected InvocationStatus beforeInvoke() throws Exception { CompletableFuture<Void> future; switch (topologyMode) { case WAIT_TOPOLOGY: future = handler.getStateTransferLock().topologyFuture(waitTopology()); if (!future.isDone()) { if (forceOrdering) { <START> future.get(1, TimeUnit.DAYS); <END> } else { future.thenRunAsync(this, remoteExecutor); return InvocationStatus.DEFERRED; } } break; case WAIT_TX_DATA: future = handler.getStateTransferLock().transactionDataFuture(waitTopology()); if (!future.isDone()) { if (forceOrdering) { future.get(1, TimeUnit.DAYS); } else { future.thenRunAsync(this, remoteExecutor); return InvocationStatus.DEFERRED; } } break; default: break; } if (handler.isCommandSentBeforeFirstTopology(commandTopologyId)) { return InvocationStatus.CACHE_NOT_FOUND; } return super.beforeInvoke(); }</code><technical_language>CompletableFutures.await()</technical_language>

Target:
protected CompletableFuture<Response> beforeInvoke() { CompletableFuture<Void> future = null; switch (topologyMode) { case WAIT_TOPOLOGY: future = handler.getStateTransferLock().topologyFuture(waitTopology()); break; case WAIT_TX_DATA: future = handler.getStateTransferLock().transactionDataFuture(waitTopology()); break; default: break; } if (handler.isCommandSentBeforeFirstTopology(commandTopologyId)) { return future == null ? CompletableFuture.completedFuture(CacheNotFoundResponse.INSTANCE) : future.thenApply(nil -> CacheNotFoundResponse.INSTANCE); } else if (future != null) { return future.thenApply(nil -> null); } else { return null; } }
Source:
<code>public void handleRow(int index, Values row) { <START> if (index == 1) { <END> aliases = new LineBasedAliases(row, dictionary); process.log(ProcessLog.info().withMessage(aliases.toString())); } else { Watch w = Watch.start(); try { Context ctx = aliases.transform(row); handleRow(index, ctx); } catch (Exception e) { process.handle(e); } finally { process.addTiming(descriptor.getPluralLabel(), w.elapsedMillis()); } } }</code><technical_language>explain change in a separate commit!</technical_language>

Target:
public void handleRow(int index, Values row) { if (aliases == null) { aliases = new LineBasedAliases(row, dictionary); process.log(ProcessLog.info().withMessage(aliases.toString())); } else { Watch w = Watch.start(); try { Context ctx = aliases.transform(row); handleRow(index, ctx); } catch (Exception e) { process.handle(e); } finally { process.addTiming(descriptor.getPluralLabel(), w.elapsedMillis()); } } }
Source:
<code>public List<KeySlice> get_range_slices(ColumnParent column_parent, SlicePredicate predicate, KeyRange range, ConsistencyLevel consistency_level) throws InvalidRequestException, UnavailableException, TimedOutException, TException { List<KeySlice> result = checkLimitAndCall( () -> super.get_range_slices(column_parent, predicate, range, consistency_level)); int approximateBytesRead = result.stream() .mapToInt(keySlice -> SerializationUtils.serialize(keySlice).length) .sum(); <START> try { <END> recordBytesRead(approximateBytesRead); } catch (Exception e) { log.warn("Encountered an exception when recording read metrics for get_range_slices.", e); } return result; }</code><technical_language>I hope recording metrics throw Exception for reason. do need this</technical_language>

Target:
public List<KeySlice> get_range_slices(ColumnParent column_parent, SlicePredicate predicate, KeyRange range, ConsistencyLevel consistency_level) throws InvalidRequestException, UnavailableException, TimedOutException, TException { qosClient.checkLimit(); List<KeySlice> result = super.get_range_slices(column_parent, predicate, range, consistency_level); recordBytesRead(getCollectionSize(result, ThriftObjectSizeUtils::getKeySliceSize)); return result; }
Source:
<code>public OpenShiftProjectFactory( @Nullable @Named("che.infra.openshift.project") String projectName, @Nullable @Named("che.infra.kubernetes.service_account_name") String serviceAccountName, @Nullable @Named("che.infra.kubernetes.cluster_role_name") String clusterRoleName, @Nullable @Named("che.infra.kubernetes.namespace.default") String defaultNamespaceName, @Named("che.infra.kubernetes.namespace.allow_user_defined") boolean allowUserDefinedNamespaces, OpenShiftClientFactory clientFactory, OpenShiftClientConfigFactory clientConfigFactory) { super( projectName, serviceAccountName, clusterRoleName, defaultNamespaceName, allowUserDefinedNamespaces, clientFactory); if (allowUserDefinedNamespaces && !clientConfigFactory.isPersonalized()) { LOG.warn( <START> "Users allowed to list projects but all reuse Che Server configured service account. " <END> + "Consider configuring OpenShift OAuth to personalize credentials that will be used for cluster access."); } this.defaultNamespaceName = defaultNamespaceName; this.allowUserDefinedNamespaces = allowUserDefinedNamespaces; this.clientFactory = clientFactory; }</code><technical_language>sense, is a bit difficult parse for personally. about: Users allowed list projects Che server is configured a service account. users receive list of projects. Consider ..</technical_language>

Target:
public OpenShiftProjectFactory( @Nullable @Named("che.infra.openshift.project") String projectName, @Nullable @Named("che.infra.kubernetes.service_account_name") String serviceAccountName, @Nullable @Named("che.infra.kubernetes.cluster_role_name") String clusterRoleName, @Nullable @Named("che.infra.kubernetes.namespace.default") String defaultNamespaceName, @Named("che.infra.kubernetes.namespace.allow_user_defined") boolean allowUserDefinedNamespaces, OpenShiftClientFactory clientFactory, OpenShiftClientConfigFactory clientConfigFactory) { super( projectName, serviceAccountName, clusterRoleName, defaultNamespaceName, allowUserDefinedNamespaces, clientFactory); if (allowUserDefinedNamespaces && !clientConfigFactory.isPersonalized()) { LOG.warn( "Users are allowed to list projects but Che server is configured with a service account. " + "All users will receive the same list of projects. Consider configuring OpenShift " + "OAuth to personalize credentials that will be used for cluster access."); } this.clientFactory = clientFactory; }
Source:
<code>public MotionEventHandler() { <START> if (Context.getConfig() != null) { <END> tripsConfig = ReportUtils.initTripsConfig(); } }</code><technical_language>Is case config</technical_language>

Target:
public MotionEventHandler() { tripsConfig = ReportUtils.initTripsConfig(); }
Source:
<code>public int hashCode() { final int prime = 31; int result = 1; result = prime * result + Integer.valueOf(maxBatchSize).hashCode(); result = prime * result + Long.valueOf(timeOut).hashCode(); <START> return result; <END> }</code><technical_language>int result = super.hashCode(); result = 31_result + maxBatchSize; result = 31_result + timeOut; return result;</technical_language>

Target:
public int hashCode() { int result = super.hashCode(); result = 31 * result + maxBatchSize; result = 31 * result + Long.valueOf(timeOut).hashCode(); return result; }
Source:
<code>public void testRefreshLocalHosts() { Set<InetSocketAddress> localHosts = clientPool.getLocalHosts(); assertTrue(localHosts.size() == 1); <START> myLocation = Optional.of(HostLocation.of("dc1", "rack2")); <END> CassandraClientPoolImpl clientPoolDifferentLocation = CassandraClientPoolImpl.createImplForTest(metricsManager, CASSANDRA.getConfig(), CassandraClientPoolImpl.StartupChecks.RUN, blacklist, myLocation); localHosts = clientPoolDifferentLocation.getLocalHosts(); assertTrue(localHosts.size() == 0); }</code><technical_language>please avoid reassigning variables, control flow more difficult reason about</technical_language>

Target:
public void testRefreshLocalHosts() { HostLocation localLocation = HostLocation.of("dc1", "rack1"); HostLocation remoteLocation = HostLocation.of("dc1", "rack4"); assertThat(getLocalHostsUsingLocation(localLocation)).isNotEmpty(); assertThat(getLocalHostsUsingLocation(remoteLocation)).isEmpty(); }
Source:
<code>public BaseMatcher(final NetworkConfig config, final NotificationListener notificationListener, final ObservationStore observationStore) { if (config == null) { throw new NullPointerException("Config must not be null"); } else if (notificationListener == null) { <START> throw new NullPointerException("NotificationListener must not be null"); <END> } else if (observationStore == null) { throw new NullPointerException("ObservationStore must not be null"); } else { this.config = config; } this.notificationListener = notificationListener; this.observationStore = observationStore; }</code><technical_language>IIRC UDPMatcher necessarily require a NotificationListener, it</technical_language>

Target:
public BaseMatcher(final NetworkConfig config, final NotificationListener notificationListener, final ObservationStore observationStore) { if (config == null) { throw new NullPointerException("Config must not be null"); } else if (notificationListener == null) { throw new NullPointerException("NotificationListener must not be null"); } else if (observationStore == null) { throw new NullPointerException("ObservationStore must not be null"); } else { this.config = config; this.notificationListener = notificationListener; this.observationStore = observationStore; } }
Source:
<code>protected static void assertQueryFailsEventually(QueryRunner queryRunner, Session session, @Language("SQL") String sql, @Language("RegExp") String expectedMessageRegExp, Duration timeout) { long start = System.nanoTime(); while (!Thread.currentThread().isInterrupted()) { try { assertQueryFails(queryRunner, session, sql, expectedMessageRegExp); return; } catch (AssertionError e) { if (nanosSince(start).compareTo(timeout) > 0) { throw e; } } <START> sleepUninterruptibly(50, TimeUnit.MILLISECONDS); <END> } }</code><technical_language>a static import here, imported</technical_language>

Target:
protected static void assertQueryFailsEventually(QueryRunner queryRunner, Session session, @Language("SQL") String sql, @Language("RegExp") String expectedMessageRegExp, Duration timeout) { long start = System.nanoTime(); while (!Thread.currentThread().isInterrupted()) { try { assertQueryFails(queryRunner, session, sql, expectedMessageRegExp); return; } catch (AssertionError e) { if (nanosSince(start).compareTo(timeout) > 0) { throw e; } } sleepUninterruptibly(50, MILLISECONDS); } }
Source:
<code>BigtableTableName(String tableName) { <START> this.name = tableName; <END> }</code><technical_language>nit: name = tableName this.name = name</technical_language>

Target:
BigtableTableName(String tableName) { this.tableName = tableName; }
Source:
<code>@Override public void registerContribution(Object contribution, String extensionPoint, ComponentInstance contributor) { <START> if (EP_BATCH_HANDLER.equalsIgnoreCase(extensionPoint)) { <END> if (BatchHandlerDescriptor.class.isAssignableFrom(contribution.getClass())) { BatchHandlerDescriptor contributionDescriptor = (BatchHandlerDescriptor) contribution; BatchHandler batchHandler = newInstance(contributionDescriptor.getKlass()); batchHandler.setName(contributionDescriptor.getName()); batchHandler.init(contributionDescriptor.getProperties()); handlers.put(contributionDescriptor.getName(), batchHandler); } } }</code><technical_language>ignore case, this is a technical extension point identifier reason lenient</technical_language>

Target:
public void registerContribution(Object contribution, String extensionPoint, ComponentInstance contributor) { if (EP_BATCH_HANDLER.equals(extensionPoint)) { if (contribution instanceof BatchHandlerDescriptor) { BatchHandlerDescriptor contributionDescriptor = (BatchHandlerDescriptor) contribution; String name = contributionDescriptor.getName(); BatchHandler batchHandler = contributionDescriptor.newInstance(); batchHandler.initialize(name, contributionDescriptor.getProperties()); handlers.put(name, batchHandler); } else { throw new NuxeoException("Invalid class: " + contribution.getClass().getName()); } } else { throw new NuxeoException("Invalid extension point: " + extensionPoint); } }
Source:
<code>public void handleActionButtons() { if (mModeListener != null) <START> mModeListener.inflate(getContentActionMode()); <END> }</code><technical_language>run code formatting this file? fix a number of style inconsistencies</technical_language>

Target:
public void handleActionButtons() { if (mModeListener != null) { mModeListener.inflate(getContentActionMode()); } }
Source:
<code>public void execute(IProgressMonitor monitor) throws CoreException { try { PushOperation pushOperation = new PushOperation( <START> repository.getRepository(), DEFAULT_REMOTE_NAME, false, <END> timeout); pushOperation.run(monitor); operationResult = pushOperation.getOperationResult(); if (!operationResult.isSuccessfulConnectionForAnyURI()) { String errorMessage = String.format( CoreText.pushToRemoteFailed, operationResult.getErrorStringForAllURis()); throw new CoreException(error(errorMessage)); } } catch (InvocationTargetException e) { Throwable targetException = e.getTargetException(); throw new CoreException(error(targetException.getMessage(), targetException)); } String newLocalBranch = getCurrentBranchhName(); try { repository.setRemote(newLocalBranch, DEFAULT_REMOTE_NAME); repository.setMerge(newLocalBranch, repository.getRepository().getFullBranch()); } catch (IOException e) { throw new CoreException(error(CoreText.unableToStoreGitConfig, e)); } }</code><technical_language>happen if multiple remotes exist ? explicit refspec</technical_language>

Target:
public void execute(IProgressMonitor monitor) throws CoreException { try { PushOperation pushOperation = new PushOperation( repository.getRepository(), DEFAULT_REMOTE_NAME, false, timeout); pushOperation.run(monitor); operationResult = pushOperation.getOperationResult(); if (!operationResult.isSuccessfulConnectionForAnyURI()) { String errorMessage = String.format( CoreText.pushToRemoteFailed, operationResult.getErrorStringForAllURis()); throw new CoreException(error(errorMessage)); } } catch (InvocationTargetException e) { Throwable targetException = e.getTargetException(); throw new CoreException(error(targetException.getMessage(), targetException)); } String newLocalBranch = getCurrentBranchhName(); try { repository.setRemote(newLocalBranch, DEFAULT_REMOTE_NAME); repository.setUpstreamBranchName(newLocalBranch, repository.getRepository().getFullBranch()); } catch (IOException e) { throw new CoreException(error(CoreText.unableToStoreGitConfig, e)); } }
Source:
<code>private void collectAndExportAttribute(MBeanServer mbeanServer, OutputWriter outputWriter, ObjectName objectName, String attribute) { try { Object attributeValue = null; try { attributeValue = mbeanServer.getAttribute(objectName, attribute); } catch (Exception ex) { <START> logger.info("Failed to fetch attribute for '" + objectName + "'#" + attribute + ", exception: " + ex.getMessage()); <END> return; } Object value; if (attributeValue instanceof CompositeData) { CompositeData compositeData = (CompositeData) attributeValue; if (key == null) { CompositeType compositeType = compositeData.getCompositeType(); for (String key : compositeType.keySet()) { value = compositeData.get(key); processAttributeValue(outputWriter, objectName, attribute, value, key); } return; } else { value = compositeData.get(key); } } else { if (key == null) { value = attributeValue; } else { logger.warning("Ignore NON compositeData for specified key for '" + objectName + "'#" + attribute + "#" + key + ": " + attributeValue); return; } } if (value != null && value.getClass().isArray()) { List valueAsList = new ArrayList(); for (int i = 0; i < Array.getLength(value); i++) { valueAsList.add(Array.get(value, i)); } value = valueAsList; } processAttributeValue(outputWriter, objectName, attribute, value, key); } catch (Exception e) { logger.log(Level.WARNING, "Exception collecting " + objectName + "#" + attribute + (key == null ? "" : "#" + key), e); } }</code><technical_language>need change this warning message info message</technical_language>

Target:
private void collectAndExportAttribute(MBeanServer mbeanServer, OutputWriter outputWriter, ObjectName objectName, String attribute) { try { Object attributeValue = null; try { attributeValue = mbeanServer.getAttribute(objectName, attribute); } catch (Exception ex) { logger.warning("Failed to fetch attribute for '" + objectName + "'#" + attribute + ", exception: " + ex.getMessage()); return; } Object value; if (attributeValue instanceof CompositeData) { CompositeData compositeData = (CompositeData) attributeValue; if (key == null) { CompositeType compositeType = compositeData.getCompositeType(); for (String key : compositeType.keySet()) { value = compositeData.get(key); processAttributeValue(outputWriter, objectName, attribute, value, key); } return; } else { value = compositeData.get(key); } } else { if (key == null) { value = attributeValue; } else { logger.warning("Ignore NON compositeData for specified key for '" + objectName + "'#" + attribute + "#" + key + ": " + attributeValue); return; } } if (value != null && value.getClass().isArray()) { List valueAsList = new ArrayList(); for (int i = 0; i < Array.getLength(value); i++) { valueAsList.add(Array.get(value, i)); } value = valueAsList; } processAttributeValue(outputWriter, objectName, attribute, value, key); } catch (Exception e) { logger.log(Level.WARNING, "Exception collecting " + objectName + "#" + attribute + (key == null ? "" : "#" + key), e); } }
Source:
<code>public String toString() { <START> return "MetadataImpl{" + "name='" + name + '\'' + '}'; <END> }</code><technical_language>java "MetadataImpl{name='" + name + "'}"; simpler</technical_language>

Target:
public String toString() { return "MetadataImpl{'name='" + name + '\'' + '}'; }
Source:
<code>public void updateUser(@NonNull final String id, final JSONObject content, final KuzzleOptions options, final KuzzleResponseListener<KuzzleUser> listener) throws JSONException { if (id == null) { throw new IllegalArgumentException("KuzzleSecurity.updateUser: cannot update user without an ID"); } JSONObject data = new JSONObject().put("_id", id); data.put("body", content); if (listener != null) { this.kuzzle.query(buildQueryArgs("updateUser"), data, options, new OnQueryDoneListener() { @Override public void onSuccess(JSONObject response) { try { <START> listener.onSuccess(new KuzzleUser(KuzzleSecurity.this.kuzzle, response.getJSONObject("result").getString("_id"), response.getJSONObject("result"))); <END> } catch(JSONException e) { throw new RuntimeException(e); } } @Override public void onError(JSONObject error) { listener.onError(error); } }); } else { this.kuzzle.query(buildQueryArgs("updateUser"), data, options); } }</code><technical_language>here: need pass result._source instead of result</technical_language>

Target:
public void updateUser(@NonNull final String id, final JSONObject content, final KuzzleOptions options, final KuzzleResponseListener<KuzzleUser> listener) throws JSONException { if (id == null) { throw new IllegalArgumentException("KuzzleSecurity.updateUser: cannot update user without an ID"); } JSONObject data = new JSONObject().put("_id", id); data.put("body", content); if (listener != null) { this.kuzzle.query(buildQueryArgs("updateUser"), data, options, new OnQueryDoneListener() { @Override public void onSuccess(JSONObject response) { try { listener.onSuccess(new KuzzleUser(KuzzleSecurity.this.kuzzle, response.getJSONObject("result").getString("_id"), response.getJSONObject("result").getJSONObject("_source"))); } catch(JSONException e) { throw new RuntimeException(e); } } @Override public void onError(JSONObject error) { listener.onError(error); } }); } else { this.kuzzle.query(buildQueryArgs("updateUser"), data, options); } }
Source:
<code>static Object getProviderFromEntry(String entry, Class<?>[] argumentTypes, Object[] arguments) throws FacesException, NoSuchMethodException { if (entry == null) { return null; } try { Class<?> clazz = Util.loadClass(entry, null); Constructor c = clazz.getDeclaredConstructor(argumentTypes); if (c == null) { throw new FacesException("Unable to find constructor accepting arguments: " + Arrays.toString(arguments)); } return c.newInstance(arguments); <START> } catch (ClassNotFoundException | SecurityException | InstantiationException | IllegalAccessException | IllegalArgumentException | InvocationTargetException e) { <END> throw new FacesException(e); } }</code><technical_language>I leave NoSuchMethodException wrap in a FacesException</technical_language>

Target:
static Object getProviderFromEntry(String entry, Class<?>[] argumentTypes, Object[] arguments) throws FacesException { if (entry == null) { return null; } try { Class<?> clazz = Util.loadClass(entry, null); Constructor c = clazz.getDeclaredConstructor(argumentTypes); if (c == null) { throw new FacesException("Unable to find constructor accepting arguments: " + Arrays.toString(arguments)); } return c.newInstance(arguments); } catch (ClassNotFoundException | NoSuchMethodException | SecurityException | InstantiationException | IllegalAccessException | IllegalArgumentException | InvocationTargetException e) { throw new FacesException(e); } }
Source:
<code>public AcceptorCacheDigest latestSequencesPreparedOrAccepted( Optional<AcceptorCacheKey> maybeCacheKey, Set<Client> clients) { primeCache(clients); if (!maybeCacheKey.isPresent()) { return acceptorCache.getAllUpdates(); <START> } else { <END> AcceptorCacheKey cacheKey = maybeCacheKey.get(); return latestSequencesPreparedOrAcceptedCached(cacheKey) .orElseGet(() -> emptyDigest(cacheKey)); } }</code><technical_language>nit: stylistic preference, I else if if block is a straight return</technical_language>

Target:
public AcceptorCacheDigest latestSequencesPreparedOrAccepted( Optional<AcceptorCacheKey> maybeCacheKey, Set<Client> clients) { primeCache(clients); if (!maybeCacheKey.isPresent()) { return acceptorCache.getAllUpdates(); } AcceptorCacheKey cacheKey = maybeCacheKey.get(); return latestSequencesPreparedOrAcceptedCached(cacheKey) .orElseGet(() -> emptyDigest(cacheKey)); }
Source:
<code><START> private int getForeignIdHashSource() { <END> int result = 0; if (getArgs() != null && getArgs().get(FID_HASH_SRC_ARG) != null) { String hashSourceArg = getArgs().get(FID_HASH_SRC_ARG).toLowerCase(); for (String keyword : HASH_IP_KEYWORDS) { if (hashSourceArg.contains(keyword)) { result = 2; break; } } for (String keyword : HASH_LABEL_KEYWORDS) { if (hashSourceArg.contains(keyword)) { result++; break; } } } return result; }</code><technical_language>this return enum instead of integer</technical_language>

Target:
private ForeignIdHashSource getForeignIdHashSource() { boolean hasIpKeywords = false; boolean hasLabelKeywords = false; if (getArgs() != null && getArgs().get(FID_HASH_SRC_ARG) != null) { String hashSourceArg = getArgs().get(FID_HASH_SRC_ARG).toLowerCase(); for (String keyword : HASH_IP_KEYWORDS) { if (hashSourceArg.contains(keyword)) { hasIpKeywords = true; break; } } for (String keyword : HASH_LABEL_KEYWORDS) { if (hashSourceArg.contains(keyword)) { hasLabelKeywords = true; break; } } } if (hasIpKeywords && !hasLabelKeywords) { return ForeignIdHashSource.IP_ADDRESS; } else if (hasIpKeywords && hasLabelKeywords) { return ForeignIdHashSource.NODE_LABEL_AND_IP_ADDRESS; } else { return ForeignIdHashSource.NODE_LABEL; } }