auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public void init() { this.taskSideInputStorageManager.init(); Map<SystemStreamPartition, String> fileOffsets = this.taskSideInputStorageManager.getFileOffsets(); LOG.info("File offsets for the task {}: {}", taskName, fileOffsets); this.lastProcessedOffsets.putAll(fileOffsets); LOG.info("Last processed offsets for the task {}: {}", taskName, lastProcessedOffsets); this.startingOffsets = getStartingOffsets(fileOffsets, getOldestOffsets()); LOG.info("Starting offsets for the task {}: {}", taskName, startingOffsets); this.sspOffsetsToBlockUntil = new HashMap<>(); for (SystemStreamPartition ssp : this.sspToStores.keySet()) { SystemStreamMetadata metadata = this.streamMetadataCache.getSystemStreamMetadata(ssp.getSystemStream(), false); if (metadata != null) { String offset = metadata.getSystemStreamPartitionMetadata().get(ssp.getPartition()).getNewestOffset(); this.sspOffsetsToBlockUntil.put(ssp, offset); } } this.startingOffsets.forEach((ssp, offset) -> checkCaughtUp(ssp, offset, true)); }

Target:
public void init() { this.taskSideInputStorageManager.init(); Map<SystemStreamPartition, String> fileOffsets = this.taskSideInputStorageManager.getFileOffsets(); LOG.info("File offsets for the task {}: {}", taskName, fileOffsets); this.lastProcessedOffsets.putAll(fileOffsets); LOG.info("Last processed offsets for the task {}: {}", taskName, lastProcessedOffsets); this.startingOffsets = getStartingOffsets(fileOffsets, getOldestOffsets()); LOG.info("Starting offsets for the task {}: {}", taskName, startingOffsets); this.initialSideInputSSPMetadata = getInitialSideInputSSPMetadata(); LOG.info("Task will catch up to offsets {}", this.taskName, this.initialSideInputSSPMetadata); this.startingOffsets.forEach((ssp, offset) -> checkCaughtUp(ssp, offset, SystemStreamMetadata.OffsetType.UPCOMING)); }
Source:
private TimeValue unpackTime() throws IOException { long nanosOfDayUTC = unpackLong(); int offsetSeconds = unpackInteger(); return time( nanosOfDayUTC - offsetSeconds * NANOS_PER_SECOND, ZoneOffset.ofTotalSeconds( offsetSeconds ) ); }

Target:
private TimeValue unpackTime() throws IOException { long nanosOfDayLocal = unpackLong(); int offsetSeconds = unpackInteger(); return time( TimeUtil.nanosOfDayToUTC( nanosOfDayLocal, offsetSeconds ), ZoneOffset.ofTotalSeconds( offsetSeconds ) ); }
Source:
public UserTrades getTradeHistory(TradeHistoryParams p) throws IOException { CoingiOrdersList orderList; if (p instanceof CoingiTradeHistoryParams) { CoingiTradeHistoryParams params = (CoingiTradeHistoryParams) p; CoingiGetOrderHistoryRequest request = new CoingiGetOrderHistoryRequest(); if (params.getCurrencyPair() != null) request.setCurrencyPair(params.getCurrencyPair()); request.setPageNumber(params.getPageNumber()); request.setPageSize(params.getPageSize()); if (params.getStatus() != null) request.setStatus(params.getStatus()); if (params.getType() != null) request.setType(params.getType()); try { orderList = getCoingiOrderHistory(request); } catch (CoingiException e) { throw CoingiErrorAdapter.adapt(e); } return CoingiAdapters.adaptTradeHistory(orderList); } return null; }

Target:
public UserTrades getTradeHistory(TradeHistoryParams p) throws IOException { try { if (p instanceof CoingiTradeHistoryParams) { CoingiTradeHistoryParams params = (CoingiTradeHistoryParams) p; CoingiGetOrderHistoryRequest request = new CoingiGetOrderHistoryRequest(); if (params.getCurrencyPair() != null) request.setCurrencyPair(params.getCurrencyPair()); request.setPageNumber(params.getPageNumber()); request.setPageSize(params.getPageSize()); if (params.getStatus() != null) request.setStatus(params.getStatus()); if (params.getType() != null) request.setType(params.getType()); CoingiOrdersList orderList = getCoingiOrderHistory(request); return CoingiAdapters.adaptTradeHistory(orderList); } return null; } catch (CoingiException e) { throw CoingiErrorAdapter.adapt(e); } }
Source:
public void execute() { if (canExecute()) { editor = Abstract4DIACUIPlugin.getCurrentActiveEditor(); checkSourceAndTarget(); connection = createConnectionElement(); connection.setSource(source); connection.setDestination(destination); connection.setDx1(connDx1); connection.setDx2(connDx2); connection.setDy(connDy); parent.addConnection(connection); if (performMappingCheck) { mirroredConnection = checkAndCreateMirroredConnection(); if (null != mirroredConnection) { mirroredConnection.execute(); } } } }

Target:
public void execute() { editor = Abstract4DIACUIPlugin.getCurrentActiveEditor(); checkSourceAndTarget(); connection = createConnectionElement(); connection.setSource(source); connection.setDestination(destination); connection.setDx1(connDx1); connection.setDx2(connDx2); connection.setDy(connDy); parent.addConnection(connection); if(performMappingCheck){ mirroredConnection = checkAndCreateMirroredConnection(); if(null != mirroredConnection){ mirroredConnection.execute(); } } }
Source:
private boolean isIpLevelBlocked(String apiTenantDomain, String ip) { Set<IPRange> ipRanges = blockedIpConditionsMap.get(apiTenantDomain); if (ipRanges != null && ipRanges.size() > 0) { for (IPRange ipRange : ipRanges) { if (APIConstants.BLOCKING_CONDITIONS_IP.equals(ipRange.getType())) { if (ip.equals(ipRange.getFixedIp())) { if (!ipRange.isInvert()) { return true; } } else { if (ipRange.isInvert()) { return true; } } } else if (APIConstants.BLOCK_CONDITION_IP_RANGE.equals(ipRange.getType())) { BigInteger ipBigIntegerValue = APIUtil.ipToBigInteger(ip); if (((ipBigIntegerValue.compareTo(ipRange.getStartingIpBigIntValue()) > 0) && (ipBigIntegerValue.compareTo(ipRange.getEndingIpBigIntValue()) < 0))) { if (!ipRange.isInvert()) { return true; } } else { if (ipRange.isInvert()) { return true; } } } } } return false; }

