auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public Choices getMatches(String field, String query, Collection collection, int start, int limit, String locale) { String formName; try { formName = Utils.getInputFormNameByCollectionAndField(collection, field); return delegates.get(formName).getMatches(field, query, collection, start, limit, locale); } catch (DCInputsReaderException e) { e.printStackTrace(); } return null; }

Target:
public Choices getMatches(String field, String query, Collection collection, int start, int limit, String locale) { String formName; try { init(); if(collection==null) { Set<Choice> choices = new HashSet<Choice>(); for(ChoiceAuthority ca : delegates.values()) { Choices tmp = ca.getMatches(field, query, null, start, limit, locale); if(tmp.total>0) { Set<Choice> mySet = new HashSet<Choice>(Arrays.asList(tmp.values)); choices.addAll(mySet); } } if(!choices.isEmpty()) { Choice[] results = new Choice[choices.size()-1]; choices.toArray(results); return new Choices(results, 0, choices.size(), Choices.CF_AMBIGUOUS, false); } } else { formName = dci.getInputFormNameByCollectionAndField(collection, field); return delegates.get(formName).getMatches(field, query, collection, start, limit, locale); } } catch (DCInputsReaderException e) { log.error(e.getMessage(), e); } return new Choices(Choices.CF_NOTFOUND); }
Source:
public Long getSearchKey1() { return extBusEvent.getAccountId().getMostSignificantBits() & Long.MAX_VALUE; }

Target:
public Long getSearchKey1() { final UUID accountId = extBusEvent.getAccountId(); return accountId == null ? null : accountId.getMostSignificantBits() & Long.MAX_VALUE; }
Source:
protected Stream<URL> listBundleComponents(Bundle bundle) { String list = OSGiRuntimeService.getComponentsList(bundle); String name = bundle.getSymbolicName(); log.debug("PartialBundle: " + name + " components: " + list); if (list == null) { return null; } return Arrays.stream(list.split("[, \t\n\r\f]")).map(s -> bundle.getEntry((String) s)).filter(Objects::nonNull); }

Target:
protected Stream<URL> listBundleComponents(Bundle bundle) { String list = OSGiRuntimeService.getComponentsList(bundle); String name = bundle.getSymbolicName(); log.debug("PartialBundle: " + name + " components: " + list); if (list == null) { return null; } return Arrays.stream(list.split("[, \t\n\r\f]")).map(bundle::getEntry).filter(Objects::nonNull); }
Source:
public TemporalSearchFunctionFactory(final Configuration conf, final TemporalIndexer temporalIndexer) { this.conf = conf; this.temporalIndexer = temporalIndexer; }

Target:
public TemporalSearchFunctionFactory(final Configuration conf, final TemporalIndexer temporalIndexer) { this.temporalIndexer = temporalIndexer; }
Source:
CompletableFuture<JobManagerRunner> createJobManagerRunner(JobGraph jobGraph) { final RpcService rpcService = getRpcService(); return CompletableFuture.supplyAsync( () -> { try { JobManagerRunner runner = jobManagerRunnerFactory.createJobManagerRunner( jobGraph, configuration, rpcService, highAvailabilityServices, heartbeatServices, jobManagerSharedServices, new DefaultJobManagerJobMetricGroupFactory(jobManagerMetricGroup), fatalErrorHandler); runner.start(); return runner; } catch (Exception e) { throw new CompletionException(new JobExecutionException(jobGraph.getJobID(), "Could not instantiate JobManager.", e)); } }, rpcService.getExecutor()); }

Target:
CompletableFuture<JobManagerRunner> createJobManagerRunner(JobGraph jobGraph) { final RpcService rpcService = getRpcService(); return CompletableFuture.supplyAsync( () -> { try { JobManagerRunner runner = jobManagerRunnerFactory.createJobManagerRunner( jobGraph, configuration, rpcService, highAvailabilityServices, heartbeatServices, jobManagerSharedServices, new DefaultJobManagerJobMetricGroupFactory(jobManagerMetricGroup), fatalErrorHandler); runner.start(); return runner; } catch (Exception e) { throw new CompletionException(new JobInitializationException(jobGraph.getJobID(), "Could not instantiate JobManager.", e)); } }, rpcService.getExecutor()); }
Source:
public void testEvalNegative() { Mockito.when(mockExternalNetworkPredicate.eval(mockNetwork)).thenReturn(true); assertFalse(underTest.eval(mockNetwork)); }

Target:
public void testEvalNegative() { when(mockExternalNetworkPredicate.eval(mockNetwork)).thenReturn(true); assertFalse(underTest.eval(mockNetwork)); }
Source:
public void publish(String content) { System.out.println("Hello"); RequestAttributes requestAttributes = RequestContextHolder.getRequestAttributes(); String priority = null; if (requestAttributes != null) { priority = (String) requestAttributes.getAttribute("priority", RequestAttributes.SCOPE_REQUEST); } String tenantId = String.valueOf(TenancyContextHolder.getContext().getTenant().getIdentity()); String userId = null; Authentication authentication = SecurityContextHolder.getContext().getAuthentication(); if (authentication != null) { userId = authentication.getName(); } Message message = new Message(userId, tenantId, content, priority); this.messages.add(message); }

Target:
public void publish(String content) { RequestAttributes requestAttributes = RequestContextHolder.getRequestAttributes(); String priority = null; if (requestAttributes != null) { priority = (String) requestAttributes.getAttribute("priority", RequestAttributes.SCOPE_REQUEST); } String tenantId = String.valueOf(TenancyContextHolder.getContext().getTenant().getIdentity()); String userId = null; Authentication authentication = SecurityContextHolder.getContext().getAuthentication(); if (authentication != null) { userId = authentication.getName(); } Message message = new Message(userId, tenantId, content, priority); this.messages.add(message); }
Source:
private static RepositorySystemSession newSession(RepositorySystem system ) { DefaultRepositorySystemSession session = MavenRepositorySystemUtils.newSession(); LocalRepository localRepo = new LocalRepository(ArtifactRepositoryService.GLOBAL_M2_REPO_NAME ); session.setLocalRepositoryManager( system.newLocalRepositoryManager( session, localRepo ) ); return session; }

