auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
private void testCancelAddInstructor() { ______TS("Click cancel button upon new form created"); courseEditPage.clickShowNewInstructorFormButton(); assertTrue(courseEditPage.verifyAddInstructorFormDisplayed()); courseEditPage.clickCancelAddInstructorLink(); assertFalse(courseEditPage.verifyAddInstructorFormDisplayed()); ______TS("Click cancel button after filling some fields of the form"); courseEditPage.clickShowNewInstructorFormButton(); assertTrue(courseEditPage.verifyAddInstructorFormDisplayed()); courseEditPage.fillNewInstructorName("New Instructor Test"); courseEditPage.fillNewInstructorEmail("newinstructortest@example.com"); courseEditPage.clickCancelAddInstructorLink(); assertFalse(courseEditPage.verifyAddInstructorFormDisplayed()); }

Target:
private void testCancelAddInstructor() { ______TS("Click cancel button upon new form created"); courseEditPage.clickShowNewInstructorFormButton(); assertTrue(courseEditPage.verifyAddInstructorFormDisplayed()); courseEditPage.clickCancelAddInstructorLink(); assertFalse(courseEditPage.verifyAddInstructorFormDisplayed()); ______TS("Click cancel button after filling all fields of the form"); int newInstructorIndex = 8; courseEditPage.clickShowNewInstructorFormButton(); assertTrue(courseEditPage.verifyAddInstructorFormDisplayed()); courseEditPage.fillNewInstructorName(newInstructorName); courseEditPage.fillNewInstructorEmail(newInstructorEmail); courseEditPage.fillNewInstructorDisplayName("Test Display"); courseEditPage.selectRoleForNewInstructor(newInstructorIndex, "Observer"); courseEditPage.clickCancelAddInstructorLink(); assertFalse(courseEditPage.verifyAddInstructorFormDisplayed()); ______TS("Confirm form is reset to default values"); courseEditPage.clickShowNewInstructorFormButton(); assertTrue(courseEditPage.verifyAddInstructorFormDisplayed()); assertEquals("", courseEditPage.getNewInstructorName()); assertEquals("", courseEditPage.getNewInstructorEmail()); assertTrue(courseEditPage.verifyAddInstructorFormDefaultValues(newInstructorIndex)); courseEditPage.clickCancelAddInstructorLink(); assertFalse(courseEditPage.verifyAddInstructorFormDisplayed()); }
Source:
private Object wrapForEmbedding(HALResource<? extends RestAddressableModel> resource, Object linkedObject, Link link) { int childEmbedLevel = resource.getContent().getEmbedLevel() + 1; if (linkedObject instanceof RestAddressableModel) { RestAddressableModel restObject = (RestAddressableModel) linkedObject; restObject.setEmbedLevel(childEmbedLevel); return converter.toResource(restObject); } else if (linkedObject instanceof Page) { Page<RestAddressableModel> page = (Page<RestAddressableModel>) linkedObject; return new EmbeddedPage(link.getHref(), page.map((restObject) -> { restObject.setEmbedLevel(childEmbedLevel); return converter.toResource(restObject); }), null, link.getRel()); } else if (linkedObject instanceof List) { List<RestAddressableModel> list = (List<RestAddressableModel>) linkedObject; if (list.size() > 0) { PageImpl<RestAddressableModel> page = new PageImpl( list.subList(0, list.size() > EMBEDDED_PAGE_SIZE ? EMBEDDED_PAGE_SIZE : list.size()), new PageRequest(0, EMBEDDED_PAGE_SIZE), list.size()); return new EmbeddedPage(link.getHref(), page.map((restObject) -> { restObject.setEmbedLevel(childEmbedLevel); return converter.toResource(restObject); }), list, link.getRel()); } else { PageImpl<RestAddressableModel> page = new PageImpl(list); return new EmbeddedPage(link.getHref(), page, list, link.getRel()); } } else { return linkedObject; } }

Target:
private Object wrapForEmbedding(HALResource<? extends RestAddressableModel> resource, Object linkedObject, Link link) { int childEmbedLevel = resource.getContent().getEmbedLevel() + 1; if (linkedObject instanceof RestAddressableModel) { RestAddressableModel restObject = (RestAddressableModel) linkedObject; restObject.setEmbedLevel(childEmbedLevel); return converter.toResource(restObject); } else if (linkedObject instanceof Page) { Page<RestAddressableModel> page = (Page<RestAddressableModel>) linkedObject; return new EmbeddedPage(link.getHref(), page.map((restObject) -> { restObject.setEmbedLevel(childEmbedLevel); return converter.toResource(restObject); }), null, link.getRel()); } else if (linkedObject instanceof List) { List<RestAddressableModel> list = (List<RestAddressableModel>) linkedObject; if (list.size() > 0) { PageImpl<RestAddressableModel> page = new PageImpl( list.subList(0, list.size() > DEFAULT_PAGE_SIZE ? DEFAULT_PAGE_SIZE : list.size()), new PageRequest(0, DEFAULT_PAGE_SIZE), list.size()); return new EmbeddedPage(link.getHref(), page.map((restObject) -> { restObject.setEmbedLevel(childEmbedLevel); return converter.toResource(restObject); }), list, link.getRel()); } else { PageImpl<RestAddressableModel> page = new PageImpl(list); return new EmbeddedPage(link.getHref(), page, list, link.getRel()); } } else { return linkedObject; } }
Source:
@Override protected String getResourceEntryName(Object source, int id) { final View view = (View) source; if (view.isInEditMode()) { return "{ Names cannot be retrieved while in Edit Mode }"; } return super.getResourceEntryName(source, id); }

Target:
@Override protected String getResourceEntryName(Object source, int id) { final View view = (View) source; if (view.isInEditMode()) { return "<unavailable while editing>"; } return super.getResourceEntryName(source, id); }
Source:
public HashSet<String> getRequiredColumns() { return Sets.newHashSet(dimensions.stream() .map(DimensionSpec::getDimension) .collect(Collectors.toSet()) ); }

Target:
public Set<String> getRequiredColumns() { return dimensions.stream().map(DimensionSpec::getDimension).collect(Collectors.toSet()); }
Source:
public void preprocess(DataSetLookup lookup) { if (identityProvider == null) { return; } final List<String> deploymentIds = deploymentRolesManager.getDeploymentsForUser(identityProvider); ColumnFilter columnFilter; if(deploymentIds == null || deploymentIds.size()==0){ columnFilter = equalsTo(impossibleConditionColumnId,-1); } else { columnFilter = in(columnId, deploymentIds); } LOGGER.debug("Adding column filter: {}", columnFilter); if (lookup.getFirstFilterOp() != null) { lookup.getFirstFilterOp().addFilterColumn(columnFilter); } else { DataSetFilter filter = new DataSetFilter(); filter.addFilterColumn(columnFilter); lookup.addOperation(filter); } }

