auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public void testVanillaScenario() throws Exception { final AnalysisResultFuture result; final SparkConf sparkConf = new SparkConf().setMaster("local").setAppName("DCTest - " + getName()); final JavaSparkContext sparkContext = new JavaSparkContext(sparkConf); try { final SparkJobContext sparkJobContext = new SparkJobContext(sparkContext, "src/test/resources/conf_local.xml", "src/test/resources/vanilla-job.analysis.xml"); final AnalysisJob job = sparkJobContext.getAnalysisJob(); assertNotNull(job); <START> final SparkAnalysisRunner sparkAnalysisRunner = new SparkAnalysisRunner(sparkContext, sparkJobContext); <END> result = sparkAnalysisRunner.run(job); } finally { sparkContext.close(); } if (result.isErrornous()) { throw (Exception) result.getErrors().get(0); } assertEquals(2, result.getResultMap().size()); final List<AnalyzerResult> results = result.getResults(); assertEquals(2, results.size()); final StringAnalyzerResult stringAnalyzerResult = result.getResults(StringAnalyzerResult.class).get(0); assertEquals("[MetaModelInputColumn[resources.person_names.txt.company]]", Arrays.toString(stringAnalyzerResult.getColumns())); final int rowCount = stringAnalyzerResult.getRowCount(stringAnalyzerResult.getColumns()[0]); assertEquals(7, rowCount); final int upperCaseChars = stringAnalyzerResult.getEntirelyUpperCaseCount(stringAnalyzerResult.getColumns()[0]); assertEquals(7, upperCaseChars); }</code><technical_language>is this removed</technical_language>

Target:
public void testVanillaScenario() throws Exception { final AnalysisResultFuture result; final SparkConf sparkConf = new SparkConf().setMaster("local").setAppName("DCTest - " + getName()); final JavaSparkContext sparkContext = new JavaSparkContext(sparkConf); try { final SparkJobContext sparkJobContext = new SparkJobContext(sparkContext, "src/test/resources/conf_local.xml", "src/test/resources/vanilla-job.analysis.xml"); final AnalysisJob job = sparkJobContext.getAnalysisJob(); assertNotNull(job); assertEquals("vanilla-job", sparkJobContext.getAnalysisJobName()); final SparkAnalysisRunner sparkAnalysisRunner = new SparkAnalysisRunner(sparkContext, sparkJobContext); result = sparkAnalysisRunner.run(job); } finally { sparkContext.close(); } if (result.isErrornous()) { throw (Exception) result.getErrors().get(0); } assertEquals(2, result.getResultMap().size()); final List<AnalyzerResult> results = result.getResults(); assertEquals(2, results.size()); final StringAnalyzerResult stringAnalyzerResult = result.getResults(StringAnalyzerResult.class).get(0); assertEquals("[MetaModelInputColumn[resources.person_names.txt.company]]", Arrays.toString(stringAnalyzerResult.getColumns())); final int rowCount = stringAnalyzerResult.getRowCount(stringAnalyzerResult.getColumns()[0]); assertEquals(7, rowCount); final int upperCaseChars = stringAnalyzerResult.getEntirelyUpperCaseCount(stringAnalyzerResult.getColumns()[0]); assertEquals(7, upperCaseChars); }
Source:
<code>public void withChecksContext() throws Exception { WorkflowJob j = rule.jenkins.createProject(WorkflowJob.class, "singleStep"); j.setDefinition(new CpsFlowDefinition("stage('first') {\n" + " node {\n" + " withChecks('With Checks') {\n"+ <START> " def results = junit(testResults: '*.xml')\n" + <END> " assert results.totalCount == 6\n" + " }\n" + " }\n" + "}\n", true)); FilePath ws = rule.jenkins.getWorkspaceFor(j); FilePath testFile = requireNonNull(ws).child("test-result.xml"); testFile.copyFrom(TestResultTest.class.getResource("junit-report-1463.xml")); rule.buildAndAssertSuccess(j); List<ChecksDetails> checksDetails = getDetails(); assertThat(checksDetails.size(), is(2)); assertThat(checksDetails.get(0).getName().get(), is("With Checks")); assertThat(checksDetails.get(0).getStatus(), is(ChecksStatus.IN_PROGRESS)); assertThat(checksDetails.get(0).getConclusion(), is(ChecksConclusion.NONE)); assertThat(checksDetails.get(1).getName().get(), is("With Checks")); assertThat(checksDetails.get(1).getStatus(), is(ChecksStatus.COMPLETED)); assertThat(checksDetails.get(1).getConclusion(), is(ChecksConclusion.SUCCESS)); }</code><technical_language>suggestion " def results = junit '*.xml'\n" +</technical_language>

Target:
public void withChecksContext() throws Exception { WorkflowJob j = rule.jenkins.createProject(WorkflowJob.class, "singleStep"); j.setDefinition(new CpsFlowDefinition("stage('first') {\n" + " node {\n" + " withChecks('With Checks') {\n"+ " def results = junit '*.xml'\n" + " assert results.totalCount == 6\n" + " }\n" + " }\n" + "}\n", true)); FilePath ws = rule.jenkins.getWorkspaceFor(j); FilePath testFile = requireNonNull(ws).child("test-result.xml"); testFile.copyFrom(TestResultTest.class.getResource("junit-report-1463.xml")); rule.buildAndAssertSuccess(j); List<ChecksDetails> checksDetails = getDetails(); assertThat(checksDetails.size(), is(2)); assertThat(checksDetails.get(0).getName().get(), is("With Checks")); assertThat(checksDetails.get(0).getStatus(), is(ChecksStatus.IN_PROGRESS)); assertThat(checksDetails.get(0).getConclusion(), is(ChecksConclusion.NONE)); assertThat(checksDetails.get(1).getName().get(), is("With Checks")); assertThat(checksDetails.get(1).getStatus(), is(ChecksStatus.COMPLETED)); assertThat(checksDetails.get(1).getConclusion(), is(ChecksConclusion.SUCCESS)); }
Source:
<code>public Date getEndDate() { if (null == dataFile) { return null; } LocalDateTime date = dataFile.getEndDate(); if (null == date) { return null; } <START> return Date.from(date.atZone(ZoneId.of("UTC")).toInstant()); <END> }</code><technical_language>return statement</technical_language>

