auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public void testResolvingMultipleSortOrdersReturnsCompositeComparator() { KeyValueQuery<Predicate<String, Foo>> query = new KeyValueQuery<>(); Sort.Order fooOrder = new Sort.Order(Sort.Direction.DESC, "foo"); Sort.Order barOrder = new Sort.Order(Sort.Direction.DESC, "bar"); List<Sort.Order> orderList = new LinkedList<>(); orderList.add(fooOrder); orderList.add(barOrder); query.setSort(Sort.by(orderList)); HazelcastSortAccessorTest.Foo testData1 = new HazelcastSortAccessorTest.Foo("zzz", "def"); HazelcastSortAccessorTest.Foo testData2 = new HazelcastSortAccessorTest.Foo("aaa", "aaa"); Map.Entry<String, HazelcastSortAccessorTest.Foo> entry1 = entryOf("testData1", testData1); Map.Entry<String, HazelcastSortAccessorTest.Foo> entry2 = entryOf("testData2", testData2); HazelcastSortAccessorTest.Foo testData3 = new HazelcastSortAccessorTest.Foo("aaa", "aaa"); HazelcastSortAccessorTest.Foo testData4 = new HazelcastSortAccessorTest.Foo("aaa", "def"); Map.Entry<String, HazelcastSortAccessorTest.Foo> entry3 = entryOf("testData3", testData3); Map.Entry<String, HazelcastSortAccessorTest.Foo> entry4 = entryOf("testData4", testData4); HazelcastSortAccessor hazelcastSortAccessor = new HazelcastSortAccessor(); Comparator<Map.Entry<?, ?>> comparator = (Comparator<Map.Entry<?, ?>>) hazelcastSortAccessor.resolve((KeyValueQuery<?>) query); assertNotNull(comparator); assertTrue(comparator.compare(entry1, entry2) < 0); assertTrue(comparator.compare(entry2, entry1) > 0); assertFalse(comparator.compare(entry3, entry4) == 0); assertTrue((comparator.compare(entry3, entry4) > 0)); }

Target:
public void testResolvingMultipleSortOrdersReturnsCompositeComparator() { KeyValueQuery<Predicate<String, Foo>> query = new KeyValueQuery<>(); Sort.Order fooOrder = new Sort.Order(Sort.Direction.DESC, "foo"); Sort.Order barOrder = new Sort.Order(Sort.Direction.DESC, "bar"); query.setSort(Sort.by(fooOrder, barOrder)); HazelcastSortAccessorTest.Foo testData1 = new HazelcastSortAccessorTest.Foo("zzz", "def"); HazelcastSortAccessorTest.Foo testData2 = new HazelcastSortAccessorTest.Foo("aaa", "aaa"); Map.Entry<String, HazelcastSortAccessorTest.Foo> entry1 = entryOf("testData1", testData1); Map.Entry<String, HazelcastSortAccessorTest.Foo> entry2 = entryOf("testData2", testData2); HazelcastSortAccessorTest.Foo testData3 = new HazelcastSortAccessorTest.Foo("aaa", "aaa"); HazelcastSortAccessorTest.Foo testData4 = new HazelcastSortAccessorTest.Foo("aaa", "def"); Map.Entry<String, HazelcastSortAccessorTest.Foo> entry3 = entryOf("testData3", testData3); Map.Entry<String, HazelcastSortAccessorTest.Foo> entry4 = entryOf("testData4", testData4); HazelcastSortAccessor hazelcastSortAccessor = new HazelcastSortAccessor(); Comparator<Map.Entry<?, ?>> comparator = (Comparator<Map.Entry<?, ?>>) hazelcastSortAccessor.resolve((KeyValueQuery<?>) query); assertNotNull(comparator); assertTrue(comparator.compare(entry1, entry2) < 0); assertTrue(comparator.compare(entry2, entry1) > 0); assertFalse(comparator.compare(entry3, entry4) == 0); assertTrue((comparator.compare(entry3, entry4) > 0)); }
Source:
protected void executeCommand() { DbUser userToAdd = getParameters().getUserToAdd(); DbUser syncedUser = SyncUsers.sync(Arrays.asList(userToAdd)).get(0); if (Guid.isNullOrEmpty(syncedUser.getId()) && syncedUser.isActive()) { DbFacade.getInstance().getDbUserDao().save(syncedUser); } else { if (!Guid.isNullOrEmpty(syncedUser.getId())) { DbFacade.getInstance().getDbUserDao().update(syncedUser); } } setActionReturnValue(DbFacade.getInstance().getDbUserDao().getByExternalId(userToAdd.getDomain(), userToAdd.getExternalId()).getId()); setSucceeded(true); }

Target:
protected void executeCommand() { DbUser userToAdd = getParameters().getUserToAdd(); for (DbUser syncedUser : SyncUsers.sync(Arrays.asList(userToAdd))) { if (Guid.isNullOrEmpty(syncedUser.getId())) { if (syncedUser.isActive()) { DbFacade.getInstance().getDbUserDao().save(syncedUser); } } else { DbFacade.getInstance().getDbUserDao().update(syncedUser); } } setActionReturnValue(DbFacade.getInstance().getDbUserDao().getByExternalId(userToAdd.getDomain(), userToAdd.getExternalId()).getId()); setSucceeded(true); }
Source:
public void testRank() throws Exception { CacheStore.Provider provider = new CacheStore.Provider(); Assert.assertThat(provider.rank( Collections.<ResourceType>singleton(ResourceType.Core.DISK), Collections.<ServiceConfiguration<?>>emptyList()), Matchers.is(0)); Assert.assertThat(provider.rank( Collections.<ResourceType>singleton(ResourceType.Core.HEAP), Collections.<ServiceConfiguration<?>>emptyList()), Matchers.is(0)); Assert.assertThat(provider.rank( Collections.<ResourceType>singleton(ResourceType.Core.OFFHEAP), Collections.<ServiceConfiguration<?>>emptyList()), Matchers.is(0)); final ResourceType unmatchedResourceType = new ResourceType() { @Override public boolean isPersistable() { return true; } @Override public boolean requiresSerialization() { return true; } }; Assert.assertThat(provider.rank( Collections.singleton(unmatchedResourceType), Collections.<ServiceConfiguration<?>>emptyList()), Matchers.is(0)); }

