auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
private String reduceTopicPartitionStatsResponses(Map<String, String> responses) { Map<String, Map<String, Set<Integer>>> result = new HashMap<>(); responses.forEach((instance, json) -> { List<KafkaTopicPartitionStatsResponse> responseList; try { responseList = KafkaTopicPartitionStatsResponse.fromJson(json); } catch (Exception e) { _logger.error("Invalid response from instance {}", json, instance); return; } if (responseList.size() >= 0) { responseList.forEach(response -> { if (response.getTopicPartitions() == null || response.getConsumerGroupId().isEmpty()) { _logger.warn("Empty topic partition stats map from instance {}. Ignoring the result", instance); return; } result.putIfAbsent(response.getConsumerGroupId(), new HashMap<>()); Set<TopicPartition> topicPartitions = response.getTopicPartitions(); topicPartitions.forEach(topicPartition -> { Map<String, Set<Integer>> topicPartitionsMap = result.get(response.getConsumerGroupId()); topicPartitionsMap.putIfAbsent(topicPartition.topic(), new HashSet<>()); topicPartitionsMap.get(topicPartition.topic()).add(topicPartition.partition()); }); }); } }); return JsonUtils.toJson(result); }

Target:
private String reduceTopicPartitionStatsResponses(Map<String, String> responses) { Map<String, KafkaTopicPartitionStatsResponse> result = new HashMap<>(); responses.forEach((instance, json) -> { List<KafkaTopicPartitionStatsResponse> responseList; try { responseList = JsonUtils.fromJson(json, new TypeReference<List<KafkaTopicPartitionStatsResponse>>() { }); } catch (Exception e) { _logger.error("Invalid response from instance {}", json, instance); return; } responseList.forEach(response -> { if (response.getTopicPartitions() == null || StringUtils.isBlank(response.getConsumerGroupId()) || response.getDatastreams() == null) { _logger.warn("Empty topic partition stats map from instance {}. Ignoring the result", instance); return; } KafkaTopicPartitionStatsResponse reducedResponse = result.computeIfAbsent(response.getConsumerGroupId(), k -> new KafkaTopicPartitionStatsResponse(response.getConsumerGroupId())); reducedResponse.getDatastreams().addAll(response.getDatastreams()); Map<String, Set<Integer>> topicPartitions = response.getTopicPartitions(); topicPartitions.forEach((topic, partitions) -> { Map<String, Set<Integer>> reducedTopicPartitions = reducedResponse.getTopicPartitions(); Set<Integer> reducedPartitions = reducedTopicPartitions.computeIfAbsent(topic, k -> new HashSet<>()); reducedPartitions.addAll(partitions); }); }); }); return JsonUtils.toJson(result.values()); }
Source:
private void loadServer() { final String serverUrl = String.format("<LINK_0>", SERVER_PORT, DEPLOYMENT_NAME, InfiniteServlet.URL_PATTERN); try (CloseableHttpClient client = HttpClientBuilder.create().build()) { while (!Thread.currentThread().isInterrupted()) { Thread.sleep(100); HttpGet httpGet = new HttpGet(serverUrl); CloseableHttpResponse response = client.execute(httpGet); HttpEntity entity = response.getEntity(); LOGGER.debug(EntityUtils.toString(entity)); EntityUtils.consumeQuietly(entity); } } catch (IOException | InterruptedException e) { LOGGER.debug(e); } }

Target:
private void loadServer() { final String serverUrl = String.format("<LINK_0>", SERVER_PORT, DEPLOYMENT_NAME, TextResponseServlet.URL_PATTERN); try (CloseableHttpClient client = HttpClientBuilder.create().build()) { while (!Thread.currentThread().isInterrupted()) { Thread.sleep(100); HttpGet httpGet = new HttpGet(serverUrl); CloseableHttpResponse response = client.execute(httpGet); LOGGER.debug(response.getStatusLine().getStatusCode()); } } catch (IOException | InterruptedException e) { LOGGER.debug(e); } }
Source:
public boolean login() throws LoginException { if (super.login() == true) { log.debug("super.login()==true"); return true; } Object credential = getCredential(); if (credential instanceof RemotingConnectionCredential) { Connection con = ((RemotingConnectionCredential) credential).getConnection(); Principal up = null; UserInfo userInfo = con.getUserInfo(); if (userInfo instanceof SubjectUserInfo) { for (Principal current : ((SubjectUserInfo) userInfo).getPrincipals()) { if (current instanceof RealmUser) { up = current; break; } } } if (up == null) { for (Principal current : con.getPrincipals()) { if (current instanceof UserPrincipal) { up = current; break; } } } if (up != null) { identity = up; if (getUseFirstPass()) { String userName = identity.getName(); log.debugf("Storing username '%s'", userName); sharedState.put("javax.security.auth.login.name", identity); if (useClientCert) { SSLSession session = con.getSslSession(); if (session != null) { try { credential = session.getPeerCertificates()[0]; log.debug("Using certificate as credential."); } catch (SSLPeerUnverifiedException e) { log.debugf("No peer certificate available for '%s'", userName); } } } sharedState.put("javax.security.auth.login.password", credential); } loginOk = true; return true; } } return false; }

Target:
public boolean login() throws LoginException { if (super.login() == true) { log.debug("super.login()==true"); return true; } Object credential = getCredential(); if (credential instanceof RemotingConnectionCredential) { Connection con = ((RemotingConnectionCredential) credential).getConnection(); Principal up = null; UserInfo userInfo = con.getUserInfo(); if (userInfo instanceof SubjectUserInfo) { for (Principal current : ((SubjectUserInfo) userInfo).getPrincipals()) { if (current instanceof RealmUser) { up = current; break; } } } if (up == null) { for (Principal current : con.getPrincipals()) { if (current instanceof UserPrincipal) { up = current; break; } } } if (up != null) { identity = up; if (getUseFirstPass()) { String userName = identity.getName(); log.debugf("Storing username '%s'", userName); sharedState.put("javax.security.auth.login.name", identity); if (useNewClientCert) { SSLSession session = con.getSslSession(); if (session != null) { try { credential = session.getPeerCertificates()[0]; log.debug("Using new certificate as credential."); } catch (SSLPeerUnverifiedException e) { log.debugf("No peer certificate available for '%s'", userName); } } } else if (useClientCert) { SSLSession session = con.getSslSession(); if (session != null) { try { credential = session.getPeerCertificateChain()[0]; log.debug("Using certificate as credential."); } catch (SSLPeerUnverifiedException e) { log.debugf("No peer certificate available for '%s'", userName); } } } sharedState.put("javax.security.auth.login.password", credential); } loginOk = true; return true; } } return false; }
Source:
public boolean equals(Object o) { Pair<?> pair = (Pair<?>) o; return pair.a == a && pair.b == b || pair.a == b && pair.b == a; }