Target:
public Date getEndDate() { Date date = null; if (null != dataFile) { LocalDateTime localDate = dataFile.getEndDate(); if (null != localDate) { date = Date.from(localDate.atZone(ZoneId.of("UTC")).toInstant()); } } return date; }
Source:
<code>public <T extends LwM2mResponse> void send(Client destination, String requestTicket, DownlinkRequest<T> request) { LOG.trace("send(requestTicket={})", requestTicket); @SuppressWarnings("unchecked") DownlinkRequest<LwM2mResponse> castedDownlinkRequest = (DownlinkRequest<LwM2mResponse>) request; LOG.trace("Sending request with queue mode", castedDownlinkRequest); String endpoint = destination.getEndpoint(); readWriteLock.readLock().lock(); try { if (clientRegistry.get(endpoint) != null) { QueuedRequest queuedRequest = new QueuedRequestImpl(endpoint, castedDownlinkRequest, requestTicket); messageStore.add(queuedRequest); if (clientStatusTracker.startClientReceiving(endpoint)) { processingExecutor.execute(newRequestSendingTask(endpoint)); } } else { String message = String.format("message received in Queue Mode for the unknown client [%s]", endpoint); LOG.warn(message); <START> throw new RequestCanceledException(message); <END> } } finally { readWriteLock.readLock().unlock(); } }</code><technical_language>canceled notification raised other errors ? (through ResponseListener)</technical_language>

Target:
public <T extends LwM2mResponse> void send(Client destination, String requestTicket, DownlinkRequest<T> request) { LOG.trace("send(requestTicket={})", requestTicket); @SuppressWarnings("unchecked") DownlinkRequest<LwM2mResponse> castedDownlinkRequest = (DownlinkRequest<LwM2mResponse>) request; LOG.trace("Sending request with queue mode", castedDownlinkRequest); String endpoint = destination.getEndpoint(); readWriteLock.readLock().lock(); try { if (clientRegistry.get(endpoint) != null) { QueuedRequest queuedRequest = new QueuedRequestImpl(endpoint, castedDownlinkRequest, requestTicket); messageStore.add(queuedRequest); if (clientStatusTracker.startClientReceiving(endpoint)) { processingExecutor.execute(newRequestSendingTask(endpoint)); } } else { String message = String.format("message received in Queue Mode for the unknown client [%s]", endpoint); LOG.warn(message); processingExecutor.execute(new ResponseProcessingTask(destination, requestTicket, responseListeners, new RequestCanceledException(message))); } } finally { readWriteLock.readLock().unlock(); } }
Source:
<code>private void backoff(Exception e) { if (e != null) { ZLog.logException(e); } failures += 1; long backoff = (long) (Math.exp(failures / 2.0) * 1000); Log.e(ASYNC_GET_EVENTS, "Failure " + failures + ", sleeping for " + backoff); <START> if (failures == 2) { <END> mActivity.showConnectivitySnackBar(Constants.STATUS_NOT_CONNECTED); } SystemClock.sleep(backoff); }</code><technical_language>I this 2 defined in Constant.java</technical_language>

Target:
private void backoff(Exception e) { if (e != null) { ZLog.logException(e); } failures += 1; long backoff = (long) (Math.exp(failures / 2.0) * 1000); Log.e(ASYNC_GET_EVENTS, "Failure " + failures + ", sleeping for " + backoff); if (failures == Constants.MAX_CONNECTION_FAILURE_COUNT) { mActivity.showConnectivitySnackBar(Constants.STATUS_NOT_CONNECTED); } SystemClock.sleep(backoff); }
Source:
<code>public void write(final ChannelHandlerContext ctx, final Object msg, final ChannelPromise promise) throws Exception { Request<?> request = (Request<?>) msg; if (request instanceof BinaryRequest) { <START> ((BinaryRequest) request).setOpaque(requestSequenceId.incrementAndGet()); <END> } outstanding.add(request); super.write(ctx, msg, promise); }</code><technical_language>A regular integer do fine. connection handler is single threaded</technical_language>

Target:
public void write(final ChannelHandlerContext ctx, final Object msg, final ChannelPromise promise) throws Exception { Request<?> request = (Request<?>) msg; if (request instanceof BinaryRequest) { ((BinaryRequest) request).setOpaque(++requestSequenceId); } outstanding.add(request); super.write(ctx, msg, promise); }
Source:
<code>public Map<String, Object> getSpecificEventStyle(ITimeEvent event) { if (event instanceof SpanMarkerEvent) { SpanMarkerEvent markerEvent = (SpanMarkerEvent) event; Map<String, Object> ret = new HashMap<>(); ret.put(ITimeEventStyleStrings.fillColor(), RGBAUtil.fromRGBA(markerEvent.getColor())); String type = markerEvent.getType(); String fillStyle = ITimeEventStyleStrings.symbolStyle(); if (type.contains(ERROR_KIND)) { ret.put(fillStyle, IYAppearance.SymbolStyle.PLUS); } else if (type.contains(ERROR_OBJECT)) { ret.put(fillStyle, IYAppearance.SymbolStyle.CROSS); } else if (type.contains(EVENT)) { ret.put(fillStyle, IYAppearance.SymbolStyle.CIRCLE); } else if (type.contains(MESSAGE)) { ret.put(fillStyle, IYAppearance.SymbolStyle.TRIANGLE); } else if (type.contains(STACK)) { ret.put(fillStyle, IYAppearance.SymbolStyle.INVERTED_TRIANGLE); } else { ret.put(fillStyle, IYAppearance.SymbolStyle.DIAMOND); } ret.put(ITimeEventStyleStrings.heightFactor(), 0.5f); ret.put(ITimeEventStyleStrings.label(), markerEvent.getLabel()); return ret; } return <START> super.getSpecificEventStyle(event); <END> }</code><technical_language>safer get this in a map add additional style in change</technical_language>

Target:
public Map<String, Object> getSpecificEventStyle(ITimeEvent event) { if (event instanceof SpanMarkerEvent) { SpanMarkerEvent markerEvent = (SpanMarkerEvent) event; Map<String, Object> ret = new HashMap<>(); ret.put(ITimeEventStyleStrings.fillColor(), RGBAUtil.fromRGBA(markerEvent.getColor())); String type = markerEvent.getType(); String fillStyle = ITimeEventStyleStrings.symbolStyle(); if (type.contains(ERROR_KIND)) { ret.put(fillStyle, IYAppearance.SymbolStyle.PLUS); } else if (type.contains(ERROR_OBJECT)) { ret.put(fillStyle, IYAppearance.SymbolStyle.CROSS); } else if (type.contains(EVENT)) { ret.put(fillStyle, IYAppearance.SymbolStyle.CIRCLE); } else if (type.contains(MESSAGE)) { ret.put(fillStyle, IYAppearance.SymbolStyle.TRIANGLE); } else if (type.contains(STACK)) { ret.put(fillStyle, IYAppearance.SymbolStyle.INVERTED_TRIANGLE); } else { ret.put(fillStyle, IYAppearance.SymbolStyle.DIAMOND); } ret.put(ITimeEventStyleStrings.heightFactor(), 0.5f); ret.put(ITimeEventStyleStrings.label(), markerEvent.getLabel()); return ret; } Map<String, Object> specificEventStyle = super.getSpecificEventStyle(event); return specificEventStyle; }
Source:
<code>public Permission getRequiredPermission() { <START> return Jenkins.MANAGE; <END> }</code><technical_language>I leaning moving this requiring Jenkins.ADMINISTER</technical_language>