Target:
public void testRank() throws Exception { CacheStore.Provider provider = new CacheStore.Provider(); assertRank(provider, 0, ResourceType.Core.DISK); assertRank(provider, 0, ResourceType.Core.HEAP); assertRank(provider, 0, ResourceType.Core.OFFHEAP); assertRank(provider, 0, ResourceType.Core.DISK, ResourceType.Core.OFFHEAP); assertRank(provider, 0, ResourceType.Core.DISK, ResourceType.Core.HEAP); assertRank(provider, 0, ResourceType.Core.OFFHEAP, ResourceType.Core.HEAP); assertRank(provider, 0, ResourceType.Core.DISK, ResourceType.Core.OFFHEAP, ResourceType.Core.HEAP); final ResourceType unmatchedResourceType = new ResourceType() { @Override public boolean isPersistable() { return true; } @Override public boolean requiresSerialization() { return true; } }; assertRank(provider, 0, unmatchedResourceType); }
Source:
protected void processFiltered(File file, FileText fileText) throws CheckstyleException { if (CommonUtils.matchesFileExtension(file, getFileExtensions())) { final String msg = "%s occurred during the analysis of file %s."; final String fileName = file.getPath(); try { if (!ordinaryChecks.isEmpty() || !commentChecks.isEmpty()) { final FileContents contents = new FileContents(fileText); final DetailAST rootAST = parse(contents); if (!ordinaryChecks.isEmpty()) { walk(rootAST, contents, AstState.ORDINARY); } if (!commentChecks.isEmpty()) { final DetailAST astWithComments = appendHiddenCommentNodes(rootAST); walk(astWithComments, contents, AstState.WITH_COMMENTS); } final SortedSet<LocalizedMessage> filteredMessages = getFilteredMessages(fileName, contents, rootAST); addMessages(filteredMessages); messages.clear(); } } catch (final TokenStreamRecognitionException tre) { final String exceptionMsg = String.format(Locale.ROOT, msg, "TokenStreamRecognitionException", fileName); throw new CheckstyleException(exceptionMsg, tre); } catch (RecognitionException | TokenStreamException ex) { final String exceptionMsg = String.format(Locale.ROOT, msg, ex.getClass().getSimpleName(), fileName); throw new CheckstyleException(exceptionMsg, ex); } } }

Target:
protected void processFiltered(File file, FileText fileText) throws CheckstyleException { if (CommonUtils.matchesFileExtension(file, getFileExtensions())) { final String msg = "%s occurred during the analysis of file %s."; final String fileName = file.getPath(); try { if (!ordinaryChecks.isEmpty() || !commentChecks.isEmpty()) { final FileContents contents = new FileContents(fileText); final DetailAST rootAST = parse(contents); if (!ordinaryChecks.isEmpty()) { walk(rootAST, contents, AstState.ORDINARY); } if (!commentChecks.isEmpty()) { final DetailAST astWithComments = appendHiddenCommentNodes(rootAST); walk(astWithComments, contents, AstState.WITH_COMMENTS); } if (filters.isEmpty()) { addMessages(messages); } else { final SortedSet<LocalizedMessage> filteredMessages = getFilteredMessages(fileName, contents, rootAST); addMessages(filteredMessages); } messages.clear(); } } catch (final TokenStreamRecognitionException tre) { final String exceptionMsg = String.format(Locale.ROOT, msg, "TokenStreamRecognitionException", fileName); throw new CheckstyleException(exceptionMsg, tre); } catch (RecognitionException | TokenStreamException ex) { final String exceptionMsg = String.format(Locale.ROOT, msg, ex.getClass().getSimpleName(), fileName); throw new CheckstyleException(exceptionMsg, ex); } } }
Source:
public static org.kie.server.api.model.instance.ProcessInstanceCustomVars convertToProcessInstanceCustomVars(ProcessInstanceCustomDesc pi) { if (pi == null) { return null; } org.kie.server.api.model.instance.ProcessInstanceCustomVars instance = org.kie.server.api.model.instance.ProcessInstanceCustomVars.builder() .id(pi.getId()) .processId(pi.getProcessId()) .processName(pi.getProcessName()) .processVersion(pi.getProcessVersion()) .containerId(pi.getDeploymentId()) .processInstanceDescription(pi.getProcessInstanceDescription()) .correlationKey(pi.getCorrelationKey()) .parentInstanceId(pi.getParentId()) .date(pi.getDataTimeStamp()) .initiator(pi.getInitiator()) .state(pi.getState()) .lastModificationDate(pi.getLastModificationDate()) .build(); if(pi.getVariables() != null && !pi.getVariables().isEmpty()) { instance.setVariables(pi.getVariables()); } return instance; }

Target:
public static org.kie.server.api.model.instance.ProcessInstanceCustomVars convertToProcessInstanceCustomVars(ProcessInstanceCustomDesc pi) { if (pi == null) { return null; } org.kie.server.api.model.instance.ProcessInstanceCustomVars instance = org.kie.server.api.model.instance.ProcessInstanceCustomVars.builder() .id(pi.getId()) .processId(pi.getProcessId()) .processName(pi.getProcessName()) .processVersion(pi.getProcessVersion()) .containerId(pi.getDeploymentId()) .processInstanceDescription(pi.getProcessInstanceDescription()) .correlationKey(pi.getCorrelationKey()) .parentInstanceId(pi.getParentId()) .date(pi.getDataTimeStamp()) .initiator(pi.getInitiator()) .state(pi.getState()) .lastModificationDate(pi.getLastModificationDate()) .variables(pi.getVariables()) .build(); return instance; }
Source:
public Void visitExecutable(AnnotatedTypeMirror.AnnotatedExecutableType t, Void p) { AnnotatedTypeMirror returnType = t.getReturnType(); AnnotationMirror unknownThisAnnot = AnnotationBuilder.fromClass(elements, UnknownThis.class); AnnotationMirror retAnnotation = returnType.getAnnotationInHierarchy(unknownThisAnnot); if (retAnnotation != null && AnnotationUtils.areSame(retAnnotation, THIS_ANNOTATION)) { AnnotatedTypeMirror.AnnotatedDeclaredType receiverType = t.getReceiverType(); receiverType.replaceAnnotation(THIS_ANNOTATION); } if (!isConstructor(t)) { for (FrameworkSupport frameworkSupport : frameworks) { if (frameworkSupport.returnsThis(t)) { returnType.replaceAnnotation(THIS_ANNOTATION); AnnotatedTypeMirror.AnnotatedDeclaredType receiverType = t.getReceiverType(); receiverType.replaceAnnotation(THIS_ANNOTATION); break; } } } return super.visitExecutable(t, p); }

Target:
public Void visitExecutable(AnnotatedTypeMirror.AnnotatedExecutableType t, Void p) { if (t.getElement().getKind() == ElementKind.CONSTRUCTOR) { return super.visitExecutable(t, p); } AnnotatedTypeMirror returnType = t.getReturnType(); if (FluentAPIGenerator.check(t)) { if (!returnType.isAnnotatedInHierarchy(THIS_ANNOTATION)) { returnType.addAnnotation(THIS_ANNOTATION); } } AnnotationMirror retAnnotation = returnType.getAnnotationInHierarchy(THIS_ANNOTATION); if (retAnnotation != null && AnnotationUtils.areSame(retAnnotation, THIS_ANNOTATION)) { AnnotatedTypeMirror.AnnotatedDeclaredType receiverType = t.getReceiverType(); if (receiverType != null && !receiverType.isAnnotatedInHierarchy(THIS_ANNOTATION)) { receiverType.addAnnotation(THIS_ANNOTATION); } } return super.visitExecutable(t, p); }
Source:
public IClimateState copy() { return copy(false); }