Target:
private boolean isIpLevelBlocked(String apiTenantDomain, String ip) { Set<IPRange> ipRanges = blockedIpConditionsMap.get(apiTenantDomain); if (ipRanges != null && ipRanges.size() > 0) { log.debug("Tenant " + apiTenantDomain + " contains block conditions"); for (IPRange ipRange : ipRanges) { if (APIConstants.BLOCKING_CONDITIONS_IP.equals(ipRange.getType())) { if (ip.equals(ipRange.getFixedIp())) { if (!ipRange.isInvert()) { log.debug("Block IP selected for Blocked"); return true; } } else { if (ipRange.isInvert()) { log.debug("Block IP selected for Blocked"); return true; } } } else if (APIConstants.BLOCK_CONDITION_IP_RANGE.equals(ipRange.getType())) { BigInteger ipBigIntegerValue = APIUtil.ipToBigInteger(ip); if (((ipBigIntegerValue.compareTo(ipRange.getStartingIpBigIntValue()) > 0) && (ipBigIntegerValue.compareTo(ipRange.getEndingIpBigIntValue()) < 0))) { if (!ipRange.isInvert()) { log.debug("Block IPRange selected for Blocked"); return true; } } else { if (ipRange.isInvert()) { log.debug("Block IPRange selected for Blocked"); return true; } } } } } return false; }
Source:
public static JsonObject getVCAPService(JsonObject deploy) throws IOException { JsonObject services = getVCAPServices(deploy.get(VCAP_SERVICES)); JsonArray streamsServices = array(services, "streaming-analytics"); if (streamsServices == null || streamsServices.size() == 0) throw new IllegalStateException("No streaming-analytics services defined in VCAP_SERVICES"); String serviceName = jstring(deploy, SERVICE_NAME); if (serviceName == null) { serviceName = System.getenv("SERVICE_NAME"); } if (serviceName != null) serviceName = serviceName.trim(); if (serviceName == null || serviceName.isEmpty()) throw new IllegalStateException( "Streaming Analytics service name is not defined, please set configuration property: " + SERVICE_NAME); JsonObject service = null; for (JsonElement ja : streamsServices) { JsonObject possibleService = ja.getAsJsonObject(); if (serviceName.equals(possibleService.get("name").getAsString())) { service = possibleService; break; } } if (service == null) throw new IllegalStateException( "No streaming-analytics services defined in VCAP_SERVICES with name: " + serviceName); return service; }

Target:
public static JsonObject getVCAPService(JsonObject deploy) throws IOException { JsonObject services = getVCAPServices(deploy.get(VCAP_SERVICES)); JsonArray streamsServices = array(services, "streaming-analytics"); if (streamsServices == null || streamsServices.size() == 0) throw new IllegalStateException("No streaming-analytics services defined in VCAP_SERVICES"); String serviceName = jstring(deploy, SERVICE_NAME); if (serviceName == null) { serviceName = System.getenv("STREAMING_ANALYTICS_SERVICE_NAME"); } if (serviceName != null) serviceName = serviceName.trim(); if (serviceName == null || serviceName.isEmpty()) throw new IllegalStateException( "Streaming Analytics service name is not defined, please set configuration property: " + SERVICE_NAME); JsonObject service = null; for (JsonElement ja : streamsServices) { JsonObject possibleService = ja.getAsJsonObject(); if (serviceName.equals(possibleService.get("name").getAsString())) { service = possibleService; break; } } if (service == null) throw new IllegalStateException( "No streaming-analytics services defined in VCAP_SERVICES with name: " + serviceName); return service; }
Source:
public void search_shouldSearchForDiagnosisConceptsFromSpecifiedSets() throws Exception { when(context.getLocale()).thenReturn(locale); String queryString = "infection"; String diagnosisSetUuids = LUNG_DISEASE_DIAGNOSIS_SET_UUID; List<SimpleObject> conceptSearchResults = controller.search(context, uiUtils, emrApiProperties, emrConceptService, conceptService, queryString, diagnosisSetUuids, null, null); assertEquals(1, conceptSearchResults.size()); assertThat((String) ((SimpleObject) conceptSearchResults.get(0).get("conceptName")).get("name"), is("Tuberculosis infection")); }

Target:
public void search_shouldSearchForDiagnosisConceptsFromSpecifiedSets() throws Exception { controller.search(context, uiUtils, emrApiProperties, emrConceptService, conceptService, queryString, "1st_diagnosis_set_uuid,2nd_diagnosis_set_uuid", null, null); verify(emrApiProperties, never()).getDiagnosisSets(); }
Source:
private void checkGitModules(ProgressMonitor pm, FsckError errors) throws IOException { for (GitmoduleEntry entry : objChecker.getGitsubmodules()) { AnyObjectId blobId = entry.getBlobId(); ObjectLoader blob = objdb.open(blobId, Constants.OBJ_BLOB); try { SubmoduleValidator.assertValidGitModulesFile( new String(blob.getBytes(), UTF_8)); } catch (IOException e) { CorruptObject co = new FsckError.CorruptObject( blobId.toObjectId(), Constants.OBJ_BLOB, ObjectChecker.ErrorType.INVALID_GIT_MODULES); errors.getCorruptObjects().add(co); } } }

Target:
private void checkGitModules(ProgressMonitor pm, FsckError errors) throws IOException { pm.beginTask(JGitText.get().validatingGitModules, objChecker.getGitsubmodules().size()); for (GitmoduleEntry entry : objChecker.getGitsubmodules()) { AnyObjectId blobId = entry.getBlobId(); ObjectLoader blob = objdb.open(blobId, Constants.OBJ_BLOB); try { SubmoduleValidator.assertValidGitModulesFile( new String(blob.getBytes(), UTF_8)); } catch (SubmoduleValidationException e) { CorruptObject co = new FsckError.CorruptObject( blobId.toObjectId(), Constants.OBJ_BLOB, exceptionToFsckError(e.getSubdmoduleError())); errors.getCorruptObjects().add(co); } pm.update(1); } pm.endTask(); }
Source:
private static List<SegmentPruner> sortSegmentPruners(List<SegmentPruner> pruners) { List<SegmentPruner> sortedPruners = new ArrayList<>(); for (SegmentPruner pruner : pruners) { if (pruner instanceof TimeRangeSegmentPruner) { sortedPruners.add(pruner); } } for (SegmentPruner pruner: pruners) { if (!(pruner instanceof TimeRangeSegmentPruner)) { sortedPruners.add(pruner); } } return sortedPruners; }

Target:
private static List<SegmentPruner> sortSegmentPruners(List<SegmentPruner> pruners) { List<SegmentPruner> sortedPruners = new ArrayList<>(); for (SegmentPruner pruner : pruners) { if (pruner instanceof TimeSegmentPruner) { sortedPruners.add(pruner); } } for (SegmentPruner pruner: pruners) { if (!(pruner instanceof TimeSegmentPruner)) { sortedPruners.add(pruner); } } return sortedPruners; }
Source:
AutoCloseable enter() { if (!lock.tryLock()) { throw new IllegalStateException(); } return () -> { if (!lock.tryLock()) throw new IllegalStateException(); }; }