Target:
public boolean equals(Object o) { Pair<?> pair = (Pair<?>) o; return (pair.a == a && pair.b == b) || (pair.a == b && pair.b == a); }
Source:
private void updateMaterial(Material material) { try { if (!materialUpdateService.updateMaterial(material)) { retryQueue.add(material); } } catch (Exception e) { retryQueue.add(material); } }

Target:
private void updateMaterial(Material material) { if(skipUpdate) return; try { if (!materialUpdateService.updateMaterial(material)) { retryQueue.add(material); } } catch (Exception e) { HealthStateScope scope = HealthStateScope.forMaterialUpdate(material); serverHealthService.update(error(format("Error updating Dependency Material %s", material.getUriForDisplay()), e.getMessage(), general(scope))); retryQueue.add(material); } }
Source:
public void findAll() throws Exception { ServiceProvider provider = new ServiceProvider(new ID("id1"), "name", "desc"); final List<ServiceProvider> providers = Lists.newArrayList(provider); context.checking(new Expectations() {{ oneOf(repository).findAll(); will(returnValue(providers)); }}); Reply<?> reply = service.findAll(); ServiceProviderDTO dto = new ServiceProviderDTO(provider.id, provider.name, provider.description); List<ServiceProviderDTO> dtos = Lists.newArrayList(dto); assertThat(reply, containsValue(dtos)); assertThat(reply, isOk()); }

Target:
public void findAll() throws Exception { ServiceProvider provider = new ServiceProvider(new ID("id1"), "name", "desc"); ServiceProviderDTO dto = new ServiceProviderDTO(provider.id, provider.name, provider.description); List<ServiceProviderDTO> dtos = Lists.newArrayList(dto); final List<ServiceProvider> providers = Lists.newArrayList(provider); context.checking(new Expectations() {{ oneOf(repository).findAll(); will(returnValue(providers)); }}); Reply<?> reply = service.findAll(); assertThat(reply, containsValue(dtos)); assertThat(reply, isOk()); }
Source:
public void close() throws IOException { if (httpClient != null) { httpClient.close(); } }

Target:
public void close() throws IOException { httpClient.close(); }
Source:
public boolean equals(Object obj) { if (obj == this) { return true; } if (obj instanceof WindowSpec) { WindowSpec another = (WindowSpec) obj; return TUtil.checkEquals(windowName, another.windowName) && TUtil.checkEquals(partitionKeys, another.partitionKeys) && TUtil.checkEquals(sortSpecs, another.sortSpecs); } else { return false; } }

Target:
public boolean equals(Object obj) { if (obj == this) { return true; } if (obj instanceof WindowSpec) { WindowSpec another = (WindowSpec) obj; return TUtil.checkEquals(windowName, another.windowName) && TUtil.checkEquals(partitionKeys, another.partitionKeys) && TUtil.checkEquals(sortSpecs, another.sortSpecs) && TUtil.checkEquals(windowFrame, another.windowFrame); } else { return false; } }
Source:
public void addForcibly(DelayedEntry delayedEntry) { }

Target:
public void addForcibly(DelayedEntry delayedEntry) { throw new IllegalStateException("No addForcibly call is expected from a write-through store!"); }
Source:
void buildLock() { String studySubjectLabel = studySubject.getLabel(); html.table(0).border("0").cellpadding("0").cellspacing("0").close(); html.tr(0).valign("top").close().td(0).close(); html.div().id("Lock_" + studySubjectLabel + "_" + crf.getId() + "_" + rowCount) .style("position: absolute; visibility: hidden; z-index: 3; width: 50px; height: 30px; top: 0px;").close(); if ((eventCrfBean.getRemoved()!=null && eventCrfBean.getRemoved()) || (eventCrfBean.getArchived()!=null && eventCrfBean.getArchived())) { lockLinkBuilder(html, studySubjectLabel, rowCount, crf, "images/CRF_status_icon_Invalid_collapse.gif", "images/CRF_status_icon_Invalid.gif"); } else if (eventCrfBean.getWorkflowStatus() == EventCrfWorkflowStatusEnum.COMPLETED) { lockLinkBuilder(html, studySubjectLabel, rowCount, crf, "images/CRF_status_icon_Complete_collapse.gif", "images/CRF_status_icon_Complete.gif"); } else if (eventCrfBean.getWorkflowStatus() == EventCrfWorkflowStatusEnum.NOT_STARTED) { lockLinkBuilder(html, studySubjectLabel, rowCount, crf, "images/CRF_status_icon_Scheduled.gif", "images/CRF_status_icon_Scheduled.gif"); } else if (eventCrfBean.getWorkflowStatus() == EventCrfWorkflowStatusEnum.INITIAL_DATA_ENTRY) { lockLinkBuilder(html, studySubjectLabel, rowCount, crf, "images/CRF_status_icon_Started.gif", "images/CRF_status_icon_Started.gif"); } html.divEnd(); }

Target:
void buildLock() { String studySubjectLabel = studySubject.getLabel(); html.table(0).border("0").cellpadding("0").cellspacing("0").close(); html.tr(0).valign("top").close().td(0).close(); html.div().id("Lock_" + studySubjectLabel + "_" + crf.getId() + "_" + rowCount) .style("position: absolute; visibility: hidden; z-index: 3; width: 50px; height: 30px; top: 0px;").close(); if (BooleanUtils.isTrue(eventCrfBean.getRemoved()) || BooleanUtils.isTrue(eventCrfBean.getArchived())) { lockLinkBuilder(html, studySubjectLabel, rowCount, crf, "images/CRF_status_icon_Invalid_collapse.gif", "images/CRF_status_icon_Invalid.gif"); } else if (eventCrfBean.getWorkflowStatus() == EventCrfWorkflowStatusEnum.COMPLETED) { lockLinkBuilder(html, studySubjectLabel, rowCount, crf, "images/CRF_status_icon_Complete_collapse.gif", "images/CRF_status_icon_Complete.gif"); } else if (eventCrfBean.getWorkflowStatus() == EventCrfWorkflowStatusEnum.NOT_STARTED) { lockLinkBuilder(html, studySubjectLabel, rowCount, crf, "images/CRF_status_icon_Scheduled.gif", "images/CRF_status_icon_Scheduled.gif"); } else if (eventCrfBean.getWorkflowStatus() == EventCrfWorkflowStatusEnum.INITIAL_DATA_ENTRY) { lockLinkBuilder(html, studySubjectLabel, rowCount, crf, "images/CRF_status_icon_Started.gif", "images/CRF_status_icon_Started.gif"); } html.divEnd(); }
Source:
public Vector3 getCurrentTangent() { Vector3 start_portion = mControlPoint.clone().subtract(mPoint1).multiply(1-mCurrent); Vector3 end_portion = mPoint2.clone().subtract(mControlPoint).multiply(mCurrent); Vector3 result = start_portion.clone().add(end_portion); result.normalize(); return result; }