Target:
private static RepositorySystemSession newSession(RepositorySystem system) { DefaultRepositorySystemSession session = MavenRepositorySystemUtils.newSession(); LocalRepository localRepo = new LocalRepository(ArtifactRepositoryPreference.getGlobalM2RepoDirWithFallback()); session.setLocalRepositoryManager(system.newLocalRepositoryManager(session, localRepo)); return session; }
Source:
public boolean initialize(List<StorageDomain> sds, StoragePool dc, String okCommandName, String cancelCommandName, ICommandTarget target) { List<StorageDomain> sdsToUpgrade = sds.stream().filter(getComparePredicate(dc)).collect(Collectors.toList()); if (sdsToUpgrade.isEmpty()) { return false; } UICommand okCommand = UICommand.createDefaultOkUiCommand(okCommandName, target); UICommand cancelCommand = UICommand.createCancelUiCommand(cancelCommandName, target); getCommands().add(okCommand); getCommands().add(cancelCommand); setTitle(ConstantsManager.getInstance().getConstants().updatingStorageDomainTitle()); setMessage(getFormatWarningMessage(dc, sdsToUpgrade)); getReason().setIsValid(false); return true; }

Target:
public boolean initialize(List<StorageDomain> sds, StoragePool dc, String okCommandName, String cancelCommandName, ICommandTarget target) { List<StorageDomain> sdsToUpgrade = sds.stream().filter(getComparePredicate(dc)).collect(Collectors.toList()); if (sdsToUpgrade.isEmpty()) { return false; } UICommand okCommand = UICommand.createDefaultOkUiCommand(okCommandName, target); UICommand cancelCommand = UICommand.createCancelUiCommand(cancelCommandName, target); getCommands().add(okCommand); getCommands().add(cancelCommand); setTitle(ConstantsManager.getInstance().getConstants().updatingStorageDomainTitle()); setMessage(getFormatWarningMessage(dc, sdsToUpgrade)); return true; }
Source:
public void signUpWithEmail() { SignupFlow signupFlow = new SignupFlow(); signupFlow.chooseSignupWithEmail(); signupFlow.enterEmail("e2eflowtestingmobile@example.com", mMagicLinkActivityTestRule); signupFlow.checkEpilogue( "e2eflowtestingmobile@example.com", "Eeflowtestingmobile@example.com", "e2eflowtestingmobile"); signupFlow.enterPassword("Pa$$word"); signupFlow.confirmSignup(); }

Target:
public void signUpWithEmail() { SignupFlow signupFlow = new SignupFlow(); signupFlow.chooseSignupWithEmail(); signupFlow.enterEmail(E2E_SIGNUP_EMAIL, mMagicLinkActivityTestRule); signupFlow.checkEpilogue( E2E_SIGNUP_DISPLAY_NAME, E2E_SIGNUP_USERNAME); signupFlow.enterPassword(E2E_SIGNUP_PASSWORD); signupFlow.confirmSignup(); }
Source:
private BestPossibleStateOutput calcBestPossState(ResourceControllerDataProvider cache, Set<String> resources) throws Exception { ClusterEvent event = new ClusterEvent(ClusterEventType.StateVerifier); event.addAttribute(AttributeName.ControllerDataProvider.name(), cache); runStage(event, new ResourceComputationStage()); if (resources != null && !resources.isEmpty()) { final Map<String, Resource> resourceMap = event.getAttribute(AttributeName.RESOURCES.name()); resourceMap.keySet().retainAll(resources); event.addAttribute(AttributeName.RESOURCES.name(), resourceMap); final Map<String, Resource> resourceMapToRebalance = event.getAttribute(AttributeName.RESOURCES_TO_REBALANCE.name()); resourceMapToRebalance.keySet().retainAll(resources); event.addAttribute(AttributeName.RESOURCES_TO_REBALANCE.name(), resourceMapToRebalance); } runStage(event, new CurrentStateComputationStage()); DryrunWagedRebalancer wagedRebalancer = new DryrunWagedRebalancer(_zkClient.getServers(), cache.getClusterName(), cache.getClusterConfig().getGlobalRebalancePreference()); runStage(event, new BestPossibleStateCalcStage(wagedRebalancer)); wagedRebalancer.close(); BestPossibleStateOutput output = event.getAttribute(AttributeName.BEST_POSSIBLE_STATE.name()); return output; }

Target:
private BestPossibleStateOutput calcBestPossState(ResourceControllerDataProvider cache, Set<String> resources) throws Exception { ClusterEvent event = new ClusterEvent(ClusterEventType.StateVerifier); event.addAttribute(AttributeName.ControllerDataProvider.name(), cache); runStage(event, new ResourceComputationStage()); if (resources != null && !resources.isEmpty()) { final Map<String, Resource> resourceMap = event.getAttribute(AttributeName.RESOURCES.name()); resourceMap.keySet().retainAll(resources); event.addAttribute(AttributeName.RESOURCES.name(), resourceMap); final Map<String, Resource> resourceMapToRebalance = event.getAttribute(AttributeName.RESOURCES_TO_REBALANCE.name()); resourceMapToRebalance.keySet().retainAll(resources); event.addAttribute(AttributeName.RESOURCES_TO_REBALANCE.name(), resourceMapToRebalance); } runStage(event, new CurrentStateComputationStage()); DryrunWagedRebalancer dryrunWagedRebalancer = new DryrunWagedRebalancer(_zkClient.getServers(), cache.getClusterName(), cache.getClusterConfig().getGlobalRebalancePreference()); try { runStage(event, new BestPossibleStateCalcStage(dryrunWagedRebalancer)); } finally { dryrunWagedRebalancer.close(); } BestPossibleStateOutput output = event.getAttribute(AttributeName.BEST_POSSIBLE_STATE.name()); return output; }
Source:
public void buildConnectionCache() { this.connectionCache = null; this.connectionCache = CacheBuilder.newBuilder().removalListener((RemovalListener<ConnectionInfo, HikariDataSource>) notification -> { HikariDataSource source = notification.getValue(); if (source != null) { source.close(); } }).build(new CacheLoader<ConnectionInfo, HikariDataSource>() { @Override public HikariDataSource load(@Nonnull ConnectionInfo key) throws Exception { HikariConfig config = new HikariConfig(); config.setUsername(key.getUser()); config.setPassword(key.getPassword()); config.setDriverClassName(key.getDriverClassName()); config.setMaximumPoolSize((Runtime.getRuntime().availableProcessors() * 2) + 1); config.setLeakDetectionThreshold(60 * 1000); Properties driverSpecificProperties = PROTOCOL_SPECIFIC_PROPS.get(key.getDriverClassName()); if (driverSpecificProperties != null) { config.setDataSourceProperties(driverSpecificProperties); } if (key.getDriverClassName().equals("com.mysql.cj.jdbc.Driver")) { config.setJdbcUrl(key.getAuthlessUrl() + "?disableMariaDbDriver"); } else { config.setJdbcUrl(key.getAuthlessUrl()); } return new HikariDataSource(config); } }); }