Target:
AutoCloseable enter() { if(!lock.compareAndSet(false, true)) throw new IllegalStateException(); return new AutoCloseable() { @Override public void close() throws Exception { if(!lock.compareAndSet(true, false)) throw new IllegalStateException(); } }; }
Source:
public BatchConfig(String tableNameWithType, Map<String, String> batchConfigsMap) { _batchConfigMap = batchConfigsMap; _tableNameWithType = tableNameWithType; _inputDirURI = batchConfigsMap.get(BatchConfigProperties.INPUT_DIR_URI); Preconditions.checkState(_inputDirURI != null, "Property: %s cannot be null", BatchConfigProperties.INPUT_DIR_URI); _outputDirURI = batchConfigsMap.get(BatchConfigProperties.OUTPUT_DIR_URI); Preconditions.checkState(_outputDirURI != null, "Property: %s cannot be null", BatchConfigProperties.OUTPUT_DIR_URI); _inputFsClassName = batchConfigsMap.get(BatchConfigProperties.INPUT_FS_CLASS); _outputFsClassName = batchConfigsMap.get(BatchConfigProperties.OUTPUT_FS_CLASS); String inputFormat = batchConfigsMap.get(BatchConfigProperties.INPUT_FORMAT); Preconditions.checkState(inputFormat != null, "Property: %s cannot be null", BatchConfigProperties.INPUT_FORMAT); _inputFormat = FileFormat.valueOf(inputFormat.toUpperCase()); _recordReaderClassName = batchConfigsMap.get(BatchConfigProperties.RECORD_READER_CLASS); _recordReaderConfigClassName = batchConfigsMap.get(BatchConfigProperties.RECORD_READER_CONFIG_CLASS); for (Map.Entry<String, String> entry : batchConfigsMap.entrySet()) { String key = entry.getKey(); if (key.startsWith(BatchConfigProperties.INPUT_FS_PROP_PREFIX)) { _inputFsProps.put(key, entry.getValue()); } if (key.startsWith(BatchConfigProperties.OUTPUT_FS_PROP_PREFIX)) { _outputFsProps.put(key, entry.getValue()); } if (key.startsWith(BatchConfigProperties.RECORD_READER_PROP_PREFIX)) { _recordReaderProps.put(key, entry.getValue()); } } }

Target:
public BatchConfig(String tableNameWithType, Map<String, String> batchConfigsMap) { _batchConfigMap = batchConfigsMap; _tableNameWithType = tableNameWithType; String inputFormat = batchConfigsMap.get(BatchConfigProperties.INPUT_FORMAT); Preconditions.checkState(inputFormat != null, "Property: %s cannot be null", BatchConfigProperties.INPUT_FORMAT); _inputFormat = FileFormat.valueOf(inputFormat.toUpperCase()); _inputDirURI = batchConfigsMap.get(BatchConfigProperties.INPUT_DIR_URI); _inputFsClassName = batchConfigsMap.get(BatchConfigProperties.INPUT_FS_CLASS); _outputDirURI = batchConfigsMap.get(BatchConfigProperties.OUTPUT_DIR_URI); _outputFsClassName = batchConfigsMap.get(BatchConfigProperties.OUTPUT_FS_CLASS); _recordReaderClassName = batchConfigsMap.get(BatchConfigProperties.RECORD_READER_CLASS); _recordReaderConfigClassName = batchConfigsMap.get(BatchConfigProperties.RECORD_READER_CONFIG_CLASS); for (Map.Entry<String, String> entry : batchConfigsMap.entrySet()) { String key = entry.getKey(); if (key.startsWith(BatchConfigProperties.INPUT_FS_PROP_PREFIX)) { _inputFsProps.put(key, entry.getValue()); } if (key.startsWith(BatchConfigProperties.OUTPUT_FS_PROP_PREFIX)) { _outputFsProps.put(key, entry.getValue()); } if (key.startsWith(BatchConfigProperties.RECORD_READER_PROP_PREFIX)) { _recordReaderProps.put(key, entry.getValue()); } } }
Source:
public List<String> columnLabelsList() { return Collections.unmodifiableList(columnLabels); }

Target:
public List<String> columnLabelsList() { return Collections.unmodifiableList(new ArrayList<String>(columnLabelIndices.keySet())); }
Source:
private String formatTableList(List<String> items, ListMultimap<String, String> issueToFilesMap) { if (items.isEmpty()) { return ""; } String caption = "Issues list"; StringBuilder sb = new StringBuilder(); sb.append(NEW_LINE).append(NEW_LINE); sb.append("| ").append(caption).append(" |").append(NEW_LINE); sb.append("|"); sb.append(repeatString(caption.length() + 2, "-")); sb.append("|"); sb.append(NEW_LINE); for (String item : items) { sb.append("| ").append(item).append(" |").append(NEW_LINE); if (this.includeFilesInOverview > 0 && issueToFilesMap.containsKey(item)) { String files = String.join(", ", issueToFilesMap.get(item)); sb.append("| :arrow_right_hook: *Files: ").append(files).append("* |").append(NEW_LINE); } } return sb.toString(); }

Target:
private String formatTableList(List<String> items, ListMultimap<String, String> issueToFilesMap) { if (items.isEmpty()) { return ""; } String caption = "Issues list"; StringBuilder sb = new StringBuilder(); sb.append(NEW_LINE).append(NEW_LINE); sb.append("| ").append(caption).append(" |").append(NEW_LINE); sb.append("|"); sb.append(repeatString(caption.length() + 2, "-")); sb.append("|"); sb.append(NEW_LINE); for (String item : items) { sb.append("| ").append(item).append(" |").append(NEW_LINE); if (this.includeFilesInOverview > 0 && issueToFilesMap.containsKey(item)) { String files = String.join(", ", issueToFilesMap.get(item)); sb.append("| &nbsp;&nbsp; *Files: ").append(files).append("* |").append(NEW_LINE); } } return sb.toString(); }
Source:
private String createIntermediateTableForeignKeyStepId() { if (DbConnectionFactory.isMySql()) { return MYSQL_CREATE_INTERMEDIATE_TABLE_FOREIGN_KEYS_STEP_ID; } else if (DbConnectionFactory.isPostgres()) { return POSTGRES_CREATE_INTERMEDIATE_TABLE_FOREIGN_KEYS_STEP_ID; } else if (DbConnectionFactory.isMsSql()) { return MSSQL_CREATE_INTERMEDIATE_TABLE_FOREIGN_KEYS_STEP_ID; } else if (DbConnectionFactory.isOracle()) { return ORACLE_CREATE_INTERMEDIATE_TABLE_FOREIGN_KEYS_STEP_ID; } return H2_CREATE_INTERMEDIATE_TABLE_FOREIGN_KEYS_STEP_ID; }