Target:
public Vector3 getCurrentTangent() { Vector3 startPortion = new Vector3(mStartTangent).multiply(1-mCurrent); Vector3 endPortion = new Vector3(mEndTangent).multiply(mCurrent); return startPortion.add(endPortion); }
Source:
public void search() { OrmUtils.withinSession( sessionFactory, session -> { FullTextSession ftSession = Search.getFullTextSession( session ); FullTextQuery<ParentIndexedEntity> query = ftSession.search( Arrays.asList( IndexedEntity.class, YetAnotherIndexedEntity.class ) ) .query() .asEntity() .predicate( f -> f.matchAll().toPredicate() ) .build(); query.setFirstResult( 3 ); query.setMaxResults( 2 ); backendMock.expectSearchObjects( Arrays.asList( IndexedEntity.INDEX, YetAnotherIndexedEntity.INDEX ), b -> b .firstResultIndex( 3L ) .maxResultsCount( 2L ), StubSearchWorkBehavior.of( 6L, reference( IndexedEntity.INDEX, "0" ), reference( YetAnotherIndexedEntity.INDEX, "1" ) ) ); List<ParentIndexedEntity> result = query.list(); backendMock.verifyExpectationsMet(); Assertions.assertThat( result ) .containsExactly( session.get( IndexedEntity.class, 0 ), session.get( YetAnotherIndexedEntity.class, 1 ) ); backendMock.resetExpectations(); backendMock.expectSearchObjects( Arrays.asList( IndexedEntity.INDEX, YetAnotherIndexedEntity.INDEX ), b -> b .firstResultIndex( 3L ) .maxResultsCount( 2L ), StubSearchWorkBehavior.of( 6L ) ); long resultSize = query.getResultSize(); backendMock.verifyExpectationsMet(); Assertions.assertThat( resultSize ).isEqualTo( 6L ); } ); }

Target:
public void search() { OrmUtils.withinSession( sessionFactory, session -> { FullTextSession ftSession = Search.getFullTextSession( session ); FullTextQuery<ParentIndexedEntity> query = ftSession.search( Arrays.asList( IndexedEntity.class, YetAnotherIndexedEntity.class ) ) .query() .asEntity() .predicate( f -> f.matchAll().toPredicate() ) .build(); query.setFirstResult( 3 ); query.setMaxResults( 2 ); backendMock.expectSearchObjects( Arrays.asList( IndexedEntity.INDEX, YetAnotherIndexedEntity.INDEX ), b -> b .firstResultIndex( 3L ) .maxResultsCount( 2L ), StubSearchWorkBehavior.of( 6L, reference( IndexedEntity.INDEX, "0" ), reference( YetAnotherIndexedEntity.INDEX, "1" ) ) ); List<ParentIndexedEntity> result = query.list(); backendMock.verifyExpectationsMet(); Assertions.assertThat( result ) .containsExactly( session.get( IndexedEntity.class, 0 ), session.get( YetAnotherIndexedEntity.class, 1 ) ); backendMock.expectCount( Arrays.asList( IndexedEntity.INDEX, YetAnotherIndexedEntity.INDEX ), 6L ); long resultSize = query.getResultSize(); backendMock.verifyExpectationsMet(); Assertions.assertThat( resultSize ).isEqualTo( 6L ); } ); }
Source:
public Tuple exec(Tuple input) throws IOException { Tuple t = mTupleFactory.newTuple(2); try{ DataBag bg = (DataBag) input.get(0); Long cxl = null; if(bg.iterator().hasNext()) { Tuple tp = bg.iterator().next(); cxl = getFreq(tp); } if(cxl == null || cxl.longValue() < 0) { t.set(0, null); t.set(1, null); warn("Non-positive input frequency number: " + cxl, PigWarning.UDF_WARNING_1); } else { long cx = cxl.longValue(); double logcx = (cx > 0 ? Math.log(cx) : 0); double cxlogcx = cx * logcx; t.set(0, cxlogcx); t.set(1, cxl); } return t; } catch (NumberFormatException nfe) { warn("Caught invalid format input number, exception: " + nfe, PigWarning.UDF_WARNING_2); try { t.set(0, null); t.set(1, null); } catch(ExecException e) { throw e; } return t; } catch (ExecException ee) { throw ee; } catch(Exception e) { int errCode = 10080; String msg = "Error while computing entropy in " + this.getClass().getSimpleName(); throw new ExecException(msg, errCode, PigException.BUG, e); } }

Target:
public Tuple exec(Tuple input) throws IOException { Tuple t = mTupleFactory.newTuple(2); try{ DataBag bg = (DataBag) input.get(0); Long cxl = null; if(bg.iterator().hasNext()) { Tuple tp = bg.iterator().next(); cxl = ((Number)(tp.get(0))).longValue(); } if(cxl == null || cxl.longValue() < 0) { t.set(0, null); t.set(1, null); warn("Non-positive input frequency number: " + cxl, PigWarning.UDF_WARNING_1); } else { long cx = cxl.longValue(); double logcx = (cx > 0 ? Math.log(cx) : 0); double cxlogcx = cx * logcx; t.set(0, cxlogcx); t.set(1, cxl); } return t; } catch (ExecException ee) { throw ee; } catch(Exception e) { int errCode = 10080; String msg = "Error while computing entropy in " + this.getClass().getSimpleName(); throw new ExecException(msg, errCode, PigException.BUG, e); } }
Source:
private void computeUsedNames() { fUsedGetterNames= new ArrayList<>(0); fUsedSetterNames= new ArrayList<>(0); IVariableBinding binding= fFieldDeclaration.resolveBinding(); ITypeBinding type= binding.getType(); IMethodBinding[] methods= binding.getDeclaringClass().getDeclaredMethods(); for (int i= 0; i < methods.length; i++) { IMethodBinding method= methods[i]; ITypeBinding[] parameters= methods[i].getParameterTypes(); if (parameters == null || parameters.length == 0) { fUsedGetterNames.add(method); } else if (parameters.length == 1 && parameters[0] == type) { fUsedSetterNames.add(method); } } }

Target:
private void computeUsedNames() { fUsedReadNames= new ArrayList<>(0); fUsedModifyNames= new ArrayList<>(0); IVariableBinding binding= fFieldDeclaration.resolveBinding(); ITypeBinding type= binding.getType(); IMethodBinding[] methods= binding.getDeclaringClass().getDeclaredMethods(); for (int i= 0; i < methods.length; i++) { IMethodBinding method= methods[i]; ITypeBinding[] parameters= methods[i].getParameterTypes(); if (parameters == null || parameters.length == 0) { fUsedReadNames.add(method); } else if (parameters.length == 1 && parameters[0] == type) { fUsedModifyNames.add(method); } } }
Source:
public boolean bridge$allowsBlockBulkCapture() { return this.entityType.allowsBlockBulkCapture; }