Target:
public void buildConnectionCache() { this.connectionCache = null; this.connectionCache = CacheBuilder.newBuilder().removalListener((RemovalListener<ConnectionInfo, HikariDataSource>) notification -> { HikariDataSource source = notification.getValue(); if (source != null) { source.close(); } }).build(new CacheLoader<ConnectionInfo, HikariDataSource>() { @Override public HikariDataSource load(@Nonnull ConnectionInfo key) throws Exception { HikariConfig config = new HikariConfig(); config.setUsername(key.getUser()); config.setPassword(key.getPassword()); config.setDriverClassName(key.getDriverClassName()); config.setMaximumPoolSize((Runtime.getRuntime().availableProcessors() * 2) + 1); config.setLeakDetectionThreshold(60 * 1000); Properties driverSpecificProperties = PROTOCOL_SPECIFIC_PROPS.get(key.getDriverClassName()); if (driverSpecificProperties != null) { config.setDataSourceProperties(driverSpecificProperties); } config.setJdbcUrl(key.getAuthlessUrl() + key.getOptions()); return new HikariDataSource(config); } }); }
Source:
protected PendingWorkerNums notifyAllocatedWorkerStopped(ResourceID resourceID) { WorkerResourceSpec workerResourceSpec = allocatedNotRegisteredWorkerResourceSpecs.remove(resourceID); if (workerResourceSpec == null) { return PendingWorkerNums.ZERO; } return new PendingWorkerNums( requestedNotAllocatedWorkerCounter.getNum(workerResourceSpec), requestedNotRegisteredWorkerCounter.decreaseAndGet(workerResourceSpec)); }

Target:
protected void notifyAllocatedWorkerStopped(ResourceID resourceID) { WorkerResourceSpec workerResourceSpec = allocatedNotRegisteredWorkerResourceSpecs.remove(resourceID); if (workerResourceSpec == null) { return; } requestedNotRegisteredWorkerCounter.decreaseAndGet(workerResourceSpec); }
Source:
public void underlineStyling() { interact(() -> { area.replaceText(firstWord + styledWord1 + moreText + styledWord2 + remainingLine); }); List<Text> textNodes = getTextNodes(); assertEquals(1, textNodes.size()); assertEquals(firstWord + styledWord1 + moreText + styledWord2 + remainingLine, textNodes.get(0).getText()); interact(() -> { final int start1 = firstWord.length(); final int end1 = start1 + styledWord1.length(); area.setStyle(start1, end1, "-rtfx-underline-color: red; -rtfx-underline-dash-array: 2 2; -rtfx-underline-width: 1; -rtfx-underline-cap: butt;"); final int start2 = end1 + moreText.length(); final int end2 = start2 + styledWord2.length(); area.setStyle(start2, end2, "-rtfx-underline-color: red; -rtfx-underline-dash-array: 2 2; -rtfx-underline-width: 1; -rtfx-underline-cap: butt;"); }); textNodes = getTextNodes(); assertEquals(5, textNodes.size()); Text first = textNodes.get(0); assertEquals(firstWord, first.getText()); Text second = textNodes.get(1); assertEquals(styledWord1, second.getText()); Text third = textNodes.get(2); assertEquals(moreText, third.getText()); Text fourth = textNodes.get(3); assertEquals(styledWord2, fourth.getText()); Text fifth = textNodes.get(4); assertEquals(remainingLine, fifth.getText()); List<Path> underlineNodes = getUnderlinePaths(); assertEquals(2, underlineNodes.size()); }

Target:
public void underlineStyling() { final String underlineStyle = "-rtfx-underline-color: red; -rtfx-underline-dash-array: 2 2; -rtfx-underline-width: 1; -rtfx-underline-cap: butt;"; interact(() -> { area.replaceText(HELLO + WORLD + AND_ALSO_THE + SUN + AND_MOON); }); List<Text> textNodes = getTextNodes(0); assertEquals(1, textNodes.size()); assertEquals(HELLO + WORLD + AND_ALSO_THE + SUN + AND_MOON, textNodes.get(0).getText()); interact(() -> { final int start1 = HELLO.length(); final int end1 = start1 + WORLD.length(); area.setStyle(start1, end1, underlineStyle); final int start2 = end1 + AND_ALSO_THE.length(); final int end2 = start2 + SUN.length(); area.setStyle(start2, end2, underlineStyle); }); textNodes = getTextNodes(0); assertEquals(5, textNodes.size()); Text first = textNodes.get(0); assertEquals(HELLO, first.getText()); Text second = textNodes.get(1); assertEquals(WORLD, second.getText()); Text third = textNodes.get(2); assertEquals(AND_ALSO_THE, third.getText()); Text fourth = textNodes.get(3); assertEquals(SUN, fourth.getText()); Text fifth = textNodes.get(4); assertEquals(AND_MOON, fifth.getText()); List<Path> underlineNodes = getUnderlinePaths(0); assertEquals(2, underlineNodes.size()); }
Source:
public void onPostUploaded(OnPostUploaded event) { if (isAdded() && event.post.getLocalSiteId() == mSite.getId()) { loadPosts(LoadMode.FORCED); final PostModel post = event.post; boolean isDraft = post != null && PostStatus.fromPost(post) == PostStatus.DRAFT; if (isDraft) { if (PostUtils.isPublishable(post)) { if (event.isError()) { showSnackbar(getString(R.string.editor_draft_saved_locally)); } else { View.OnClickListener publishPostListener = new View.OnClickListener() { @Override public void onClick(View v) { publishPost(post); } }; showSnackbar(R.string.editor_draft_saved_online, R.string.button_publish, publishPostListener); } } } else { if (event.isError()) { showSnackbar(getString(R.string.editor_draft_saved_locally)); } else { String message = post.isPage() ? getString(R.string.page_published) : getString(R.string.post_published); showSnackbar(message); } } } }