Target:
public IClimateState copy() { return this; }
Source:
Tristate(boolean val) { this.val = val; }

Target:
private Tristate(boolean val) { this.val = val; }
Source:
public void expiredEmbargoedBitstreamTest() throws Exception { context.turnOffAuthorisationSystem(); parentCommunity = CommunityBuilder.createCommunity(context) .withName("Parent Community") .build(); Collection col1 = CollectionBuilder.createCollection(context, parentCommunity) .withName("Collection 1") .build(); String bitstreamContent = "Embargoed!"; try (InputStream is = IOUtils.toInputStream(bitstreamContent, CharEncoding.UTF_8)) { Item publicItem1 = ItemBuilder.createItem(context, col1) .withTitle("Public item 1") .withIssueDate("2015-10-17") .withAuthor("Smith, Donald") .build(); Bitstream bitstream = BitstreamBuilder .createBitstream(context, publicItem1, is) .withName("Test Embargoed Bitstream") .withDescription("This bitstream is embargoed") .withMimeType("text/plain") .withEmbargoPeriod("-3 months") .build(); context.restoreAuthSystemState(); String authToken = getAuthToken(eperson.getEmail(), password); getClient(authToken).perform(get("/api/core/bitstreams/" + bitstream.getID() + "/content")) .andExpect(status().isOk()); getClient().perform(get("/api/core/bitstreams/" + bitstream.getID() + "/content")) .andExpect(status().isOk()); checkNumberOfStatsRecords(bitstream, 2); } }

Target:
public void expiredEmbargoedBitstreamTest() throws Exception { context.turnOffAuthorisationSystem(); parentCommunity = CommunityBuilder.createCommunity(context) .withName("Parent Community") .build(); Collection col1 = CollectionBuilder.createCollection(context, parentCommunity) .withName("Collection 1") .build(); String bitstreamContent = "Embargoed!"; try (InputStream is = IOUtils.toInputStream(bitstreamContent, CharEncoding.UTF_8)) { Item publicItem1 = ItemBuilder.createItem(context, col1) .withTitle("Public item 1") .withIssueDate("2015-10-17") .withAuthor("Smith, Donald") .build(); Bitstream bitstream = BitstreamBuilder .createBitstream(context, publicItem1, is) .withName("Test Embargoed Bitstream") .withDescription("This bitstream is embargoed") .withMimeType("text/plain") .withEmbargoPeriod("-3 months") .build(); } context.restoreAuthSystemState(); String authToken = getAuthToken(eperson.getEmail(), password); getClient(authToken).perform(get("/api/core/bitstreams/" + bitstream.getID() + "/content")) .andExpect(status().isOk()); getClient().perform(get("/api/core/bitstreams/" + bitstream.getID() + "/content")) .andExpect(status().isOk()); checkNumberOfStatsRecords(bitstream, 2); }
Source:
public void read(String currentUrl, String lastUrl) { FeedConfig[] feeds = new FeedConfig[2]; feeds[0] = new FeedConfig(currentUrl, "/([0-9a-f-]*)\\?"); feeds[1] = new FeedConfig(lastUrl, "/([0-9a-f-]*)\\?"); configService.setFeedConfigs(new FeedConfigs(new HashSet<>(Arrays.asList(feeds)))); fetch(); FeedRecord feedRecord = feedRecordDataService.findByURL(currentUrl); String currenData = feedRecord.getData(); int currentPage = feedRecord.getPage(currenData); feedRecord = feedRecordDataService.findByURL(currentUrl); String lastData = feedRecord.getData(); int lastPage = feedRecord.getPage(lastData); configService.readNewFeeds(currentPage, lastPage, currentUrl); fetch(); }

Target:
public void read(String currentUrl, String lastUrl) { List<FeedConfig> feeds = new ArrayList<>(); String regex = "/([0-9a-f-]*)\\?"; feeds.add(new FeedConfig(currentUrl, regex)); feeds.add(new FeedConfig(lastUrl, regex)); configService.setFeedConfigs(new FeedConfigs(new HashSet<>(feeds))); fetch(); FeedRecord feedRecord = feedRecordDataService.findByURL(currentUrl); String currenData = feedRecord.getData(); int currentPage = feedRecord.getPage(currenData); feedRecord = feedRecordDataService.findByURL(lastUrl); String lastData = feedRecord.getData(); int lastPage = feedRecord.getPage(lastData); configService.readNewFeeds(currentPage, lastPage, currentUrl); fetch(); }
Source:
private RecordsToOpen( @JsonProperty("records") @NonNull @Singular final List<TableRecordReference> records, @JsonProperty("adWindowId") @Nullable final String adWindowId, @JsonProperty("target") @Nullable final OpenTarget target, @JsonProperty("targetTab") final TargetTab targetTab, @JsonProperty("automaticallySetReferencingDocumentPaths") @Nullable final Boolean automaticallySetReferencingDocumentPaths, @JsonProperty("useAutoFilters") @Nullable final Boolean useAutoFilters) { Check.assumeNotEmpty(records, "records is not empty"); this.records = ImmutableList.copyOf(records); this.windowIdString = StringUtils.trimBlankToNull(adWindowId); this.target = target != null ? target : OpenTarget.GridView; this.targetTab = targetTab != null ? targetTab : target == OpenTarget.GridView ? TargetTab.SAME_TAB_OVERLAY : TargetTab.SAME_TAB; this.automaticallySetReferencingDocumentPaths = automaticallySetReferencingDocumentPaths != null ? automaticallySetReferencingDocumentPaths : true; this.useAutoFilters = useAutoFilters != null ? useAutoFilters : true; }

