auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
Set<Integer> extractGidsFromObservations(final String gidLabel, final List<MeasurementRow> observations) { Set<Integer> gids = new HashSet<>(); for (MeasurementRow observationRow : observations) { String gidString = observationRow.getMeasurementDataValue(gidLabel); if (StringUtils.isNotBlank(gidString)) { gids.add(Integer.valueOf(gidString)); } } return gids; }

Target:
Set<Integer> extractGidsFromObservations(final String gidLabel, final List<MeasurementRow> observations) { final Set<Integer> gids = new HashSet<>(); for (final MeasurementRow observationRow : observations) { final String gidString = observationRow.getMeasurementDataValue(gidLabel); if (StringUtils.isNotBlank(gidString) && StringUtils.isNumeric(gidString)) { gids.add(Integer.valueOf(gidString)); } } return gids; }
Source:
public NotAnInputTypeError(TypeDefinition typeDefinition) { super(typeDefinition, format("The %s type is used as an InputType, but is not declared as one", typeDefinition.getName())); }

Target:
public NotAnInputTypeError(TypeDefinition typeDefinition) { super(typeDefinition, format("expected InputType, but found %s type", typeDefinition.getName())); }
Source:
public Map<String,String> validateLiterals(Map<String, List<Literal>> varNamesToValues){ HashMap<String,String> errors = new HashMap<String,String>(); for( String name : editConfig.getLiteralsOnForm() ){ List<Literal> literals = varNamesToValues.get(name); List<String>validations = varsToValidations.get(name); if( validations != null ){ boolean isRequiredField = validations.contains("nonempty"); for( String validationType : validations){ String value = null; StringBuilder validateMsg = null; if((literals == null || literals.size() == 0) && isRequiredField) { errors.put(name, i18n.text("required_field_empty_msg")); break; } if(literals != null) { for(Literal literal: literals) { try{ if( literal != null ){ value = literal.getString(); } }catch(Throwable th){ log.debug("could not convert literal to string" , th); } if (isEmpty(value)) { if (isRequiredField) { errors.put(name, i18n.text("required_field_empty_msg")); } break; } String thisValidateMsg = validate(validationType,value); if (thisValidateMsg != null) { if (validateMsg != null) { validateMsg.append(", ").append(thisValidateMsg); } else { validateMsg = new StringBuilder(thisValidateMsg); } } } } if( validateMsg != null) { errors.put(name, validateMsg.toString()); } } } } return errors; }

Target:
public Map<String,String> validateLiterals(Map<String, List<Literal>> varNamesToValues){ HashMap<String,String> errors = new HashMap<String,String>(); for( String name : editConfig.getLiteralsOnForm() ){ List<Literal> literals = varNamesToValues.get(name); List<String>validations = varsToValidations.get(name); if( validations != null ){ boolean isRequiredField = validations.contains("nonempty"); for( String validationType : validations){ String value = null; StringBuilder validateMsg = null; if((literals == null || literals.size() == 0) && isRequiredField) { errors.put(name, i18n.text(REQUIRED_FIELD_EMPTY_MSG)); break; } if(literals != null) { for(Literal literal: literals) { try{ if( literal != null ){ value = literal.getString(); } }catch(Throwable th){ log.debug("could not convert literal to string" , th); } if (isEmpty(value)) { if (isRequiredField) { errors.put(name, i18n.text(REQUIRED_FIELD_EMPTY_MSG)); } break; } String thisValidateMsg = validate(validationType,value); if (thisValidateMsg != null) { if (validateMsg != null) { validateMsg.append(", ").append(thisValidateMsg); } else { validateMsg = new StringBuilder(thisValidateMsg); } } } } if( validateMsg != null) { errors.put(name, validateMsg.toString()); } } } } return errors; }
Source:
private List<GerritQueryResult> executeQueryRest(String query) { List<GerritQueryResult> results = null; try { results = client.executeQueryRest(new NullProgressMonitor(), query); } catch (GerritException e) { results = null; } return results; }

Target:
private List<GerritQueryResult> executeQueryRest(String query) throws GerritException { List<GerritQueryResult> results = null; results = client.executeQueryRest(new NullProgressMonitor(), query); return results; }
Source:
public void run() { String smsg = null; try { m_consumer.subscribe(Arrays.asList(m_config.topic)); while (!m_closed.get()) { ConsumerRecords<byte[], byte[]> records = m_consumer.poll(1000); for (ConsumerRecord<byte[], byte[]> record : records) { byte[] msg = record.value(); long offset = record.offset(); smsg = new String(msg); Object params[]; if (m_formatter != null) { try { params = m_formatter.transform(ByteBuffer.wrap(msg)); } catch (FormatException badMsg) { m_log.warn("Failed to transform message " + smsg + " at offset " + offset + ", error message: " + badMsg.getMessage()); continue; } } else { params = m_csvParser.parseLine(smsg); } if (params == null) continue; m_loader.insertRow(new RowWithMetaData(smsg, offset), params); } } } catch (IllegalArgumentException invalidTopic) { m_closed.set(true); m_log.error("Failed subscribing to the topic " + m_config.topic, invalidTopic); } catch (WakeupException wakeup) { m_closed.set(true); m_log.debug("Consumer signalled to terminate ", wakeup); } catch (IOException ioExcp) { m_closed.set(true); if (m_formatter == null) { m_log.error("Failed to parse message" + smsg); } else { m_log.error("Error seen when processing message ", ioExcp); } } catch (Throwable terminate) { m_closed.set(true); m_log.error("Error seen during poll", terminate); } finally { try { m_consumer.close(); } catch (Exception ignore) notifyShutdown(); } }

Target:
public void run() { String smsg = null; try { m_consumer.subscribe(Arrays.asList(m_config.topic)); while (!m_closed.get()) { ConsumerRecords<byte[], byte[]> records = m_consumer.poll(pollTimedWaitInMilliSec); for (ConsumerRecord<byte[], byte[]> record : records) { byte[] msg = record.value(); long offset = record.offset(); smsg = new String(msg); Object params[]; if (m_formatter != null) { try { params = m_formatter.transform(ByteBuffer.wrap(msg)); } catch (FormatException badMsg) { m_log.warn("Failed to transform message " + smsg + " at offset " + offset + ", error message: " + badMsg.getMessage()); continue; } } else { params = m_csvParser.parseLine(smsg); } if (params == null) continue; m_loader.insertRow(new RowWithMetaData(smsg, offset), params); } } } catch (IllegalArgumentException invalidTopic) { m_closed.set(true); m_log.error("Failed subscribing to the topic " + m_config.topic, invalidTopic); } catch (WakeupException wakeup) { m_closed.set(true); m_log.debug("Consumer signalled to terminate ", wakeup); } catch (IOException ioExcp) { m_closed.set(true); if (m_formatter == null) { m_log.error("Failed to parse message" + smsg); } else { m_log.error("Error seen when processing message ", ioExcp); } } catch (Throwable terminate) { m_closed.set(true); m_log.error("Error seen during poll", terminate); } finally { try { m_consumer.close(); } catch (Exception ignore) notifyShutdown(); } }
Source:
protected void okPressed() { String sessionPath = fFileNameCombo.getText(); if (!"".equals(sessionPath)) { saveWidgetValues(); ImmutableList.Builder<String> builder = new ImmutableList.Builder<>(); try (BufferedRandomAccessFile rafile = new BufferedRandomAccessFile(sessionPath, "r")) { String line = rafile.getNextLine(); while (line != null) { builder.add(line); line = rafile.getNextLine(); } } catch (IOException e) { return; } fCommands = builder.build(); super.okPressed(); } }