Target:
private String createIntermediateTableForeignKeyStepId() { String sql = H2_CREATE_INTERMEDIATE_TABLE_FOREIGN_KEYS_STEP_ID; if (DbConnectionFactory.isMySql()) { sql = MYSQL_CREATE_INTERMEDIATE_TABLE_FOREIGN_KEYS_STEP_ID; } else if (DbConnectionFactory.isPostgres()) { sql = POSTGRES_CREATE_INTERMEDIATE_TABLE_FOREIGN_KEYS_STEP_ID; } else if (DbConnectionFactory.isMsSql()) { sql = MSSQL_CREATE_INTERMEDIATE_TABLE_FOREIGN_KEYS_STEP_ID; } else if (DbConnectionFactory.isOracle()) { sql = ORACLE_CREATE_INTERMEDIATE_TABLE_FOREIGN_KEYS_STEP_ID; } return sql; }
Source:
public ValidationResult isMacAssignableValidator() { boolean allowDupMacs = macPool.isDuplicateMacAddressesAllowed(); boolean illegalDuplicateMacUsage = !allowDupMacs && macPool.isMacInUse(macAddress); if (illegalDuplicateMacUsage) { Optional<VM> optionalVm = macsUsedAcrossWholeSystem.getVmUsingMac(macPool.getId(), macAddress); if (!optionalVm.isPresent()) { optionalVm = macsUsedAcrossWholeSystem.getSnapshotUsingMac(macPool.getId(), macAddress); } return new ValidationResult(EngineMessage.NETWORK_MAC_ADDRESS_IN_USE, ReplacementUtils.createSetVariableString(VAR_MAC_IN_USE, macAddress), ReplacementUtils.createSetVariableString(VAR_IN_USE_BY, optionalVm.isPresent() ? optionalVm.get().getName() : "")); } return ValidationResult.VALID; }

Target:
public ValidationResult isMacAssignableValidator() { boolean allowDupMacs = macPool.isDuplicateMacAddressesAllowed(); boolean illegalDuplicateMacUsage = !allowDupMacs && macPool.isMacInUse(macAddress); if (illegalDuplicateMacUsage) { Optional<VM> optionalVm = macsUsedAcrossWholeSystem.getVmUsingMac(macPool.getId(), macAddress); if (!optionalVm.isPresent()) { optionalVm = macsUsedAcrossWholeSystem.getSnapshotUsingMac(macPool.getId(), macAddress); } return new ValidationResult(EngineMessage.NETWORK_MAC_ADDRESS_IN_USE, ReplacementUtils.createSetVariableString(VAR_MAC_ADDRESS, macAddress), ReplacementUtils.createSetVariableString(VAR_VM_NAME, optionalVm.isPresent() ? optionalVm.get().getName() : "")); } return ValidationResult.VALID; }
Source:
public QueryImpl[] getPartitionArray() { return (QueryImpl[]) partitions.values().toArray(); }

Target:
public Query[] getPartitionArray() { return (Query[]) partitions.values().toArray(); }
Source:
protected void startReplications() { if (mReplicationPolicyManager != null) { if (mWifiLock == null) { WifiManager wm = (WifiManager) getSystemService(Context.WIFI_SERVICE); mWifiLock = wm.createWifiLock(WifiManager.WIFI_MODE_FULL_HIGH_PERF, "ReplicationService"); } if(!mWifiLock.isHeld()){ mWifiLock.acquire(); } mReplicationPolicyManager.startReplications(); } }

Target:
protected void startReplications() { if (mReplicationPolicyManager != null) { synchronized (mWifiLock) { if (!mWifiLock.isHeld()) { mWifiLock.acquire(); } } mReplicationPolicyManager.startReplications(); } }
Source:
private Optional<Account> readAccountFromResponse(Response response) { JsonNode responseEntity = response.readEntity(JsonNode.class); String accountId = responseEntity.get("account_id").asText(); MDC.put(GATEWAY_ACCOUNT_ID, accountId); String tokenType = Optional.ofNullable(responseEntity.get("token_type")) .map(JsonNode::asText).orElse(CARD.toString()); TokenPaymentType tokenPaymentType = fromString(tokenType); return Optional.of(new Account(accountId, tokenPaymentType)); }

Target:
private Optional<Account> readAccountFromResponse(Response response) { JsonNode responseEntity = response.readEntity(JsonNode.class); String accountId = responseEntity.get("account_id").asText(); String tokenType = Optional.ofNullable(responseEntity.get("token_type")) .map(JsonNode::asText).orElse(CARD.toString()); TokenPaymentType tokenPaymentType = fromString(tokenType); return Optional.of(new Account(accountId, tokenPaymentType)); }
Source:
public Map<String, Object> getComponentConfiguration() { Map<String, Object> configuration = super.getComponentConfiguration(); if (configuration == null) { configuration = new HashMap<>(); } String configKeyPrefix = "config."; configuration.put(configKeyPrefix + "topics", getTopicsString()); configuration.put(configKeyPrefix + "groupid", kafkaSpoutConfig.getConsumerGroupId()); for (Entry<String, Object> conf: kafkaSpoutConfig.getKafkaProps().entrySet()) { if (conf.getValue() != null && isPrimitiveOrWrapper(conf.getValue().getClass())) { configuration.put(configKeyPrefix + conf.getKey(), conf.getValue()); } } return configuration; }

Target:
public Map<String, Object> getComponentConfiguration() { Map<String, Object> configuration = super.getComponentConfiguration(); if (configuration == null) { configuration = new HashMap<>(); } String configKeyPrefix = "config."; configuration.put(configKeyPrefix + "topics", getTopicsString()); configuration.put(configKeyPrefix + "groupid", kafkaSpoutConfig.getConsumerGroupId()); for (Entry<String, Object> conf: kafkaSpoutConfig.getKafkaProps().entrySet()) { if (conf.getValue() != null && isPrimitiveOrWrapper(conf.getValue().getClass())) { configuration.put(configKeyPrefix + conf.getKey(), conf.getValue()); } else { LOG.debug("Dropping Kafka prop '{}' from component configuration", conf.getKey()); } } return configuration; }
Source:
private String attributeKeyFrom(String key) { if (key.startsWith(EXTENDED_ATTRIBUTE_PREFIX)) { key = key.replace(EXTENDED_ATTRIBUTE_PREFIX, ""); } String formattedAttribute = Stream.of(key.split("\\.")) .map(part -> part.replaceAll("-", " ")) .collect(Collectors.joining(" ")); return WordUtils.capitalize(formattedAttribute); }