Target:
private RecordsToOpen( @JsonProperty("records") @NonNull @Singular final List<TableRecordReference> records, @JsonProperty("adWindowId") @Nullable final String adWindowId, @JsonProperty("target") @Nullable final OpenTarget target, @JsonProperty("targetTab") final TargetTab targetTab, @JsonProperty("automaticallySetReferencingDocumentPaths") @Nullable final Boolean automaticallySetReferencingDocumentPaths, @JsonProperty("useAutoFilters") @Nullable final Boolean useAutoFilters) { Check.assumeNotEmpty(records, "records is not empty"); this.records = ImmutableList.copyOf(records); this.windowIdString = StringUtils.trimBlankToNull(adWindowId); this.target = target != null ? target : OpenTarget.GridView; this.targetTab = targetTab != null ? targetTab : TargetTab.SAME_TAB; this.automaticallySetReferencingDocumentPaths = automaticallySetReferencingDocumentPaths != null ? automaticallySetReferencingDocumentPaths : true; this.useAutoFilters = useAutoFilters != null ? useAutoFilters : true; }
Source:
public void loadContactPicture(final Address address, final ImageView imageView) { Uri photoUri = mContactsHelper.getPhotoUri(address.getAddress()); if (photoUri != null) { final RequestListener<Uri, GlideDrawable> noPhotoListener = new RequestListener<Uri, GlideDrawable>() { @Override public boolean onException(Exception e, Uri model, Target<GlideDrawable> target, boolean isFirstResource) { loadFallbackPicture(address, imageView); return true; } @Override public boolean onResourceReady(GlideDrawable resource, Uri model, Target<GlideDrawable> target, boolean isFromMemoryCache, boolean isFirstResource) { return false; } }; Glide.with(imageView.getContext()) .load(photoUri) .diskCacheStrategy(DiskCacheStrategy.NONE) .listener(noPhotoListener) .dontAnimate() .override(mPictureSizeInPx, mPictureSizeInPx) .into(imageView); } else { loadFallbackPicture(address, imageView); } }

Target:
public void loadContactPicture(final Address address, final ImageView imageView) { Uri photoUri = mContactsHelper.getPhotoUri(address.getAddress()); loadContactPicture(photoUri, address, imageView); }
Source:
public void testBufferSizeFlush() throws Exception { int maxSize = 1024; BufferedMutatorParams params = new BufferedMutatorParams(TABLE_NAME) .writeBufferSize(maxSize); try (BufferedMutator mutator = connection.getBufferedMutator(params)) { Put put = getPut(); mutator.mutate(put); Assert.assertTrue(mutator.getWriteBufferSize() > 0); Put largePut = new Put(dataHelper.randomData("testrow-")); largePut.addColumn(COLUMN_FAMILY, qualifier, Bytes.toBytes(RandomStringUtils.randomAlphanumeric(maxSize * 2))); long heapSize = largePut.heapSize(); Assert.assertTrue("largePut heapsize is : " + heapSize, heapSize > maxSize); mutator.mutate(largePut); Assert.assertTrue( 0 == mutator.getWriteBufferSize() || maxSize == mutator.getWriteBufferSize()); } }

Target:
public void testBufferSizeFlush() throws Exception { int maxSize = 1024; BufferedMutatorParams params = new BufferedMutatorParams(TABLE_NAME) .writeBufferSize(maxSize); try (BufferedMutator mutator = connection.getBufferedMutator(params)) { Assert.assertTrue( 0 == mutator.getWriteBufferSize() || maxSize == mutator.getWriteBufferSize()); Put put = getPut(); mutator.mutate(put); Assert.assertTrue(mutator.getWriteBufferSize() > 0); Put largePut = new Put(dataHelper.randomData("testrow-")); largePut.addColumn(COLUMN_FAMILY, qualifier, Bytes.toBytes(RandomStringUtils.randomAlphanumeric(maxSize * 2))); long heapSize = largePut.heapSize(); Assert.assertTrue("largePut heapsize is : " + heapSize, heapSize > maxSize); mutator.mutate(largePut); Assert.assertTrue( 0 == mutator.getWriteBufferSize() || maxSize == mutator.getWriteBufferSize()); } }
Source:
private ConfigurationObjectDto retrieveConfigurationObject(final DlmsConnectionHolder conn) throws IOException, TimeoutException, ProtocolAdapterException { final AttributeAddress configurationObjectValue = new AttributeAddress(CLASS_ID, OBIS_CODE, ATTRIBUTE_ID); conn.getDlmsMessageListener() .setDescription("SetConfigurationObject retrieve current value, retrieve attribute: " + JdlmsObjectToStringUtil.describeAttributes(configurationObjectValue)); LOGGER.info( "Retrieving current configuration object by issuing get request for class id: {}, obis code: {}, attribute id: {}", CLASS_ID, OBIS_CODE, ATTRIBUTE_ID); final GetResult getResult = conn.getConnection().get(configurationObjectValue); if (getResult == null) { throw new ProtocolAdapterException("No result received while retrieving current configuration object."); } return this.getConfigurationObject(getResult); }

Target:
private ConfigurationObjectDto retrieveConfigurationObject(final DlmsConnectionHolder conn) throws IOException, TimeoutException, ProtocolAdapterException { final AttributeAddress configurationObjectValue = new AttributeAddress(CLASS_ID, OBIS_CODE, ATTRIBUTE_ID); conn.getDlmsMessageListener().setDescription("retrieve current ConfigurationObject, attribute: " + JdlmsObjectToStringUtil.describeAttributes(configurationObjectValue)); LOGGER.info( "Retrieving current configuration object by issuing get request for class id: {}, obis code: {}, attribute id: {}", CLASS_ID, OBIS_CODE, ATTRIBUTE_ID); final GetResult getResult = conn.getConnection().get(configurationObjectValue); if (getResult == null) { throw new ProtocolAdapterException("No result received while retrieving current configuration object."); } return this.getConfigurationObject(getResult); }
Source:
private void test(int callsiteSize) { String testName = "Test" + callsiteSize + " callsites"; addCallsites(callsiteSize); Performance perf = Performance.getDefault(); PerformanceMeter pm = perf.createPerformanceMeter(TEST_ID + '#' + testName); testMain(pm); pm.commit(); }

Target:
private void test(int callsiteSize) { String testName = "Test" + callsiteSize + " callsites"; addCallsites(callsiteSize); Performance perf = Performance.getDefault(); PerformanceMeter pm = perf.createPerformanceMeter(TEST_ID + '#' + testName); perf.tagAsSummary(pm, TEST_SUITE_NAME + ':' + callsiteSize + " callsites", Dimension.CPU_TIME); testMain(pm); pm.commit(); }
Source:
private void handleDescription(List<StringField> descriptionList, DataSetReference.Builder metaBuilder) { if (CollectionUtils.isNotEmpty(descriptionList)) { for (StringField currentDescription : descriptionList) { if (fieldApprover.approve(currentDescription.getDataInfo()) && StringUtils.isNotBlank(currentDescription.getValue()) && !NULL_STRING_VALUE.equals(currentDescription.getValue())) { metaBuilder.setDescription(currentDescription.getValue()); break; } } } }