Target:
public void onPostUploaded(OnPostUploaded event) { final PostModel post = event.post; if (isAdded() && event.post != null && event.post.getLocalSiteId() == mSite.getId()) { loadPosts(LoadMode.FORCED); if (event.isError()) { showSnackbar(getString(R.string.editor_draft_saved_locally)); } else { boolean isDraft = PostStatus.fromPost(post) == PostStatus.DRAFT; if (isDraft) { View.OnClickListener publishPostListener = new View.OnClickListener() { @Override public void onClick(View v) { publishPost(post); } }; showSnackbar(R.string.editor_draft_saved_online, R.string.button_publish, publishPostListener); } else { String message = post.isPage() ? getString(R.string.page_published) : getString(R.string.post_published); showSnackbar(message); } } } }
Source:
public void testAsSAMRecordParsedTags() throws Exception { final String tags = "BC:Z:ACTG\tRG:Z:sample1"; final SAMRecord samRecord = new SAMRecordSetBuilder().addFrag("test", 0, 1, false, false, "10M", null, 2); final FastqRecord record = new FastqRecord(samRecord.getReadName(), samRecord.getReadBases(), tags, samRecord.getBaseQualities()); final SAMRecord converted = FastqEncoder.asSAMRecord(record, samRecord.getHeader(), FastqEncoder.QUALITY_HEADER_PARSE_SAM_TAGS); testConvertedSAMRecord(converted, samRecord); Assert.assertEquals(converted.getAttribute("BC"), "ACTG"); Assert.assertEquals(converted.getAttribute("RG"), "sample1"); }

Target:
public void testAsSAMRecordParsedTags() throws Exception { final String bc = "ACTG"; final String rg = "sample1"; final int fi = 1; final String customTag = "ct"; final char ct = 'a'; final String tags = String.format("%s:Z:%s\t%s:Z:%s\t%s:i:%d\t%s:A:%c", SAMTag.BC, bc, SAMTag.RG, rg, SAMTag.FI, fi, customTag, ct ); final SAMRecord samRecord = new SAMRecordSetBuilder().addFrag("test", 0, 1, false, false, "10M", null, 2); final FastqRecord record = new FastqRecord(samRecord.getReadName(), samRecord.getReadBases(), tags, samRecord.getBaseQualities()); final SAMRecord converted = FastqEncoder.asSAMRecord(record, samRecord.getHeader(), FastqEncoder.QUALITY_HEADER_PARSE_SAM_TAGS); testConvertedSAMRecord(converted, samRecord); Assert.assertEquals(converted.getAttribute(SAMTag.BC.name()), bc); Assert.assertEquals(converted.getAttribute(SAMTag.RG.name()), rg); Assert.assertEquals(converted.getAttribute(SAMTag.FI.name()), fi); Assert.assertEquals(converted.getAttribute(customTag), ct); }
Source:
public void execute(TronObject object) { if (object instanceof Player) { Player player = (Player) object; player.skipNumberOfActions(POWER_FAILURE_PENALTY_AT_START_TURN); } }

Target:
public void execute(TronObject object) { if (object instanceof TronPlayer) { TronPlayer player = (TronPlayer) object; player.skipNumberOfActions(POWER_FAILURE_PENALTY_AT_START_TURN); } super.execute(object); }
Source:
public OkHttpClient provideOkHttpClient(Context context, HttpLoggingInterceptor httpLoggingInterceptor) { File dir = new File(context.getCacheDir(), "okHttpCache"); OkHttpClient.Builder builder = new OkHttpClient.Builder().connectTimeout(60, TimeUnit.SECONDS) .writeTimeout(60, TimeUnit.SECONDS) .addInterceptor(httpLoggingInterceptor) .readTimeout(60, TimeUnit.SECONDS) .cache(new Cache(dir, OK_HTTP_CACHE_SIZE)); if(BuildConfig.FLAVOR.equals("beta")){ builder.sslSocketFactory(SslUtils.INSTANCE.getSslContextForCertificateFile(context, "*.wikimedia.beta.wmflabs.org.cer").getSocketFactory()); } return builder.build(); }

Target:
public OkHttpClient provideOkHttpClient(Context context, HttpLoggingInterceptor httpLoggingInterceptor) { File dir = new File(context.getCacheDir(), "okHttpCache"); OkHttpClient.Builder builder = new OkHttpClient.Builder().connectTimeout(60, TimeUnit.SECONDS) .writeTimeout(60, TimeUnit.SECONDS) .addInterceptor(httpLoggingInterceptor) .readTimeout(60, TimeUnit.SECONDS) .cache(new Cache(dir, OK_HTTP_CACHE_SIZE)); if(ConfigUtils.isBetaFlavour()){ builder.sslSocketFactory(SslUtils.INSTANCE.getSslContextForCertificateFile(context, "*.wikimedia.beta.wmflabs.org.cer").getSocketFactory()); } return builder.build(); }
Source:
public static AttributeValue createValue(String value) { if (value == null) throw new IllegalArgumentException(); return new AttributeValue(value, value); }

Target:
public static AttributeValue createValue(String value) { if (value == null) throw new IllegalArgumentException( JGitText.get().attributeValueCantBeNull); return new AttributeValue(value, value); }
Source:
String generateComponent(){ return mPackage + "/" + mComponent; }

Target:
String generateComponent() { return pkg + "/" + component; }
Source:
protected void insert(Record record) throws NoGuidForIdException, NullCursorException, ParentNotFoundException { HistoryRecord toStore = (HistoryRecord) prepareRecord(record); enqueueNewRecord(toStore); }

Target:
protected void insert(Record record) throws NoGuidForIdException, NullCursorException, ParentNotFoundException { enqueueNewRecord((HistoryRecord) prepareRecord(record)); }
Source:
public Map<String, PartitionStatistics> getPartitionStatistics(String databaseName, String tableName, Set<String> partitionNames) { Table table = getTable(databaseName, tableName) .orElseThrow(() -> new TableNotFoundException(new SchemaTableName(databaseName, tableName))); List<String> dataColumns = table.getSd().getCols().stream() .map(FieldSchema::getName) .collect(toImmutableList()); List<String> partitionColumns = table.getPartitionKeys().stream() .map(FieldSchema::getName) .collect(toImmutableList()); Map<String, HiveBasicStatistics> partitionBasicStatistics = getPartitionsByNames(databaseName, tableName, ImmutableList.copyOf(partitionNames)) .stream() .collect(toImmutableMap(partition -> makePartName(partitionColumns, partition.getValues()), partition -> getHiveBasicStatistics(partition.getParameters()))); Map<String, Map<String, HiveColumnStatistics>> partitionColumnStatistics = getPartitionColumnStatistics(databaseName, tableName, partitionNames, dataColumns); ImmutableMap.Builder<String, PartitionStatistics> result = ImmutableMap.builder(); for (String partitionName : partitionNames) { HiveBasicStatistics basicStatistics = partitionBasicStatistics.get(partitionName); if (basicStatistics == null) { basicStatistics = createEmptyStatistics(); } Map<String, HiveColumnStatistics> columnStatistics = partitionColumnStatistics.get(partitionName); if (columnStatistics == null) { columnStatistics = ImmutableMap.of(); } result.put(partitionName, new PartitionStatistics(basicStatistics, columnStatistics)); } return result.build(); }