Target:
private String attributeKeyFrom(String key) { if (key.startsWith(EXTENDED_ATTRIBUTE_PREFIX)) { key = key.replaceFirst(EXTENDED_ATTRIBUTE_PREFIX, ""); } String formattedAttribute = Stream.of(key.split("\\.")) .map(part -> part.replaceAll("-", " ")) .collect(Collectors.joining(" ")); return WordUtils.capitalize(formattedAttribute); }
Source:
private NodePair findPair(T value) { while (true) { boolean list_is_clean = true; Node crnt = head.getReference(), prev = null; AtomicMarkableReference<Node> ref = head; while (null != crnt) { if (ref.isMarked()) { list_is_clean = false; AtomicMarkableReference<Node> crnt_next = crnt.next; if (ref.compareAndSet(crnt, crnt_next.getReference(), true, crnt_next.isMarked())) { crnt = crnt_next.getReference(); continue; } } if (crnt.value.compareTo(value) <= 0 && !ref.isMarked()) return new NodePair(crnt, prev); ref = crnt.next; prev = crnt; crnt = crnt.next.getReference(); } if (list_is_clean) return new NodePair(null, prev); } }

Target:
private NodePair findPair(T value) { again: while (true) { Node crnt = head.getReference(), prev = null; AtomicMarkableReference<Node> ref = head; while (null != crnt) { if (ref.isMarked()) { AtomicMarkableReference<Node> crnt_next = crnt.next; if (ref.compareAndSet(crnt, crnt_next.getReference(), true, crnt_next.isMarked())) { crnt = crnt_next.getReference(); continue; } else continue again; } if (crnt.value.compareTo(value) <= 0 && !ref.isMarked()) return new NodePair(crnt, prev); ref = crnt.next; prev = crnt; crnt = crnt.next.getReference(); } return new NodePair(null, prev); } }
Source:
public Path getPath(String first, String... more) { if (Strings.isEmpty(first)) { return new BridgePath(vfs.root(), this); } return null; }

Target:
public Path getPath(String first, String... more) { if (Strings.isEmpty(first)) { return new BridgePath(virtualFileSystem.root(), this); } throw new IllegalArgumentException(Strings.apply( "A non root directory was requested in BridgeFileSystem.getPath: %s - %s", first, Strings.join(",", more))); }
Source:
private void deleteProcessTempFiles(IProcess process) { if (process.getAttribute(ATTR_LAUNCH_TEMP_FILES) == null) { return; } Arrays.stream(process.getAttribute(ATTR_LAUNCH_TEMP_FILES).split(File.pathSeparator)).map(path -> new File(path)).forEach(file -> file.delete()); }

Target:
private void deleteProcessTempFiles(IProcess process) { String tempFiles = process.getAttribute(ATTR_LAUNCH_TEMP_FILES); if (tempFiles == null) { return; } Arrays.stream(tempFiles.split(File.pathSeparator)).map(path -> new File(path)).forEach(file -> file.delete()); }
Source:
public void init(ProcessingContext context, ProcessingComponentConfiguration config) throws IOException { super.init(context, config); slingRequest = context.getRequest(); String[] selectors = slingRequest.getRequestPathInfo().getSelectors(); if (selectors.length > 0) { enabled = Arrays.asList(selectors).contains(SELECTOR); if (enabled) { log.info("Inlining Stylesheet references for {}", slingRequest.getRequestURL().toString()); } } }

Target:
public void init(ProcessingContext context, ProcessingComponentConfiguration config) throws IOException { super.init(context, config); slingRequest = context.getRequest(); log.debug("Inlining Stylesheet references for {}", slingRequest.getRequestURL().toString()); }
Source:
private static void loadExtensions(ModuleService moduleService, Map<String, Object> argMap) { ExtensionsManager extensionsManager = new ExtensionsManager(); Map<String, ExtensionProxy> proxies = moduleService.getContext().get(Base.GlobalContextKeys.EXTENSIONS_MAP); List<File> files; Object extensionFile = argMap.get("extension-file"); if(extensionFile != null) { if(extensionFile instanceof List) { files = (List<File>) argMap.get("extension-file"); } else { files = new ArrayList<>(); files.add((File)extensionFile); } } else { files = listFiles((String)argMap.get("extensions-dir"), "properties"); } for(File f : files) { String proxy = extensionsManager.load(f); proxies.put(proxy, extensionsManager.getExtensionByName(proxy)); } for(String proxy : proxies.keySet()) { extensionsManager.initialize(proxy); } }

Target:
private static void loadExtensions(ModuleService moduleService, Map<String, Object> argMap) { ExtensionsManager extensionsManager = new ExtensionsManager(); Map<String, ExtensionProxy> proxies = moduleService.getContext().get(ModuleService.EXTENSIONS_MAP); List<File> files = (List<File>)argMap.get("extension-file"); if(files == null) { files = listFiles((String)argMap.get("extensions-dir"), "properties"); } for(File f : files) { String proxy = extensionsManager.load(f); proxies.put(proxy, extensionsManager.getExtensionByName(proxy)); } for(String proxy : proxies.keySet()) { extensionsManager.initialize(proxy); } }
Source:
void performSubmit(Request request) { BitmapHunter hunter = hunterMap.get(request.getKey()); if (hunter == null) { hunter = BitmapHunter.forRequest(context, request.getPicasso(), this, request, downloader); hunter.attach(request); Bitmap cache = loadFromCache(request); if (cache != null) { hunter.loadedFrom = MEMORY; performComplete(hunter); return; } hunterMap.put(request.getKey(), hunter); hunter.future = service.submit(hunter); } else { hunter.attach(request); } }

Target:
void performSubmit(Request request) { BitmapHunter hunter = hunterMap.get(request.getKey()); if (hunter != null) { hunter.attach(request); return; } hunter = BitmapHunter.forRequest(context, request.getPicasso(), this, request, downloader); Bitmap cached = loadFromCache(request); if (cached != null) { hunter.loadedFrom = MEMORY; hunter.result = cached; performComplete(hunter); return; } hunterMap.put(request.getKey(), hunter); hunter.future = service.submit(hunter); }
Source:
private void initBreakpointOrganizers(IMemento memento) { if (memento != null) { IMemento node = memento.getChild(IDebugUIConstants.EXTENSION_POINT_BREAKPOINT_ORGANIZERS); if (node == null) { fOrganizers = null; } else { String value = node.getString(KEY_VALUE); if (value != null) { BreakpointOrganizerManager manager = BreakpointOrganizerManager.getDefault(); List<IBreakpointOrganizer> organziers = new ArrayList<>(); for (String id : value.split(",")) { IBreakpointOrganizer organizer = manager.getOrganizer(id); if (organizer != null) { organziers.add(organizer); } } fOrganizers = organziers.toArray(new IBreakpointOrganizer[organziers.size()]); for (IBreakpointOrganizer fOrganizer : organziers) { fOrganizer.addPropertyChangeListener(this); } } } } }