Target:
public void preprocess(DataSetLookup lookup) { if (identityProvider == null) { return; } final List<String> deploymentIds = deploymentRolesManager.getDeploymentsForUser(identityProvider); ColumnFilter columnFilter; if(deploymentIds != null && !deploymentIds.isEmpty()){ columnFilter = in(columnId, deploymentIds); } else { columnFilter = equalsTo(impossibleConditionColumnId,-1); } LOGGER.debug("Adding column filter: {}", columnFilter); if (lookup.getFirstFilterOp() != null) { lookup.getFirstFilterOp().addFilterColumn(columnFilter); } else { DataSetFilter filter = new DataSetFilter(); filter.addFilterColumn(columnFilter); lookup.addOperation(filter); } }
Source:
InstrumentedInterceptor(TaggedMetricRegistry registry, HostEventsSink hostEventsSink, String serviceName) { this.hostEventsSink = hostEventsSink; this.serviceName = serviceName; this.responseTimer = registry.timer(name()); this.ioExceptionMeter = registry.meter(MetricName.builder() .safeName("client.response.failure") .putSafeTags("reason", "IOException") .putSafeTags(SERVICE_NAME_TAG, serviceName) .build()); }

Target:
InstrumentedInterceptor(TaggedMetricRegistry registry, HostEventsSink hostEventsSink, String serviceName) { this.hostEventsSink = hostEventsSink; this.serviceName = serviceName; this.responseTimer = registry.timer(name()); this.ioExceptionMeter = registry.meter(MetricName.builder() .safeName("client.response.error") .putSafeTags("reason", "IOException") .putSafeTags(SERVICE_NAME_TAG, serviceName) .build()); }
Source:
public NavigationView.OnNavigationItemSelectedListener getNewListener() { return new NavigationView.OnNavigationItemSelectedListener() { @Override public boolean onNavigationItemSelected(MenuItem menuItem) { switch (menuItem.getItemId()) { case R.id.nav_item_today: page.displayMainPage(); break; case R.id.nav_item_history: page.pushFragment(new HistoryFragment()); break; case R.id.nav_item_saved_pages: page.pushFragment(new SavedPagesFragment()); break; case R.id.nav_item_nearby: page.pushFragment(new NearbyFragment()); break; case R.id.nav_item_more: launchSettingsActivity(); break; case R.id.nav_item_login: launchLoginActivity(); break; case R.id.nav_item_random: page.getRandomHandler().doVisitRandomArticle(); break; default: return false; } return true; } }; }

Target:
public NavigationView.OnNavigationItemSelectedListener getNewListener() { return new NavigationView.OnNavigationItemSelectedListener() { @Override public boolean onNavigationItemSelected(MenuItem menuItem) { switch (menuItem.getItemId()) { case R.id.nav_item_today: page.displayMainPage(); break; case R.id.nav_item_history: page.pushFragment(new HistoryFragment()); break; case R.id.nav_item_saved_pages: page.pushFragment(new SavedPagesFragment()); break; case R.id.nav_item_nearby: page.pushFragment(new NearbyFragment()); break; case R.id.nav_item_more: launchSettingsActivity(); break; case R.id.nav_item_login: launchLoginActivity(); break; case R.id.nav_item_random: page.getRandomHandler().doVisitRandomArticle(); break; default: return false; } menuItem.setChecked(true); return true; } }; }
Source:
private Diagram doTransformation(final String fileName, final String xml) { final String defSetId = getDefinitionSetId(backendService); final Metadata metadata = buildMetadataInstance(defSetId); final InputStream is = new ByteArrayInputStream(xml.getBytes()); try { final DiagramMarshaller marshaller = backendService.getDiagramMarshaller(); final Graph<DefinitionSet, ?> graph = marshaller.unmarshall(metadata, is); final Node<Definition<BPMNDiagram>, ?> diagramNode = GraphUtils.getFirstNode((Graph<?, Node>) graph, BPMNDiagramImpl.class); if (null == diagramNode) { throw new RuntimeException("No BPMN Diagram can be found."); } diagramNode.getContent().getDefinition().getDiagramSet().getName().setValue(fileName); diagramNode.getContent().getDefinition().getDiagramSet().getId().setValue(fileName); final String title = diagramNode.getContent().getDefinition().getDiagramSet().getName().getValue(); metadata.setTitle(title); return diagramFactory.build(title, metadata, graph); } catch (Exception e) { LOG.error("Error whilst converting XML to BPMN Diagram.", e); throw new DiagramParsingException(metadata, xml); } }

Target:
private Diagram doTransformation(final String fileName, final String xml) { final String defSetId = getDefinitionSetId(backendService); final Metadata metadata = buildMetadataInstance(defSetId); final InputStream is = new ByteArrayInputStream(xml.getBytes()); try { final DiagramMarshaller marshaller = backendService.getDiagramMarshaller(); final Graph<DefinitionSet, ?> graph = marshaller.unmarshall(metadata, is); final Node<Definition<BPMNDiagram>, ?> diagramNode = GraphUtils.getFirstNode((Graph<?, Node>) graph, BPMNDiagramImpl.class); if (null == diagramNode) { throw new RuntimeException("No BPMN Diagram can be found."); } final BaseDiagramSet diagramSet = diagramNode.getContent().getDefinition().getDiagramSet(); diagramSet.getName().setValue(fileName); diagramSet.getId().setValue(fileName); final String title = diagramNode.getContent().getDefinition().getDiagramSet().getName().getValue(); metadata.setTitle(title); return diagramFactory.build(title, metadata, graph); } catch (Exception e) { LOG.error("Error whilst converting XML to BPMN Diagram.", e); throw new DiagramParsingException(metadata, xml); } }
Source:
public Stream(byte[] key) { this.key = key; checkLength(key, NaCl.Sodium.AES_128_CTR_KEYBYTES); }

Target:
public Stream(byte[] key) { this.key = key; checkLength(key, AES_128_CTR_KEYBYTES); }
Source:
public DbAdmin(DbModel model, String server, String user, String passwd, boolean write) throws WaarpDatabaseNoConnectionException { this.server = server; this.user = user; this.passwd = passwd; this.dbModel = model; this.typeDriver = model.getDbType(); if (typeDriver == null) { logger.error("Cannot find TypeDriver"); throw new WaarpDatabaseNoConnectionException( "Cannot find database driver"); } if (write) { for (int i = 0; i < RETRYNB; i++) { try { setSession(new DbSession(this, false)); } catch (WaarpDatabaseNoConnectionException e) { logger.warn("Attempt of connection in error: " + i, e); continue; } isReadOnly = false; getSession().setAdmin(this); validConnection(); getSession().useConnection(); return; } } else { for (int i = 0; i < RETRYNB; i++) { try { setSession(new DbSession(this, true)); } catch (WaarpDatabaseNoConnectionException e) { logger.warn("Attempt of connection in error: " + i, e); continue; } isReadOnly = true; getSession().setAdmin(this); validConnection(); getSession().useConnection(); return; } } setSession(null); setActive(false); logger.error("Cannot connect to Database!"); throw new WaarpDatabaseNoConnectionException( "Cannot connect to database"); }