Target:
public Map<String, PartitionStatistics> getPartitionStatistics(String databaseName, String tableName, Set<String> partitionNames) { Table table = getTable(databaseName, tableName) .orElseThrow(() -> new TableNotFoundException(new SchemaTableName(databaseName, tableName))); List<String> dataColumns = table.getSd().getCols().stream() .map(FieldSchema::getName) .collect(toImmutableList()); List<String> partitionColumns = table.getPartitionKeys().stream() .map(FieldSchema::getName) .collect(toImmutableList()); Map<String, HiveBasicStatistics> partitionBasicStatistics = getPartitionsByNames(databaseName, tableName, ImmutableList.copyOf(partitionNames)).stream() .collect(toImmutableMap( partition -> makePartName(partitionColumns, partition.getValues()), partition -> getHiveBasicStatistics(partition.getParameters()))); Map<String, Map<String, HiveColumnStatistics>> partitionColumnStatistics = getPartitionColumnStatistics(databaseName, tableName, partitionNames, dataColumns); ImmutableMap.Builder<String, PartitionStatistics> result = ImmutableMap.builder(); for (String partitionName : partitionNames) { HiveBasicStatistics basicStatistics = partitionBasicStatistics.getOrDefault(partitionName, createEmptyStatistics()); Map<String, HiveColumnStatistics> columnStatistics = partitionColumnStatistics.getOrDefault(partitionName, ImmutableMap.of()); result.put(partitionName, new PartitionStatistics(basicStatistics, columnStatistics)); } return result.build(); }
Source:
private void initializeMap() { WebSourceTileLayer tileSource = new WebSourceTileLayer( "openstreetmap", getString(R.string.map_tile_source_url), true ); mapView.setDiskCacheEnabled(true); mapView.setTileSource(tileSource); mapView.setZoom(getResources().getInteger(R.integer.map_default_zoom)); mapView.setUserLocationEnabled(true); mapView.setUserLocationTrackingMode(UserLocationOverlay.TrackingMode.FOLLOW_BEARING); mapView.getUserLocationOverlay().runOnFirstFix(new Runnable() { @Override public void run() { currentLocation = mapView.getUserLocationOverlay().getLastFix(); makeUseOfNewLocation(currentLocation); fetchNearbyPages(); } }); mapView.setMapViewListener(new DefaultMapViewListener() { @Override public void onTapMarker(MapView mapView, Marker marker) { highlightMarker(marker); int index = adapter.getPosition((NearbyPage) marker.getRelatedObject()); if (index == -1) { return; } nearbyList.setSelection(index); } }); mapView.addListener(new MapListener() { @Override public void onScroll(ScrollEvent scrollEvent) { fetchNearbyPages(); } @Override public void onZoom(ZoomEvent zoomEvent) { fetchNearbyPages(); } @Override public void onRotate(RotateEvent rotateEvent) { } }); }

Target:
private void initializeMap() { WebSourceTileLayer tileSource = new WebSourceTileLayer( "openstreetmap", getString(R.string.map_tile_source_url), true ); mapView.setBubbleEnabled(false); mapView.setDiskCacheEnabled(true); mapView.setTileSource(tileSource); mapView.setZoom(getResources().getInteger(R.integer.map_default_zoom)); mapView.setUserLocationTrackingMode(UserLocationOverlay.TrackingMode.FOLLOW_BEARING); mapView.getUserLocationOverlay().runOnFirstFix(new Runnable() { @Override public void run() { currentLocation = mapView.getUserLocationOverlay().getLastFix(); makeUseOfNewLocation(currentLocation); fetchNearbyPages(); } }); mapView.setMapViewListener(new DefaultMapViewListener() { @Override public void onTapMarker(MapView mapView, Marker marker) { highlightMarker(marker); int index = adapter.getPosition((NearbyPage) marker.getRelatedObject()); if (index == -1) { return; } nearbyList.setSelection(index); } }); mapView.addListener(new MapListener() { @Override public void onScroll(ScrollEvent scrollEvent) { fetchNearbyPages(); } @Override public void onZoom(ZoomEvent zoomEvent) { fetchNearbyPages(); } @Override public void onRotate(RotateEvent rotateEvent) { } }); }
Source:
private String getConsoleModelErrorMessage(Object sender, ErrorCodeEventArgs e) { String translatedError = consoleErrorCodeTranslator.translateErrorCode(e.getErrorCode()); if (sender instanceof SpiceConsoleModel) { return ConstantsManager.getInstance() .getMessages() .errConnectingVmUsingSpiceMsg(translatedError); } else if (sender instanceof RdpConsoleModel) { return ConstantsManager.getInstance() .getMessages() .errConnectingVmUsingRdpMsg(translatedError); } throw new IllegalArgumentException("Message recieved from an unknown model " + sender.getClass().getName()); }

Target:
private String getConsoleModelErrorMessage(Object sender, ErrorCodeEventArgs e) { String translatedError = consoleErrorCodeTranslator.translateErrorCode(e.getErrorCode()); if (sender instanceof SpiceConsoleModel) { return ConstantsManager.getInstance() .getMessages() .errConnectingVmUsingSpiceMsg(translatedError); } else if (sender instanceof RdpConsoleModel) { return ConstantsManager.getInstance() .getMessages() .errConnectingVmUsingRdpMsg(translatedError); } return translatedError; }
Source:
public void getAsCsvTest() throws Exception { System.out.println(ENDPOINT); getAsDelimitedTest(ENDPOINT + CSV, HttpConstants.MIME_TYPE_CSV, CSV, PROFILE, POSTABLE); }

Target:
public void getAsCsvTest() throws Exception { getAsDelimitedTest(ENDPOINT + CSV, HttpConstants.MIME_TYPE_CSV, CSV, PROFILE, POSTABLE); }
Source:
public boolean isMaskValid(String netmask) { if (!isMaskFormatValid(netmask)) { return false; } if (netmask.matches(ValidationUtils.SUBNET_PATTERN_AS_NETMASK_WITH_SLASH)) { return true; } return isMaskValidPrefixFree(netmask); }