Target:
public Permission getRequiredPermission() { return Jenkins.ADMINISTER; }
Source:
<code>public static <T> Stream<T> stream(Optional<T> optional) { <START> if (optional.isPresent()) { <END> return Stream.of(optional.get()); } return Stream.empty(); }</code><technical_language>This done in functional style if prefer: java return optional.map(Stream::of).orElseGet(Stream::empty);</technical_language>

Target:
public static <T> Stream<T> stream(Optional<T> optional) { return optional.map(Stream::of).orElseGet(Stream::empty); }
Source:
<code>public T deleteHostedVersion(@ApiParam(hidden = true) @Auth User user, @ApiParam(value = "Entry to modify.", required = true) @PathParam("entryId") Long entryId, @ApiParam(value = "version", required = true) @QueryParam("version") String version) { T entry = getEntryDAO().findById(entryId); checkEntry(entry); checkUserCanUpdate(user, entry); checkHosted(entry); if (entry.getActualDefaultVersion().getName().equals(version)) { Optional<U> max = entry.getWorkflowVersions().stream().filter(v -> !Objects.equals(v.getName(), version)) <START> .max(Comparator.comparingLong(ver -> ver.getDate() != null ? ver.getDate().getTime() : ver.getDbCreateDate().getTime())); <END> entry.setActualDefaultVersion(max.orElse(null)); } entry.getWorkflowVersions().removeIf(v -> Objects.equals(v.getName(), version)); PublicStateManager.getInstance().handleIndexUpdate(entry, StateManagerMode.UPDATE); return entry; }</code><technical_language>devil's advocate? difference? dbcreatedate</technical_language>

Target:
public T deleteHostedVersion(@ApiParam(hidden = true) @Auth User user, @ApiParam(value = "Entry to modify.", required = true) @PathParam("entryId") Long entryId, @ApiParam(value = "version", required = true) @QueryParam("version") String version) { T entry = getEntryDAO().findById(entryId); checkEntry(entry); checkUserCanUpdate(user, entry); checkHosted(entry); if (entry.getActualDefaultVersion().getName().equals(version)) { Optional<U> max = entry.getWorkflowVersions().stream().filter(v -> !Objects.equals(v.getName(), version)) .max(Comparator.comparingLong(ver -> ver.getDbCreateDate().getTime())); entry.setActualDefaultVersion(max.orElse(null)); } entry.getWorkflowVersions().removeIf(v -> Objects.equals(v.getName(), version)); PublicStateManager.getInstance().handleIndexUpdate(entry, StateManagerMode.UPDATE); return entry; }
Source:
<code>private CppCompileActionBuilder initializeCompileAction(Artifact sourceArtifact) { CppCompileActionBuilder builder = new CppCompileActionBuilder( actionConstructionContext, grepIncludes, ccToolchain, configuration); builder.setSourceFile(sourceArtifact); builder.setCcCompilationContext(ccCompilationContext); builder.setCoptsFilter(coptsFilter); builder.setFeatureConfiguration(featureConfiguration); <START> if (ruleContext != null) { <END> builder.addExecutionInfo(TargetUtils.getExecutionInfo(ruleContext.getRule(), ruleContext.isAllowTagsPropagation())); } return builder; }</code><technical_language>if (ruleContext != null && ruleContext.isAllowTagsPropagation()) { builder.addExecutionInfo(TargetUtils.getExecutionInfo(ruleContext.getRule())) }</technical_language>

Target:
private CppCompileActionBuilder initializeCompileAction(Artifact sourceArtifact) { CppCompileActionBuilder builder = new CppCompileActionBuilder( actionConstructionContext, grepIncludes, ccToolchain, configuration); builder.setSourceFile(sourceArtifact); builder.setCcCompilationContext(ccCompilationContext); builder.setCoptsFilter(coptsFilter); builder.setFeatureConfiguration(featureConfiguration); builder.addExecutionInfo(executionInfo); return builder; }
Source:
<code>public void unbind(String name) { if (name == null || name.isEmpty()) { throw MessagingLogger.ROOT_LOGGER.cannotUnbindJndiName(); } final ContextNames.BindInfo bindInfo = ContextNames.bindInfoFor(name); ServiceController<?> bindingService = container.getService(bindInfo.getBinderServiceName()); if (bindingService == null) { ROOT_LOGGER.debugf("Cannot unbind %s since no binding exists with that name", name); return; } final UninterruptibleCountDownLatch latch = new UninterruptibleCountDownLatch(1); bindingService.addListener(new LifecycleListener() { @Override public void handleEvent(final ServiceController<?> controller, final LifecycleEvent event) { if (event == LifecycleEvent.REMOVED) { ROOT_LOGGER.unboundJndiName(bindInfo.getAbsoluteJndiName()); latch.countDown(); } } }); try { bindingService.setMode(ServiceController.Mode.REMOVE); } finally { <START> latch.awaitUninterruptibly(); <END> } }</code><technical_language>ignore interrupts here</technical_language>

Target:
public void unbind(String name) { if (name == null || name.isEmpty()) { throw MessagingLogger.ROOT_LOGGER.cannotUnbindJndiName(); } final ContextNames.BindInfo bindInfo = ContextNames.bindInfoFor(name); ServiceController<?> bindingService = container.getService(bindInfo.getBinderServiceName()); if (bindingService == null) { ROOT_LOGGER.debugf("Cannot unbind %s since no binding exists with that name", name); return; } final CountDownLatch latch = new CountDownLatch(1); bindingService.addListener(new LifecycleListener() { @Override public void handleEvent(final ServiceController<?> controller, final LifecycleEvent event) { if (event == LifecycleEvent.REMOVED) { ROOT_LOGGER.unboundJndiName(bindInfo.getAbsoluteJndiName()); latch.countDown(); } } }); try { bindingService.setMode(ServiceController.Mode.REMOVE); } finally { try { latch.await(); } catch (InterruptedException ie) { ROOT_LOGGER.failedToUnbindJndiName(name, 5, SECONDS.toString().toLowerCase(Locale.US)); } } }
Source:
<code>private static boolean appendPort(final String scheme, final int port) { <START> return port > -1 && ((HTTP.equals(scheme) && port != 80) || (HTTPS.equals(scheme) && port != 443)); <END> }</code><technical_language>necessary, protocol is case-insensitive - equalsIgnoreCase used</technical_language>