Target:
public DbAdmin(DbModel model, String server, String user, String passwd, boolean write) throws WaarpDatabaseNoConnectionException { this.server = server; this.user = user; this.passwd = passwd; this.dbModel = model; this.typeDriver = model.getDbType(); if (typeDriver == null) { logger.error("Cannot find TypeDriver"); throw new WaarpDatabaseNoConnectionException( "Cannot find database driver"); } if (write) { for (int i = 0; i < RETRYNB; i++) { try { setSession(new DbSession(this, false)); } catch (WaarpDatabaseNoConnectionException e) { logger.warn("Attempt of connection in error: " + i, e); continue; } isReadOnly = false; getSession().setAdmin(this); validConnection(); getSession().useConnection(); return; } } else { for (int i = 0; i < RETRYNB; i++) { try { setSession(new DbSession(this, true)); } catch (WaarpDatabaseNoConnectionException e) { logger.warn("Attempt of connection in error: " + i, e); continue; } isReadOnly = true; getSession().setAdmin(this); validConnection(); getSession().useConnection(); return; } } setSession(null); logger.error("Cannot connect to Database!"); throw new WaarpDatabaseNoConnectionException( "Cannot connect to database"); }
Source:
private Protos.ExecutorInfo createExecutor() { final String jar = "crate-mesos.jar"; String hostIP; try { hostIP = InetAddress.getLocalHost().getHostAddress(); } catch (UnknownHostException e) { e.printStackTrace(); hostIP = "127.0.0.1"; } String path = String.format("http://%s:%d/static/%s", hostIP, configuration.apiPort, jar); Protos.CommandInfo cmd = Protos.CommandInfo.newBuilder() .addUris(Protos.CommandInfo.URI.newBuilder().setValue(path).setExtract(false).build()) .setValue(String.format("java -cp %s io.crate.frameworks.mesos.CrateExecutor", jar)) .build(); return Protos.ExecutorInfo.newBuilder() .setName("Crate Executor") .setExecutorId( Protos.ExecutorID.newBuilder() .setValue(UUID.randomUUID().toString()) .build() ) .setCommand(cmd) .addAllResources(configuration.getAllRequiredResources()) .build(); }

Target:
private Protos.ExecutorInfo createExecutor() { final String jar = "crate-mesos.jar"; String path = String.format("http://%s:%d/static/%s", hostIP, configuration.apiPort, jar); Protos.CommandInfo cmd = Protos.CommandInfo.newBuilder() .addUris(Protos.CommandInfo.URI.newBuilder().setValue(path).setExtract(false).build()) .setValue(String.format("java -cp %s io.crate.frameworks.mesos.CrateExecutor", jar)) .build(); return Protos.ExecutorInfo.newBuilder() .setName("Crate Executor") .setExecutorId( Protos.ExecutorID.newBuilder() .setValue(UUID.randomUUID().toString()) .build() ) .setCommand(cmd) .addAllResources(configuration.getAllRequiredResources()) .build(); }
Source:
public boolean equals(final Object o) { if (!super.equals(o)) { return false; } final ArrayOfDoublesSketchToQuantilesSketchPostAggregator that = (ArrayOfDoublesSketchToQuantilesSketchPostAggregator) o; if (column != that.column) { return false; } if (k != that.k) { return false; } return true; }

Target:
public boolean equals(final Object o) { if (!super.equals(o)) { return false; } if (!(o instanceof ArrayOfDoublesSketchToQuantilesSketchPostAggregator)) { return false; } final ArrayOfDoublesSketchToQuantilesSketchPostAggregator that = (ArrayOfDoublesSketchToQuantilesSketchPostAggregator) o; if (column != that.column) { return false; } if (k != that.k) { return false; } return true; }
Source:
public IAEItemStack injectItems( IAEItemStack iox, Actionable type, BaseActionSource src ) { ItemStack orgInput = iox.getItemStack(); ItemStack remaining = orgInput; if( type == Actionable.SIMULATE ) { for( int i = 0; i < itemHandler.getSlots(); i++ ) { remaining = itemHandler.insertItem( i, remaining, true ); if( remaining == null ) { break; } } } else { int slotCount = itemHandler.getSlots(); boolean[] retry = new boolean[slotCount]; for( int i = 0; i < slotCount; i++ ) { ItemStack stackInSlot = itemHandler.getStackInSlot( i ); if( stackInSlot == null ) { retry[i] = true; continue; } remaining = itemHandler.insertItem( i, remaining, false ); if( remaining == null ) { break; } } for( int i = 0; i < slotCount; i++ ) { if( retry[i] ) { remaining = itemHandler.insertItem( i, remaining, false ); if( remaining == null ) { break; } } } } if( remaining == orgInput ) { return iox; } if( type == Actionable.MODULATE ) { this.onTick(); } return AEItemStack.create( remaining ); }

Target:
public IAEItemStack injectItems( IAEItemStack iox, Actionable type, BaseActionSource src ) { ItemStack orgInput = iox.getItemStack(); ItemStack remaining = orgInput; int slotCount = itemHandler.getSlots(); boolean simulate = ( type == Actionable.SIMULATE ); for( int i = 0; i < slotCount && remaining != null; i++ ) { remaining = itemHandler.insertItem( i, remaining, simulate ); } if( remaining == orgInput ) { return iox; } if( type == Actionable.MODULATE ) { this.onTick(); } return AEItemStack.create( remaining ); }
Source:
protected void assertPutFromLoadLatches(CountDownLatch[] latches) { if (!await(latches[0]) && !await(latches[1])) throw new AssertionError(String.format( "One of the latches in %s should have at least completed", Arrays.toString(latches))); }