Target:
public boolean isMaskValid(String netmask) { if (netmask.matches(ValidationUtils.SUBNET_PATTERN_AS_NETMASK_WITH_OPTIONAL_PREFIX_SLASH)) { return true; } return isNetmaskValid(netmask); }
Source:
protected void syncFromImpl(OpenshiftRequestContext context, RolesBuilder builder) { String kibIndexName = formatKibanaIndexName(context, kibanaIndexMode); String kibRoleName = formatKibanaRoleName(context); RoleBuilder kibRole = new RoleBuilder(kibRoleName) .setClusterActions(KIBANA_ROLE_CLUSTER_ACTIONS) .setActions(kibIndexName, ALL, KIBANA_ROLE_INDEX_ACTIONS) .setActions(ALL, ALL, KIBANA_ROLE_ALL_INDEX_ACTIONS) .expires(expire); builder.addRole(kibRole.build()); if (context.isOperationsUser()) { RoleBuilder opsRole = new RoleBuilder(SearchGuardRolesMapping.ADMIN_ROLE) .setClusters(OPERATIONS_ROLE_CLUSTER_ACTIONS) .setActions("?operations?", ALL, OPERATIONS_ROLE_OPERATIONS_ACTIONS) .setActions(ALL, ALL, OPERATIONS_ROLE_ANY_ACTIONS) .expires(expire); builder.addRole(opsRole.build()); return; } String roleName = formatUserRoleName(context.getUser()); RoleBuilder role = new RoleBuilder(roleName) .setClusters(USER_ROLE_CLUSTER_ACTIONS) .expires(expire); for (String project : context.getProjects()) { String indexName = String.format("%s?*", project.replace('.', '?')); role.setActions(indexName, ALL, PROJECT_ROLE_ACTIONS); if (StringUtils.isNotEmpty(cdmProjectPrefix)) { indexName = String.format("%s?%s?*", cdmProjectPrefix.replace('.', '?'), project.replace('.', '?')); role.setActions(indexName, ALL, PROJECT_ROLE_ACTIONS); } } builder.addRole(role.build()); }

Target:
protected void syncFromImpl(OpenshiftRequestContext context, RolesBuilder builder) { String kibIndexName = formatKibanaIndexName(context, kibanaIndexMode); String kibRoleName = formatKibanaRoleName(context); RoleBuilder kibRole = new RoleBuilder(kibRoleName) .setClusterActions(KIBANA_ROLE_CLUSTER_ACTIONS) .setActions(kibIndexName, ALL, KIBANA_ROLE_INDEX_ACTIONS) .expires(expire); builder.addRole(kibRole.build()); if (context.isOperationsUser()) { RoleBuilder opsRole = new RoleBuilder(SearchGuardRolesMapping.ADMIN_ROLE) .setClusters(OPERATIONS_ROLE_CLUSTER_ACTIONS) .setActions(ALL, ALL, OPERATIONS_ROLE_ANY_ACTIONS) .expires(expire); builder.addRole(opsRole.build()); return; } String roleName = formatUserRoleName(context.getUser()); RoleBuilder role = new RoleBuilder(roleName) .setClusters(USER_ROLE_CLUSTER_ACTIONS) .expires(expire); for (String project : context.getProjects()) { String indexName = String.format("%s?*", project.replace('.', '?')); role.setActions(indexName, ALL, PROJECT_ROLE_ACTIONS); if (StringUtils.isNotEmpty(cdmProjectPrefix)) { indexName = String.format("%s?%s?*", cdmProjectPrefix.replace('.', '?'), project.replace('.', '?')); role.setActions(indexName, ALL, PROJECT_ROLE_ACTIONS); } } builder.addRole(role.build()); }
Source:
public AetherModuleResolver(File localRepository, Map<String, String> remoteRepositories) { if (log.isDebugEnabled()) { log.debug("Local repository: " + localRepository); log.debug("Remote repository: " + remoteRepositories); } if (!localRepository.exists()) { Assert.isTrue(localRepository.mkdirs(), "Unable to create directory for local repository: " + localRepository); } this.localRepository = localRepository; this.remoteRepositories = new LinkedList<>(); if (!CollectionUtils.isEmpty(remoteRepositories)) { for (Map.Entry<String, String> remoteRepo : remoteRepositories.entrySet()) { RemoteRepository remoteRepository = new RemoteRepository.Builder(remoteRepo.getKey(), DEFAULT_CONTENT_TYPE, remoteRepo.getValue()).build(); this.remoteRepositories.add(remoteRepository); } } repositorySystem = newRepositorySystem(); }

Target:
public AetherModuleResolver(File localRepository, Map<String, String> remoteRepositories) { Assert.notNull(localRepository, "Local repository path cannot be null"); if (log.isDebugEnabled()) { log.debug("Local repository: " + localRepository); if (!CollectionUtils.isEmpty(remoteRepositories)) { log.debug("Remote repositories: " + StringUtils.collectionToCommaDelimitedString(remoteRepositories.values())); } } if (!localRepository.exists()) { Assert.isTrue(localRepository.mkdirs(), "Unable to create directory for local repository: " + localRepository); } this.localRepository = localRepository; this.remoteRepositories = new LinkedList<>(); if (!CollectionUtils.isEmpty(remoteRepositories)) { for (Map.Entry<String, String> remoteRepo : remoteRepositories.entrySet()) { RemoteRepository remoteRepository = new RemoteRepository.Builder(remoteRepo.getKey(), DEFAULT_CONTENT_TYPE, remoteRepo.getValue()).build(); this.remoteRepositories.add(remoteRepository); } } repositorySystem = newRepositorySystem(); }
Source:
public Path generateArtifact(PypiWheelArtifactCoordinates coordinates) throws IOException { String packagePath = String.format("%s-%s-py2-none-any.whl", coordinates.getId(), coordinates.getVersion()); Path fullPath = basedir.resolve(packagePath); ZipOutputStream zos = new ZipOutputStream(new FileOutputStream(fullPath.toString())); createPackageFiles(zos, coordinates.getId(), coordinates.getVersion()); zos.close(); return fullPath; }

Target:
public Path generateArtifact(PypiWheelArtifactCoordinates coordinates) throws IOException { String packagePath = coordinates.toPath(); Path fullPath = basedir.resolve(packagePath); try(ZipOutputStream zos = new ZipOutputStream(Files.newOutputStream(fullPath))) { createPackageFiles(zos, coordinates.getId(), coordinates.getVersion()); } return fullPath; }
Source:
public int[][] getDrops(Item item) { if (this.meta >= 0x03) { return new int[][]{ {Item.NETHER_WART, 0, 2+(int)(Math.random()*((4-2)+1))} }; } else { return new int[][]{ {Item.NETHER_WART, 0, 1} }; } }