Target:
private void handleDescription(List<StringField> descriptionList, DataSetReference.Builder metaBuilder) { if (CollectionUtils.isNotEmpty(descriptionList)) { descriptionList.stream().filter(x -> fieldApprover.approve(x.getDataInfo())) .filter(x -> StringUtils.isNotBlank(x.getValue())) .filter(x -> !NULL_STRING_VALUE.equals(x.getValue())).findFirst().map(StringField::getValue) .ifPresent(metaBuilder::setDescription); } }
Source:
public static void assumeChrome(WebDriver driver) { Assume.assumeNotNull(driver); String chromeArguments = System.getProperty("chromeArguments"); Assume.assumeNotNull(chromeArguments); Assume.assumeTrue(chromeArguments.contains("--enable-web-authentication-testing-api")); Assume.assumeTrue("Browser must be Chrome (RemoteWebDriver)!", driver instanceof RemoteWebDriver); Capabilities cap = ((RemoteWebDriver) driver).getCapabilities(); String browserName = cap.getBrowserName().toLowerCase(); int version = Integer.parseInt(cap.getVersion().substring(0, cap.getVersion().indexOf("."))); Assume.assumeTrue("Browser must be Chrome !", browserName.equals(CHROME_NAME)); Assume.assumeTrue("Version of chrome must be higher than " + CHROME_MIN_VERSION, version >= CHROME_MIN_VERSION); }

Target:
public static void assumeChrome(WebDriver driver) { Assume.assumeNotNull(driver); String chromeArguments = System.getProperty("chromeArguments"); Assume.assumeNotNull(chromeArguments); Assume.assumeTrue(chromeArguments.contains("--enable-web-authentication-testing-api")); Assume.assumeTrue("Browser must be Chrome (RemoteWebDriver)!", driver instanceof RemoteWebDriver); Capabilities cap = ((RemoteWebDriver) driver).getCapabilities(); String browserName = cap.getBrowserName().toLowerCase(); int version = Integer.parseInt(cap.getVersion().substring(0, cap.getVersion().indexOf("."))); Assume.assumeTrue("Browser must be Chrome !", browserName.equals(CHROME_NAME)); Assume.assumeTrue("Version of chrome must be higher than or equal to " + CHROME_MIN_VERSION, version >= CHROME_MIN_VERSION); }
Source:
private Operation<List<BuildConfig>> showConfirmDialog(final ProjectDescriptor projectDescriptor, final String nameSpace) { return new Operation<List<BuildConfig>>() { @Override public void apply(List<BuildConfig> configs) throws OperationException { String dialogLabel = ""; if (configs.isEmpty()) { dialogLabel = locale.deleteProjectWithoutAppLabel(nameSpace); } if (configs.size() == 1) { dialogLabel = locale.deleteSingleAppProjectLabel(nameSpace); } if (configs.size() > 1) { String applications = getBuildConfigNames(configs); dialogLabel = locale.deleteMultipleAppProjectLabel(nameSpace, applications); } dialogFactory.createConfirmDialog(locale.deleteProjectDialogTitle(), dialogLabel, new ConfirmCallback() { @Override public void accepted() { service.deleteProject(nameSpace).then(new Operation<Void>() { @Override public void apply(Void arg) throws OperationException { notificationManager.showInfo(locale.deleteNameSpaceSuccess(nameSpace)); cleanUpApplication(projectDescriptor, nameSpace); } }).catchError(new Operation<PromiseError>() { @Override public void apply(PromiseError arg) throws OperationException { handleError(nameSpace); } }); } }, null).show(); } }; }

Target:
private Operation<List<BuildConfig>> showConfirmDialog(final ProjectDescriptor projectDescriptor, final String nameSpace) { return new Operation<List<BuildConfig>>() { @Override public void apply(List<BuildConfig> configs) throws OperationException { String dialogLabel; if (configs.isEmpty()) { dialogLabel = locale.deleteProjectWithoutAppLabel(nameSpace); } else if (configs.size() == 1) { dialogLabel = locale.deleteSingleAppProjectLabel(nameSpace); } else { String applications = getBuildConfigNames(configs); dialogLabel = locale.deleteMultipleAppProjectLabel(nameSpace, applications); } dialogFactory.createConfirmDialog(locale.deleteProjectDialogTitle(), dialogLabel, new ConfirmCallback() { @Override public void accepted() { service.deleteProject(nameSpace).then(new Operation<Void>() { @Override public void apply(Void arg) throws OperationException { notificationManager.showInfo(locale.deleteProjectSuccess(nameSpace)); removeOpenshiftMixin(projectDescriptor, nameSpace); } }).catchError(new Operation<PromiseError>() { @Override public void apply(PromiseError arg) throws OperationException { handleError(nameSpace); } }); } }, null).show(); } }; }
Source:
public void removeListenersFromController(GenericHelixController controller) { PropertyKey.Builder keyBuilder = new PropertyKey.Builder(_manager.getClusterName()); _manager.removeListener(keyBuilder.idealStates(), controller); _manager.removeListener(keyBuilder.liveInstances(), controller); _manager.removeListener(keyBuilder.clusterConfig(), controller); _manager.removeListener(keyBuilder.resourceConfigs(), controller); _manager.removeListener(keyBuilder.instanceConfigs(), controller); _manager.removeListener(keyBuilder.customizedStateConfig(), controller); _manager.removeListener(keyBuilder.controller(), controller); _manager.removeListener(keyBuilder.controllerMessages(), _messagingService.getExecutor()); }

Target:
public void removeListenersFromController(GenericHelixController controller) { PropertyKey.Builder keyBuilder = new PropertyKey.Builder(_manager.getClusterName()); _manager.removeListener(keyBuilder.idealStates(), controller); _manager.removeListener(keyBuilder.liveInstances(), controller); _manager.removeListener(keyBuilder.customizedStateConfig(), controller); _manager.removeListener(keyBuilder.clusterConfig(), controller); _manager.removeListener(keyBuilder.resourceConfigs(), controller); _manager.removeListener(keyBuilder.instanceConfigs(), controller); _manager.removeListener(keyBuilder.controller(), controller); _manager.removeListener(keyBuilder.controllerMessages(), _messagingService.getExecutor()); }
Source:
public void set(String name, Object value, Document document, LuceneOptions luceneOptions) { if ( value == null ) { return; } Double doubleValue = ((WrappedDoubleValue) value).value; if ( doubleValue == null ) { return; } document.add( new DoubleDocValuesField( name, doubleValue ) ); }

Target:
public void set(String name, Object value, Document document, LuceneOptions luceneOptions) { if ( value == null ) { return; } Double doubleValue = ((WrappedDoubleValue) value).value; if ( doubleValue == null ) { return; } luceneOptions.addNumericFieldToDocument( name, doubleValue, document ); document.add( new DoubleDocValuesField( name, doubleValue ) ); }
Source:
private boolean startIPv6() { try { mNwService.setInterfaceIpv6PrivacyExtensions(mInterfaceName, true); setIPv6AddrGenModeIfSupported(); mNwService.enableIpv6(mInterfaceName); } catch (RemoteException re) { logError("Unable to change interface settings: %s", re); return false; } catch (IllegalStateException ie) { logError("Unable to change interface settings: %s", ie); return false; } return true; }