Target:
protected void assertPutFromLoadLatches(CountDownLatch[] latches) { assertTrue(String.format( "One of the latches in %s should have at least completed", Arrays.toString(latches)), await(latches[0]) || await(latches[1])); }
Source:
void showWorkingDirectoryFileDiff(final FileDiff d) { final String p = d.getPath(); final RevCommit commit = d.getCommit(); if (commit == null) { Activator.showError(UIText.GitHistoryPage_openFailed, null); return; } IWorkbenchPage activePage = site.getWorkbenchWindow().getActivePage(); IFile file = ResourceUtil.getFileForLocation(getRepository(), p); try { if (file != null) { if (!CompareUtils.canDirectlyOpenInCompare(file)) { GitModelSynchronize.synchronizeModelWithWorkspace(file, getRepository(), commit.getName()); } else { CompareUtils.compareWorkspaceWithRef(getRepository(), file, commit.getName(), null); } } else { IPath path = new Path(getRepository().getWorkTree() .getAbsolutePath()).append(p); File ioFile = path.toFile(); if (ioFile.exists()) { CompareUtils.compareLocalWithRef(getRepository(), ioFile, commit.getName(), activePage); } } } catch (IOException e) { Activator.logError(UIText.GitHistoryPage_openFailed, e); Activator.showError(UIText.GitHistoryPage_openFailed, null); } }

Target:
void showWorkingDirectoryFileDiff(final FileDiff d) { final String p = d.getPath(); final RevCommit commit = d.getCommit(); if (commit == null) { Activator.showError(UIText.GitHistoryPage_openFailed, null); return; } IWorkbenchPage activePage = site.getWorkbenchWindow().getActivePage(); IFile file = ResourceUtil.getFileForLocation(getRepository(), p); try { if (file != null) { if (!CompareUtils.canDirectlyOpenInCompare(file)) GitModelSynchronize.synchronizeModelWithWorkspace(file, getRepository(), commit.getName()); else CompareUtils.compareWorkspaceWithRef(getRepository(), file, commit.getName(), null); } else { IPath path = new Path(getRepository().getWorkTree() .getAbsolutePath()).append(p); File ioFile = path.toFile(); if (ioFile.exists()) CompareUtils.compareLocalWithRef(getRepository(), ioFile, commit.getName(), activePage); } } catch (IOException e) { Activator.logError(UIText.GitHistoryPage_openFailed, e); Activator.showError(UIText.GitHistoryPage_openFailed, null); } }
Source:
private static Builder add(Builder builder, long number, String symbol) { String s = symbol.toLowerCase(); if (s.equals("y")) { return builder.addYears(number); } else if (s.equals("mo")) { return builder.addMonths(number); } else if (s.equals("w")) { return builder.addWeeks(number); } else if (s.equals("d")) { return builder.addDays(number); } else if (s.equals("h")) { return builder.addHours(number); } else if (s.equals("m")) { return builder.addMinutes(number); } else if (s.equals("s")) { return builder.addSeconds(number); } else if (s.equals("ms")) { return builder.addMillis(number); } else if (s.equals("us") || s.equals("µs")) { return builder.addMicros(number); } else if (s.equals("ns")) { return builder.addNanos(number); } throw new InvalidTypeException(String.format("Unknown duration symbol '%s'", symbol)); }

Target:
private static Builder add(Builder builder, long number, String symbol) { String s = symbol.toLowerCase(); if (s.equals("y")) { return builder.addYears(number); } else if (s.equals("mo")) { return builder.addMonths(number); } else if (s.equals("w")) { return builder.addWeeks(number); } else if (s.equals("d")) { return builder.addDays(number); } else if (s.equals("h")) { return builder.addHours(number); } else if (s.equals("m")) { return builder.addMinutes(number); } else if (s.equals("s")) { return builder.addSeconds(number); } else if (s.equals("ms")) { return builder.addMillis(number); } else if (s.equals("us") || s.equals("µs")) { return builder.addMicros(number); } else if (s.equals("ns")) { return builder.addNanos(number); } throw new IllegalArgumentException(String.format("Unknown duration symbol '%s'", symbol)); }
Source:
private void validateTemplate(Errors errors, EmailTemplate template, String fieldName, String... templateVariables) { if (template == null) { errors.rejectValue(fieldName, "is required"); } else { errors.pushNestedPath(fieldName); if (StringUtils.isBlank(template.getSubject())) { errors.rejectValue("subject", "is required"); } if (StringUtils.isBlank(template.getBody())) { errors.rejectValue("body", "is required"); } else { boolean missingTemplateVariable = true; for (int i=0; i < templateVariables.length; i++) { if (template.getBody().contains(templateVariables[i])) { missingTemplateVariable = false; } } if (missingTemplateVariable) { errors.rejectValue("body", "must contain one of these template variables: " + BridgeUtils.COMMA_SPACE_JOINER.join(templateVariables)); } } errors.popNestedPath(); } }

Target:
private void validateTemplate(Errors errors, EmailTemplate template, String fieldName, String... templateVariables) { if (template == null) { errors.rejectValue(fieldName, "is required"); } else { errors.pushNestedPath(fieldName); if (StringUtils.isBlank(template.getSubject())) { errors.rejectValue("subject", "is required"); } if (StringUtils.isBlank(template.getBody())) { errors.rejectValue("body", "is required"); } else { boolean missingTemplateVariable = true; for (int i=0; i < templateVariables.length; i++) { if (template.getBody().contains(templateVariables[i])) { missingTemplateVariable = false; break; } } if (missingTemplateVariable) { errors.rejectValue("body", "must contain one of these template variables: " + BridgeUtils.COMMA_SPACE_JOINER.join(templateVariables)); } } errors.popNestedPath(); } }
Source:
private ArtifactCoordinates getArtifactCoordinates(Path p) { return ThrowingFunction.unchecked(RepositoryFiles::readCoordinates).apply((RepositoryPath) p); }

Target:
private ArtifactCoordinates getArtifactCoordinates(Path p) throws IOException { return RepositoryFiles.readCoordinates((RepositoryPath) p); }
Source:
public void testOnNodeShutdown() throws Exception { final StreamingContext ctxSpy = Mockito.spy(createTestContext(null)); Thread t = new Thread(() -> { try { ctxSpy.streamInternal(new State() { @Override public void onEnter() { } }); } catch (final InterruptedException ignore) { } }); t.start(); t.join(1000); t = new Thread(() -> ctxSpy.onNodeShutdown()); t.start(); t.join(1000); Thread.sleep(1000); Mockito.verify(ctxSpy).switchState(Mockito.isA(CleanupState.class)); Mockito.verify(ctxSpy).unregisterSession(); Mockito.verify(ctxSpy).switchState(Mockito.isA(DummyState.class)); }