Target:
public int[][] getDrops(Item item) { if (this.meta == 0x03) { return new int[][]{ {Item.NETHER_WART, 0, 2+(int)(Math.random()*((4-2)+1))} }; } else { return new int[][]{ {Item.NETHER_WART, 0, 1} }; } }
Source:
public void fixedSwapLeg() { PeriodicSchedule accrualSchedule = PeriodicSchedule.builder() .startDate(LocalDate.of(2014, 2, 12)) .endDate(LocalDate.of(2016, 7, 31)) .businessDayAdjustment(BusinessDayAdjustment.of(MODIFIED_FOLLOWING, HolidayCalendars.GBLO)) .frequency(Frequency.P3M) .stubConvention(StubConvention.LONG_INITIAL) .rollConvention(RollConventions.EOM) .build(); PaymentSchedule paymentSchedule = PaymentSchedule.builder() .paymentFrequency(Frequency.P6M) .paymentRelativeTo(PaymentRelativeTo.PERIOD_END) .paymentOffset(DaysAdjustment.ofBusinessDays(2, HolidayCalendars.GBLO)) .compoundingMethod(CompoundingMethod.STRAIGHT) .build(); NotionalSchedule notionalSchedule = NotionalSchedule.builder() .currency(Currency.GBP) .amount(ValueSchedule.of( 1_000_000, ValueStep.ofAbsoluteAmount(LocalDate.of(2015, 1, 31), 2_000_000))) .build(); RateCalculationSwapLeg swapLeg = RateCalculationSwapLeg.builder() .payReceive(PayReceive.PAY) .accrualSchedule(accrualSchedule) .paymentSchedule(paymentSchedule) .notionalSchedule(notionalSchedule) .calculation(FixedRateCalculation.builder() .dayCount(DayCounts.ACT_ACT_ISDA) .rate(ValueSchedule.of( 0.008, ValueStep.ofAbsoluteAmount(LocalDate.of(2015, 1, 31), 0.007))) .build()) .build(); ExpandedSwapLeg expandedLeg = swapLeg.expand(); System.out.println("===== Fixed ====="); System.out.println(JodaBeanSer.PRETTY.jsonWriter().write(swapLeg)); System.out.println(); System.out.println("===== Fixed expanded ====="); System.out.println(JodaBeanSer.PRETTY.jsonWriter().write(expandedLeg)); System.out.println(); }

Target:
public void fixedSwapLeg() { PeriodicSchedule accrualSchedule = PeriodicSchedule.builder() .startDate(LocalDate.of(2014, 2, 12)) .endDate(LocalDate.of(2016, 7, 31)) .businessDayAdjustment(BusinessDayAdjustment.of(MODIFIED_FOLLOWING, HolidayCalendars.GBLO)) .frequency(Frequency.P3M) .stubConvention(StubConvention.LONG_INITIAL) .rollConvention(RollConventions.EOM) .build(); PaymentSchedule paymentSchedule = PaymentSchedule.builder() .paymentFrequency(Frequency.P6M) .paymentRelativeTo(PaymentRelativeTo.PERIOD_END) .paymentOffset(DaysAdjustment.ofBusinessDays(2, HolidayCalendars.GBLO)) .compoundingMethod(CompoundingMethod.STRAIGHT) .build(); NotionalSchedule notionalSchedule = NotionalSchedule.of(Currency.GBP, 1_000_000); RateCalculationSwapLeg swapLeg = RateCalculationSwapLeg.builder() .payReceive(PayReceive.PAY) .accrualSchedule(accrualSchedule) .paymentSchedule(paymentSchedule) .notionalSchedule(notionalSchedule) .calculation(FixedRateCalculation.builder() .dayCount(DayCounts.ACT_ACT_ISDA) .rate(ValueSchedule.of( 0.008, ValueStep.ofAbsoluteAmount(LocalDate.of(2015, 1, 31), 0.007))) .build()) .build(); ExpandedSwapLeg expandedLeg = swapLeg.expand(); System.out.println("===== Fixed ====="); System.out.println(JodaBeanSer.PRETTY.jsonWriter().write(swapLeg)); System.out.println(); System.out.println("===== Fixed expanded ====="); System.out.println(JodaBeanSer.PRETTY.jsonWriter().write(expandedLeg)); System.out.println(); }
Source:
public void flushVariants(IResource resource, int depth) throws TeamException { if (!gsdData.getData(resource.getProject()).shouldIncludeLocal()) { store.flushBytes(resource, depth); } }

Target:
public void flushVariants(IResource resource, int depth) throws TeamException { if (!gsdData.getData(resource.getProject()).shouldIncludeLocal()) store.flushBytes(resource, depth); }
Source:
private String extractEtagFromResults( final byte[] cachedResult ) { if (cachedResult == null) { return null; } log.info("Fetching result level cache identifier for query: %s", query.getId()); int etagLength = ByteBuffer.wrap(cachedResult, 0, Integer.BYTES).getInt(); return StringUtils.fromUtf8(Arrays.copyOfRange(cachedResult, Integer.BYTES, etagLength + Integer.BYTES)); }

Target:
private String extractEtagFromResults( final byte[] cachedResult ) { if (cachedResult == null) { return null; } log.debug("Fetching result level cache identifier for query: %s", query.getId()); int etagLength = ByteBuffer.wrap(cachedResult, 0, Integer.BYTES).getInt(); return StringUtils.fromUtf8(Arrays.copyOfRange(cachedResult, Integer.BYTES, etagLength + Integer.BYTES)); }
Source:
public void fireAllEvents() { if (eventThreadLocal != null) { while (!eventThreadLocal.get().isEmpty()) { CacheEventWrapper cacheEventWrapper = eventThreadLocal.get().get(0); dispatchEvent(cacheEventWrapper); eventThreadLocal.get().remove(0); } } }

Target:
public void fireAllEvents() { EventThreadLocal currentThreadLocal = eventThreadLocal; while (!currentThreadLocal.get().isEmpty()) { CacheEventWrapper cacheEventWrapper = currentThreadLocal.get().get(0); dispatchEvent(cacheEventWrapper, currentThreadLocal); currentThreadLocal.get().remove(0); } }
Source:
public void testRejectUnknownType() { ThriftSessionProperties sessionProperties = new ThriftSessionProperties(() -> ImmutableMap.of( "test_session_prop", new PropertyMetadata<>("unsupported_typed_prop", "custom types are not supported", VARCHAR, TestingClass.class, null, false, value -> new TestingClass((String) value), object -> object == null ? null : object.getValue()))); }

Target:
public void testRejectUnknownType() { ThriftSessionProperties sessionProperties = new ThriftSessionProperties(() -> ImmutableMap.of( "test_session_prop", new PropertyMetadata<>( "unsupported_typed_prop", "complex types are not supported", BIGINT, AtomicLong.class, null, false, value -> new AtomicLong(((Number) value).intValue()), object -> object == null ? null : object.toString()))); }
Source:
private HttpServerFake startHttpServerFake(String statusLine) throws Exception { int port = new Random().nextInt(9 * 1024) + 1024; HttpServerFake serverFake; if (statusLine == null) { serverFake = new HttpServerFake(port); } else { serverFake = new HttpServerFake(port, null, statusLine); } serverFake.start(); return serverFake; }