Target:
protected void okPressed() { String sessionPath = fFileNameCombo.getText(); if (!"".equals(sessionPath)) { ImmutableList.Builder<String> builder = new ImmutableList.Builder<>(); try (BufferedRandomAccessFile rafile = new BufferedRandomAccessFile(sessionPath, "r")) { String line = rafile.getNextLine(); while (line != null) { builder.add(line); line = rafile.getNextLine(); } } catch (IOException e) { ErrorDialog.openError(getShell(), null, null, new Status(IStatus.ERROR, Activator.PLUGIN_ID, IStatus.ERROR, e.getLocalizedMessage(), e)); return; } saveWidgetValues(); fCommands = builder.build(); super.okPressed(); } }
Source:
public void beginTraining() { String trainingFilesUrl = "{SAS-URL-of-your-container-in-blob-storage}"; boolean useTrainingLabels = true; formTrainingAsyncClient.beginTraining(trainingFilesUrl, useTrainingLabels) .subscribe(trainingPollingOperation -> { trainingPollingOperation.getFinalResult().subscribe(customFormModel -> { System.out.printf("Model Id: %s%n", customFormModel.getModelId()); System.out.printf("Model Status: %s%n", customFormModel.getModelStatus()); customFormModel.getSubmodels() .forEach(customFormSubmodel -> customFormSubmodel.getFields() .forEach((key, customFormModelField) -> System.out.printf("Form type: %s Field Text: %s Field Accuracy: %f%n", key, customFormModelField.getName(), customFormModelField.getAccuracy()))); }); }); END: com.azure.ai.formrecognizer.training.FormTrainingAsyncClient.beginTraining#string-boolean }

Target:
public void beginTraining() { String trainingFilesUrl = "{SAS-URL-of-your-container-in-blob-storage}"; boolean useTrainingLabels = true; formTrainingAsyncClient.beginTraining(trainingFilesUrl, useTrainingLabels) .flatMap(AsyncPollResponse::getFinalResult) .subscribe(customFormModel -> { System.out.printf("Model Id: %s%n", customFormModel.getModelId()); System.out.printf("Model Status: %s%n", customFormModel.getModelStatus()); customFormModel.getSubmodels() .forEach(customFormSubmodel -> customFormSubmodel.getFields() .forEach((key, customFormModelField) -> System.out.printf("Form type: %s Field Text: %s Field Accuracy: %f%n", key, customFormModelField.getName(), customFormModelField.getAccuracy()))); }); END: com.azure.ai.formrecognizer.training.FormTrainingAsyncClient.beginTraining#string-boolean }
Source:
protected void updateAttributesInfo(Collection<DynamicMetric<?, ?>> dynamicMetrics, String description) { if (dynamicMetrics == null || dynamicMetrics.isEmpty()) { _logger.warn("Cannot update attributes info because dynamicMetrics is null or empty."); } List<MBeanAttributeInfo> attributeInfoList = new ArrayList<>(); Map<String, DynamicMetric> newAttributeMap = new HashMap<>(); for (DynamicMetric dynamicMetric : dynamicMetrics) { Iterator<MBeanAttributeInfo> iter = dynamicMetric.getAttributeInfos().iterator(); while (iter.hasNext()) { MBeanAttributeInfo attributeInfo = iter.next(); attributeInfoList.add(attributeInfo); newAttributeMap.put(attributeInfo.getName(), dynamicMetric); } } attributeInfoList.add(new MBeanAttributeInfo(SENSOR_NAME_TAG, String.class.getName(), "The name of the metric sensor", true, false, false)); MBeanConstructorInfo constructorInfo = new MBeanConstructorInfo( String.format("Default %s Constructor", getClass().getSimpleName()), getClass().getConstructors()[0]); MBeanAttributeInfo[] attributesInfo = new MBeanAttributeInfo[attributeInfoList.size()]; attributesInfo = attributeInfoList.toArray(attributesInfo); if (description == null) { description = DEFAULT_DESCRIPTION; } _mBeanInfo = new MBeanInfo(getClass().getName(), description, attributesInfo, new MBeanConstructorInfo[]{constructorInfo}, new MBeanOperationInfo[0], new MBeanNotificationInfo[0]); _attributeMap = newAttributeMap; }

Target:
protected void updateAttributesInfo(Collection<DynamicMetric<?, ?>> dynamicMetrics, String description) { if (dynamicMetrics == null) { _logger.warn("Cannot update attributes info because dynamicMetrics is null."); return; } List<MBeanAttributeInfo> attributeInfoList = new ArrayList<>(); Map<String, DynamicMetric> newAttributeMap = new HashMap<>(); for (DynamicMetric<?, ?> dynamicMetric : dynamicMetrics) { for (MBeanAttributeInfo attributeInfo : dynamicMetric.getAttributeInfos()) { attributeInfoList.add(attributeInfo); newAttributeMap.put(attributeInfo.getName(), dynamicMetric); } } attributeInfoList.add(new MBeanAttributeInfo(SENSOR_NAME_TAG, String.class.getName(), "The name of the metric sensor", true, false, false)); MBeanConstructorInfo constructorInfo = new MBeanConstructorInfo( String.format("Default %s Constructor", getClass().getSimpleName()), getClass().getConstructors()[0]); MBeanAttributeInfo[] attributesInfo = new MBeanAttributeInfo[attributeInfoList.size()]; attributesInfo = attributeInfoList.toArray(attributesInfo); if (description == null) { description = DEFAULT_DESCRIPTION; } _mBeanInfo = new MBeanInfo(getClass().getName(), description, attributesInfo, new MBeanConstructorInfo[]{constructorInfo}, new MBeanOperationInfo[0], new MBeanNotificationInfo[0]); _attributeMap = newAttributeMap; }
Source:
public List<Credential> fromRequest(final HttpServletRequest request, final MultiValueMap<String, String> requestBody) { val credentials = super.fromRequest(request, requestBody); if (credentials.isEmpty()) { return credentials; } val credential = extractCredential(request, credentials); if (credential == null) { LOGGER.debug("Not a surrogate authentication attempt, returning parent class credentials"); return credentials; } val surrogateAccounts = surrogateAuthenticationService.getEligibleAccountsForSurrogateToProxy(credential.getId()); if (!surrogateAccounts.contains(credential.getSurrogateUsername())) { throw new SurrogateAuthenticationException("Unable to authorize surrogate authentication request for " + credential.getSurrogateUsername()); } return CollectionUtils.wrapList(credential); }

Target:
public List<Credential> fromRequest(final HttpServletRequest request, final MultiValueMap<String, String> requestBody) { val credentials = super.fromRequest(request, requestBody); if (credentials.isEmpty()) { return credentials; } val credential = extractCredential(request, credentials); if (credential == null) { LOGGER.trace("Not a surrogate authentication attempt, returning parent class credentials"); return credentials; } val surrogateAccounts = surrogateAuthenticationService.getEligibleAccountsForSurrogateToProxy(credential.getId()); if (!surrogateAccounts.contains(credential.getSurrogateUsername())) { throw new SurrogateAuthenticationException("Unable to authorize surrogate authentication request for " + credential.getSurrogateUsername()); } return CollectionUtils.wrapList(credential); }
Source:
private void verifyBodyOpenBraceStyle(ParserRuleContext ctx, String constructName) { ParserRuleContext leftSibling = (ParserRuleContext) ParseTreeUtil.getLeftSibling(ctx); Location constructLocation = ListenerUtil.getContextStopLocation(leftSibling); verifySingleSpaceBeforeOpenBrace(ctx, leftSibling.getStop()); verifyCodeBlockOpenBraceIsInline(ctx, constructLocation, constructName); }

Target:
private void verifyBodyOpenBraceStyle(ParserRuleContext ctx, String constructName) { ParserRuleContext leftSibling = (ParserRuleContext) ParseTreeUtil.getLeftSibling(ctx); Location constructLocation = ListenerUtil.getContextStopLocation(leftSibling); verifyCodeBlockOpenBraceIsInline(ctx, constructLocation, constructName); verifySingleSpaceBeforeOpenBrace(ctx, leftSibling.getStop()); }
Source:
private void handleResult(final String id, Map<String, List<QualifiedOafJsonRecord>> mappedRecords) throws InterruptedException, IOException { Oaf oafObj = buildOafObject(mappedRecords.get(Type.result.name())); if (oafObj == null) { log.error("missing 'body' qualifier value for record " + id); return; } if (resultApprover.approve(oafObj)) { DocumentMetadata docMeta = docMetaConverter.convert(oafObj.getEntity()); if (docMeta!=null) { outputs.write(outputNameDocumentMeta, new AvroKey<DocumentMetadata>(docMeta)); } if (acceptAsDataset(oafObj)) { DataSetReference datasetMeta = datasetMetaConverter.convert(oafObj.getEntity()); if (datasetMeta != null) { outputs.write(outputNameDatasetMeta, new AvroKey<DataSetReference>(datasetMeta)); } } handleRelation(mappedRecords.get(resProjColumnFamily), docProjectConverter, outputNameDocumentProject); handleRelation(mappedRecords.get(dedupMappingColumnFamily), deduplicationMappingConverter, outputNameDedupMapping); } }

Target:
private void handleResult(final String id, Map<String, List<QualifiedOafJsonRecord>> mappedRecords) throws InterruptedException, IOException { Oaf oafObj = buildOafObject(mappedRecords.get(Type.result.name())); if (oafObj == null) { log.error("missing 'body' qualifier value for record " + id); return; } if (resultApprover.approve(oafObj)) { DocumentMetadata docMeta = docMetaConverter.convert(oafObj.getEntity()); if (docMeta!=null) { outputs.write(outputNameDocumentMeta, new AvroKey<>(docMeta)); } if (acceptAsDataset(oafObj)) { DataSetReference datasetMeta = datasetMetaConverter.convert(oafObj.getEntity()); if (datasetMeta != null) { outputs.write(outputNameDatasetMeta, new AvroKey<>(datasetMeta)); } } handleRelation(mappedRecords.get(resProjColumnFamily), docProjectConverter, outputNameDocumentProject); handleRelation(mappedRecords.get(dedupMappingColumnFamily), deduplicationMappingConverter, outputNameDedupMapping); } }
Source:
private static LinkedFile convert(List<String> entry) { while (entry.size() < 3) { entry.add(""); } LinkedFile field; if (LinkedFile.isOnlineLink(entry.get(1))) { try { field = new LinkedFile(new URL(entry.get(1)), entry.get(2)); } catch (MalformedURLException e) { field = new LinkedFile(entry.get(0), Path.of(entry.get(1)), entry.get(2)); } } else { field = new LinkedFile(entry.get(0), Path.of(entry.get(1)), entry.get(2)); } if (field.getDescription().isEmpty() && field.getLink().isEmpty() && !field.getFileType().isEmpty()) { field = new LinkedFile("", Path.of(field.getFileType()), ""); } else if (!field.getDescription().isEmpty() && field.getLink().isEmpty() && field.getFileType().isEmpty()) { field = new LinkedFile("", Path.of(field.getDescription()), ""); } entry.clear(); return field; }

Target:
private static LinkedFile convert(List<String> entry) { while (entry.size() < 3) { entry.add(""); } LinkedFile field = null; if (LinkedFile.isOnlineLink(entry.get(1))) { try { field = new LinkedFile(new URL(entry.get(1)), entry.get(2)); } catch (MalformedURLException ignored) { } } if (field == null) { field = new LinkedFile(entry.get(0), Path.of(entry.get(1)), entry.get(2)); } if (field.getDescription().isEmpty() && field.getLink().isEmpty() && !field.getFileType().isEmpty()) { field = new LinkedFile("", Path.of(field.getFileType()), ""); } else if (!field.getDescription().isEmpty() && field.getLink().isEmpty() && field.getFileType().isEmpty()) { field = new LinkedFile("", Path.of(field.getDescription()), ""); } entry.clear(); return field; }
Source:
protected boolean canDoAction() { boolean retValue = true; if (!VM.isStatusUpOrPaused(getVm().getstatus())) { setSucceeded(false); retValue = false; addCanDoActionMessage(VdcBllMessages.VAR__TYPE__VM); if (!StringUtils.isEmpty(mCdImagePath)) { addCanDoActionMessage(VdcBllMessages.VAR__ACTION__CHANGE_CD); } else { addCanDoActionMessage(VdcBllMessages.VAR__ACTION__EJECT_CD); } addCanDoActionMessage(VdcBllMessages.ACTION_TYPE_FAILED_VM_STATUS_ILLEGAL); } else if ((VmRunHandler.getInstance().findActiveISODomain(getVm().getstorage_pool_id()) == null) && !StringUtils.isEmpty(mCdImagePath)) { } else if ((VmRunHandler.getInstance().findActiveISODomain(getVm().getstorage_pool_id()) == null) && !StringHelper.isNullOrEmpty(mCdImagePath)) { addCanDoActionMessage(VdcBllMessages.VAR__ACTION__CHANGE_CD); addCanDoActionMessage(VdcBllMessages.VM_CANNOT_WITHOUT_ACTIVE_STORAGE_DOMAIN_ISO); setSucceeded(false); retValue = false; } return retValue; }

Target:
protected boolean canDoAction() { boolean retValue = true; if (!VM.isStatusUpOrPaused(getVm().getstatus())) { setSucceeded(false); retValue = false; addCanDoActionMessage(VdcBllMessages.VAR__TYPE__VM); if (!StringUtils.isEmpty(mCdImagePath)) { addCanDoActionMessage(VdcBllMessages.VAR__ACTION__CHANGE_CD); } else { addCanDoActionMessage(VdcBllMessages.VAR__ACTION__EJECT_CD); } addCanDoActionMessage(VdcBllMessages.ACTION_TYPE_FAILED_VM_STATUS_ILLEGAL); } else if ((VmRunHandler.getInstance().findActiveISODomain(getVm().getstorage_pool_id()) == null) && !StringUtils.isEmpty(mCdImagePath)) { } else if ((VmRunHandler.getInstance().findActiveISODomain(getVm().getstorage_pool_id()) == null) && !StringUtils.isEmpty(mCdImagePath)) { addCanDoActionMessage(VdcBllMessages.VAR__ACTION__CHANGE_CD); addCanDoActionMessage(VdcBllMessages.VM_CANNOT_WITHOUT_ACTIVE_STORAGE_DOMAIN_ISO); setSucceeded(false); retValue = false; } return retValue; }
Source:
public void testGetAllPropertiesByTags() throws Exception { try{ out = new BufferedWriter(new FileWriter(CONFIG)); startConfig(); appendProperty("hadoop.tags.system", "YARN,HDFS,NAMENODE"); appendProperty("hadoop.tags.custom", "MYCUSTOMTAG"); appendPropertyByTag("dfs.cblock.trace.io", "false", "YARN"); appendPropertyByTag("dfs.replication", "1", "HDFS"); appendPropertyByTag("dfs.namenode.logging.level", "INFO", "NAMENODE"); appendPropertyByTag("dfs.random.key", "XYZ", "MYCUSTOMTAG"); endConfig(); Path fileResource = new Path(CONFIG); conf.addResource(fileResource); assertEq(conf.getAllPropertiesByTag("MYCUSTOMTAG").getProperty("dfs.random.key"), "XYZ"); } finally { out.close(); } try { out = new BufferedWriter(new FileWriter(CONFIG_CORE)); startConfig(); appendProperty("dfs.random.key", "ABC"); appendProperty("dfs.replication", "3"); appendProperty("dfs.cblock.trace.io", "true"); endConfig(); Path fileResource = new Path(CONFIG_CORE); conf.addResource(fileResource); } finally { out.close(); } assertEq("3", conf.getAllPropertiesByTag("HDFS").getProperty("dfs.replication")); assertEq("ABC", conf.getAllPropertiesByTag("MYCUSTOMTAG").getProperty("dfs.random.key")); assertEq("true", conf.getAllPropertiesByTag("YARN").getProperty("dfs.cblock.trace.io")); }

Target:
public void testGetAllPropertiesByTags() throws Exception { File coreDefault = tempConfigs.newFile("core-default-test.xml"); File coreSite = tempConfigs.newFile("core-site-test.xml"); try (BufferedWriter out = new BufferedWriter(new FileWriter(coreDefault))) { startConfig(out); appendProperty(out, "hadoop.tags.system", "YARN,HDFS,NAMENODE"); appendProperty(out, "hadoop.tags.custom", "MYCUSTOMTAG"); appendPropertyByTag(out, "dfs.cblock.trace.io", "false", "YARN"); appendPropertyByTag(out, "dfs.replication", "1", "HDFS"); appendPropertyByTag(out, "dfs.namenode.logging.level", "INFO", "NAMENODE"); appendPropertyByTag(out, "dfs.random.key", "XYZ", "MYCUSTOMTAG"); endConfig(out); Path fileResource = new Path(coreDefault.getAbsolutePath()); conf.addResource(fileResource); Assert.assertEquals(conf.getAllPropertiesByTag("MYCUSTOMTAG") .getProperty("dfs.random.key"), "XYZ"); } try (BufferedWriter out = new BufferedWriter(new FileWriter(coreSite))) { startConfig(out); appendProperty(out, "dfs.random.key", "ABC"); appendProperty(out, "dfs.replication", "3"); appendProperty(out, "dfs.cblock.trace.io", "true"); endConfig(out); Path fileResource = new Path(coreSite.getAbsolutePath()); conf.addResource(fileResource); } Assert.assertEquals("3", conf.getAllPropertiesByTag("HDFS") .getProperty("dfs.replication")); Assert.assertEquals("ABC", conf.getAllPropertiesByTag("MYCUSTOMTAG") .getProperty("dfs.random.key")); Assert.assertEquals("true", conf.getAllPropertiesByTag("YARN") .getProperty("dfs.cblock.trace.io")); }
Source:
public Builder crossoverRate(double rate) { if(rate < 0 || rate > 1.0) { throw new IllegalArgumentException("Rate must be between 0.0 and 1.0"); } this.crossoverRate = rate; return this; }

Target:
public Builder crossoverRate(double rate) { Preconditions.checkState(rate >= 0.0 && rate <= 1.0, "Rate must be between 0.0 and 1.0, got %s", rate); this.crossoverRate = rate; return this; }
Source:
public void test() { String title = getViewTitle(); SWTBotView viewBot = fBot.viewByTitle(title); viewBot.show(); viewBot.setFocus(); TmfSignalManager.dispatchSignal(new TmfSelectionRangeUpdatedSignal(this, START_TIME)); ConditionHelpers.timeGraphIsReadyCondition((AbstractTimeGraphView) viewBot.getViewReference().getPart(false), new TmfTimeRange(START_TIME, START_TIME), START_TIME); openDialog(viewBot); SWTBotShell shell = fBot.shell("Find"); SWTBot bot = shell.bot(); SWTBotButton findButton = bot.button("Fi&nd"); String text = getFindText(); testDirectionSearch(true, text, bot, findButton, viewBot); testCaseSensitive(text, bot, findButton); final @NonNull String ttext = text.split(SPACE)[0]; testWholeWord(ttext, bot, findButton); testRegEx(REGEX_PREFIX + ttext, bot, findButton); testDirectionSearch(false, text, bot, findButton, viewBot); }

Target:
public void test() { String title = getViewTitle(); SWTBotView viewBot = fBot.viewByTitle(title); viewBot.show(); viewBot.setFocus(); TmfSignalManager.dispatchSignal(new TmfSelectionRangeUpdatedSignal(this, START_TIME)); ConditionHelpers.timeGraphIsReadyCondition((AbstractTimeGraphView) viewBot.getViewReference().getPart(false), new TmfTimeRange(START_TIME, START_TIME), START_TIME); openDialog(viewBot); SWTBotShell shell = fBot.shell("Find"); SWTBot bot = shell.bot(); SWTBotButton findButton = bot.button("Fi&nd"); String text = getFindText(); testWrapSearch(text, bot, findButton, viewBot); testDirectionSearch(true, text, bot, findButton, viewBot); testCaseSensitive(text, bot, findButton); final @NonNull String ttext = text.split(SPACE)[0]; testWholeWord(ttext, bot, findButton); testRegEx(REGEX_PREFIX + ttext, bot, findButton); testDirectionSearch(false, text, bot, findButton, viewBot); }
Source:
public void updateS3Credentials() { s3Credentials = service.updateS3Credentials(s3Credentials) .get(1, TimeUnit.MINUTES); assertThat(s3Credentials, notNullValue()); }

Target:
public void updateS3Credentials() { final DateTime lastUpdated = s3Credentials.getUpdated(); s3Credentials = service.updateS3Credentials(s3Credentials.withSecretKey("newSecretKey")) .get(1, TimeUnit.MINUTES); assertThat(s3Credentials, notNullValue()); assertThat(s3Credentials.getUpdated(), is(not(lastUpdated))); }
Source:
private static void updateAttributeValue( ApplicationConfiguration configuration, Element element, String attribute, Object value) { if (value == null || value instanceof String) { WidgetUtil.updateAttribute(element, attribute, (String) value); } else { JsonObject object = WidgetUtil.crazyJsCast(value); assert object.hasKey( NodeProperties.URI_ATTRIBUTE) : "Implementation error: JsonObject is recieved as an attribute value for '" + attribute + "' but it has no " + NodeProperties.URI_ATTRIBUTE + " key"; String uri = object.getString(NodeProperties.URI_ATTRIBUTE); if (configuration.isWebComponentMode()) { String baseUri = configuration.getServiceUrl(); baseUri = baseUri.endsWith("/") ? baseUri : baseUri + "/"; WidgetUtil.updateAttribute(element, attribute, baseUri + uri); } else { WidgetUtil.updateAttribute(element, attribute, uri); } } }

Target:
private static void updateAttributeValue( ApplicationConfiguration configuration, Element element, String attribute, Object value) { if (value == null || value instanceof String) { WidgetUtil.updateAttribute(element, attribute, (String) value); } else { JsonValue jsonValue = WidgetUtil.crazyJsoCast(value); if (JsonType.OBJECT.equals(jsonValue.getType())) { JsonObject object = (JsonObject) jsonValue; assert object.hasKey( NodeProperties.URI_ATTRIBUTE) : "Implementation error: JsonObject is recieved as an attribute value for '" + attribute + "' but it has no " + NodeProperties.URI_ATTRIBUTE + " key"; String uri = object.getString(NodeProperties.URI_ATTRIBUTE); if (configuration.isWebComponentMode()) { String baseUri = configuration.getServiceUrl(); baseUri = baseUri.endsWith("/") ? baseUri : baseUri + "/"; WidgetUtil.updateAttribute(element, attribute, baseUri + uri); } else { WidgetUtil.updateAttribute(element, attribute, uri); } } else { WidgetUtil.updateAttribute(element, attribute, value.toString()); } } }
Source:
public void onAllRequiredCapabilitiesAvailable() { FrameworkUtil.getBundle(MSF4JDeployerSC.class).getBundleContext() .registerService(Deployer.class, new MicroservicesDeployer(), null); if (log.isDebugEnabled()) { log.debug("MicroservicesDeployer service is available"); } }

Target:
public void onAllRequiredCapabilitiesAvailable() { FrameworkUtil.getBundle(MSF4JDeployerSC.class).getBundleContext() .registerService(Deployer.class, new MicroservicesDeployer(), null); log.debug("MicroservicesDeployer service is available"); }
Source:
public void createCache(String name, String template, EnumSet<AdminFlag> flags) { Map<String, String> params = new HashMap<>(2); params.put(CACHE_NAME, name); if (template != null) params.put(CACHE_TEMPLATE, template); if (flags != null && !flags.isEmpty()) params.put(FLAGS, flagsToString(flags)); operationsFactory.newAdminOperation("CACHE_CREATE", params).execute(); }

Target:
public void createCache(String name, String template, EnumSet<AdminFlag> flags) { Map<String, byte[]> params = new HashMap<>(2); params.put(CACHE_NAME, string(name)); if (template != null) params.put(CACHE_TEMPLATE, string(template)); if (flags != null && !flags.isEmpty()) params.put(FLAGS, flags(flags)); operationsFactory.newExecuteOperation("@@cache@create", params).execute(); }
Source:
ConcurrentMap<String, StatisticQuery.Builder> getSelectedStatsPerCapability() { return selectedStatsPerCapability; }

Target:
Map<String, StatisticQuery.Builder> getSelectedStatsPerCapability() { return Collections.unmodifiableMap(selectedStatsPerCapability); }
Source:
public void testAddRawRow() { DoorsTableRowCollector dtc = setupTestRowCollector(); Assert.assertEquals(dtc.getTableRows().size(), 2); }

Target:
public void testAddRawRow() { loadElementsInCollector(); Assert.assertEquals(dtc.getTableRows().size(), 2); }
Source:
public void testDoGet_NotFound_MissingFile() throws IOException, ServletException { final IConfigUtilsInterface configUtils = Mockito.mock(IConfigUtilsInterface.class); Config.setConfigUtils(configUtils); testServlet.doGet(mockRequest, mockResponse); verify(mockResponse).sendError(HttpServletResponse.SC_NOT_FOUND); }

Target:
public void testDoGet_NotFound_MissingFile() throws IOException, ServletException { testServlet.doGet(mockRequest, mockResponse); verify(mockResponse).sendError(HttpServletResponse.SC_NOT_FOUND); }
Source:
public static KeyVaultKeyIdentifier parse(String keyId) throws IllegalArgumentException, MalformedURLException { if (keyId == null) { throw new IllegalArgumentException("keyId cannot be null"); } URL url = new URL(keyId); String[] pathSegments = url.getPath().split("/"); if ((pathSegments.length != 3 && pathSegments.length != 4) || !"https".equals(url.getProtocol()) || (!"keys".equals(pathSegments[1]) && !"deletedkeys".equals(pathSegments[1])) || ("deletedkeys".equals(pathSegments[1]) && pathSegments.length == 4)) { throw new IllegalArgumentException("keyId is not a valid Key Vault Key identifier"); } return new KeyVaultKeyIdentifier(keyId, url.getProtocol() + "://" + url.getHost(), pathSegments[2], pathSegments.length == 4 ? pathSegments[3] : null); }

Target:
public static KeyVaultKeyIdentifier parse(String keyId) throws IllegalArgumentException { if (keyId == null) { throw new IllegalArgumentException("keyId cannot be null"); } try { final URL url = new URL(keyId); final String[] pathSegments = url.getPath().split("/"); if ((pathSegments.length != 3 && pathSegments.length != 4) || !"https".equals(url.getProtocol()) || (!"keys".equals(pathSegments[1]) && !"deletedkeys".equals(pathSegments[1])) || ("deletedkeys".equals(pathSegments[1]) && pathSegments.length == 4)) { throw new IllegalArgumentException("keyId is not a valid Key Vault Key identifier"); } final String vaultUrl = String.format("%s://%s", url.getProtocol(), url.getHost()); final String keyName = pathSegments[2]; final String keyVersion = pathSegments.length == 4 ? pathSegments[3] : null; return new KeyVaultKeyIdentifier(keyId, vaultUrl, keyName, keyVersion); } catch (MalformedURLException e) { throw new IllegalArgumentException("Could not parse keyId", e); } }
Source:
private static StrictMode.VmPolicy.Builder newVmPolicyBuilderWithDefaultViolations() { return new StrictMode.VmPolicy.Builder() .detectLeakedSqlLiteObjects() .detectLeakedRegistrationObjects(); }

Target:
private static StrictMode.VmPolicy.Builder newVmPolicyBuilderWithDefaultViolations() { StrictMode.VmPolicy.Builder builder = new StrictMode.VmPolicy.Builder().detectLeakedSqlLiteObjects(); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) { builder.detectLeakedRegistrationObjects(); } return builder; }
Source:
public V putIfAbsent(final K key, final V value) { putIfAbsentObserver.begin(); statusTransitioner.checkAvailable(); checkNonNull(key, value); AtomicBoolean put = new AtomicBoolean(false); try { ValueHolder<V> inCache = doPutIfAbsent(key, value, b -> put.set(b)); if(put.get()) { putIfAbsentObserver.end(PutIfAbsentOutcome.PUT); return null; } else if (inCache == null) { putIfAbsentObserver.end(PutIfAbsentOutcome.HIT); return null; } else { putIfAbsentObserver.end(PutIfAbsentOutcome.HIT); return inCache.get(); } } catch (StoreAccessException e) { try { return resilienceStrategy.putIfAbsentFailure(key, value, e); } finally { putIfAbsentObserver.end(PutIfAbsentOutcome.FAILURE); } } }

Target:
public V putIfAbsent(final K key, final V value) { putIfAbsentObserver.begin(); try { statusTransitioner.checkAvailable(); checkNonNull(key, value); boolean[] put = { false }; try { ValueHolder<V> inCache = doPutIfAbsent(key, value, b -> put[0] = b); if (put[0]) { putIfAbsentObserver.end(PutIfAbsentOutcome.PUT); return null; } else if (inCache == null) { putIfAbsentObserver.end(PutIfAbsentOutcome.HIT); return null; } else { putIfAbsentObserver.end(PutIfAbsentOutcome.HIT); return inCache.get(); } } catch (StoreAccessException e) { V newValue = resilienceStrategy.putIfAbsentFailure(key, value, e); putIfAbsentObserver.end(PutIfAbsentOutcome.FAILURE); return newValue; } } catch (Throwable e) { putIfAbsentObserver.end(PutIfAbsentOutcome.FAILURE); throw e; } }
Source:
public DataContentViewerHTML() { try { fileTypeDetector = new FileTypeDetector(); } catch (FileTypeDetectorInitException ex) { Exceptions.printStackTrace(ex); } initComponents(); resetComponents(); enableJavaScriptTxt = NbBundle.getMessage(this.getClass(), "DataContentViewerHTML.enableJavaScriptBtnTxt"); disableJavaScriptTxt = NbBundle.getMessage(this.getClass(), "DataContentViewerHTML.disableJavaScriptBtnTxt"); logger.log(Level.INFO, "Created HTMLView instance: " + this); }

Target:
public DataContentViewerHTML() { try { fileTypeDetector = new FileTypeDetector(); } catch (FileTypeDetectorInitException ex) { logger.log(Level.WARNING, "An error occured while initializing the file type " + "detector for the HTML content viewer.", ex); } enableJavaScriptTxt = NbBundle.getMessage(this.getClass(), "DataContentViewerHTML.enableJavaScriptBtnTxt"); disableJavaScriptTxt = NbBundle.getMessage(this.getClass(), "DataContentViewerHTML.disableJavaScriptBtnTxt"); jfxPanel = new JFXPanel(); setLayout(new BorderLayout()); add(jfxPanel, BorderLayout.CENTER); Platform.runLater(() -> { stage = new Stage(); stage.setResizable(true); BorderPane root = new BorderPane(); scene = new Scene(root); stage.setScene(scene); HBox btnBox = new HBox(); btnBox.setPadding(new Insets(10, 10, 10, 10)); btnBox.setSpacing(10); javaScriptButton = new Button(enableJavaScriptTxt); javaScriptButton.setOnAction((ActionEvent event) -> { if(webEngine.isJavaScriptEnabled()) { webEngine.setJavaScriptEnabled(false); javaScriptButton.setText(enableJavaScriptTxt); } else { webEngine.setJavaScriptEnabled(true); javaScriptButton.setText(disableJavaScriptTxt); } webEngine.reload(); }); btnBox.getChildren().add(javaScriptButton); browser = new WebView(); webEngine = browser.getEngine(); webEngine.setJavaScriptEnabled(false); root.setTop(btnBox); root.setCenter(browser); jfxPanel.setScene(scene); }); resetComponents(); logger.log(Level.INFO, "Created HTMLView instance: " + this); }
Source:
static void LoginAsync(final String userName, final String password, final String domain, final AsyncQuery callback, final GenericApiGWTServiceAsync service) { logger.finer("Frontend: Invoking async Login."); service.Login(userName, password, domain, new AsyncCallback<VdcReturnValueBase>() { @Override public void onSuccess(final VdcReturnValueBase result) { logger.finer("Succesful returned result from Login."); setLoggedInUser(null); callback.getDel().onSuccess(callback.getModel(), result); setLoginPassword(null); if (getLoginHandler() != null && result.getSucceeded()) { getLoginHandler().onLoginSuccess(userName, password, domain); } } @Override public void onFailure(final Throwable caught) { if (ignoreFailure(caught)) { return; } logger.log(Level.SEVERE, "Failed to execute RunQuery: " + caught, caught); getEventsHandler().runQueryFailed(null); failureEventHandler(caught); if (callback.isHandleFailure()) { setLoggedInUser(null); callback.getDel().onSuccess(callback.getModel(), null); setLoginPassword(null); } } }); }

Target:
static void LoginAsync(final String userName, final String password, final String domain, final AsyncQuery callback, final GenericApiGWTServiceAsync service) { logger.finer("Frontend: Invoking async Login."); service.Login(userName, password, domain, new AsyncCallback<VdcReturnValueBase>() { @Override public void onSuccess(final VdcReturnValueBase result) { logger.finer("Succesful returned result from Login."); setLoggedInUser(null); result.setCanDoActionMessages((ArrayList<String>) translateError(result)); callback.getDel().onSuccess(callback.getModel(), result); setLoginPassword(null); if (getLoginHandler() != null && result.getSucceeded()) { getLoginHandler().onLoginSuccess(userName, password, domain); } } @Override public void onFailure(final Throwable caught) { if (ignoreFailure(caught)) { return; } logger.log(Level.SEVERE, "Failed to execute RunQuery: " + caught, caught); getEventsHandler().runQueryFailed(null); failureEventHandler(caught); if (callback.isHandleFailure()) { setLoggedInUser(null); callback.getDel().onSuccess(callback.getModel(), null); setLoginPassword(null); } } }); }
Source:
private void populateBoards(BoardPickerState state) { boardList.getChildren().clear(); state.getMatchedBoards().stream() .sorted(String::compareToIgnoreCase) .map(PickerBoard::new) .forEach(pickerBoard -> { suggestion.ifPresent(suggestion -> { pickerBoard.setHighlighted(suggestion.equals(pickerBoard.getBoardName())); }); pickerBoard.setOnMouseClicked(e -> handleBoardClick(pickerBoard)); boardList.getChildren().add(pickerBoard); }); updateConfirmButton(); }

Target:
private void populateBoards(BoardPickerState state) { boardList.getChildren().clear(); state.getMatchedBoards().stream() .sorted(String::compareToIgnoreCase) .map(PickerBoard::new) .forEach(pickerBoard -> { processItem(pickerBoard); addItemToList(pickerBoard); }); updateConfirmButton(); }
Source:
public List<User> getAllowedUsersNotExpired(PerunSession sess, Facility facility, Vo specificVo, Service specificService) throws InternalErrorException { List<Resource> resources = getAssignedResources(sess, facility, specificVo, specificService); List<User> users = new ArrayList<>(); for (Resource resource: resources) { users.addAll(getPerunBl().getResourcesManagerBl().getAllowedUsersNotExpired(sess, resource)); } return users; }

Target:
public List<User> getAllowedUsersNotExpired(PerunSession sess, Facility facility, Vo specificVo, Service specificService) throws InternalErrorException { List<Resource> resources = getAssignedResources(sess, facility, specificVo, specificService); Set<User> users = new TreeSet<>(); for (Resource resource: resources) { users.addAll(getPerunBl().getResourcesManagerBl().getAllowedUsersNotExpired(sess, resource)); } return new ArrayList<>(users); }
Source:
private void setupWords() { for (int i= 0; i < attributeWords.length; i++) { this.addWord(attributeWords[i], blue); } for (int i= 0; i < tagWrods.length; i++) { this.addWord(tagWrods[i], red); } }

Target:
private void setupWords() { for (String word : attributeWords) { this.addWord(word, blue); } for (String word : tagWords) { this.addWord(word, red); } }
Source:
public Tuple next() throws IOException { if (!reader.isReadable()) { return null; } if (targets.length == 0) { return EmptyTuple.get(); } VTuple tuple = new VTuple(schema.size()); try { do { ByteBuf buf = readLine(); if (buf == null) { return null; } try { deserializer.deserialize(buf, tuple); break; } catch (TextLineParsingError tae) { errorNum++; if (errorNum < errorPrintOutMaxNum) { LOG.warn("Ignore JSON Parse Error (" + errorNum + "): ", tae); } if (errorTorrenceMaxNum >= 0 && errorNum > errorTorrenceMaxNum) { throw tae; } continue; } } while (reader.isReadable()); return tuple; } catch (Throwable t) { LOG.error(t); throw new IOException(t); } }

Target:
public Tuple next() throws IOException { if (!reader.isReadable()) { return null; } if (targets.length == 0) { return EmptyTuple.get(); } VTuple tuple = new VTuple(schema.size()); try { do { ByteBuf buf = reader.readLine(); if (buf == null) { return null; } try { deserializer.deserialize(buf, tuple); break; } catch (TextLineParsingError tae) { errorNum++; if (errorNum < errorPrintOutMaxNum) { LOG.warn("Ignore JSON Parse Error (" + errorNum + "): ", tae); } if (errorTorrenceMaxNum >= 0 && errorNum > errorTorrenceMaxNum) { throw tae; } continue; } } while (reader.isReadable()); recordCount++; return tuple; } catch (Throwable t) { LOG.error(t); throw new IOException(t); } }
Source:
public Response query2(PerformanceQuery query) { Optional<String> id = Optional.<String> absent(); Optional<String> start = query.getStart() != null ? Optional.of(query .getStart()) : Optional.<String> absent(); Optional<String> end = query.getEnd() != null ? Optional.of(query .getEnd()) : Optional.<String> absent(); Optional<Boolean> exact = query.getExactTimeWindow() == null ? Optional .<Boolean> absent() : Optional.of(query.getExactTimeWindow()); Optional<Boolean> series = (query.getSeries() == null ? Optional .<Boolean> absent() : Optional.of(query.getSeries())); Optional<String> downsample = query.getDownsample() == null ? Optional .<String> absent() : Optional.of(query.getDownsample()); Optional<Map<String, String>> tags = query.getTags() == null ? Optional .<Map<String, String>> absent() : Optional.of(query.getTags()); return api.query(id, start, end, exact, series, downsample, tags, query.getMetrics()); }

Target:
public Response query2(PerformanceQuery query) { Optional<String> id = Optional.<String> absent(); Optional<String> start = Optional.<String> fromNullable(query .getStart()); Optional<String> end = Optional.<String> fromNullable(query.getEnd()); Optional<Boolean> exact = Optional.<Boolean> fromNullable(query .getExactTimeWindow()); Optional<Boolean> series = Optional.<Boolean> fromNullable(query .getSeries()); Optional<String> downsample = Optional.<String> fromNullable(query .getDownsample()); Optional<Map<String, String>> tags = Optional .<Map<String, String>> fromNullable(query.getTags()); return api.query(id, start, end, exact, series, downsample, tags, query.getMetrics()); }
Source:
public boolean isFunctionDefinition() { return expression instanceof CompiledExpressionImpl && ((CompiledExpressionImpl)expression).getExpression() instanceof FunctionDefNode || expression instanceof ProcessedExpression && ((ProcessedExpression) expression).getInterpreted().isFunctionOhNoWhyAreYouDoingThis() ; }

Target:
public boolean isFunctionDefinition() { return isFunctionDef; }
Source:
private static FSTConfiguration copy(ClassLoader classLoader, FstCodec codec) { FSTConfiguration def = codec.getConfig().deriveConfiguration(); def.setClassLoader(classLoader); def.setCoderSpecific(codec.config.getCoderSpecific()); def.setCrossPlatform(codec.config.isCrossPlatform()); def.setForceClzInit(codec.config.isForceClzInit()); def.setForceSerializable(codec.config.isForceSerializable()); def.setInstantiator(codec.config.getInstantiator(null)); def.setJsonFieldNames(codec.config.getJsonFieldNames()); def.setLastResortResolver(codec.config.getLastResortResolver()); def.setName(codec.config.getName()); def.setPreferSpeed(codec.config.isPreferSpeed()); def.setStructMode(codec.config.isStructMode()); def.setShareReferences(codec.config.isShareReferences()); def.setStreamCoderFactory(codec.config.getStreamCoderFactory()); def.setVerifier(codec.config.getVerifier()); try { Field serializationInfoRegistryField = FSTConfiguration.class.getDeclaredField("serializationInfoRegistry"); serializationInfoRegistryField.setAccessible(true); FSTClazzInfoRegistry registry = (FSTClazzInfoRegistry) serializationInfoRegistryField.get(codec.config); serializationInfoRegistryField.set(def, registry); } catch (Exception e) { throw new IllegalStateException(e); } return def; }

Target:
private static FSTConfiguration copy(ClassLoader classLoader, FstCodec codec) { FSTConfiguration def = codec.config.deriveConfiguration(); def.setClassLoader(classLoader); def.setCoderSpecific(codec.config.getCoderSpecific()); def.setCrossPlatform(codec.config.isCrossPlatform()); def.setForceClzInit(codec.config.isForceClzInit()); def.setForceSerializable(codec.config.isForceSerializable()); def.setInstantiator(codec.config.getInstantiator(null)); def.setJsonFieldNames(codec.config.getJsonFieldNames()); def.setLastResortResolver(codec.config.getLastResortResolver()); def.setName(codec.config.getName()); def.setPreferSpeed(codec.config.isPreferSpeed()); def.setStructMode(codec.config.isStructMode()); def.setShareReferences(codec.config.isShareReferences()); def.setStreamCoderFactory(codec.config.getStreamCoderFactory()); def.setVerifier(codec.config.getVerifier()); try { Field serializationInfoRegistryField = FSTConfiguration.class.getDeclaredField("serializationInfoRegistry"); serializationInfoRegistryField.setAccessible(true); FSTClazzInfoRegistry registry = (FSTClazzInfoRegistry) serializationInfoRegistryField.get(codec.config); serializationInfoRegistryField.set(def, registry); } catch (Exception e) { throw new IllegalStateException(e); } return def; }
Source:
public int getMaxResults() { return maxResults; }

Target:
public Integer getMaxResults() { return maxResults; }
Source:
public <CC, C extends IAPIClientProvider<CC>> C getAPIProvider(Class<C> apiProviderClass, IEndpointSelectionStrategy endpointSelectionStrategy) { log.info("ClientProvider request received for class: " + apiProviderClass.getCanonicalName()); for (Class<?> internalAPIProviderClass : internalClientProviders.keySet()) { @SuppressWarnings("unchecked") IInternalAPIProvider<CC> internalAPIProvider = (IInternalAPIProvider<CC>) internalClientProviders.get(internalAPIProviderClass); if (doTypeArgumentsMatch(VALID_API_PROVIDERS, apiProviderClass, internalAPIProviderClass)) { @SuppressWarnings("unchecked") C c = (C) Proxy.newProxyInstance(apiProviderClass.getClassLoader(), new Class[] { apiProviderClass }, new APIProviderAdapter<CC>((IInternalAPIProvider<CC>) internalAPIProvider, coreModelCapability, endpointSelectionStrategy)); log.debug("Providing ClientProvider."); return c; } } log.debug("Not able to provide ClientProvider!"); return null; }

Target:
public <CC, C extends IAPIClientProvider<CC>> C getAPIProvider(Class<C> apiProviderClass, IEndpointSelectionStrategy endpointSelectionStrategy) { log.info("ClientProvider request received for class: " + apiProviderClass.getCanonicalName()); for (Class<?> internalAPIProviderClass : internalClientProviders.keySet()) { @SuppressWarnings("unchecked") IInternalAPIProvider<CC> internalAPIProvider = (IInternalAPIProvider<CC>) internalClientProviders.get(internalAPIProviderClass); if (doTypeArgumentsMatch(VALID_API_PROVIDERS, apiProviderClass, internalAPIProviderClass)) { if (endpointSelectionStrategy == null) { endpointSelectionStrategy = new BasicEndpointSelectionStrategy(); } @SuppressWarnings("unchecked") C c = (C) Proxy.newProxyInstance(apiProviderClass.getClassLoader(), new Class[] { apiProviderClass }, new APIProviderAdapter<CC>((IInternalAPIProvider<CC>) internalAPIProvider, coreModelCapability, endpointSelectionStrategy)); log.debug("Providing ClientProvider."); return c; } } log.debug("Not able to provide ClientProvider!"); return null; }