Target:
private static boolean appendPort(final String scheme, final int port) { return port > -1 && ((HTTP.equalsIgnoreCase(scheme) && port != 80) || (HTTPS.equalsIgnoreCase(scheme) && port != 443)); }
Source:
<code>private static String getProperty(String property) { try { return SystemReader.getInstance().getProperty(property); <START> } catch (SecurityException e) { <END> return null; } }</code><technical_language>logging exception</technical_language>

Target:
private static String getProperty(String property) { try { return SystemReader.getInstance().getProperty(property); } catch (SecurityException e) { LOG.warn(JGitText.get().failedReadHttpsProtocols, e); return null; } }
Source:
<code>public boolean isEmpty() { <START> return size > 0; <END> }</code><technical_language>This wrong</technical_language>

Target:
public boolean isEmpty() { return size == 0; }
Source:
<code>public TestTemplateTestDescriptor(UniqueId uniqueId, Class<?> testClass, Method templateMethod) { super(uniqueId, determineDisplayName(Preconditions.notNull(templateMethod, "Method must not be null"), MethodTestDescriptor::generateDefaultDisplayName)); <START> <END> this.testClass = Preconditions.notNull(testClass, "Class must not be null"); this.templateMethod = templateMethod; setSource(new MethodSource(templateMethod)); }</code><technical_language>method reference generateDefaultDisplayName show slight symptoms of 'feature envy'? Again, a common helper structure useful</technical_language>

Target:
public TestTemplateTestDescriptor(UniqueId uniqueId, Class<?> testClass, Method templateMethod) { super(uniqueId, testClass, templateMethod); }
Source:
<code>private void getPathsAndIndex(RevCommit bCommit) throws Exception { RevTree bTree = bCommit.getTree(); try { RevTree aTree = aFor(bCommit, walk); if (aTree == null) { return; } DiffFormatter df = new DiffFormatter(DisabledOutputStream.INSTANCE); try { df.setRepository(repo); List<ChangeData> cds = byId.get(bCommit); if (!cds.isEmpty()) { List<String> paths = getPaths(df.scan(aTree, bTree)); for (ChangeData cd : cds) { try { cd.setCurrentFilePaths(paths); indexer.indexTask(cd).call(); done.update(1); if (verbose) { System.out.println("Reindexed change " + cd.getId()); } } catch (Exception e) { log.warn("Failed to index change " + cd.getId(), e); if (verbose) { <START> System.out.println("Failed to index change " + cd.getId()); <END> } failed.update(1); } } } } finally { df.release(); } } catch (Exception e) { log.warn("Failed to index changes for commit " + bCommit.name(), e); if (verbose) { System.out.println("Failed to index changes for commit " + bCommit.name()); } failed.update(1); } }</code><technical_language>Nit: factor out: void fail(String msg, Exception e) { log.warn(msg, e); System.out.println(e); }</technical_language>

Target:
private void getPathsAndIndex(RevCommit bCommit) throws Exception { RevTree bTree = bCommit.getTree(); try { RevTree aTree = aFor(bCommit, walk); if (aTree == null) { return; } DiffFormatter df = new DiffFormatter(DisabledOutputStream.INSTANCE); try { df.setRepository(repo); List<ChangeData> cds = byId.get(bCommit); if (!cds.isEmpty()) { List<String> paths = getPaths(df.scan(aTree, bTree)); for (ChangeData cd : cds) { cd.setCurrentFilePaths(paths); indexer.indexTask(cd).call(); done.update(1); if (verbose) { System.out.println("Reindexed change " + cd.getId()); } } } } finally { df.release(); } } catch (Exception e) { fail("Failed to index commit " + bCommit.name(), e); } }
Source:
<code>private List<Person> createModel() { List<Person> elements = new ArrayList<Person>(4); elements.add(new Person("Tom", "Schindl", "tom.schindl@bestsolution.at")); elements.add(new Person("Boris", "Bokowski", <START> "Boris_Bokowski@ca.ibm.com")); <END> elements.add(new Person("Tod", "Creasey", "Tod_Creasey@ca.ibm.com")); elements.add(new Person("Wayne", "Beaton", "wayne@eclipse.org")); return elements; }</code><technical_language>Replace Boris</technical_language>

Target:
private List<Person> createModel() { List<Person> elements = new ArrayList<Person>(4); elements.add(new Person("Tom", "Schindl", "tom.schindl@bestsolution.at")); elements.add(new Person("Tod", "Creasey", "Tod_Creasey@ca.ibm.com")); elements.add(new Person("Wayne", "Beaton", "wayne@eclipse.org")); return elements; }
Source:
<code>public I dispatch(CommandEnvelope cmd) { checkNotNull(cmd); <START> I id = with(cmd.tenantId()).evaluate(() -> { <END> I target = route(cmd); return target; }); inbox.send(cmd).toHandler(id); return id; }</code><technical_language>I do a TenantAwareRunner in other dispatch methods</technical_language>

Target:
public I dispatch(CommandEnvelope cmd) { checkNotNull(cmd); I id = route(cmd); inbox.send(cmd).toHandler(id); return id; }
Source:
<code>public default LabeledText getCRCBinary() { <START> return new LabeledText(getCDKDefaultSection(), "crc binary file: "); <END> }</code><technical_language>I for label CDKLabel.java class, consistency classes</technical_language>

Target:
public default LabeledText getCRCBinary() { return new LabeledText(getCDKDefaultSection(), CDKLabel.Labels.CRC_BINARY_EDITOR); }
Source:
<code><START> ReactorCloudFoundryClient cloudFoundryClient(ConnectionContext connectionContext, TokenProvider tokenProvider) { <END> return ReactorCloudFoundryClient.builder() .connectionContext(connectionContext) .tokenProvider(tokenProvider) .build(); }</code><technical_language>public</technical_language>