Target:
private void initBreakpointOrganizers(IMemento memento) { if (memento != null) { IMemento node = memento.getChild(IDebugUIConstants.EXTENSION_POINT_BREAKPOINT_ORGANIZERS); if (node == null) { fOrganizers = null; } else { String value = node.getString(KEY_VALUE); if (value != null) { BreakpointOrganizerManager manager = BreakpointOrganizerManager.getDefault(); List<IBreakpointOrganizer> organziers = new ArrayList<>(); for (String id : value.split(",")) { IBreakpointOrganizer organizer = manager.getOrganizer(id); if (organizer != null) { organziers.add(organizer); } } fOrganizers = organziers.toArray(new IBreakpointOrganizer[organziers.size()]); for (IBreakpointOrganizer organizer : organziers) { organizer.addPropertyChangeListener(this); } } } } }
Source:
public ApiResponse handleApiView(String name, JSONObject params) throws ApiException { ApiResponse result; switch (name) { case VIEW_RULE_CONFIG_VALUE: RuleConfig rc = extension.getRuleConfig(params.getString(PARAM_KEY)); if (rc != null) { result = new ApiResponseElement(name, rc.getValue()); } else { throw new ApiException(ApiException.Type.DOES_NOT_EXIST); } break; case VIEW_ALL_RULE_CONFIGS: List<RuleConfig> allRules = extension.getAllRuleConfigs(); ApiResponseList resultList = new ApiResponseList(name); for (RuleConfig rc2 : allRules) { Map<String, String> map = new HashMap<>(); map.put("key", String.valueOf(rc2.getKey())); map.put("defaultValue", rc2.getDefaultValue()); map.put("value", String.valueOf(rc2.getValue())); if (Constant.messages.containsKey(rc2.getKey())) { map.put("description", Constant.messages.getString(rc2.getKey())); } resultList.addItem(new ApiResponseSet("ruleConfig", map)); } result = resultList; break; default: throw new ApiException(ApiException.Type.BAD_VIEW); } return result; }

Target:
public ApiResponse handleApiView(String name, JSONObject params) throws ApiException { ApiResponse result; switch (name) { case VIEW_RULE_CONFIG_VALUE: RuleConfig rc = extension.getRuleConfig(params.getString(PARAM_KEY)); if (rc != null) { result = new ApiResponseElement(name, rc.getValue()); } else { throw new ApiException(ApiException.Type.DOES_NOT_EXIST, PARAM_KEY); } break; case VIEW_ALL_RULE_CONFIGS: List<RuleConfig> allRules = extension.getAllRuleConfigs(); ApiResponseList resultList = new ApiResponseList(name); for (RuleConfig rc2 : allRules) { Map<String, String> map = new HashMap<>(); map.put("key", String.valueOf(rc2.getKey())); map.put("defaultValue", rc2.getDefaultValue()); map.put("value", String.valueOf(rc2.getValue())); if (Constant.messages.containsKey(rc2.getKey())) { map.put("description", Constant.messages.getString(rc2.getKey())); } resultList.addItem(new ApiResponseSet("ruleConfig", map)); } result = resultList; break; default: throw new ApiException(ApiException.Type.BAD_VIEW); } return result; }
Source:
protected void assertComponentModelUsesDefaultOnSameValue(AbstractWComponent wComponent, String method, Object userContextValue, Object setterArgs[]) { wComponent.setLocked(false); invokeSetMethod(wComponent, method, userContextValue, setterArgs); ComponentModel shared = wComponent.getDefaultModel(); wComponent.setLocked(true); ComponentModel model = wComponent.getOrCreateComponentModel(); org.junit.Assert.assertSame(model, shared); setActiveContext(createUIContext()); invokeSetMethod(wComponent, method, userContextValue, setterArgs); model = wComponent.getOrCreateComponentModel(); org.junit.Assert.assertEquals(shared, model); resetContext(); }

Target:
private void assertComponentModelUsesDefaultOnSameValue(AbstractWComponent wComponent, String method, Object userContextValue, Object setterArgs[]) { wComponent.setLocked(false); invokeSetMethod(wComponent, method, userContextValue, setterArgs); ComponentModel shared = wComponent.getDefaultModel(); wComponent.setLocked(true); ComponentModel model = wComponent.getComponentModel(); org.junit.Assert.assertSame(model, shared); setActiveContext(createUIContext()); invokeSetMethod(wComponent, method, userContextValue, setterArgs); model = wComponent.getComponentModel(); org.junit.Assert.assertSame(shared, model); resetContext(); }
Source:
public void removeSubscriptions(String id) { final String ecql = queryId(id); LOCK.lock(); try { persistentStore.delete(SubscriptionsPersistentStore.SUBSCRIPTIONS_TYPE, ecql, 0, 1000); } catch (PersistenceException e) { LOGGER.warn("Could not delete subscriptions for query {}", ecql, e); } finally { LOCK.unlock(); } }

Target:
public void removeSubscriptions(String id) { final String ecql = queryId(id); LOCK.lock(); try { persistentStore.delete(SUBSCRIPTIONS_TYPE, ecql, START_INDEX, PAGE_SIZE); } catch (PersistenceException e) { LOGGER.debug("Could not delete subscriptions for query {}", ecql, e); } finally { LOCK.unlock(); } }
Source:
private TypeVariableName(String name, List<TypeName> bounds, List<AnnotationSpec> annotations) { super(annotations); this.name = checkNotNull(name, "name == null"); this.bounds = bounds; this.boundsHashCode = bounds.hashCode(); for (TypeName bound : this.bounds) { checkArgument(!bound.isPrimitive() && bound != VOID, "invalid bound: %s", bound); } }

Target:
private TypeVariableName(String name, List<TypeName> bounds, List<AnnotationSpec> annotations) { super(annotations); this.name = checkNotNull(name, "name == null"); this.bounds = bounds; this.hashCode = name.hashCode() ^ bounds.hashCode(); for (TypeName bound : this.bounds) { checkArgument(!bound.isPrimitive() && bound != VOID, "invalid bound: %s", bound); } }
Source:
public void setUpAuthorization() { if (!isHostAvailable()) { showError(hostEdit, R.string.error_empty); return; } if (isPortAvailable() && !isPortCorrect()) { showError(portEdit, R.string.error_authorization_port); return; } Intent login_activity = new Intent(getApplicationContext(), LoginActivity.class); login_activity.putExtra("host", getHost().toString()); login_activity.putExtra("port", getPort().toString()); startActivity(login_activity); finish(); }

Target:
public void setUpAuthorization() { if (!isHostAvailable()) { showError(hostEdit, R.string.error_empty); return; } if (isPortAvailable() && !isPortCorrect()) { showError(portEdit, R.string.error_authorization_port); return; } setUpBackendAuthorization(); }
Source:
@Override public SqlMonotonicity getMonotonicity(SqlOperatorBinding call) { if (call.getOperandCount() == 3) { final SqlMonotonicity mono0 = call.getOperandMonotonicity(0); if ((mono0 != SqlMonotonicity.NOT_MONOTONIC) && call.getOperandMonotonicity(1) == SqlMonotonicity.CONSTANT && ((call.isOperandNull(1, true)) || call.getOperandLiteralValue(1, BigDecimal.class) .equals(BigDecimal.ZERO)) && call.getOperandMonotonicity(2) == SqlMonotonicity.CONSTANT) { return mono0.unstrict(); } } return super.getMonotonicity(call); }