Target:
private boolean startIPv6() { try { mNwService.setInterfaceIpv6PrivacyExtensions(mInterfaceName, true); setIPv6AddrGenModeIfSupported(); mNwService.enableIpv6(mInterfaceName); } catch (IllegalStateException | RemoteException | ServiceSpecificException e) { logError("Unable to change interface settings: %s", e); return false; } return true; }
Source:
void selectObjectRepresentation(PackWriter packer, ObjectToPack otp, WindowCursor curs) throws IOException { PackList pList = packList.get(); SEARCH: for (;;) { for (final PackFile p : pList.packs) { try { LocalObjectRepresentation rep = p.representation(curs, otp); if (rep != null) packer.select(otp, rep); } catch (PackMismatchException e) { pList = scanPacks(pList); continue SEARCH; } catch (CorruptObjectException e) { logPackIOException(e, p, true); removePack(p); } catch (PackInvalidException e) { logPackIOException(e, p, true); removePack(p); } catch (IOException e) { logPackIOException(e, p, false); } } break SEARCH; } for (AlternateHandle h : myAlternates()) h.db.selectObjectRepresentation(packer, otp, curs); }

Target:
void selectObjectRepresentation(PackWriter packer, ObjectToPack otp, WindowCursor curs) throws IOException { PackList pList = packList.get(); SEARCH: for (;;) { for (final PackFile p : pList.packs) { try { LocalObjectRepresentation rep = p.representation(curs, otp); if (rep != null) packer.select(otp, rep); } catch (IOException e) { handlePackError(e, p); } } break SEARCH; } for (AlternateHandle h : myAlternates()) h.db.selectObjectRepresentation(packer, otp, curs); }
Source:
protected List<String> getLdapServers(CLIParser parser, String domainName) throws ManageDomainsResult { String argValue = parser.getArg(Arguments.ldapServers.toString().toLowerCase()); if (StringUtils.isEmpty(argValue)) { LdapSRVLocator locator = new LdapSRVLocator(); DnsSRVResult ldapDnsResult = null; boolean foundServers = true; try { ldapDnsResult = locator.getLdapServers(domainName); if (!foundSrvRecords(ldapDnsResult)) { foundServers = false; } } catch (Exception ex) { foundServers = false; } if (!foundServers) { throw new ManageDomainsResult("Could not locate LDAP servers to be used to validate the input of the utility", ManageDomainsResultEnum.NO_LDAP_SERVERS_FOR_DOMAIN, domainName); } ArrayList<String> result = new ArrayList<String>(); for (int counter = 0; counter < ldapDnsResult.getNumOfValidAddresses(); counter++) { result.add(ldapDnsResult.getAddresses()[counter]); } return result; } else { for (String host: argValue.split(DOMAIN_SEPERATOR)) { try { InetAddress ia = InetAddress.getByName(host); ia.getCanonicalHostName(); } catch (UnknownHostException e) { log.error("Cannot resolve FQDN: " + e.getMessage()); } } } return new ArrayList<String>(Arrays.asList(argValue.split(DOMAIN_SEPERATOR))); }

Target:
protected List<String> getLdapServers(CLIParser parser, String domainName) throws ManageDomainsResult { String argValue = parser.getArg(Arguments.ldapServers.toString().toLowerCase()); if (StringUtils.isEmpty(argValue)) { LdapSRVLocator locator = new LdapSRVLocator(); DnsSRVResult ldapDnsResult = null; boolean foundServers = true; try { ldapDnsResult = locator.getLdapServers(domainName); if (!foundSrvRecords(ldapDnsResult)) { foundServers = false; } } catch (Exception ex) { foundServers = false; } if (!foundServers) { throw new ManageDomainsResult("Could not locate LDAP servers to be used to validate the input of the utility", ManageDomainsResultEnum.NO_LDAP_SERVERS_FOR_DOMAIN, domainName); } ArrayList<String> result = new ArrayList<String>(); for (int counter = 0; counter < ldapDnsResult.getNumOfValidAddresses(); counter++) { result.add(ldapDnsResult.getAddresses()[counter]); } return result; } for (String host: argValue.split(DOMAIN_SEPERATOR)) { try { InetAddress.getByName(host).getCanonicalHostName(); } catch (UnknownHostException e) { String warnMessage = "Warning: Cannot resolve FQDN: " + e.getMessage(); log.warn(warnMessage); System.out.println(warnMessage); } } return new ArrayList<String>(Arrays.asList(argValue.split(DOMAIN_SEPERATOR))); }
Source:
private ArchivedTask matchTaskPattern(String pattern, List<ArchivedTask> tasks) { try { return TaskMatchPattern.compile(pattern).find( tasks .stream() .collect( Collectors.toMap(t -> t.getFullName(), t -> t, (a, b) -> a) )); } catch (TaskMatchPattern.MultipleTaskMatchException | TaskMatchPattern.NoMatchException ex) { throw new IllegalArgumentException(ex); } }

Target:
private ArchivedTask matchTaskPattern(String pattern, List<ArchivedTask> tasks) { try { return TaskMatchPattern.compile(pattern).find( tasks .stream() .collect( Collectors.toMap(t -> t.getFullName(), t -> t, (a, b) -> b) )); } catch (TaskMatchPattern.MultipleTaskMatchException | TaskMatchPattern.NoMatchException ex) { throw new IllegalArgumentException(ex); } }
Source:
private static void validateNestedFilters(Iterable<Filter> filters) { Predicate<Filter> byIsNested = f -> (f.isNested() || f.isDeepNested()); List<Filter> other = StreamSupport .stream(filters::spliterator, Spliterator.ORDERED, false) .filter(byIsNested.negate()).collect(Collectors.toList()); Map<String, List<Filter>> groupedFilters = StreamSupport .stream(filters::spliterator, Spliterator.ORDERED, false) .filter(byIsNested) .collect(Collectors.groupingBy( filter -> { if (filter.isNested()) { return filter.isNestedRelationshipEntity() ? filter.getRelationshipType() : filter.getNestedEntityTypeLabel(); } else if (filter.isDeepNested()) { return filter.getNestedPath().get(filter.getNestedPath().size() - 1).getNestedEntityTypeLabel(); } else { throw new RuntimeException("¯\\_(ツ)_/¯"); } }, TreeMap::new, Collectors.toList() )); Predicate<Filter> hasBooleanOperator = filter -> BooleanOperator.OR == filter.getBooleanOperator(); boolean throwException = false; if (other.isEmpty()) { if (groupedFilters.size() > 1) { throwException = groupedFilters .values().stream() .anyMatch(l -> hasBooleanOperator.test(l.get(0))); } } else if (!groupedFilters.isEmpty()) { throwException = other.stream().anyMatch(hasBooleanOperator) || groupedFilters.values().stream() .map(groupedFilter -> groupedFilter.get(0)) .anyMatch(hasBooleanOperator); } if (throwException) { throw new UnsupportedOperationException( "Filters containing nested paths cannot be combined via the logical OR operator."); } }