Target:
public ReactorCloudFoundryClient cloudFoundryClient(ConnectionContext connectionContext, TokenProvider tokenProvider) { return ReactorCloudFoundryClient.builder() .connectionContext(connectionContext) .tokenProvider(tokenProvider) .build(); }
Source:
<code>public String toString() { StringBuilder sb = new StringBuilder(); sb.append("GetRequest["); sb.append("ListOfBlobIDs=").append(blobIds); if(partitionId!=null) { sb.append(", ").append("PartitionId=").append(partitionId); } else { sb.append(", ").append("PartitionId=Null"); } <START> if(flags!=null) { <END> sb.append(", ").append("MessageFormatFlags=").append(flags); } else { sb.append(", ").append("MessageFormatFlags=Null"); } sb.append(", ").append("TotalIdSize=").append(totalIdSize); sb.append("]"); return sb.toString(); }</code><technical_language>flags is native type. check null</technical_language>

Target:
public String toString() { StringBuilder sb = new StringBuilder(); sb.append("GetRequest["); sb.append("ListOfBlobIDs=").append(blobIds); sb.append(", ").append("PartitionId=").append(partitionId); sb.append(", ").append("MessageFormatFlags=").append(flags); sb.append(", ").append("TotalIdSize=").append(totalIdSize); sb.append("]"); return sb.toString(); }
Source:
<code>private void processTask(Task task) { if (task.getProcessingStatusEnum().equals(TaskStatus.OPEN)) { task.setProcessingStatusEnum(TaskStatus.INWORK); task.setEditTypeEnum(TaskEditType.MANUAL_MULTI); task.setProcessingTime(new Date()); User user = getUser(); serviceManager.getTaskService().replaceProcessingUser(task, user); if (task.getProcessingBegin() == null) { task.setProcessingBegin(new Date()); } if (task.isTypeImagesRead() || task.isTypeImagesWrite()) { try { new File(serviceManager.getProcessService().getImagesOrigDirectory(false, task.getProcess())); } catch (Exception e1) { Helper.setErrorMessage("Error retrieving image directory: ", logger, e1); <START> } <END> task.setProcessingTime(new Date()); serviceManager.getTaskService().replaceProcessingUser(task, user); this.myDav.downloadToHome(task.getProcess(), !task.isTypeImagesWrite()); } } try { this.serviceManager.getProcessService().save(task.getProcess()); } catch (DataException e) { Helper.setErrorMessage("errorSaving", new Object[] {Helper.getTranslation("prozess") }, logger, e); } }</code><technical_language>for moved code: exists() call added a local variable exists() call executed? I prefer option</technical_language>

Target:
private void processTask(Task task) { if (task.getProcessingStatusEnum().equals(TaskStatus.OPEN)) { task.setProcessingStatusEnum(TaskStatus.INWORK); task.setEditTypeEnum(TaskEditType.MANUAL_MULTI); task.setProcessingTime(new Date()); User user = getUser(); serviceManager.getTaskService().replaceProcessingUser(task, user); if (task.getProcessingBegin() == null) { task.setProcessingBegin(new Date()); } if (task.isTypeImagesRead() || task.isTypeImagesWrite()) { try { URI imagesOrigDirectory = serviceManager.getProcessService().getImagesOrigDirectory(false, task.getProcess()); if (! serviceManager.getFileService().fileExist(imagesOrigDirectory)) { Helper.setErrorMessage("Directory doesn't exists!", new Object[] {imagesOrigDirectory}); } } catch (Exception e) { Helper.setErrorMessage("Error retrieving image directory: ", logger, e); } task.setProcessingTime(new Date()); serviceManager.getTaskService().replaceProcessingUser(task, user); this.myDav.downloadToHome(task.getProcess(), !task.isTypeImagesWrite()); } } try { this.serviceManager.getProcessService().save(task.getProcess()); } catch (DataException e) { Helper.setErrorMessage("errorSaving", new Object[] {Helper.getTranslation("prozess") }, logger, e); } }
Source:
<code>public void testToJsonWithLengthLimitComplex() throws JsonLengthLimitExceededException { JsonCodec<List<ImmutablePerson>> jsonCodec = listJsonCodec(jsonCodec(ImmutablePerson.class)); ImmutablePerson person = new ImmutablePerson(Strings.repeat("a", 1000), false); List<ImmutablePerson> people = Collections.nCopies(10, person); assertLengthLimitExceeded(jsonCodec, people, 10000); <START> jsonCodec.toJsonWithLengthLimit(people, 10382); <END> }</code><technical_language>Add a failure for 10381 (assuming is boundary)</technical_language>

Target:
public void testToJsonWithLengthLimitComplex() { JsonCodec<List<ImmutablePerson>> jsonCodec = listJsonCodec(jsonCodec(ImmutablePerson.class)); ImmutablePerson person = new ImmutablePerson(Strings.repeat("a", 1000), false); List<ImmutablePerson> people = Collections.nCopies(10, person); assertFalse(jsonCodec.toJsonWithLengthLimit(people, 0).isPresent()); assertFalse(jsonCodec.toJsonWithLengthLimit(people, 5000).isPresent()); assertFalse(jsonCodec.toJsonWithLengthLimit(people, 10381).isPresent()); jsonCodec.toJsonWithLengthLimit(people, 10382); }
Source:
<code>public boolean put(String lookupName, final LookupExtractorFactory lookupExtractorFactory) { synchronized (lock) { assertStarted(); if (!lookupExtractorFactory.start()) { throw new ISE("start method returned false for lookup [%s]", lookupName); } <START> return (null == lookupMap.putIfAbsent(lookupName, lookupExtractorFactory)); <END> } }</code><technical_language>state is started stopped. stop if lookupName is present</technical_language>

Target:
public boolean put(String lookupName, final LookupExtractorFactory lookupExtractorFactory) { synchronized (lock) { assertStarted(); if (lookupMap.containsKey(lookupName)) { LOGGER.warn("lookup [%s] is not add, another lookup with the same name already exist", lookupName); return false; } if (!lookupExtractorFactory.start()) { throw new ISE("start method returned false for lookup [%s]", lookupName); } return (null == lookupMap.putIfAbsent(lookupName, lookupExtractorFactory)); } }
Source:
<code>private AstyanaxCassandraContentStore( AstyanaxContext<Keyspace> context, String cfName, ConsistencyLevel readConsistency, ConsistencyLevel writeConsistency, ContentHasher hasher, IdGenerator idGenerator, MessageSender<ResourceUpdatedMessage> sender, EquivalenceGraphStore graphStore, Clock clock, MetricRegistry metricRegistry, String metricPrefix ) { super(hasher, idGenerator, sender, graphStore, clock); this.keyspace = checkNotNull(context.getClient()); this.readConsistency = checkNotNull(readConsistency); this.writeConsistency = checkNotNull(writeConsistency); this.mainCf = ColumnFamily.newColumnFamily(checkNotNull(cfName), LongSerializer.get(), StringSerializer.get() ); this.aliasIndex = AliasIndex.create(keyspace, cfName + "_aliases"); <START> calledMeter = checkNotNull(metricRegistry) <END> .meter(checkNotNull(metricPrefix) + "meter.called"); failureMeter = checkNotNull(metricRegistry) .meter(checkNotNull(metricPrefix) + "meter.failure"); }</code><technical_language>do checkNotNulls start parameters avoid duplicate check</technical_language>