Target:
public boolean bridge$allowsBlockBulkCapture() { return this.type.allowsBlockBulkCapture; }
Source:
protected void onSaveInstanceState(Bundle outState) { outState = mExpandableAdapter.onSaveInstanceState(outState); super.onSaveInstanceState(outState); }

Target:
protected void onSaveInstanceState(Bundle outState) { super.onSaveInstanceState(outState); outState = mExpandableAdapter.onSaveInstanceState(outState); }
Source:
void setDictionary(Dictionary dictionary) { dictionaryResults = new BitSet(dictionary.getMaxId()+1); for (int i = 0, end = dictionary.getMaxId()+1; i < end; i++) { dictionaryResults.set(i, update(dictionary, i)); } }

Target:
void setDictionary(Dictionary dictionary) { dictionaryResults = new BitSet(dictionary.getMaxId()+1); for (int i = 0; i <= dictionary.getMaxId(); i++) { dictionaryResults.set(i, evaluateFilterForDictionaryElement(dictionary, i)); } }
Source:
public void addOfficial(Official official) { if(official == null || this.officials.contains(official)) { return; } this.officials.add(official); }

Target:
public int addOfficial(Official official) { if(official == null || this.officials.contains(official)) { return -1; } if(this.officials.size() == tournament.OFFICIALS_PER_GAME) { return 0; } this.officials.add(official); return 1; }
Source:
public void purge(OrderType orderType, RequestContext context) throws ResponseException { throw new ResourceDoesNotSupportOperationException(); }

Target:
public void purge(OrderType orderType, RequestContext context) throws ResponseException { if (orderType == null) return; Context.getOrderService().purgeOrderType(orderType); }
Source:
public void regression() { PROVIDER.discountFactors(USD); double price = PRICER.price(FUTURE, PROVIDER); assertEquals(price, 1.022245377054993, TOL); }

Target:
public void regression() { double price = PRICER.price(FUTURE, PROVIDER); assertEquals(price, 1.022245377054993, TOL); }
Source:
public @Nullable CatchupServer resolveIfBackupEnabled( Config config ) { if ( config.get( OnlineBackupSettings.online_backup_enabled ) ) { return new CatchupServer( logProvider, userLogProvider, localDatabaseStoreIdSupplier, platformModule.dependencies.provideDependency( TransactionIdStore.class ), platformModule.dependencies.provideDependency( LogicalTransactionStore.class ), localDatabaseDataSourceSupplier, localDatabaseIsAvailable, coreSnapshotService, platformModule.monitors, new CheckpointerSupplier( platformModule.dependencies ), fileSystem, platformModule.pageCache, backupAddressForTxProtocol( config ), platformModule.storeCopyCheckPointMutex, serverPipelineWrapper ); } else { return null; } }

Target:
public Optional<CatchupServer> resolveIfBackupEnabled( Config config ) { if ( config.get( OnlineBackupSettings.online_backup_enabled ) ) { return Optional.of( new CatchupServer( logProvider, userLogProvider, localDatabaseStoreIdSupplier, platformModule.dependencies.provideDependency( TransactionIdStore.class ), platformModule.dependencies.provideDependency( LogicalTransactionStore.class ), localDatabaseDataSourceSupplier, localDatabaseIsAvailable, coreSnapshotService, platformModule.monitors, new CheckpointerSupplier( platformModule.dependencies ), fileSystem, platformModule.pageCache, backupAddressForTxProtocol( config ), platformModule.storeCopyCheckPointMutex, serverPipelineWrapper ) ); } else { return Optional.empty(); } }
Source:
private static SymbolStatsEstimate addColumnStats(SymbolStatsEstimate leftStats, double leftRows, SymbolStatsEstimate rightStats, double rightRows, double newRowCount, RangeAdditionStrategy strategy) { StatisticRange leftRange = StatisticRange.from(leftStats); StatisticRange rightRange = StatisticRange.from(rightStats); StatisticRange sum = strategy.add(leftRange, rightRange); double nullsCountRight = rightStats.getNullsFraction() * rightRows; double nullsCountLeft = leftStats.getNullsFraction() * leftRows; double totalSizeLeft = (leftRows - nullsCountLeft) * leftStats.getAverageRowSize(); double totalSizeRight = (rightRows - nullsCountRight) * rightStats.getAverageRowSize(); return SymbolStatsEstimate.builder() .setStatisticsRange(sum) .setAverageRowSize((totalSizeLeft + totalSizeRight) / newRowCount) .setNullsFraction((nullsCountLeft + nullsCountRight) / newRowCount) .build(); }

Target:
private static SymbolStatsEstimate addColumnStats(SymbolStatsEstimate leftStats, double leftRows, SymbolStatsEstimate rightStats, double rightRows, double newRowCount, RangeAdditionStrategy strategy) { StatisticRange leftRange = StatisticRange.from(leftStats); StatisticRange rightRange = StatisticRange.from(rightStats); StatisticRange sum = strategy.add(leftRange, rightRange); double nullsCountRight = rightStats.getNullsFraction() * rightRows; double nullsCountLeft = leftStats.getNullsFraction() * leftRows; double totalSizeLeft = (leftRows - nullsCountLeft) * leftStats.getAverageRowSize(); double totalSizeRight = (rightRows - nullsCountRight) * rightStats.getAverageRowSize(); double newNullsFraction = (nullsCountLeft + nullsCountRight) / newRowCount; double newNonNullsRowCount = newRowCount * (1.0 - newNullsFraction); return SymbolStatsEstimate.builder() .setStatisticsRange(sum) .setAverageRowSize((totalSizeLeft + totalSizeRight) / newNonNullsRowCount) .setNullsFraction(newNullsFraction) .build(); }
Source:
public Long getId() throws IdGenerationException { final Long count = counter.getAndIncrement(); final int numPartitionsInEval = numPartitions / numInitialEvals + ((numPartitions % numInitialEvals >= memoryStoreId) ? 1 : 0); final long partitionSize = Long.MAX_VALUE / numPartitions; final long offset = count / numPartitionsInEval; if (offset >= partitionSize) { throw new IdGenerationException("The number of ids in one partition has exceeded its limit."); } final int partitionId = memoryStoreId + numInitialEvals * (count.intValue() % numPartitionsInEval); return partitionId * partitionSize + offset; }