Target:
public void testOnNodeShutdown() throws Exception { final StreamingContext ctxSpy = Mockito.spy(createTestContext(null)); final Thread t = new Thread(() -> { try { ctxSpy.streamInternal(new State() { @Override public void onEnter() { } }); } catch (final InterruptedException ignore) { } }); t.start(); t.join(1000); new Thread(() -> ctxSpy.onNodeShutdown()).start(); Thread.sleep(2000); Mockito.verify(ctxSpy).switchState(Mockito.isA(CleanupState.class)); Mockito.verify(ctxSpy).unregisterSession(); Mockito.verify(ctxSpy).switchState(Mockito.isA(DummyState.class)); }
Source:
public boolean equals(final Object o) { if (this == o) { return true; } if (o == null || getClass() != o.getClass()) { return false; } final StreamsMetadata that = (StreamsMetadata) o; if (!hostInfo.equals(that.hostInfo)) { return false; } if (!stateStoreNames.equals(that.stateStoreNames)) { return false; } if (!topicPartitions.equals(that.topicPartitions)) { return false; } if (!standbyStateStoreNames.equals(that.standbyStateStoreNames)) { return false; } return standbyTopicPartitions.equals(that.standbyTopicPartitions); }

Target:
public boolean equals(final Object o) { if (this == o) { return true; } if (o == null || getClass() != o.getClass()) { return false; } final StreamsMetadata that = (StreamsMetadata) o; return Objects.equals(hostInfo, that.hostInfo) && Objects.equals(stateStoreNames, that.stateStoreNames) && Objects.equals(topicPartitions, that.topicPartitions) && Objects.equals(standbyStateStoreNames, that.standbyStateStoreNames) && Objects.equals(standbyTopicPartitions, that.standbyTopicPartitions); }
Source:
private ChannelWriter channelWriterGroupSummaryAnnotationSupported() { return ChannelWriter.create( channelGroupResolver, "channels", "channel", new ChannelGroupSummaryWriter(idCodec()), true ); }

Target:
private ChannelWriter channelWriterGroupSummaryAnnotationSupported() { return ChannelWriter.builder() .channelGroupResolver(channelGroupResolver) .listName("channels") .fieldName("channel") .channelGroupSummaryWriter(new ChannelGroupSummaryWriter(idCodec())) .buildWithGroupSummaryAnnotationSupported(); }
Source:
public List<AuthorizationAttribute> getAll() { return Stream.of( Optional.ofNullable(this.readers).orElse(new ArrayList<>()), Optional.ofNullable(this.writers).orElse(new ArrayList<>()), Optional.ofNullable(this.admins).orElse(new ArrayList<>())) .flatMap(Collection::stream).collect(Collectors.toList()); }

Target:
public List<AuthorizationAttribute> getAll() { return Stream.of(this.writers, this.admins, this.readers) .flatMap(Collection::stream).collect(Collectors.toList()); }
Source:
public Authentication authenticate(Authentication authentication) throws AuthenticationException { if (!supports(authentication.getClass())) throw new IllegalArgumentException("Only TwoFactorAuthenticationToken is supported"); TwoFactorAuthenticationToken authToken = (TwoFactorAuthenticationToken) authentication; if (!twoFactorAuthenticationService.isConfiguredForUser()) { if (authToken.getSecretKey() != null) { if (otpService.tryVerificationCode(authToken.getVerificationCode(), authToken.getSecretKey())) { activateTwoFactorAuthentication(authToken); UserDetails userDetails = (UserDetails) SecurityContextHolder.getContext() .getAuthentication() .getPrincipal(); authToken = new TwoFactorAuthenticationToken(userDetails, userDetails.getPassword(), userDetails.getAuthorities(), authToken.getVerificationCode(), authToken.getSecretKey()); } } else { throw new BadCredentialsException("Invalid secret generated"); } } else { if (authToken.getVerificationCode() != null) { if (twoFactorAuthenticationService.isVerificationCodeValidForUser(authToken.getVerificationCode())) { UserDetails userDetails = (UserDetails) SecurityContextHolder.getContext() .getAuthentication() .getPrincipal(); authToken = new TwoFactorAuthenticationToken(userDetails, userDetails.getPassword(), userDetails.getAuthorities(), authToken.getVerificationCode(), null); } } else { throw new BadCredentialsException("Invalid verificationcode entered"); } } return authToken; }

Target:
public Authentication authenticate(Authentication authentication) throws AuthenticationException { if (!supports(authentication.getClass())) { throw new IllegalArgumentException("Only TwoFactorAuthenticationToken is supported"); } TwoFactorAuthenticationToken authToken = (TwoFactorAuthenticationToken) authentication; if (!twoFactorAuthenticationService.isConfiguredForUser()) { if (authToken.getSecretKey() != null) { if (otpService.tryVerificationCode(authToken.getVerificationCode(), authToken.getSecretKey())) { activateTwoFactorAuthentication(authToken); UserDetails userDetails = (UserDetails) SecurityContextHolder.getContext() .getAuthentication() .getPrincipal(); authToken = new TwoFactorAuthenticationToken(userDetails, userDetails.getPassword(), userDetails.getAuthorities(), authToken.getVerificationCode(), authToken.getSecretKey()); } } else { throw new BadCredentialsException("Invalid secret generated"); } } else { if (authToken.getVerificationCode() != null) { if (twoFactorAuthenticationService.isVerificationCodeValidForUser(authToken.getVerificationCode())) { UserDetails userDetails = (UserDetails) SecurityContextHolder.getContext() .getAuthentication() .getPrincipal(); authToken = new TwoFactorAuthenticationToken(userDetails, userDetails.getPassword(), userDetails.getAuthorities(), authToken.getVerificationCode(), null); } } else { throw new BadCredentialsException("Invalid verification code entered"); } } return authToken; }
Source:
@Override public byte getBaseMapColor() { return ((Number) get("baseMapColor")).byteValue(); }

Target:
public byte getBaseMapColor() { return ((Number) get("baseMapColor")).byteValue(); }
Source:
public void assertUnitPlan(@Language("SQL") String sql, PlanMatchPattern pattern) { List<PlanOptimizer> optimizeBeforeTranslation = ImmutableList.of( new UnaliasSymbolReferences(getMetadata().getFunctionManager()), new AddExchanges(getQueryRunner().getMetadata(), new SqlParser()), new PruneUnreferencedOutputs(), new IterativeOptimizer( new RuleStatsRecorder(), getQueryRunner().getStatsCalculator(), getQueryRunner().getCostCalculator(), new TranslateExpressions(getQueryRunner().getMetadata(), new SqlParser()).rules()), new IterativeOptimizer( new RuleStatsRecorder(), getQueryRunner().getStatsCalculator(), getQueryRunner().getCostCalculator(), ImmutableSet.of(new RemoveRedundantIdentityProjections()))); List<PlanOptimizer> optimizeAfterTranslation = ImmutableList.of( new AddExchanges(getQueryRunner().getMetadata(), new SqlParser()), new IterativeOptimizer( new RuleStatsRecorder(), getQueryRunner().getStatsCalculator(), getQueryRunner().getCostCalculator(), new TranslateExpressions(getMetadata(), new SqlParser()).rules()), new UnaliasSymbolReferences(getMetadata().getFunctionManager()), new PruneUnreferencedOutputs(), new IterativeOptimizer( new RuleStatsRecorder(), getQueryRunner().getStatsCalculator(), getQueryRunner().getCostCalculator(), ImmutableSet.of(new RemoveRedundantIdentityProjections()))); assertPlan(sql, pattern, optimizeBeforeTranslation); assertPlan(sql, pattern, optimizeAfterTranslation); }