Target:
private AstyanaxCassandraContentStore( AstyanaxContext<Keyspace> context, String cfName, ConsistencyLevel readConsistency, ConsistencyLevel writeConsistency, ContentHasher hasher, IdGenerator idGenerator, MessageSender<ResourceUpdatedMessage> sender, EquivalenceGraphStore graphStore, Clock clock, MetricRegistry metricRegistry, String metricPrefix ) { super(hasher, idGenerator, sender, graphStore, clock, metricRegistry, metricPrefix); this.keyspace = checkNotNull(context.getClient()); this.readConsistency = checkNotNull(readConsistency); this.writeConsistency = checkNotNull(writeConsistency); this.mainCf = ColumnFamily.newColumnFamily(checkNotNull(cfName), LongSerializer.get(), StringSerializer.get() ); this.aliasIndex = AliasIndex.create(keyspace, cfName + "_aliases"); }
Source:
<code>protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); uiController.setupUI(); loadSaveInstanceState(savedInstanceState); boolean isRotation = savedInstanceState != null; setupUpdateTask(isRotation); proceedAutomatically = getIntent().getBooleanExtra( RefreshToLatestBuildActivity.KEY_FROM_LATEST_BUILD_ACTIVITY, false); if (proceedAutomatically) { startUpdateCheck(); <START> } <END> }</code><technical_language>need call startUpdateCheck() called in setupUpdateTask()</technical_language>

Target:
protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); uiController.setupUI(); proceedAutomatically = getIntent().getBooleanExtra( RefreshToLatestBuildActivity.KEY_FROM_LATEST_BUILD_ACTIVITY, false); loadSavedInstanceState(savedInstanceState); boolean isRotation = savedInstanceState != null; setupUpdateTask(isRotation); }
Source:
<code>void setUp() { <START> factory = shouldHaveSizeGreaterThanOrEqualTo(newArrayList('a', 'b'), 4, 2); <END> }</code><technical_language>CharSequence instead of Object for actual's type</technical_language>

Target:
void setUp() { factory = shouldHaveSizeGreaterThanOrEqualTo("ab", 4, 2); }
Source:
<code>public boolean hasConfigChangeTrigger(IDeploymentConfig dc) { return dc.getTriggers().stream() <START> .anyMatch(t -> IDeploymentConfigChangeTrigger.class.isAssignableFrom(t.getClass())); <END> }</code><technical_language>triggers a type retrievable generic type require comparison interrface</technical_language>

Target:
public boolean hasConfigChangeTrigger(IDeploymentConfig dc) { return dc.getTriggers().stream() .anyMatch(t -> DeploymentTriggerType.CONFIG_CHANGE.equals(t.getType())); }
Source:
<code><START> public void stringValue(DistinctQueryType queryType) { <END> String resource = String.format("{ " + "\"id\": \"5\" + \"}"); DistinctMap distinctMap = DistinctMap.create(queryType, null); Utils.ValueHolder<String> outHash = new Utils.ValueHolder<>(); boolean add = distinctMap.add(resource, outHash); assertThat(add).as("Value should be added first time").isTrue(); boolean add2 = distinctMap.add(resource, outHash); assertThat(add2).as("same value should not be added again").isFalse(); resource = String.format("{ " + "\"id\": \"6\" + \"}"); boolean add3 = distinctMap.add(resource, outHash); assertThat(add3).as("different value should be added again").isTrue(); }</code><technical_language>a test for strings escaped counterpart</technical_language>

Target:
public void stringValue(DistinctQueryType queryType) { String resourceString = String.format("{ " + "\"id\": \"a\" }"); Utils.ValueHolder<String> outHash = new Utils.ValueHolder<>(); Document resource = new Document(resourceString); DistinctMap distinctMap = DistinctMap.create(queryType, null); boolean add = distinctMap.add(resource, outHash); assertThat(add).as("Value should be added first time").isTrue(); boolean add2 = distinctMap.add(resource, outHash); assertThat(add2).as("same value should not be added again").isFalse(); resource = new Document(String.format("{ " + "\"id\": \"b\" }")); boolean add3 = distinctMap.add(resource, outHash); assertThat(add3).as("different value should be added again").isTrue(); }
Source:
<code>private void assertTimerEventMultiple(CancellingTimerEventExecutionSet executionSet, String timerValue, String timeCycleLanguage, boolean isCancelling, String slaDueDate) { assertNotNull(executionSet); assertNotNull(executionSet.getTimerSettings()); assertEquals(timerValue, executionSet.getTimerSettings().getValue().getTimeCycle()); assertEquals(timeCycleLanguage, executionSet.getTimerSettings().getValue().getTimeCycleLanguage()); if (getMarshallerType() == Marshaller.NEW) { assertNotNull(executionSet.getCancelActivity()); assertNotNull(executionSet.getSlaDueDate()); assertEquals(isCancelling, executionSet.getCancelActivity().getValue()); assertEquals(slaDueDate, executionSet.getSlaDueDate().getValue()); } <START> assertNull(executionSet.getTimerSettings().getValue().getTimeDuration()); <END> assertNull(executionSet.getTimerSettings().getValue().getTimeDate()); }</code><technical_language>Consider refactoring well</technical_language>

Target:
private void assertTimerEventMultiple(CancellingTimerEventExecutionSet executionSet, String timerValue, String timeCycleLanguage, boolean isCancelling, String slaDueDate) { assertNotNull(executionSet); assertNotNull(executionSet.getTimerSettings()); assertEquals(timerValue, executionSet.getTimerSettings().getValue().getTimeCycle()); assertEquals(timeCycleLanguage, executionSet.getTimerSettings().getValue().getTimeCycleLanguage()); assertNull(executionSet.getTimerSettings().getValue().getTimeDuration()); assertNull(executionSet.getTimerSettings().getValue().getTimeDate()); assertEventCancelActivity(executionSet, isCancelling); assertTimerEventSlaDueDate(executionSet, slaDueDate); }
Source:
<code>public String getArchive(String archiveId) { String responseString = null; Future<Response> request = null; <START> String url = this.apiUrl+"/v2/partner/"+this.apiKey+"/archive/"+archiveId; <END> try { request = this.prepareGet(url).execute(); } catch (IOException e) { e.printStackTrace(); } try { Response response = request.get(); responseString = response.getResponseBody(); } catch (InterruptedException e) { e.printStackTrace(); } catch (ExecutionException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } return responseString; }</code><technical_language>spacing</technical_language>