Target:
private static void validateNestedFilters(Iterable<Filter> filters) { Predicate<Filter> byIsNested = f -> (f.isNested() || f.isDeepNested()); List<Filter> other = StreamSupport .stream(filters::spliterator, Spliterator.ORDERED, false) .filter(byIsNested.negate()).collect(Collectors.toList()); Map<String, List<Filter>> groupedFilters = StreamSupport .stream(filters::spliterator, Spliterator.ORDERED, false) .filter(byIsNested) .collect(Collectors.groupingBy( filter -> { if (filter.isNested()) { return filter.isNestedRelationshipEntity() ? filter.getRelationshipType() : filter.getNestedEntityTypeLabel(); } else { return filter.getNestedPath().get(filter.getNestedPath().size() - 1).getNestedEntityTypeLabel(); } }, TreeMap::new, Collectors.toList() )); Predicate<Filter> hasOrOperator = filter -> BooleanOperator.OR == filter.getBooleanOperator(); boolean throwException = false; if (other.isEmpty()) { if (groupedFilters.size() > 1) { throwException = groupedFilters .values().stream() .anyMatch(l -> hasOrOperator.test(l.get(0))); } } else if (!groupedFilters.isEmpty()) { throwException = other.stream().anyMatch(hasOrOperator) || groupedFilters.values().stream() .map(groupedFilter -> groupedFilter.get(0)) .anyMatch(hasOrOperator); } if (throwException) { throw new UnsupportedOperationException( "Filters containing nested paths cannot be combined via the logical OR operator."); } }
Source:
private static double sanitize(double d) { final double dd = Math.abs(d % 1); if ((dd != 0 && dd < 0.0000001) || (dd != 1 && dd > 0.9999999)) { return Math.round(d); } else { return d; } }

Target:
private static double sanitize(double d) { final double dd = Math.abs(d % 1); if ((dd != 0 && dd < GenericMath.DBL_EPSILON * 2) || (dd != 1 && dd > 1 - GenericMath.DBL_EPSILON * 2)) { return Math.round(d); } else { return d; } }
Source:
public void testCallNeedsPermissionMethod() throws Exception { CallNeedsPermissionDetector.METHODS = Collections.singletonList("fooBar"); StringBuilder foo = new StringBuilder("package com.example;\n"); foo.append("public class Foo {\n"); foo.append("public void someMethod() {"); foo.append("Baz baz = new Baz();\n"); foo.append("baz.fooBar(); "); foo.append("}\n"); foo.append("}"); StringBuilder baz = new StringBuilder("package com.example;\n"); baz.append("public class Baz {\n"); baz.append("public void fooBar() {\n"); baz.append("}\n"); baz.append("}"); String result = lintProject( java("src/com/example/Foo.java", foo.toString()), java("src/com/example/Baz.java", baz.toString())); StringBuilder error = new StringBuilder( "src/com/example/Foo.java:4: Error: Trying to access permission-protected method directly "); error.append("["); error.append(CallNeedsPermissionDetector.ISSUE.getId()); error.append("]\n"); error.append("baz.fooBar(); }\n"); error.append("~~~~~~~~~~~~\n"); error.append("1 errors, 0 warnings\n"); assertEquals(result, error.toString()); }

Target:
public void testCallNeedsPermissionMethod() throws Exception { CallNeedsPermissionDetector.methods = Collections.singletonList("fooBar"); @Language("JAVA") String foo = "" + "package com.example;\n" + "public class Foo {\n" + "public void someMethod() {" + "Baz baz = new Baz();\n" + "baz.fooBar(); " + "}\n" + "}"; @Language("JAVA") String baz = "" + "package com.example;\n" + "public class Baz {\n" + "public void fooBar() {\n" + "}\n" + "}"; String result = lintProject( java("src/com/example/Foo.java", foo), java("src/com/example/Baz.java", baz)); String error = "" + "src/com/example/Foo.java:4: Error: Trying to access permission-protected method directly " + "[" + CallNeedsPermissionDetector.ISSUE.getId() + "]\n" + "baz.fooBar(); }\n" + "~~~~~~~~~~~~\n" + "1 errors, 0 warnings\n"; assertEquals(result, error.toString()); }
Source:
private void changeOptionsMenu(Menu menu) { MenuInflater menuInflater = this.getMenuInflater(); if (activeScreenType == ScreenType.WEBVIEW_SCREEN) { menuInflater.inflate(R.menu.web_view_activity, menu); } else if (activeScreenType == ScreenType.TABLE_MANAGER_SCREEN) { menuInflater.inflate(R.menu.table_manager, menu); String defaultValue = Constants.TABLE_SORT_ORDER.SORT_ASC.getCorrespondingName(); String sortingOrder = defaultValue; if(mPropSingleton.getProperty(CommonToolProperties.KEY_PREF_TABLES_SORT_BY_ORDER) != null || (!mPropSingleton.getProperty(CommonToolProperties.KEY_PREF_TABLES_SORT_BY_ORDER).equals("")) ) sortingOrder = mPropSingleton.getProperty(CommonToolProperties.KEY_PREF_TABLES_SORT_BY_ORDER); if( Constants.TABLE_SORT_ORDER.getCorrespondingEnum(sortingOrder) == Constants.TABLE_SORT_ORDER.SORT_ASC ) menu.findItem(R.id.menu_sort_name_asc).setChecked(true); else menu.findItem(R.id.menu_sort_name_desc).setChecked(true); } lastMenuType = activeScreenType; ActionBar actionBar = getActionBar(); if (actionBar != null) { actionBar.show(); } }