Target:
public void assertUnitPlan(@Language("SQL") String sql, PlanMatchPattern pattern) { List<PlanOptimizer> optimizersBeforeTranslation = ImmutableList.of( new UnaliasSymbolReferences(getMetadata().getFunctionManager()), new AddExchanges(getQueryRunner().getMetadata(), new SqlParser()), new PruneUnreferencedOutputs(), new IterativeOptimizer( new RuleStatsRecorder(), getQueryRunner().getStatsCalculator(), getQueryRunner().getCostCalculator(), new TranslateExpressions(getQueryRunner().getMetadata(), new SqlParser()).rules()), new IterativeOptimizer( new RuleStatsRecorder(), getQueryRunner().getStatsCalculator(), getQueryRunner().getCostCalculator(), ImmutableSet.of(new RemoveRedundantIdentityProjections()))); List<PlanOptimizer> optimizersAfterTranslation = ImmutableList.of( new AddExchanges(getQueryRunner().getMetadata(), new SqlParser()), new IterativeOptimizer( new RuleStatsRecorder(), getQueryRunner().getStatsCalculator(), getQueryRunner().getCostCalculator(), new TranslateExpressions(getMetadata(), new SqlParser()).rules()), new UnaliasSymbolReferences(getMetadata().getFunctionManager()), new PruneUnreferencedOutputs(), new IterativeOptimizer( new RuleStatsRecorder(), getQueryRunner().getStatsCalculator(), getQueryRunner().getCostCalculator(), ImmutableSet.of(new RemoveRedundantIdentityProjections()))); assertPlan(sql, pattern, optimizersBeforeTranslation); assertPlan(sql, pattern, optimizersAfterTranslation); }
Source:
private List<AccessPointDTO> adapt(List<AccessPoint> aps) { List<AccessPointDTO> dtos = Lists.newArrayList(); for (AccessPoint ap : aps) { dtos.add(new AccessPointDTO(ap.id.value, ap.ip, ap.mac.value, ap.serialNumber, ap.model, adapt(ap.venue), adapt(ap.location), adapt(ap.capabilities))); } return dtos; }

Target:
private List<AccessPointDTO> adapt(List<AccessPoint> aps) { List<AccessPointDTO> dtos = Lists.newArrayList(); for (AccessPoint ap : aps) { dtos.add(adapt(ap)); } return dtos; }
Source:
private void doSortBy() { Resources r = getActivity().getResources(); SharedPreferences settings = Application.getPrefs(); String currentValue = settings .getString(getString(R.string.preference_key_arrival_info_style), null); String[] styles = getResources() .getStringArray(R.array.arrival_info_style_options); int newValue; if (currentValue.equalsIgnoreCase(styles[0])) { Toast.makeText(getActivity(), r.getString(R.string.stop_info_option_sort_route), Toast.LENGTH_SHORT).show(); newValue = 1; ObaAnalytics.reportEventWithCategory(ObaAnalytics.ObaEventCategory.UI_ACTION.toString(), getActivity().getString(R.string.analytics_action_button_press), getActivity().getString(R.string.analytics_label_sort_by_eta_arrival)); } else { newValue = 0; Toast.makeText(getActivity(), r.getString(R.string.stop_info_option_sort_eta), Toast.LENGTH_SHORT).show(); ObaAnalytics.reportEventWithCategory(ObaAnalytics.ObaEventCategory.UI_ACTION.toString(), getActivity().getString(R.string.analytics_action_button_press), getActivity().getString(R.string.analytics_label_sort_by_route_arrival)); } PreferenceHelp.saveString(getResources() .getString(R.string.preference_key_arrival_info_style), styles[newValue]); checkAdapterStylePreference(); refreshLocal(); }

Target:
private void doSortBy() { Resources r = getActivity().getResources(); SharedPreferences settings = Application.getPrefs(); String currentValue = settings .getString(getString(R.string.preference_key_arrival_info_style), null); String[] styles = getResources() .getStringArray(R.array.arrival_info_style_options); int newValue; if (currentValue.equalsIgnoreCase(styles[0])) { Toast.makeText(getActivity(), r.getString(R.string.stop_info_option_sort_route), Toast.LENGTH_SHORT).show(); newValue = 1; ObaAnalytics.reportEventWithCategory(ObaAnalytics.ObaEventCategory.UI_ACTION.toString(), getActivity().getString(R.string.analytics_action_button_press), getActivity().getString(R.string.analytics_label_sort_by_route_arrival)); } else { newValue = 0; Toast.makeText(getActivity(), r.getString(R.string.stop_info_option_sort_eta), Toast.LENGTH_SHORT).show(); ObaAnalytics.reportEventWithCategory(ObaAnalytics.ObaEventCategory.UI_ACTION.toString(), getActivity().getString(R.string.analytics_action_button_press), getActivity().getString(R.string.analytics_label_sort_by_eta_arrival)); } PreferenceHelp.saveString(getResources() .getString(R.string.preference_key_arrival_info_style), styles[newValue]); checkAdapterStylePreference(); refreshLocal(); }
Source:
public void setup() throws Exception { graphTestHandler = new TestingGraphMockHandler(); graph = TestingGraphInstanceBuilder.newGraph1(graphTestHandler); TestingGraphInstanceBuilder.createDefaultRulesForGraph1(graphTestHandler.ruleSet); when(cacheBuilder.apply(anyString())).thenReturn(cache); when(cache.getRuleSet()).thenReturn(graphTestHandler.ruleSet); CanConnect connectionRule = (CanConnect) ((List<Rule>) graphTestHandler.ruleSet.getRules()).get(0); when(cache.getConnectionRules()).thenReturn(Collections.singletonList(connectionRule)); when(cache.getDefinitions(contains("label1"))).thenReturn(Arrays.asList(TestingGraphInstanceBuilder.DEF1_ID).stream().collect(Collectors.toSet())); when(cache.getDefinitions(contains("label2"))).thenReturn(Arrays.asList(TestingGraphInstanceBuilder.DEF2_ID).stream().collect(Collectors.toSet())); when(definitionsRegistry.getLabels(eq(TestingGraphInstanceBuilder.DEF1_ID))).thenReturn(TestingGraphInstanceBuilder.DEF1_LABELS); when(definitionsRegistry.getLabels(eq(TestingGraphInstanceBuilder.DEF2_ID))).thenReturn(TestingGraphInstanceBuilder.DEF2_LABELS); tested = new CommonDomainLookups(graphTestHandler.definitionUtils, definitionsRegistry, graphTestHandler.ruleManager, cacheBuilder) .setDomain("ds1"); }