Target:
public Long getId() throws IdGenerationException { final Long count = counter.getAndIncrement(); final int numPartitionsInEval = numPartitions / numInitialEvals + ((numPartitions % numInitialEvals > memoryStoreId) ? 1 : 0); final int partitionId = memoryStoreId + numInitialEvals * (count.intValue() % numPartitionsInEval); final long partitionSize = Long.MAX_VALUE / numPartitions; final long offset = count / numPartitionsInEval; if (offset >= partitionSize) { throw new IdGenerationException("The number of ids in one partition has exceeded its limit."); } return partitionId * partitionSize + offset; }
Source:
protected synchronized void assertLocationInitialized() throws IllegalStateException { if (location != null && initialized) return; Activator activator = Activator.getDefault(); if (activator == null) throw new IllegalStateException(CommonMessages.activator_not_available); Location service = activator.getInstanceLocation(); if (service == null) throw new IllegalStateException(CommonMessages.meta_noDataModeSpecified); boolean explicitInitRequired = Boolean.getBoolean(REQUIRES_EXPLICIT_INIT); if (explicitInitRequired && !service.isSet()) { throw new IllegalStateException(CommonMessages.meta_instanceDataUnspecified); } try { URL url = service.getURL(); if (url == null) throw new IllegalStateException(CommonMessages.meta_instanceDataUnspecified); location = new Path(new File(url.getFile()).toString()); initializeLocation(); } catch (CoreException e) { throw new IllegalStateException(e.getMessage()); } }

Target:
protected synchronized void assertLocationInitialized() throws IllegalStateException { if (location != null && initialized) return; Activator activator = Activator.getDefault(); if (activator == null) throw new IllegalStateException(CommonMessages.activator_not_available); Location service = activator.getInstanceLocation(); if (service == null) throw new IllegalStateException(CommonMessages.meta_noDataModeSpecified); boolean explicitInitRequired = Boolean.valueOf(Activator.getContext().getProperty(REQUIRES_EXPLICIT_INIT)); if (explicitInitRequired && !service.isSet()) { throw new IllegalStateException(CommonMessages.meta_instanceDataUnspecified); } try { URL url = service.getURL(); if (url == null) throw new IllegalStateException(CommonMessages.meta_instanceDataUnspecified); location = new Path(new File(url.getFile()).toString()); initializeLocation(); } catch (CoreException e) { throw new IllegalStateException(e.getMessage()); } }
Source:
public static boolean selectorsOverlap(Map<String, String> source, Map<String, String> target) { if(!target.keySet().containsAll(source.keySet())) { return false; } for (String key : source.keySet()) { if(!target.get(key).equals(source.get(key))) { return false; } } return true; }

Target:
public static boolean selectorsOverlap(Map<String, String> source, Map<String, String> target) { if(source == null || target == null) return false; if(!target.keySet().containsAll(source.keySet())) { return false; } for (String key : source.keySet()) { if(!Objects.deepEquals(target.get(key),source.get(key))) { return false; } } return true; }
Source:
@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); Bundle args = getArguments(); if (args != null) { mIsSignupFromLoginEnabled = args.getBoolean(ARG_SIGNUP_FROM_LOGIN_ENABLED, false); } }

Target:
public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); Bundle args = getArguments(); if (args != null) { mIsSignupFromLoginEnabled = args.getBoolean(ARG_SIGNUP_FROM_LOGIN_ENABLED, false); } }
Source:
public void removeListener(String listenerName) { if (this.listenersByEvent == null) { initializeListeners(); } synchronized (this.listenersByEvent) { getListenersByName().remove(listenerName); for (Map.Entry<Class<? extends Event>, Map<String, RegisteredListener>> entry : this.listenersByEvent .entrySet()) { entry.getValue().remove(listenerName); if (entry.getValue().isEmpty()) { this.listenersByEvent.remove(entry.getKey()); } } } }

Target:
public void removeListener(String listenerName) { getListenersByName().remove(listenerName); for (Map.Entry<Class<? extends Event>, Map<String, RegisteredListener>> entry : this.listenersByEvent .entrySet()) { entry.getValue().remove(listenerName); if (entry.getValue().isEmpty()) { this.listenersByEvent.remove(entry.getKey()); } } }
Source:
public void testRuntime() throws Exception { setProperty(); KernelServicesBuilder builder = createKernelServicesBuilder(UndertowSubsystem100TestCase.RUNTIME) .setSubsystemXml(getSubsystemXml()); KernelServices mainServices = builder.build(); testRuntime(mainServices, virtualHostName, flag); }

Target:
public void testRuntime() throws Exception { setProperty(); KernelServicesBuilder builder = createKernelServicesBuilder(AbstractUndertowSubsystemTestCase.RUNTIME) .setSubsystemXml(getSubsystemXml()); KernelServices mainServices = builder.build(); testRuntime(mainServices, virtualHostName, flag); }
Source:
public String toString() { return "" + invoke(); }

Target:
public String toString() { return format("%s", value()); }
Source:
public int getTabsPaddingLeft() { return tabsPaddingLeft; }

Target:
int getTabsPaddingLeft() { return tabsPaddingLeft; }
Source:
public CompressionHeaderFactory() { baosForTagValues = new ByteArrayOutputStream(1024 * 1024); }

Target:
public CompressionHeaderFactory() { baosForTagValues = new ByteArrayOutputStream(TAG_VALUE_BUFFER_SIZE); }
Source:
public int getRandomWeight(Random random) { return Math.abs(random.nextInt()%this.totalWeight); }

Target:
public int getRandomWeight(Random random) { return random.nextInt(this.totalWeight); }
Source:
public synchronized void handleMessageLayoutCommit( @NonNull CorfuPayloadMsg<LayoutCommittedRequest> msg, ChannelHandlerContext ctx, @NonNull IServerRouter r) { if (msg.getPayload().getForce()) { forceLayout(msg, ctx, r); return; } if (!isBootstrapped(msg, ctx, r)) { return; } final long msgEpoch = msg.getPayload().getEpoch(); final long serverEpoch = getServerEpoch(); final Layout msgLayout = msg.getPayload().getLayout(); if (msgEpoch < serverEpoch) { r.sendResponse(ctx, msg, new CorfuPayloadMsg<>(CorfuMsgType.WRONG_EPOCH, serverEpoch)); return; } setCurrentLayout(msgLayout); serverContext.setServerEpoch(msgEpoch, r); log.info("New layout committed: {}", msgLayout); r.sendResponse(ctx, msg, new CorfuMsg(CorfuMsgType.ACK)); }