Target:
public String getArchive(String archiveId) throws RequestException { String responseString = null; Future<Response> request = null; String url = this.apiUrl + "/v2/partner/" + this.apiKey + "/archive/" + archiveId; try { request = this.prepareGet(url).execute(); } catch (IOException e) { throw new RequestException("Could not get an OpenTok Archive", e); } try { Response response = request.get(); switch (response.getStatusCode()) { case 200: responseString = response.getResponseBody(); break; case 400: throw new RequestException("Could not get an OpenTok Archive. The archiveId was invalid. " + "archiveId: " + archiveId); case 403: throw new RequestException("Could not get an OpenTok Archive. The request was not authorized."); case 500: throw new RequestException("Could not get an OpenTok Archive. A server error occurred."); default: throw new RequestException("Could not get an OpenTok Archive. The server response was invalid." + " response code: " + response.getStatusCode()); } } catch (InterruptedException e) { throw new RequestException("Could not get an OpenTok Archive", e); } catch (ExecutionException e) { throw new RequestException("Could not get an OpenTok Archive", e); } catch (IOException e) { throw new RequestException("Could not get an OpenTok Archive", e); } return responseString; }
Source:
<code>private void showCaseDetails(int selectedRowViewIdx) { String caseDisplayName = Bundle.DataContentViewerOtherCases_caseDetailsDialog_noCaseNameError(); String details = Bundle.DataContentViewerOtherCases_caseDetailsDialog_noDetails(); try { if (-1 != selectedRowViewIdx) { EamDb dbManager = EamDb.getInstance(); int selectedRowModelIdx = filesTable.convertRowIndexToModel(selectedRowViewIdx); List<OtherOccurrenceNodeData> rowList = filesTableModel.getListOfNodesForFile(selectedRowModelIdx); <START> if (rowList.get(0) instanceof OtherOccurrenceNodeInstanceData) { <END> if (!rowList.isEmpty()) { CorrelationCase eamCasePartial = ((OtherOccurrenceNodeInstanceData) rowList.get(0)).getCorrelationAttributeInstance().getCorrelationCase(); caseDisplayName = eamCasePartial.getDisplayName(); CorrelationCase eamCase = dbManager.getCaseByUUID(eamCasePartial.getCaseUUID()); if (eamCase != null) { details = eamCase.getCaseDetailsOptionsPaneDialog(); } else { details = Bundle.DataContentViewerOtherCases_caseDetailsDialog_noDetails(); } } else { details = Bundle.DataContentViewerOtherCases_caseDetailsDialog_noDetailsReference(); } } else { details = Bundle.DataContentViewerOtherCases_caseDetailsDialog_notSelected(); } } } catch (EamDbException ex) { LOGGER.log(Level.SEVERE, "Error loading case details", ex); } finally { JOptionPane.showConfirmDialog(showCaseDetailsMenuItem, details, caseDisplayName, DEFAULT_OPTION, PLAIN_MESSAGE); } }</code><technical_language>check list is empty, accessing data? other places similar code</technical_language>

Target:
private void showCaseDetails(int selectedRowViewIdx) { String caseDisplayName = Bundle.DataContentViewerOtherCases_caseDetailsDialog_noCaseNameError(); String details = Bundle.DataContentViewerOtherCases_caseDetailsDialog_noDetails(); try { if (-1 != selectedRowViewIdx) { EamDb dbManager = EamDb.getInstance(); int selectedRowModelIdx = filesTable.convertRowIndexToModel(selectedRowViewIdx); List<OtherOccurrenceNodeData> rowList = filesTableModel.getListOfNodesForFile(selectedRowModelIdx); if (!rowList.isEmpty()) { if (rowList.get(0) instanceof OtherOccurrenceNodeInstanceData) { CorrelationCase eamCasePartial = ((OtherOccurrenceNodeInstanceData) rowList.get(0)).getCorrelationAttributeInstance().getCorrelationCase(); caseDisplayName = eamCasePartial.getDisplayName(); CorrelationCase eamCase = dbManager.getCaseByUUID(eamCasePartial.getCaseUUID()); if (eamCase != null) { details = eamCase.getCaseDetailsOptionsPaneDialog(); } else { details = Bundle.DataContentViewerOtherCases_caseDetailsDialog_noDetails(); } } else { details = Bundle.DataContentViewerOtherCases_caseDetailsDialog_notSelected(); } } else { details = Bundle.DataContentViewerOtherCases_caseDetailsDialog_noDetailsReference(); } } } catch (EamDbException ex) { LOGGER.log(Level.SEVERE, "Error loading case details", ex); } finally { JOptionPane.showConfirmDialog(showCaseDetailsMenuItem, details, caseDisplayName, DEFAULT_OPTION, PLAIN_MESSAGE); } }
Source:
<code>private void show(final DirCacheTree tree) { out.print("\""); out.print(tree.getPathString()); out.print("\""); out.print(": "); out.print(tree.getEntrySpan()); out.print(" "); out.print(CLIText.get().entriesLabel); out.print(", "); out.print(tree.getChildCount()); out.print(" "); <START> out.print(CLIText.get().childrenLabel); <END> out.println(); for (int i = 0; i < tree.getChildCount(); i++) show(tree.getChild(i)); }</code><technical_language>string transaltors language conventions. I German" French people prefer a type of quotes</technical_language>

Target:
private void show(final DirCacheTree tree) { out.println(MessageFormat.format(CLIText.get().cacheTreePathInfo , tree.getPathString(), tree.getEntrySpan(), tree.getChildCount())); for (int i = 0; i < tree.getChildCount(); i++) show(tree.getChild(i)); }
Source:
<code>public SortedMap<String, ReadyCheck.Result> runReadyChecks(ExecutorService executor) { final Map<String, Future<ReadyCheck.Result>> futures = new HashMap<>(); for (final Map.Entry<String, ReadyCheck> entry : readyChecks.entrySet()) { final String name = entry.getKey(); final ReadyCheck readyCheck = entry.getValue(); futures.put(name, executor.submit(readyCheck::execute)); } final SortedMap<String, ReadyCheck.Result> results = new TreeMap<>(); <START> for (Map.Entry<String, Future<ReadyCheck.Result>> entry : futures.entrySet()) { <END> try { results.put(entry.getKey(), entry.getValue().get()); } catch (Exception e) { LOGGER.warn("Error executing ready check {}", entry.getKey(), e); results.put(entry.getKey(), ReadyCheck.Result.unready(e)); } } return Collections.unmodifiableSortedMap(results); }</code><technical_language>For edification, this for loop that, for example, if call get() Future<ReadyCheck.Result> takes a long time complete, block wait for complete continuing loop</technical_language>