Target:
public void setup() throws Exception { final TestingGraphMockHandler graphTestHandler = new TestingGraphMockHandler(); graph = TestingGraphInstanceBuilder.newGraph1(graphTestHandler); TestingGraphInstanceBuilder.createDefaultRulesForGraph1(graphTestHandler.ruleSet); when(cacheBuilder.apply(anyString())).thenReturn(cache); when(cache.getRuleSet()).thenReturn(graphTestHandler.ruleSet); CanConnect connectionRule = (CanConnect) ((List<Rule>) graphTestHandler.ruleSet.getRules()).get(0); when(cache.getConnectionRules()).thenReturn(Collections.singletonList(connectionRule)); when(cache.getDefinitions(contains("label1"))).thenReturn(Stream.of(TestingGraphInstanceBuilder.DEF1_ID).collect(Collectors.toSet())); when(cache.getDefinitions(contains("label2"))).thenReturn(Stream.of(TestingGraphInstanceBuilder.DEF2_ID).collect(Collectors.toSet())); when(definitionsRegistry.getLabels(eq(TestingGraphInstanceBuilder.DEF1_ID))).thenReturn(TestingGraphInstanceBuilder.DEF1_LABELS); when(definitionsRegistry.getLabels(eq(TestingGraphInstanceBuilder.DEF2_ID))).thenReturn(TestingGraphInstanceBuilder.DEF2_LABELS); tested = new CommonDomainLookups(graphTestHandler.definitionUtils, definitionsRegistry, graphTestHandler.ruleManager, cacheBuilder) .setDomain("ds1"); }
Source:
public Agent() { this.logger = Logger.getLogger( getClass().getName()); this.messagingType = MessagingConstants.FACTORY_RABBIT_MQ; try { this.ipAddress = InetAddress.getLocalHost().getHostAddress(); } catch( UnknownHostException e ) { this.ipAddress = "127.0.0.1"; this.logger.warning( "The IP address could not be found. " + e.getMessage()); Utils.logException( this.logger, e ); } }

Target:
public Agent() { this.logger = Logger.getLogger( getClass().getName()); try { this.ipAddress = InetAddress.getLocalHost().getHostAddress(); } catch( UnknownHostException e ) { this.ipAddress = "127.0.0.1"; this.logger.warning( "The IP address could not be found. " + e.getMessage()); Utils.logException( this.logger, e ); } }
Source:
public NoiseEvent(final long startTimestamp, final long endTimestamp, final int offsetMillis) { super(Type.NOISE, startTimestamp, endTimestamp, offsetMillis); final DateTime noiseDateTime = new DateTime(startTimestamp, DateTimeZone.UTC).plusMillis(offsetMillis); this.description += " " + noiseDateTime.toString(DateTimeFormat.forPattern("HH:mm")); }

Target:
public NoiseEvent(final long startTimestamp, final long endTimestamp, final int offsetMillis) { super(Type.NOISE, startTimestamp, endTimestamp, offsetMillis); }
Source:
private List<Set<TopicPartition>> batchPartitionsByLeader(@NotNull Set<TopicPartition> topicPartitions) { if (!_enablePartitionLeadershipCalculation) { return Collections.singletonList(topicPartitions); } final Map<Node, Set<TopicPartition>> assignedPartitions = new HashMap<>(); final Set<TopicPartition> unassignedPartitions = new HashSet<>(); topicPartitions.forEach(topicPartition -> { @Nullable final Node leader = _partitionLeadershipMap.get(topicPartition); if (leader == null) { LOG.debug("Leader unknown for topic partition {}", topicPartition); unassignedPartitions.add(topicPartition); } else { LOG.trace("Leader for topic partition is {}", topicPartition, leader); assignedPartitions.computeIfAbsent(leader, s -> new HashSet<>()).add(topicPartition); } }); final List<Set<TopicPartition>> batches = new ArrayList<>(); batches.addAll(assignedPartitions.values()); batches.add(unassignedPartitions); return batches; }

Target:
private List<Set<TopicPartition>> batchPartitionsByLeader(@NotNull Set<TopicPartition> topicPartitions) { if (!_enablePartitionLeadershipCalculation || _partitionLeadershipMap.isEmpty()) { if (_partitionLeadershipMap.isEmpty()) { LOG.debug("Leadership unknown for all topic partitions"); } return Collections.singletonList(topicPartitions); } final Map<Node, Set<TopicPartition>> assignedPartitions = new HashMap<>(); final Set<TopicPartition> unassignedPartitions = new HashSet<>(); topicPartitions.forEach(topicPartition -> { @Nullable final Node leader = _partitionLeadershipMap.get(topicPartition); if (leader == null) { LOG.debug("Leader unknown for topic partition {}", topicPartition); unassignedPartitions.add(topicPartition); } else { LOG.trace("Leader for topic partition is {}", topicPartition, leader); assignedPartitions.computeIfAbsent(leader, s -> new HashSet<>()).add(topicPartition); } }); final List<Set<TopicPartition>> batches = new ArrayList<>(); batches.addAll(assignedPartitions.values()); batches.add(unassignedPartitions); return batches; }
Source:
public int hashCode() { return Arrays.hashCode(arr); }

Target:
public int hashCode() { return arr.length; }
Source:
public EventHeaderDefinition createDefinition(IDefinitionScope definitionScope, String fieldName, BitBuffer input) throws CTFReaderException { alignRead(input); ByteOrder bo = input.getByteOrder(); input.setByteOrder(fByteOrder); int enumId = (int) input.get(COMPACT_ID, false); if (enumId != EXTENDED_VALUE) { long timestamp2 = input.get(COMPACT_TS, false); input.setByteOrder(bo); return new EventHeaderDefinition(this, enumId, timestamp2, COMPACT_TS); } input.position(input.position() + 3); long id = input.get(ID_SIZE, false); long timestampLong = input.get(FULL_TS, false); input.setByteOrder(bo); return new EventHeaderDefinition(this, id, timestampLong, FULL_TS); }