Target:
public synchronized void handleMessageLayoutCommit( @NonNull CorfuPayloadMsg<LayoutCommittedRequest> msg, ChannelHandlerContext ctx, @NonNull IServerRouter r) { if (msg.getPayload().getForce()) { forceLayout(msg, ctx, r); return; } if (!isBootstrapped(msg, ctx, r)) { return; } final long payloadEpoch = msg.getPayload().getEpoch(); final long serverEpoch = getServerEpoch(); final Layout msgLayout = msg.getPayload().getLayout(); if (payloadEpoch < serverEpoch) { r.sendResponse(ctx, msg, new CorfuPayloadMsg<>(CorfuMsgType.WRONG_EPOCH, serverEpoch)); return; } setCurrentLayout(msgLayout); serverContext.setServerEpoch(payloadEpoch, r); log.info("New layout committed: {}", msgLayout); r.sendResponse(ctx, msg, new CorfuMsg(CorfuMsgType.ACK)); }
Source:
public static void main(String[] args) throws Exception { EnvironmentInformation.logEnvironmentInfo(LOG, "TaskManager", args); SignalHandler.register(LOG); JvmShutdownSafeguard.installAsShutdownHook(LOG); long maxOpenFileHandles = EnvironmentInformation.getOpenFileHandlesLimit(); if (maxOpenFileHandles != -1L) { LOG.info("Maximum number of open file descriptors is {}.", maxOpenFileHandles); } else { LOG.info("Cannot determine the maximum number of open file descriptors"); } final Configuration config = loadConfiguration(args); final String resourceIDPrefix = config.get(TaskManagerOptions.TASK_MANAGER_RESOURCE_ID_PREFIX); ResourceID taskManagerResourceID; if (resourceIDPrefix == null) { taskManagerResourceID = new ResourceID(new AbstractID().toString()); } else { taskManagerResourceID = new ResourceID(resourceIDPrefix + "-" + UUID.randomUUID().toString().substring(0, 6)); } runTaskManagerSecurely(config, taskManagerResourceID); }

Target:
public static void main(String[] args) throws Exception { EnvironmentInformation.logEnvironmentInfo(LOG, "TaskManager", args); SignalHandler.register(LOG); JvmShutdownSafeguard.installAsShutdownHook(LOG); long maxOpenFileHandles = EnvironmentInformation.getOpenFileHandlesLimit(); if (maxOpenFileHandles != -1L) { LOG.info("Maximum number of open file descriptors is {}.", maxOpenFileHandles); } else { LOG.info("Cannot determine the maximum number of open file descriptors"); } runTaskManagerSecurely(args); }
Source:
public MethodCallExpr buildBinding(DrlxParseSuccess drlxParseResult) { MethodCallExpr bindDSL = new MethodCallExpr(null, BIND_CALL); if (drlxParseResult.hasUnificationVariable()) { bindDSL.addArgument(context.getVarExpr(drlxParseResult.getUnificationVariable())); } else { bindDSL.addArgument(context.getVarExpr(drlxParseResult.getExprBinding())); } final Expression constraintExpression = getConstraintExpression(drlxParseResult); drlxParseResult.getUsedDeclarationsOnLeft().forEach(d -> bindDSL.addArgument(toVar(d))); bindDSL.addArgument(constraintExpression); final Optional<MethodCallExpr> methodCallExpr = buildReactOn(drlxParseResult); methodCallExpr.ifPresent(bindDSL::addArgument); return bindDSL; }

Target:
public MethodCallExpr buildBinding(DrlxParseSuccess drlxParseResult) { MethodCallExpr bindDSL = new MethodCallExpr(null, BIND_CALL); if (drlxParseResult.hasUnificationVariable()) { bindDSL.addArgument(context.getVarExpr(drlxParseResult.getUnificationVariable())); } else { bindDSL.addArgument(context.getVarExpr(drlxParseResult.getExprBinding())); } final Expression constraintExpression = getConstraintExpression(drlxParseResult); drlxParseResult.getUsedDeclarationsOnLeft().forEach(d -> bindDSL.addArgument(context.getVar(d))); bindDSL.addArgument(constraintExpression); final Optional<MethodCallExpr> methodCallExpr = buildReactOn(drlxParseResult); methodCallExpr.ifPresent(bindDSL::addArgument); return bindDSL; }
Source:
public ResolvedReferenceType getSuperClass() { try { if (ctClass.getSuperclass() == null) { return new ReferenceTypeImpl(typeSolver.solveType(Object.class.getCanonicalName()), typeSolver); } if (ctClass.getGenericSignature() == null) { return new ReferenceTypeImpl(new JavassistClassDeclaration(ctClass.getSuperclass(), typeSolver), typeSolver); } SignatureAttribute.ClassSignature classSignature = SignatureAttribute.toClassSignature(ctClass.getGenericSignature()); return JavassistUtils.signatureTypeToType(classSignature.getSuperClass(), typeSolver, this).asReferenceType(); } catch (NotFoundException e) { return solveSuperClass(); } catch (BadBytecode e) { throw new RuntimeException(e); } }

Target:
public ResolvedReferenceType getSuperClass() { try { if (ctClass.getClassFile().getSuperclass() == null) { return new ReferenceTypeImpl(typeSolver.solveType(Object.class.getCanonicalName()), typeSolver); } if (ctClass.getGenericSignature() == null) { return new ReferenceTypeImpl(typeSolver.solveType(JavassistUtils.internalNameToCanonicalName(ctClass.getClassFile().getSuperclass())), typeSolver); } SignatureAttribute.ClassSignature classSignature = SignatureAttribute.toClassSignature(ctClass.getGenericSignature()); return JavassistUtils.signatureTypeToType(classSignature.getSuperClass(), typeSolver, this).asReferenceType(); } catch (BadBytecode e) { throw new RuntimeException(e); } }
Source:
public JsonElement encode(BigDecimal value) { if ( value == null ) { return JsonNull.INSTANCE; } if ( value.scale() > decimalScale ) { log.bigDecimalRounded( value, value.scale(), decimalScale ); } return new JsonPrimitive( value ); }

Target:
public JsonElement encode(BigDecimal value) { if ( value == null ) { return JsonNull.INSTANCE; } if ( isTooLarge( value ) ) { throw log.scaledNumberTooLarge( value ); } return new JsonPrimitive( value ); }
Source:
public void show(LocalHotspot localHotspot) { openTab(SonarLintToolWindowFactory.TAB_HOTSPOTS); ContentManager contentManager = getToolWindow().getContentManager(); Content content = contentManager.findContent(SonarLintToolWindowFactory.TAB_HOTSPOTS); if(content.getComponent() instanceof SonarLintHotspotsPanel) { SonarLintHotspotsPanel sonarLintHotspotsPanel = (SonarLintHotspotsPanel) content.getComponent(); sonarLintHotspotsPanel.setHotspot(localHotspot); } }