Target:
private void changeOptionsMenu(Menu menu) { MenuInflater menuInflater = this.getMenuInflater(); if (activeScreenType == ScreenType.WEBVIEW_SCREEN) { menuInflater.inflate(R.menu.web_view_activity, menu); } else if (activeScreenType == ScreenType.TABLE_MANAGER_SCREEN) { menuInflater.inflate(R.menu.table_manager, menu); String sortingOrder = mPropSingleton.getProperty(CommonToolProperties.KEY_PREF_TABLES_SORT_BY_ORDER); if( sortingOrder != null && sortingOrder.equalsIgnoreCase( Constants.TABLE_SORT_ORDER.SORT_DESC.name() ) ) menu.findItem(R.id.menu_sort_name_desc).setChecked(true); else menu.findItem(R.id.menu_sort_name_asc).setChecked(true); } lastMenuType = activeScreenType; ActionBar actionBar = getActionBar(); if (actionBar != null) { actionBar.show(); } }
Source:
private <T> QueryRunner<T> buildAndDecorateQueryRunner( final QueryRunnerFactory<T, Query<T>> factory, final QueryToolChest<T, Query<T>> toolChest, final ReferenceCountingSegment adapter, final SegmentDescriptor segmentDescriptor ) { SpecificSegmentSpec segmentSpec = new SpecificSegmentSpec(segmentDescriptor); return new SpecificSegmentQueryRunner<T>( new MetricsEmittingQueryRunner<T>( emitter, new Function<Query<T>, ServiceMetricEvent.Builder>() { @Override public ServiceMetricEvent.Builder apply(@Nullable final Query<T> input) { return toolChest.makeMetricBuilder(input); } }, new BySegmentQueryRunner<T>( adapter.getIdentifier(), adapter.getDataInterval().getStart(), new CachingQueryRunner<T>( adapter.getIdentifier(), segmentDescriptor, objectMapper, cache, toolChest, new MetricsEmittingQueryRunner<T>( emitter, new Function<Query<T>, ServiceMetricEvent.Builder>() { @Override public ServiceMetricEvent.Builder apply(@Nullable final Query<T> input) { return toolChest.makeMetricBuilder(input); } }, new ReferenceCountingSegmentQueryRunner<T>(factory, adapter), "segment/scan/time" ), cachingExec, cacheConfig ) ) ).withWaitMeasuredFromNow(), segmentSpec ); }

Target:
private <T> QueryRunner<T> buildAndDecorateQueryRunner( final QueryRunnerFactory<T, Query<T>> factory, final QueryToolChest<T, Query<T>> toolChest, final ReferenceCountingSegment adapter, final SegmentDescriptor segmentDescriptor ) { SpecificSegmentSpec segmentSpec = new SpecificSegmentSpec(segmentDescriptor); return new SpecificSegmentQueryRunner<T>( new MetricsEmittingQueryRunner<T>( emitter, new Function<Query<T>, ServiceMetricEvent.Builder>() { @Override public ServiceMetricEvent.Builder apply(@Nullable final Query<T> input) { return toolChest.makeMetricBuilder(input); } }, new BySegmentQueryRunner<T>( adapter.getIdentifier(), adapter.getDataInterval().getStart(), new CachingQueryRunner<T>( adapter.getIdentifier(), segmentDescriptor, objectMapper, cache, toolChest, new MetricsEmittingQueryRunner<T>( emitter, new Function<Query<T>, ServiceMetricEvent.Builder>() { @Override public ServiceMetricEvent.Builder apply(@Nullable final Query<T> input) { return toolChest.makeMetricBuilder(input); } }, new ReferenceCountingSegmentQueryRunner<T>(factory, adapter), "query/segment/time", ImmutableMap.of("segment", adapter.getIdentifier()) ), cachingExec, cacheConfig ) ), "query/segmentAndCache/time", ImmutableMap.of("segment", adapter.getIdentifier()) ).withWaitMeasuredFromNow(), segmentSpec ); }
Source:
private void UpdateVmNetworks() { if (!getVm().getVdsGroupId().equals(getParameters().getVmStaticData().getvds_group_id())) { List<Network> networks = DbFacade .getInstance() .getNetworkDao() .getAllForCluster( getParameters().getVmStaticData().getvds_group_id()); List<VmNetworkInterface> interfaces = DbFacade.getInstance() .getVmNetworkInterfaceDao() .getAllForVm(getParameters().getVmStaticData().getId()); for (final VmNetworkInterface iface : interfaces) { Network net = LinqUtils.firstOrNull(networks, new Predicate<Network>() { @Override public boolean eval(Network n) { return n.getname().equals(iface.getNetworkName()); } }); if (net == null) { iface.setNetworkName(null); DbFacade.getInstance().getVmNetworkInterfaceDao().update(iface); } } } }

Target:
private void UpdateVmNetworks() { if (!getVm().getVdsGroupId().equals(getParameters().getVmStaticData().getvds_group_id())) { List<Network> networks = DbFacade .getInstance() .getNetworkDao() .getAllForCluster( getParameters().getVmStaticData().getvds_group_id()); List<VmNetworkInterface> interfaces = DbFacade.getInstance() .getVmNetworkInterfaceDao() .getAllForVm(getParameters().getVmStaticData().getId()); for (final VmNetworkInterface iface : interfaces) { Network net = LinqUtils.firstOrNull(networks, new Predicate<Network>() { @Override public boolean eval(Network n) { return n.getName().equals(iface.getNetworkName()); } }); if (net == null) { iface.setNetworkName(null); DbFacade.getInstance().getVmNetworkInterfaceDao().update(iface); } } } }
Source:
public int getEstimatedSizeInBytes() { int result = INSTANCE_SIZE; result += SizeOf.sizeOfObjectArray(addresses.size()); for (HostAddress address : addresses) { result += HOST_ADDRESS_INSTANCE_SIZE + address.getHostText().length() * Character.BYTES; } return result; }

Target:
public int getEstimatedSizeInBytes() { int result = INSTANCE_SIZE; result += sizeOfObjectArray(addresses.size()); for (HostAddress address : addresses) { result += HOST_ADDRESS_INSTANCE_SIZE + address.getHostText().length() * Character.BYTES; } return result; }
Source:
public void waitForAnnotatedElementVisibility(Object pageObject) { Class <? extends Object> clazz = pageObject.getClass(); final List<Field> allFields = new ArrayList<Field>(Arrays.asList(clazz.getDeclaredFields())); for(clazz = clazz.getSuperclass(); ((clazz != null) && (clazz != BasePage.class) && (clazz != HtmlElement.class)); clazz = clazz.getSuperclass()) { Stream.of(clazz.getDeclaredFields()). forEach(f->allFields.add(f)); } allFields.stream() .filter(this::validateFieldVisibilityAnnotations) .forEach(field -> invokeWaitFunctionForField(field, pageObject)); }

Target:
public void waitForAnnotatedElementVisibility(Object pageObject) { Class <?> clazz = pageObject.getClass(); final List<Field> allFields = new ArrayList<>(Arrays.asList(clazz.getDeclaredFields())); final List<Field> superClassFields = getDeclaredFieldsFromSuperClasses(clazz); Stream.concat(allFields.stream(),superClassFields.stream()) .filter(this::validateFieldVisibilityAnnotations) .forEach(field -> invokeWaitFunctionForField(field, pageObject)); }