Target:
public EventHeaderDefinition createDefinition(IDefinitionScope definitionScope, String fieldName, BitBuffer input) throws CTFReaderException { alignRead(input); ByteOrder bo = input.getByteOrder(); input.setByteOrder(fByteOrder); int enumId = (int) input.get(COMPACT_ID, false); if (enumId != EXTENDED_VALUE) { long timestamp2 = input.get(COMPACT_TS, false); input.setByteOrder(bo); return new EventHeaderDefinition(this, enumId, timestamp2, COMPACT_TS); } input.position(input.position() + 3); long id = input.get(ID_SIZE, false); if( id > Integer.MAX_VALUE){ throw new CTFReaderException("ID "+ id + " larger than " + Integer.MAX_VALUE + " is currently unsupported by the parser"); } long timestampLong = input.get(FULL_TS, false); input.setByteOrder(bo); return new EventHeaderDefinition(this, (int) id, timestampLong, FULL_TS); }
Source:
public ModelAndView index(Request request, Response response) { HashMap<Object, Object> object = new HashMap<Object, Object>() {{ put("viewTitle", "Dashboard"); put("isQuickEditPageEnabled", Toggles.isToggleOn(Toggles.PIPELINE_CONFIG_SINGLE_PAGE_APP) && Toggles.isToggleOn(Toggles.QUICK_EDIT_PAGE_DEFAULT)); put("isNewDashboardPageEnabled", Toggles.isToggleOn(Toggles.NEW_DASHBOARD_PAGE_DEFAULT)); put("isUserAnAdmin", securityService.isUserAdmin(currentUsername())); }}; return new ModelAndView(object, "new_dashboard/index.vm"); }

Target:
public ModelAndView index(Request request, Response response) { HashMap<Object, Object> object = new HashMap<Object, Object>() {{ put("viewTitle", "Dashboard"); put("isQuickEditPageEnabled", Toggles.isToggleOn(Toggles.PIPELINE_CONFIG_SINGLE_PAGE_APP) && Toggles.isToggleOn(Toggles.QUICK_EDIT_PAGE_DEFAULT)); put("isNewDashboardPageEnabled", Toggles.isToggleOn(Toggles.NEW_DASHBOARD_PAGE_DEFAULT)); put("shouldShowAnalyticsIcon", securityService.isUserAdmin(currentUsername())); }}; return new ModelAndView(object, "new_dashboard/index.vm"); }
Source:
public void apply(LogReplicationEntry message) { verifyMetadata(message.getMetadata()); if (message.getMetadata().getSnapshotSyncSeqNum() != recvSeq || message.getMetadata().getMessageMetadataType() != MessageType.SNAPSHOT_MESSAGE) { log.error("Received Expecting sequencer != recvSeq or wrong message type expecting {}", message.getMetadata(), message.getMetadata().getSnapshotSyncSeqNum(), recvSeq, message.getMetadata().getMessageMetadataType(), MessageType.SNAPSHOT_MESSAGE); throw new ReplicationWriterException("Message is out of order or wrong type"); } if (message.getOpaqueEntryList().size() > 1) { log.error(" Get instead of one opaque entry in Snapshot Message", message.getOpaqueEntryList().size()); return; } for (OpaqueEntry opaqueEntry : message.getOpaqueEntryList()) { if (opaqueEntry.getEntries().keySet().size() != 1) { log.error("The opaqueEntry has more than one entry {}", opaqueEntry); return; } UUID uuid = opaqueEntry.getEntries().keySet().stream().findFirst().get(); processOpaqueEntry(opaqueEntry.getEntries().get(uuid), message.getMetadata().getSnapshotSyncSeqNum(), uuidMap.get(uuid)); recvSeq++; } }

Target:
public void apply(LogReplicationEntry message) { verifyMetadata(message.getMetadata()); if (message.getMetadata().getSnapshotSyncSeqNum() != recvSeq || message.getMetadata().getMessageMetadataType() != MessageType.SNAPSHOT_MESSAGE) { log.error("Received Expecting snapshot message sequencer number != recvSeq or wrong message type expecting {}", message.getMetadata(), message.getMetadata().getSnapshotSyncSeqNum(), recvSeq, message.getMetadata().getMessageMetadataType(), MessageType.SNAPSHOT_MESSAGE); throw new ReplicationWriterException("Message is out of order or wrong type"); } if (message.getOpaqueEntryList().size() > 1) { log.error(" Get instead of one opaque entry in Snapshot Message", message.getOpaqueEntryList().size()); return; } OpaqueEntry opaqueEntry = message.getOpaqueEntryList().get(0); if (opaqueEntry.getEntries().keySet().size() != 1) { log.error("The opaqueEntry has more than one entry {}", opaqueEntry); return; } UUID uuid = opaqueEntry.getEntries().keySet().stream().findFirst().get(); processOpaqueEntry(opaqueEntry.getEntries().get(uuid), message.getMetadata().getSnapshotSyncSeqNum(), uuidMap.get(uuid)); recvSeq++; }
Source:
private List<RepositoryChangeLog> getLogsByStoreKey( StoreKey storeKey ) { return changeLogCache.execute( c -> c.values() .stream() .filter( ch -> ch.getStoreKey().equals( storeKey ) ) .collect( Collectors.toList() ) ); }

Target:
private List<RepositoryChangeLog> getLogsByStoreKey( StoreKey storeKey ) { final ArrayList<RepositoryChangeLog> results = new ArrayList<>( RESULT_LIMITATION_FOR_TESTING ); return changeLogCache.execute( c -> { for ( RepositoryChangeLog log : c.values() ) { if ( log.getStoreKey().equals( storeKey ) ) { results.add( log ); } if ( results.size() >= RESULT_LIMITATION_FOR_TESTING ) { return results; } } return results; } ); }
Source:
public String getMetricId() { return idIfTypeCorrect(CanonicalPath.this, Resource.class); }

Target:
public String getMetricId() { return idIfTypeCorrect(CanonicalPath.this, Metric.class); }
Source:
private String createPipelineAndGetConsole(final CustomConfig customConfig) { final WorkflowJob job = jenkins.jobs.create(WorkflowJob.class); job.script.set(String.format("node {\n" + " configFileProvider(\n" + " [configFile(fileId: '%s')]) {\n" + " \n" + " sh 'echo test_custom '\n" + " }\n" + "}", customConfig.id())); job.save(); final Build b = job.startBuild().shouldSucceed(); return b.getConsole(); }

Target:
private String createPipelineAndGetConsole(final CustomConfig customConfig) { final WorkflowJob job = jenkins.jobs.create(WorkflowJob.class); job.script.set(String.format("node {\n" + " configFileProvider(\n" + " [configFile(fileId: '%s', variable: 'CUSTOM_SETTINGS')]) {\n" + " \n" + " sh 'cat $CUSTOM_SETTINGS '\n" + " }\n" + "}", customConfig.id())); job.save(); final Build b = job.startBuild().shouldSucceed(); return b.getConsole(); }