Target:
public void show(LocalHotspot localHotspot) { openTab(SonarLintToolWindowFactory.TAB_HOTSPOTS); ContentManager contentManager = getToolWindow().getContentManager(); Content content = contentManager.findContent(SonarLintToolWindowFactory.TAB_HOTSPOTS); SonarLintHotspotsPanel sonarLintHotspotsPanel = (SonarLintHotspotsPanel) content.getComponent(); sonarLintHotspotsPanel.setHotspot(localHotspot); }
Source:
protected Map<String, String> getDefaultAwardAccountAttributes() { String defaultAttributes = parameterService.getParameterValueAsString(RassStep.class, RassParameterConstants.DEFAULT_AWARD_ACCOUNT); if (StringUtils.countMatches(defaultAttributes, CUKFSConstants.COLON) != 2) { throw new RuntimeException("Default Award Account KFS System Parameter must contain two colon separators."); } String defaultChart = StringUtils.substringBefore(defaultAttributes, CUKFSConstants.COLON); defaultAttributes = StringUtils.substringAfter(defaultAttributes, CUKFSConstants.COLON); String defaultAccountNumber = StringUtils.substringBefore(defaultAttributes, CUKFSConstants.COLON); String defaulAccountActiveIndicator = StringUtils.substringAfter(defaultAttributes, CUKFSConstants.COLON); if (StringUtils.isBlank(defaultChart) || StringUtils.isBlank(defaultAccountNumber) || StringUtils.isBlank(defaulAccountActiveIndicator)) { throw new RuntimeException("Default Award Account KFS System Parameter cannot have a blank chart or account or account active indicator."); } Map<String, String> defaultValuePairs = new HashMap<String, String>(); defaultValuePairs.put(KFSPropertyConstants.CHART, defaultChart); defaultValuePairs.put(KFSPropertyConstants.ACCOUNT_NUMBER, defaultAccountNumber); defaultValuePairs.put(KFSPropertyConstants.ACCOUNT_ACTIVE_INDICATOR, defaulAccountActiveIndicator); return defaultValuePairs; }

Target:
protected Map<String, String> getDefaultAwardAccountAttributes() { String defaultAttributes = parameterService.getParameterValueAsString(RassStep.class, RassParameterConstants.DEFAULT_AWARD_ACCOUNT); if (StringUtils.countMatches(defaultAttributes, CUKFSConstants.COLON) != 2) { throw new RuntimeException("Default Award Account KFS System Parameter must contain two colon separators."); } String defaultChart = StringUtils.substringBefore(defaultAttributes, CUKFSConstants.COLON); defaultAttributes = StringUtils.substringAfter(defaultAttributes, CUKFSConstants.COLON); String defaultAccountNumber = StringUtils.substringBefore(defaultAttributes, CUKFSConstants.COLON); String defaultAccountActiveIndicator = StringUtils.substringAfter(defaultAttributes, CUKFSConstants.COLON); if (StringUtils.isBlank(defaultChart) || StringUtils.isBlank(defaultAccountNumber) || StringUtils.isBlank(defaultAccountActiveIndicator)) { throw new RuntimeException("Default Award Account KFS System Parameter cannot have a blank chart or account or account active indicator."); } Map<String, String> defaultValuePairs = new HashMap<String, String>(); defaultValuePairs.put(KFSPropertyConstants.CHART, defaultChart); defaultValuePairs.put(KFSPropertyConstants.ACCOUNT_NUMBER, defaultAccountNumber); defaultValuePairs.put(KFSPropertyConstants.ACCOUNT_ACTIVE_INDICATOR, defaultAccountActiveIndicator); return defaultValuePairs; }
Source:
protected boolean validate() { StorageServerConnections paramConnection = getConnection(); if (StringUtils.isNotEmpty(paramConnection.getId())) { return failValidation(EngineMessage.ACTION_TYPE_FAILED_STORAGE_CONNECTION_ID_NOT_EMPTY); } if (!isValidConnection(paramConnection)) { return false; } Guid storagePoolId = Guid.isNullOrEmpty(getParameters().getVdsId()) ? null : getVds().getStoragePoolId(); String duplicateConnectionId = isConnWithSameDetailsExists(paramConnection, storagePoolId); String currentConnectionId = paramConnection.getId(); if (!duplicateConnectionId.equalsIgnoreCase(currentConnectionId)) { String storageDomainName = getStorageNameByConnectionId(duplicateConnectionId); addValidationMessageVariable("connectionId", duplicateConnectionId); addValidationMessageVariable("storageDomainName", storageDomainName); return failValidation(EngineMessage.ACTION_TYPE_FAILED_STORAGE_CONNECTION_ALREADY_EXISTS); } if (!Guid.isNullOrEmpty(getParameters().getVdsId())) { if (getVds() == null) { return failValidation(EngineMessage.VDS_INVALID_SERVER_ID); } if (getVds().getStatus() != VDSStatus.Up) { return failValidation(EngineMessage.VDS_ADD_STORAGE_SERVER_STATUS_MUST_BE_UP); } } return true; }

Target:
protected boolean validate() { StorageServerConnections paramConnection = getConnection(); if (StringUtils.isNotEmpty(paramConnection.getId())) { return failValidation(EngineMessage.ACTION_TYPE_FAILED_STORAGE_CONNECTION_ID_NOT_EMPTY); } if (!isValidConnection(paramConnection)) { return false; } Guid storagePoolId = Guid.isNullOrEmpty(getParameters().getVdsId()) ? null : getVds().getStoragePoolId(); String duplicateConnectionId = isConnWithSameDetailsExists(paramConnection, storagePoolId); if (!duplicateConnectionId.isEmpty() && !duplicateConnectionId.equalsIgnoreCase(paramConnection.getId())) { String storageDomainName = getStorageNameByConnectionId(duplicateConnectionId); addValidationMessageVariable("connectionId", duplicateConnectionId); addValidationMessageVariable("storageDomainName", storageDomainName); return failValidation(EngineMessage.ACTION_TYPE_FAILED_STORAGE_CONNECTION_ALREADY_EXISTS); } if (!Guid.isNullOrEmpty(getParameters().getVdsId())) { if (getVds() == null) { return failValidation(EngineMessage.VDS_INVALID_SERVER_ID); } if (getVds().getStatus() != VDSStatus.Up) { return failValidation(EngineMessage.VDS_ADD_STORAGE_SERVER_STATUS_MUST_BE_UP); } } return true; }
Source:
public Block copyRegion(int positionOffset, int length) { checkValidRegion(getPositionCount(), positionOffset, length); if (positionOffset == 0 && length == positionOffset && arrayOffset == 0 && positionCount == values.length) { return this; } positionOffset += arrayOffset; boolean[] newValueIsNull = Arrays.copyOfRange(valueIsNull, positionOffset, positionOffset + length); byte[] newValues = Arrays.copyOfRange(values, positionOffset, positionOffset + length); return new ByteArrayBlock(length, newValueIsNull, newValues); }