Target:
public SortedMap<String, Result> runReadyChecks(ExecutorService executor) { final Map<String, Future<Result>> futures = new HashMap<>(); for (final Map.Entry<String, ReadyCheck> entry : readyChecks.entrySet()) { final String name = entry.getKey(); final ReadyCheck readyCheck = entry.getValue(); futures.put(name, executor.submit(readyCheck::execute)); } final SortedMap<String, Result> results = new TreeMap<>(); for (Map.Entry<String, Future<Result>> entry : futures.entrySet()) { try { results.put(entry.getKey(), entry.getValue().get()); } catch (Exception e) { LOGGER.warn("Error executing ready check {}", entry.getKey(), e); results.put(entry.getKey(), Result.unready(e)); } } return Collections.unmodifiableSortedMap(results); }
Source:
<code>private void joinGame(Pane gameBox, Specializations spec) { System.out.println("trying to join game"); try { if(broker != null) { <START> broker.unregisterAll(this); <END> } broker = new Broker(); broker.register(Observation.SERVER_OFFLINE, this, (Observable, data)->brokerException()); GameDTO map = ibs.joinGame(clientPlayer.getId(), spec.getValue()); try { broker.readSessionId(map.getSessionId()); } catch (IOException e) { e.printStackTrace(); } clientPlayer.createNewCharacter(map.getCharacterId(), spec); cMap = new ClientMap(map, gameBox, broker, clientPlayer); inGame = true; } catch (RemoteException e) { e.printStackTrace(); } characterController = new CharacterController(clientPlayer.getCharacter(), gameBox, sceneRelativeLocation); cMap.activate(); }</code><technical_language>shouldnt this done in deactivate</technical_language>

Target:
private void joinGame(Pane gameBox, Specializations spec) { System.out.println("trying to join game"); try { if(cMap != null) { cMap.getBroker().unregisterAll(this); } Broker broker = new Broker(); broker.register(Observation.SERVER_OFFLINE, this, (Observable, data)->brokerError()); GameDTO map = ibs.joinGame(clientPlayer.getId(), spec.getValue()); try { broker.readSessionId(map.getSessionId()); } catch (IOException e) { e.printStackTrace(); } clientPlayer.createNewCharacter(map.getCharacterId(), spec); cMap = new ClientMap(map, gameBox, broker, clientPlayer); inGame = true; } catch (RemoteException e) { e.printStackTrace(); } characterController = new CharacterController(clientPlayer.getCharacter(), gameBox, sceneRelativeLocation); cMap.activate(); }
Source:
<code>public Set<DataSegment> findUsedSegments(Set<SegmentIdWithShardSpec> identifiers) throws IOException { final Map<String, Set<SegmentIdWithShardSpec>> identifiersByDataSource = new TreeMap<>(); for (SegmentIdWithShardSpec identifier : identifiers) { <START> identifiersByDataSource.putIfAbsent(identifier.getDataSource(), new HashSet<>()); <END> identifiersByDataSource.get(identifier.getDataSource()).add(identifier); } final Set<DataSegment> retVal = new HashSet<>(); for (Map.Entry<String, Set<SegmentIdWithShardSpec>> entry : identifiersByDataSource.entrySet()) { final List<Interval> intervals = JodaUtils.condenseIntervals( Iterables.transform(entry.getValue(), input -> input.getInterval()) ); final List<DataSegment> usedSegmentsForIntervals = taskActionClient.submit( new SegmentListUsedAction(entry.getKey(), null, intervals) ); for (DataSegment segment : usedSegmentsForIntervals) { if (identifiers.contains(SegmentIdWithShardSpec.fromDataSegment(segment))) { retVal.add(segment); } } } return retVal; }</code><technical_language>This is a good candidate for computeIfAbsent</technical_language>

Target:
public Set<DataSegment> findUsedSegments(Set<SegmentIdWithShardSpec> identifiers) throws IOException { final Map<String, Set<SegmentIdWithShardSpec>> identifiersByDataSource = new TreeMap<>(); for (SegmentIdWithShardSpec identifier : identifiers) { identifiersByDataSource.computeIfAbsent(identifier.getDataSource(), k -> new HashSet<>()); identifiersByDataSource.get(identifier.getDataSource()).add(identifier); } final Set<DataSegment> retVal = new HashSet<>(); for (Map.Entry<String, Set<SegmentIdWithShardSpec>> entry : identifiersByDataSource.entrySet()) { final List<Interval> intervals = JodaUtils.condenseIntervals( Iterables.transform(entry.getValue(), input -> input.getInterval()) ); final List<DataSegment> usedSegmentsForIntervals = taskActionClient.submit( new SegmentListUsedAction(entry.getKey(), null, intervals) ); for (DataSegment segment : usedSegmentsForIntervals) { if (identifiers.contains(SegmentIdWithShardSpec.fromDataSegment(segment))) { retVal.add(segment); } } } return retVal; }
Source:
<code>private boolean ensureCountsEqual(Map<String, Integer> beforeCounts, Map<String, Integer> afterCounts) throws Exception { <START> if (beforeCounts.size() != afterCounts.size()) { <END> System.err.println("There are a different number of tables."); return false; } for (String key : beforeCounts.keySet()) { if (beforeCounts.get(key) != afterCounts.get(key)) { System.err.println("The " + key + " table has a different number of rows (" + beforeCounts.get(key) + " before, " + afterCounts.get(key) + " after)."); showTableContents(key); return false; } } return true; }</code><technical_language>junit assertions check if equal takes a message printed in case assertion fails</technical_language>

Target:
private boolean ensureCountsEqual(Map<String, Integer> beforeCounts, Map<String, Integer> afterCounts) throws Exception { for (String key : beforeCounts.keySet()) { if (beforeCounts.get(key) != afterCounts.get(key)) { System.err.println("The " + key + " table has a different number of rows (" + beforeCounts.get(key) + " before, " + afterCounts.get(key) + " after)."); return false; } } return true; }