Target:
private HttpServerFake startHttpServerFake(String statusLine) throws Exception { int port = new Random().nextInt(9 * 1024) + 1024; HttpServerFake serverFake = null; if (statusLine == null) { serverFake = new HttpServerFake(port); } else { serverFake = new HttpServerFake(port, null, statusLine); } serverFake.start(); return serverFake; }
Source:
public Set<WorkflowVersion> requestDOIForWorkflowVersion(@ApiParam(hidden = true) @Auth User user, @ApiParam(value = "Workflow to modify.", required = true) @PathParam("workflowId") Long workflowId, @ApiParam(value = "workflowVersionId", required = true) @PathParam("workflowVersionId") Long workflowVersionId) { Workflow workflow = workflowDAO.findById(workflowId); checkEntry(workflow); checkUser(user, workflow); WorkflowVersion workflowVersion = workflowVersionDAO.findById(workflowVersionId); if (workflowVersion == null) { LOG.error(user.getUsername() + ": could not find version: " + workflow.getPath()); throw new CustomWebApplicationException("Version not found.", HttpStatus.SC_INTERNAL_SERVER_ERROR); } List<Token> tokens = checkOnZenodoToken(user); Token zenodoToken = Token.extractToken(tokens, TokenType.ZENODO_ORG); if (zenodoToken == null) { LOG.error("Could not get Zenodo token for user " + user.getUsername()); throw new CustomWebApplicationException("Could not get Zenodo token for user " + user.getUsername(), HttpStatus.SC_INTERNAL_SERVER_ERROR); } final String zenodoAccessToken = zenodoToken.getContent(); registerZenodoDOIForWorkflow(zenodoAccessToken, workflow, workflowVersion); Workflow result = workflowDAO.findById(workflowId); checkEntry(result); elasticManager.handleIndexUpdate(result, ElasticMode.UPDATE); return result.getWorkflowVersions(); }

Target:
public Set<WorkflowVersion> requestDOIForWorkflowVersion(@ApiParam(hidden = true) @Auth User user, @ApiParam(value = "Workflow to modify.", required = true) @PathParam("workflowId") Long workflowId, @ApiParam(value = "workflowVersionId", required = true) @PathParam("workflowVersionId") Long workflowVersionId) { Workflow workflow = workflowDAO.findById(workflowId); checkEntry(workflow); checkUser(user, workflow); WorkflowVersion workflowVersion = workflowVersionDAO.findById(workflowVersionId); if (workflowVersion == null) { LOG.error(user.getUsername() + ": could not find version: " + workflow.getPath()); throw new CustomWebApplicationException("Version not found.", HttpStatus.SC_BAD_REQUEST); } List<Token> tokens = checkOnZenodoToken(user); Token zenodoToken = Token.extractToken(tokens, TokenType.ZENODO_ORG); if (zenodoToken == null) { LOG.error("Could not get Zenodo token for user " + user.getUsername()); throw new CustomWebApplicationException("Could not get Zenodo token for user " + user.getUsername(), HttpStatus.SC_BAD_REQUEST); } final String zenodoAccessToken = zenodoToken.getContent(); registerZenodoDOIForWorkflow(zenodoAccessToken, workflow, workflowVersion); Workflow result = workflowDAO.findById(workflowId); checkEntry(result); elasticManager.handleIndexUpdate(result, ElasticMode.UPDATE); return result.getWorkflowVersions(); }
Source:
public static TDigest deserialize(Slice serialized) { SliceInput input = new BasicSliceInput(serialized); byte format = input.readByte(); checkArgument(format == FORMAT_TAG, "Invalid format"); double min = input.readDouble(); double max = input.readDouble(); double compression = input.readDouble(); double totalWeight = input.readDouble(); int centroidCount = input.readInt(); double[] means = new double[centroidCount]; for (int i = 0; i < centroidCount; i++) { means[i] = input.readDouble(); } double[] weights = new double[centroidCount]; for (int i = 0; i < centroidCount; i++) { weights[i] = input.readDouble(); } return new TDigest( compression, min, max, totalWeight, centroidCount, means, weights, false, false); }

Target:
public static TDigest deserialize(Slice serialized) { SliceInput input = serialized.getInput(); byte format = input.readByte(); checkArgument(format == FORMAT_TAG, "Invalid format"); double min = input.readDouble(); double max = input.readDouble(); double compression = input.readDouble(); double totalWeight = input.readDouble(); int centroidCount = input.readInt(); double[] means = new double[centroidCount]; for (int i = 0; i < centroidCount; i++) { means[i] = input.readDouble(); } double[] weights = new double[centroidCount]; for (int i = 0; i < centroidCount; i++) { weights[i] = input.readDouble(); } return new TDigest( compression, min, max, totalWeight, centroidCount, means, weights, false, false); }
Source:
public void close() throws IOException { connected = false; connection.disconnect(); }

Target:
public void close() throws IOException { connected = false; if (connection != null) { connection.disconnect(); } }
Source:
private void showPushToApplicationSettings() { PushToApplicationsManager manager = frame.getPushToApplicationsManager(); PushToApplication selectedApplication = manager.getApplicationByName(pushToApplicationComboBox.getValue().getApplicationName()); PushToApplicationSettings settings = manager.getSettings(selectedApplication); DialogPane dialogPane = new DialogPane(); dialogPane.setContent(settings.getJFXSettingPane(pushToApplicationComboBox.getValue().getApplicationName())); dialogService.showCustomDialogAndWait(Localization.lang("App settings"), dialogPane, ButtonType.OK, ButtonType.CANCEL).ifPresent(btn -> { if (btn == ButtonType.OK) { settings.storeSettings(); } }); }

Target:
private void showPushToApplicationSettings() { PushToApplicationsManager manager = frame.getPushToApplicationsManager(); PushToApplication selectedApplication = pushToApplicationComboBox.getValue(); PushToApplicationSettings settings = manager.getSettings(selectedApplication); DialogPane dialogPane = new DialogPane(); dialogPane.setContent(settings.getSettingsPane()); dialogService.showCustomDialogAndWait(Localization.lang("Application settings"), dialogPane, ButtonType.OK, ButtonType.CANCEL).ifPresent(btn -> { if (btn == ButtonType.OK) { settings.storeSettings(); } }); }