Target:
public Block copyRegion(int positionOffset, int length) { checkValidRegion(getPositionCount(), positionOffset, length); positionOffset += arrayOffset; boolean[] newValueIsNull = compactArray(valueIsNull, positionOffset, length); byte[] newValues = compactArray(values, positionOffset, length); if (newValueIsNull == valueIsNull && newValues == values) { return this; } return new ByteArrayBlock(length, newValueIsNull, newValues); }
Source:
public String retrieveReport(ServiceContext context, String endPoint) throws Exception { HttpGet request = new HttpGet(endPoint); request.addHeader("User-Agent", USER_AGENT); request.addHeader("Accept", ACCEPT); ClientHttpResponse response = null; try { response = this.execute(context, request); return IOUtils.toString(response.getBody(), StandardCharsets.UTF_8.name()); } catch (Exception e) { Log.warning(Log.SERVICE, "Error calling INSPIRE service to retrieve the result report: " + endPoint, e); throw e; } finally { request.completed(); request.releaseConnection(); response.close(); } }

Target:
public String retrieveReport(ServiceContext context, String endPoint) throws Exception { HttpGet request = new HttpGet(endPoint); request.addHeader("User-Agent", USER_AGENT); request.addHeader("Accept", ACCEPT); try (ClientHttpResponse response = this.execute(context, request)) { return IOUtils.toString(response.getBody(), StandardCharsets.UTF_8.name()); } catch (Exception e) { Log.warning(Log.SERVICE, "Error calling INSPIRE service to retrieve the result report: " + endPoint, e); throw e; } }
Source:
public void addsCookieToResponse() throws IOException { MatcherAssert.assertThat( new RsPrint( new RsWithCookie( new RsEmpty(), RsWithCookieTest.FOO, RsWithCookieTest.WORKS, RsWithCookieTest.PATH ) ).print(), Matchers.equalTo( Joiner.on(RsWithCookieTest.CRLF).join( RsWithCookieTest.HTTP_OK, RsWithCookieTest.SET_COOKIE, "", "" ) ) ); }

Target:
public void addsCookieToResponse() throws IOException { final String foo = "foo"; final String works = "works?"; final String path = "Path=/"; MatcherAssert.assertThat( new RsPrint( new RsWithCookie( new RsEmpty(), foo, works, path ) ).print(), Matchers.equalTo( RsWithCookieTest.cookies( RsWithCookieTest.formatCookie(foo, works, path) ) ) ); }
Source:
public AuditLogType getAuditLogTypeValue() { switch (getActionState()) { case EXECUTE: return getSucceeded() ? (isAddToVm ? AuditLogType.USER_ADD_DISK_TO_VM : AuditLogType.USER_ADD_FLOATING_DISK) : (isAddToVm ? AuditLogType.USER_FAILED_ADD_DISK_TO_VM : AuditLogType.USER_FAILED_ADD_FLOATING_DISK); case END_SUCCESS: return getSucceeded() ? (isAddToVm ? AuditLogType.USER_ADD_DISK_TO_VM_FINISHED_SUCCESS : AuditLogType.USER_ADD_FLOATING_DISK_FINISHED_SUCCESS) : (isAddToVm ? AuditLogType.USER_ADD_DISK_TO_VM_FINISHED_FAILURE : AuditLogType.USER_ADD_FLOATING_DISK_FINISHED_FAILURE); default: return AuditLogType.USER_ADD_DISK_TO_VM_FINISHED_FAILURE; } }

Target:
public AuditLogType getAuditLogTypeValue() { boolean isAddToVm = !Guid.Empty.equals(getParameters().getVmId()); switch (getActionState()) { case EXECUTE: if (getSucceeded()) { return isAddToVm ? AuditLogType.USER_ADD_DISK_TO_VM : AuditLogType.USER_ADD_FLOATING_DISK; } return isAddToVm ? AuditLogType.USER_FAILED_ADD_DISK_TO_VM : AuditLogType.USER_FAILED_ADD_FLOATING_DISK; case END_SUCCESS: if (getSucceeded()) { return isAddToVm ? AuditLogType.USER_ADD_DISK_TO_VM_FINISHED_SUCCESS : AuditLogType.USER_ADD_FLOATING_DISK_FINISHED_SUCCESS; } return isAddToVm ? AuditLogType.USER_ADD_DISK_TO_VM_FINISHED_FAILURE : AuditLogType.USER_ADD_FLOATING_DISK_FINISHED_FAILURE; default: return isAddToVm ? AuditLogType.USER_ADD_DISK_TO_VM_FINISHED_FAILURE : AuditLogType.USER_ADD_FLOATING_DISK_FINISHED_FAILURE; } }
Source:
public void setApplication(ApplicationConfig application) { if (!ConfigManager.getInstance().getApplication().isPresent() || !ConfigManager.getInstance().getApplication().get().equals(application)) { ConfigManager.getInstance().setApplication(application); } this.application = application; }

Target:
public void setApplication(ApplicationConfig application) { ConfigManager.getInstance().setApplication(application); this.application = application; }
Source:
public DruidQueryGeneratorContext visitTableScan(TableScanNode node, DruidQueryGeneratorContext contextIn) { DruidTableHandle tableHandle = (DruidTableHandle) node.getTable().getConnectorHandle(); checkArgument(!tableHandle.getDql().isPresent(), "Druid tableHandle should not have dql before pushdown"); LinkedHashMap<VariableReferenceExpression, Selection> selections = new LinkedHashMap<>(); node.getOutputVariables().forEach(outputColumn -> { DruidColumnHandle druidColumn = (DruidColumnHandle) (node.getAssignments().get(outputColumn)); selections.put(outputColumn, new Selection(druidColumn.getColumnName(), TABLE_COLUMN)); }); return new DruidQueryGeneratorContext(selections, tableHandle.getTableName()); }

Target:
public DruidQueryGeneratorContext visitTableScan(TableScanNode node, DruidQueryGeneratorContext contextIn) { DruidTableHandle tableHandle = (DruidTableHandle) node.getTable().getConnectorHandle(); checkArgument(!tableHandle.getDql().isPresent(), "Druid tableHandle should not have dql before pushdown"); Map<VariableReferenceExpression, Selection> selections = new LinkedHashMap<>(); node.getOutputVariables().forEach(outputColumn -> { DruidColumnHandle druidColumn = (DruidColumnHandle) (node.getAssignments().get(outputColumn)); selections.put(outputColumn, new Selection(druidColumn.getColumnName(), TABLE_COLUMN)); }); return new DruidQueryGeneratorContext(selections, tableHandle.getTableName()); }