Target:
@Override public SqlMonotonicity getMonotonicity(SqlOperatorBinding call) { if (call.getOperandCount() == 3) { final SqlMonotonicity mono0 = call.getOperandMonotonicity(0); if ((mono0 != SqlMonotonicity.NOT_MONOTONIC) && call.getOperandMonotonicity(1) == SqlMonotonicity.CONSTANT && call.getOperandMonotonicity(2) == SqlMonotonicity.CONSTANT) { if (call.isOperandNull(1, true)) { return SqlMonotonicity.CONSTANT; } if (call.getOperandLiteralValue(1, BigDecimal.class) .equals(BigDecimal.ZERO)) { return mono0.unstrict(); } } } return super.getMonotonicity(call); }
Source:
public void setUp() throws Exception { super.setUp(); loc = (JcloudsLocation) mgmt.getLocationRegistry().resolve(LOCATION_SPEC); executor = MoreExecutors.listeningDecorator(Executors.newCachedThreadPool()); }

Target:
public void setUp() throws Exception { super.setUp(); loc = (JcloudsLocation) mgmt.getLocationRegistry().resolve(LOCATION_SPEC); }
Source:
public static ApiTemplate fromJSON(JsonNode json) { ApiTemplate template = new ApiTemplate(); final JsonNode params = json.get("params"); for (String paramName: IteratorUtils.asIterable(params.fieldNames())) { if (template.fixedParams.containsKey(paramName) || template.inputVars.containsKey(paramName)) { throw new IllegalArgumentException( "Repeated input parameter " + paramName); } JsonNode value = params.get(paramName); if (value.isValueNode()) { template.fixedParams.put(paramName, value.asText()); continue; } if (value.has("default")) { template.inputVars.put(paramName, value.get("default").asText()); } else { template.inputVars.put(paramName, null); } } final JsonNode output = json.get("output"); template.items = output.get("items").asText(); final JsonNode vars = output.get("vars"); for (String paramName: IteratorUtils.asIterable(vars.fieldNames())) { if (template.inputVars.containsKey(paramName)) { throw new IllegalArgumentException("Parameter " + paramName + " declared as both input and output"); } template.outputVars.put(paramName, vars.get(paramName).asText()); } return template; }

Target:
public static ApiTemplate fromJSON(JsonNode json) { ApiTemplate template = new ApiTemplate(); final JsonNode params = json.get("params"); Preconditions.checkNotNull(params, "Missing params node"); params.fieldNames().forEachRemaining(paramName -> { if (template.fixedParams.containsKey(paramName) || template.inputVars.containsKey(paramName)) { throw new IllegalArgumentException( "Repeated input parameter " + paramName); } JsonNode value = params.get(paramName); if (value.isValueNode()) { template.fixedParams.put(paramName, value.asText()); return; } if (value.has("default")) { template.inputVars.put(paramName, value.get("default").asText()); } else { template.inputVars.put(paramName, null); } }); final JsonNode output = json.get("output"); Preconditions.checkNotNull(params, "Missing output node"); template.items = output.get("items").asText(); final JsonNode vars = output.get("vars"); Preconditions.checkNotNull(vars, "Missing vars node"); vars.fieldNames().forEachRemaining(paramName -> { if (template.inputVars.containsKey(paramName)) { throw new IllegalArgumentException("Parameter " + paramName + " declared as both input and output"); } template.outputVars.put(paramName, vars.get(paramName).asText()); }); return template; }
Source:
public SanctuaryBlade(UUID ownerId, CardSetInfo setInfo) { super(ownerId, setInfo, new CardType[]{CardType.ARTIFACT}, "{2}"); this.subtype.add(SubType.EQUIPMENT); GainProtectionFromColorAttachedEffect protectionEffect = new GainProtectionFromColorAttachedEffect(Duration.WhileOnBattlefield); this.addAbility(new AttachedToCreatureTriggeredAbility(protectionEffect, false)); Effect boostEffect = new BoostEquippedEffect(2, 0); this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, boostEffect)); this.addAbility(new EquipAbility(Outcome.BoostCreature, new GenericManaCost(3))); }

Target:
public SanctuaryBlade(UUID ownerId, CardSetInfo setInfo) { super(ownerId, setInfo, new CardType[]{CardType.ARTIFACT}, "{2}"); this.subtype.add(SubType.EQUIPMENT); this.addAbility(new AttachedToCreatureSourceTriggeredAbility(new ChooseColorEffect(Outcome.Benefit), false)); Effect boostEffect = new BoostEquippedEffect(2, 0); boostEffect.concatBy("."); SimpleStaticAbility ability = new SimpleStaticAbility(Zone.BATTLEFIELD, boostEffect); ProtectionChosenColorAttachedEffect protectionEfect = new ProtectionChosenColorAttachedEffect(false); protectionEfect.setText("and has protection from the last chosen color."); ability.addEffect(protectionEfect); this.addAbility(ability); this.addAbility(new EquipAbility(Outcome.BoostCreature, new GenericManaCost(3))); }
Source:
public JSONArray getCascadedJSONRules() { InputStream is = null; BufferedReader bufferedReader = null; try { WMSLayerInfo wmsLayerInfo = (WMSLayerInfo) getLayerInfo().getResource(); StyleInfo defaultRemoteStyle = getLayerInfo().getDefaultStyle(); if (defaultRemoteStyle.getName().isEmpty() || defaultRemoteStyle.getLegend() == null) return null; HTTPClient client = wmsLayerInfo.getStore().getWebMapServer(null).getHTTPClient(); HTTPResponse jsonResponse = client.get(new URL(super.getLegendInfo().getOnlineResource())); is = jsonResponse.getResponseStream(); bufferedReader = new BufferedReader(new InputStreamReader(is, Charset.forName("UTF-8"))); StringBuilder sb = new StringBuilder(); int cp; while ((cp = bufferedReader.read()) != -1) { sb.append((char) cp); } String jsonText = sb.toString(); LOGGER.fine("Cascaded GetLegend Request JSON Response: " + jsonText); JSONObject jsonLegend = JSONObject.fromObject(jsonText); JSONArray layerLegends = jsonLegend.getJSONArray(JSONLegendGraphicBuilder.LEGEND); JSONArray cascadedRules = layerLegends.getJSONObject(0).getJSONArray(JSONLegendGraphicBuilder.RULES); return cascadedRules; } catch (Exception e) { LOGGER.log(Level.SEVERE, e.getMessage(), e); throw new RuntimeException(e); } finally { IOUtils.closeQuietly(bufferedReader); IOUtils.closeQuietly(is); } }

Target:
public JSONArray getCascadedJSONRules() { InputStream is = null; BufferedReader bufferedReader = null; try { WMSLayerInfo wmsLayerInfo = (WMSLayerInfo) getLayerInfo().getResource(); StyleInfo defaultRemoteStyle = getLayerInfo().getDefaultStyle(); if (defaultRemoteStyle == WMSLayerInfoImpl.DEFAULT_ON_REMOTE) return null; HTTPClient client = wmsLayerInfo.getStore().getWebMapServer(null).getHTTPClient(); HTTPResponse jsonResponse = client.get(new URL(super.getLegendInfo().getOnlineResource())); is = jsonResponse.getResponseStream(); bufferedReader = new BufferedReader(new InputStreamReader(is, Charset.forName("UTF-8"))); StringBuilder sb = new StringBuilder(); int cp; while ((cp = bufferedReader.read()) != -1) { sb.append((char) cp); } String jsonText = sb.toString(); LOGGER.fine("Cascaded GetLegend Request JSON Response: " + jsonText); JSONObject jsonLegend = JSONObject.fromObject(jsonText); JSONArray layerLegends = jsonLegend.getJSONArray(JSONLegendGraphicBuilder.LEGEND); JSONArray cascadedRules = layerLegends.getJSONObject(0).getJSONArray(JSONLegendGraphicBuilder.RULES); return cascadedRules; } catch (Exception e) { throw new org.geoserver.platform.ServiceException("Unable to cascade Legend"); } finally { IOUtils.closeQuietly(bufferedReader); IOUtils.closeQuietly(is); } }
Source:
public void search( @RequestParam(value = QUERY_PARAM, required = false) String query, HttpServletRequest request, HttpServletResponse response ) throws IOException { ResponseWriter writer = null; try { writer = writerResolver.writerFor(request, response); paramChecker.checkParameters(request); List<NamedParameter<?>> parameters = parse(request); SearchQuery.Builder queryBuilder; if (Strings.isNullOrEmpty(query)) { queryBuilder = SearchQuery.builder(); } else { queryBuilder = SearchQuery.getDefaultQuerySearcher(query); } for (NamedParameter<?> parameter : parameters) { if (parameter instanceof SearchParameter) { queryBuilder.addSearcher((SearchParameter)parameter); } else { queryBuilder.addFilter((FilterParameter<?>)parameter); } } Selection selection = selectionBuilder.build(request); SearchQuery searchQuery = queryBuilder .withLimit(selection.getLimit()) .withOffset(selection.getOffset()) .build(); QueryContext queryContext = QueryContext.create( applicationFetcher.applicationFor(request) .orElseThrow(InvalidParameterException::new), annotationsExtractor.extractFromSingleRequest(request), request ); QueryResult<Content> contentResult = searcher.search(searchQuery, queryContext); resultWriter.write(contentResult, writer); } catch (Exception e) { log.error("Request exception " + request.getRequestURI(), e); ErrorSummary summary = ErrorSummary.forException(e); new ErrorResultWriter().write(summary, writer, request, response); } }

Target:
public void search( @RequestParam(value = QUERY_PARAM, required = false) String query, HttpServletRequest request, HttpServletResponse response ) throws IOException { ResponseWriter writer = null; try { writer = writerResolver.writerFor(request, response); paramChecker.checkParameters(request); List<NamedParameter<?>> parameters = parse(request); SearchQuery.Builder queryBuilder; if (Strings.isNullOrEmpty(query)) { queryBuilder = SearchQuery.builder(); } else { queryBuilder = SearchQuery.getDefaultQuerySearcher(query); } for (NamedParameter<?> parameter : parameters) { if (parameter instanceof SearchParameter) { queryBuilder.addSearcher((SearchParameter)parameter); } else if (parameter instanceof FilterParameter) { queryBuilder.addFilter((FilterParameter<?>)parameter); } } Selection selection = selectionBuilder.build(request); SearchQuery searchQuery = queryBuilder .withLimit(selection.getLimit()) .withOffset(selection.getOffset()) .build(); QueryContext queryContext = QueryContext.create( applicationFetcher.applicationFor(request).orElse(DefaultApplication.create()), annotationsExtractor.extractFromSingleRequest(request), request ); QueryResult<Content> contentResult = searcher.search(searchQuery, queryContext); resultWriter.write(contentResult, writer); } catch (Exception e) { log.error("Request exception " + request.getRequestURI(), e); ErrorSummary summary = ErrorSummary.forException(e); new ErrorResultWriter().write(summary, writer, request, response); } }
Source:
public void authorizeEventTypeUpdate(final EventType eventType) throws ForbiddenAccessException, ServiceTemporaryUnavailableException { if (eventType.getAuthorization() == null) { return; } final Resource resource = new EventTypeResource("/event-type", "event-type", Collections.singletonMap(AuthorizationService.Operation.ADMIN, eventType.getAuthorization().getAdmins())); try { if (!authorizationService.isAuthorized(null, AuthorizationService.Operation.ADMIN, resource)) { throw new ForbiddenAccessException("Updating the `EventType` is only allowed for clients that " + "satisfy the authorization `admin` requirements"); } } catch (final PluginException e) { throw new ServiceTemporaryUnavailableException("Error calling authorization plugin", e); } }

Target:
public void authorizeEventTypeUpdate(final EventType eventType) throws ForbiddenAccessException, ServiceTemporarilyUnavailableException { if (eventType.getAuthorization() == null) { return; } final Resource resource = new EventTypeResource(eventType.getName(), "event-type", Collections.singletonMap(AuthorizationService.Operation.ADMIN, eventType.getAuthorization().getAdmins())); try { if (!authorizationService.isAuthorized(null, AuthorizationService.Operation.ADMIN, resource)) { throw new ForbiddenAccessException("Updating the `EventType` is only allowed for clients that " + "satisfy the authorization `admin` requirements"); } } catch (final PluginException e) { throw new ServiceTemporarilyUnavailableException("Error calling authorization plugin", e); } }
Source:
public String toString() { ToStringHelper helper = toStringHelper(this) .add("clientId", clientId) .add("name", name) .add("hiveType", hiveType) .add("hiveColumnIndex", hiveColumnIndex) .add("columnType", columnType); comment.ifPresent(comment -> helper.add("comment", comment)); return helper.toString(); }

Target:
public String toString() { return toStringHelper(this) .add("clientId", clientId) .add("name", name) .add("hiveType", hiveType) .add("hiveColumnIndex", hiveColumnIndex) .add("columnType", columnType) .add("comment", comment.orElse(null)) .omitNullValues() .toString(); }