auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public void initialize() { logger.debug("Initializing DigitalSTROM Device handler."); String configdSID = getConfig().get(DigitalSTROMBindingConstants.DEVICE_DSID).toString(); if (!configdSID.isEmpty()) { dSID = configdSID; if (getDssBridgeHandler() == null) { updateStatus(ThingStatus.OFFLINE, ThingStatusDetail.HANDLER_MISSING_ERROR, "Bridge is missig"); } else { bridgeHandlerInitialized(dssBridgeHandler, this.getBridge()); } } else { updateStatus(ThingStatus.OFFLINE, ThingStatusDetail.CONFIGURATION_ERROR, "dSID is missig"); } }

Target:
public void initialize() { logger.debug("Initializing DeviceHandler."); if (StringUtils.isNotBlank((String) getConfig().get(DigitalSTROMBindingConstants.DEVICE_DSID))) { dSID = getConfig().get(DigitalSTROMBindingConstants.DEVICE_DSID).toString(); bridgeHandlerInitialized(dssBridgeHandler, this.getBridge()); } else { updateStatus(ThingStatus.OFFLINE, ThingStatusDetail.CONFIGURATION_ERROR, "dSID is missig"); } }
Source:
public void ThrottleOnOverTest() throws Exception { githubApi.stubFor( get(urlEqualTo("/rate_limit")) .inScenario("API Rate Limit Throttle on Over") .whenScenarioStateIs(Scenario.STARTED) .willReturn( aResponse() .withHeader("Content-Type", "application/json; charset=utf-8") .withHeader("Accept-Encoding", "gzip,deflate") .withBody("{ \"rate\": { \"limit\": 100, \"remaining\": 8, \"reset\": 1 } }")) .willSetStateTo("API Rate Limit Depleted")); githubApi.stubFor( get(urlEqualTo("/rate_limit")) .inScenario("API Rate Limit Throttle on Over") .whenScenarioStateIs("API Rate Limit Depleted") .willReturn( aResponse() .withHeader("Content-Type", "application/json; charset=utf-8") .withHeader("Accept-Encoding", "gzip,deflate") .withBody("{ \"rate\": { \"limit\": 100, \"remaining\": 100, \"reset\": 1000 } }")) .willSetStateTo("API Rate Limit Refreshed")); githubApi.stubFor( get(urlEqualTo("/rate_limit")) .inScenario("API Rate Limit Throttle on Over") .whenScenarioStateIs("API Rate Limit Refreshed") .willReturn( aResponse() .withHeader("Content-Type", "application/json; charset=utf-8") .withHeader("Accept-Encoding", "gzip,deflate") .withBody("{ \"rate\": { \"limit\": 100, \"remaining\": 99, \"reset\": 1000 } }"))); final Logger logger = Logger.getLogger(getClass().getName()); final LogTaskListener listener = new LogTaskListener(logger, Level.INFO); final ApiRateLimitChecker apiRateLimitChecker = ApiRateLimitChecker.ThrottleOnOver; apiRateLimitChecker.setExpirationWaitMillis(1); apiRateLimitChecker.checkApiRateLimit(listener, github); apiRateLimitChecker.checkApiRateLimit(listener, github); }

Target:
public void ThrottleOnOverTest() throws Exception { List<RateLimit> scenarios = new ArrayList<>(); int limit = 5000; int buffer = ApiRateLimitChecker.calculateBuffer(limit); int expectedNumThrottles = 10; for (int i = -10; i <= expectedNumThrottles; i++) { scenarios.add(new RateLimit(limit, buffer - i, soon)); } scenarios.add(new RateLimit(limit, limit, soon)); setupStubs(scenarios); for (int i = 0; i < 11; i++) { ApiRateLimitChecker.ThrottleOnOver.checkApiRateLimit(listener, github); } assertEquals(0, countOfOutputLines(m -> m.matches("[sS]leeping"))); ApiRateLimitChecker.ThrottleOnOver.checkApiRateLimit(listener, github); assertEquals(1, countOfOutputLinesContaining("Sleeping for")); assertEquals(expectedNumThrottles-1, countOfOutputLinesContaining("Still sleeping")); assertEquals(1, countOfOutputLinesContaining("refreshed")); ApiRateLimitChecker.ThrottleOnOver.checkApiRateLimit(listener, github); assertEquals(1, countOfOutputLinesContaining("Sleeping for")); assertEquals(expectedNumThrottles-1, countOfOutputLinesContaining("Still sleeping")); assertEquals(1, countOfOutputLinesContaining("refreshed")); }
Source:
public void testPruningOfDuplicateReporter() { XmlSuite xmlSuite = createXmlSuite("Suite"); XmlTest xmlTest = createXmlTest(xmlSuite, "Test"); createXmlClass(xmlTest, UniqueReporterInjectionSample1.class); createXmlClass(xmlTest, UniqueReporterInjectionSample2.class); TestNG tng = create(xmlSuite); tng.setUseDefaultListeners(false); tng.addListener((ITestNGListener) new ReporterListenerForIssue1227()); tng.run(); Assert.assertTrue(tng.getReporters().size() == 1); }

Target:
public void testPruningOfDuplicateReporter() { XmlSuite xmlSuite = createXmlSuite("Suite"); XmlTest xmlTest = createXmlTest(xmlSuite, "Test"); createXmlClass(xmlTest, UniqueReporterInjectionSample1.class); createXmlClass(xmlTest, UniqueReporterInjectionSample2.class); TestNG tng = create(xmlSuite); tng.setUseDefaultListeners(false); tng.addListener((ITestNGListener) new ReporterListenerForIssue1227()); tng.run(); Assert.assertEquals(tng.getReporters().size(),1); Assert.assertEquals(ReporterListenerForIssue1227.counter, 1); }
Source:
private boolean parseKeywords(String[] args, int i) throws Exception { boolean result = false; if (checkPair(args, NEW_SESSION, i)) { result = true; } else if (checkPair(args, SESSION, i)) { result = true; } else if (checkPair(args, DIR, i)) { Constant.setZapHome(keywords.get(DIR)); result = true; } else if (checkPair(args, INSTALL_DIR, i)) { Constant.setZapInstall(keywords.get(INSTALL_DIR)); result = true; } else if (checkPair(args, HOST, i)) { this.host = keywords.get(HOST); result = true; } else if (checkPair(args, PORT, i)) { this.port = Integer.parseInt(keywords.get(PORT)); result = true; } else if (checkPair(args, CONFIG, i)) { String pair = keywords.get(CONFIG); if (pair != null && pair.indexOf("=") > 0) { int eqIndex = pair.indexOf("="); this.configs.put(pair.substring(0, eqIndex), pair.substring(eqIndex + 1)); result = true; } } else if (checkPair(args, CONFIG_FILE, i)) { String conf = keywords.get(CONFIG_FILE); File confFile = new File(conf); if (! confFile.exists()) { String error = "No such file: " + confFile.getAbsolutePath(); System.out.println(error); throw new Exception(error); } else if (! confFile.canRead()) { String error = "File not readable: " + confFile.getAbsolutePath(); System.out.println(error); throw new Exception(error); } Properties prop = new Properties(); try (FileInputStream inStream = new FileInputStream(confFile)) { prop.load(inStream); } for (Entry<Object, Object> keyValue : prop.entrySet()) { this.configs.put((String)keyValue.getKey(), (String)keyValue.getValue()); } } return result; }

Target:
private boolean parseKeywords(String[] args, int i) throws Exception { boolean result = false; if (checkPair(args, NEW_SESSION, i)) { result = true; } else if (checkPair(args, SESSION, i)) { result = true; } else if (checkPair(args, DIR, i)) { Constant.setZapHome(keywords.get(DIR)); result = true; } else if (checkPair(args, INSTALL_DIR, i)) { Constant.setZapInstall(keywords.get(INSTALL_DIR)); result = true; } else if (checkPair(args, HOST, i)) { this.host = keywords.get(HOST); result = true; } else if (checkPair(args, PORT, i)) { this.port = Integer.parseInt(keywords.get(PORT)); result = true; } else if (checkPair(args, CONFIG, i)) { String pair = keywords.get(CONFIG); if (pair != null && pair.indexOf("=") > 0) { int eqIndex = pair.indexOf("="); this.configs.put(pair.substring(0, eqIndex), pair.substring(eqIndex + 1)); result = true; } } else if (checkPair(args, CONFIG_FILE, i)) { String conf = keywords.get(CONFIG_FILE); File confFile = new File(conf); if (! confFile.isFile()) { String error = "No such file: " + confFile.getAbsolutePath(); System.out.println(error); throw new Exception(error); } else if (! confFile.canRead()) { String error = "File not readable: " + confFile.getAbsolutePath(); System.out.println(error); throw new Exception(error); } Properties prop = new Properties(); try (FileInputStream inStream = new FileInputStream(confFile)) { prop.load(inStream); } for (Entry<Object, Object> keyValue : prop.entrySet()) { this.configs.put((String)keyValue.getKey(), (String)keyValue.getValue()); } } return result; }
Source:
public void testChallengeSentWithUnhandledAuthorization() throws Exception { HttpChannel channel = new HttpChannel(new MockConnector(), new HttpConfiguration(), null, null) { @Override public Server getServer() { return null; } @Override protected HttpOutput newHttpOutput() { return new HttpOutput(this) { @Override public void close() @Override public void flush() throws IOException }; } }; Request req = channel.getRequest(); Response res = channel.getResponse(); MetaData.Request metadata = new MetaData.Request(null, HttpURI.build("http://localhost").asImmutable(), null, HttpFields.build().add(HttpHeader.AUTHORIZATION, "Basic asdf")); req.setMetaData(metadata); assertThat(channel.getState().handling(), is(HttpChannelState.Action.DISPATCH)); assertEquals(Authentication.SEND_CONTINUE, _authenticator.validateRequest(req, res, true)); assertEquals(HttpHeader.NEGOTIATE.asString(), res.getHeader(HttpHeader.WWW_AUTHENTICATE.asString())); assertEquals(HttpServletResponse.SC_UNAUTHORIZED, res.getStatus()); }

Target:
public void testChallengeSentWithUnhandledAuthorization() throws Exception { HttpChannel channel = new HttpChannel(new MockConnector(), new HttpConfiguration(), null, null) { @Override public Server getServer() { return null; } @Override protected HttpOutput newHttpOutput() { return new HttpOutput(this) { @Override public void close() @Override public void flush() throws IOException }; } }; Request req = channel.getRequest(); Response res = channel.getResponse(); MetaData.Request metadata = new MetaData.Request(null, HttpURI.build("http://localhost"), null, HttpFields.build().add(HttpHeader.AUTHORIZATION, "Basic asdf")); req.setMetaData(metadata); assertThat(channel.getState().handling(), is(HttpChannelState.Action.DISPATCH)); assertEquals(Authentication.SEND_CONTINUE, _authenticator.validateRequest(req, res, true)); assertEquals(HttpHeader.NEGOTIATE.asString(), res.getHeader(HttpHeader.WWW_AUTHENTICATE.asString())); assertEquals(HttpServletResponse.SC_UNAUTHORIZED, res.getStatus()); }
Source:
private IMarkerResolutionGenerator createGenerator(IConfigurationElement element) { IMarkerResolutionGenerator generator = getGenerator(element); if (generator != null && generator != GENERATOR_NOT_STARTED) { return generator; } Bundle bundle = Platform.getBundle(element.getContributor().getName()); if (bundle.getState() == Bundle.ACTIVE) { generator = createGeneratorFromActiveBundle(element); } else { BundleContext bundleContext = bundle.getBundleContext(); if (bundleContext != null) { generator = GENERATOR_NOT_ACTIVE; bundleContext.addBundleListener(new BundleListener() { @Override public void bundleChanged(BundleEvent b) { if (b.getType() == BundleEvent.STARTED && bundle.getState() == Bundle.ACTIVE) { bundleContext.removeBundleListener(this); if (getGenerator(element) == GENERATOR_NOT_ACTIVE) { putGenerator(element, null); } } } }); if (bundle.getState() == Bundle.ACTIVE) { generator = createGeneratorFromActiveBundle(element); } } else { generator = GENERATOR_NOT_STARTED; } } putGenerator(element, generator); return generator; }

Target:
private IMarkerResolutionGenerator createGenerator(IConfigurationElement element) { IMarkerResolutionGenerator generator = getGenerator(element); if (generator != null && generator != GENERATOR_NOT_STARTED) { return generator; } Bundle bundle = Platform.getBundle(element.getContributor().getName()); if (canLoadExtensionWithoutActivation(bundle)) { generator = createGeneratorFromActiveBundle(element); } else { BundleContext bundleContext = bundle.getBundleContext(); if (bundleContext != null) { generator = GENERATOR_NOT_ACTIVE; bundleContext.addBundleListener(new BundleListener() { @Override public void bundleChanged(BundleEvent b) { if (b.getType() == BundleEvent.STARTED && canLoadExtensionWithoutActivation(bundle)) { bundleContext.removeBundleListener(this); if (getGenerator(element) == GENERATOR_NOT_ACTIVE) { putGenerator(element, null); } } } }); if (canLoadExtensionWithoutActivation(bundle)) { generator = createGeneratorFromActiveBundle(element); } } else { generator = GENERATOR_NOT_STARTED; } } putGenerator(element, generator); return generator; }
Source:
public Map<String, String> getRecipientsForQuestion( FeedbackQuestionAttributes question, String giver, InstructorAttributes instructorGiver, StudentAttributes studentGiver) throws EntityDoesNotExistException { Map<String, String> recipients = new HashMap<String, String>(); FeedbackParticipantType recipientType = question.recipientType; String giverTeam = getTeamNameForUser(giver, instructorGiver, studentGiver); addRecipientsBasedOnRecipientType(question, giver, studentGiver, recipients, recipientType, giverTeam); return recipients; }

Target:
public Map<String, String> getRecipientsForQuestion( FeedbackQuestionAttributes question, String giver, InstructorAttributes instructorGiver, StudentAttributes studentGiver) throws EntityDoesNotExistException { FeedbackParticipantType recipientType = question.recipientType; String giverTeam = getTeamNameForUser(giver, instructorGiver, studentGiver); return getRecipientsBasedOnRecipientType(question, giver, studentGiver, recipientType, giverTeam); }
Source:
public void shouldPerformStringSuffixSearch() throws Exception { int label = token.nodeLabel( "Node" ); int prop = token.propertyKey( "prop" ); CapableIndexReference index = schemaRead.index( label, prop ); IndexValueCapability stringCapability = index.value( ValueGroup.TEXT ); try ( NodeValueIndexCursor node = cursors.allocateNodeValueIndexCursor(); PrimitiveLongSet uniqueIds = Primitive.longSet() ) { read.nodeIndexSeek( index, node, null, IndexQuery.stringSuffix( prop, "e" ) ); assertFoundNodesAndValue( node, uniqueIds, stringCapability, strOne, strThree1, strThree2, strThree3 ); } }

Target:
public void shouldPerformStringSuffixSearch() throws Exception { int label = token.nodeLabel( "Node" ); int prop = token.propertyKey( "prop" ); CapableIndexReference index = schemaRead.index( label, prop ); IndexValueCapability stringCapability = index.valueCapability( ValueGroup.TEXT ); try ( NodeValueIndexCursor node = cursors.allocateNodeValueIndexCursor(); PrimitiveLongSet uniqueIds = Primitive.longSet() ) { read.nodeIndexSeek( index, node, IndexOrder.NONE, IndexQuery.stringSuffix( prop, "e" ) ); assertFoundNodesAndValue( node, uniqueIds, stringCapability, strOne, strThree1, strThree2, strThree3 ); } }
Source:
private void loadUnitDataBase(UnitDataBaseType newValue) { UnitDatabase unitDatabase = clientProperties.getUnitDatabase(); String rackoverSettingsEncoded = ""; if (newValue == UnitDataBaseType.RACKOVER) { String rackoverSettings = new Gson().toJson(new RackoversDBSettings(i18n.getUserSpecificLocale())); rackoverSettingsEncoded = Base64.getEncoder().encodeToString(rackoverSettings.getBytes()); } unitsRoot.getEngine().load(newValue == UnitDataBaseType.SPOOKY ? unitDatabase.getSpookiesUrl() : unitDatabase.getRackOversUrl() + rackoverSettingsEncoded); }

Target:
private void loadUnitDataBase(UnitDataBaseType newValue) { UnitDatabase unitDatabase = clientProperties.getUnitDatabase(); switch (newValue) { case RACKOVER: String rackoverSettings = new Gson().toJson(new RackoversDBSettings(i18n.getUserSpecificLocale())); String rackoverSettingsEncoded = Base64.getEncoder().encodeToString(rackoverSettings.getBytes()); unitsRoot.getEngine().load(String.format(unitDatabase.getRackOversUrl(), rackoverSettingsEncoded)); break; case SPOOKY: unitsRoot.getEngine().load(unitDatabase.getSpookiesUrl()); break; default: new ProgrammingError("Trying to load unimplemented database type: " + newValue.toString()); } }
Source:
public void can_merge_an_incoming_list_of_forms() { ExportForms forms = new ExportForms(new ArrayList<>(), new HashMap<>(), new HashMap<>()); assertThat(forms.size(), is(0)); int expectedSize = 10; forms.merge(buildFormStatusList(expectedSize)); assertThat(forms.size(), is(expectedSize)); }

Target:
public void can_merge_an_incoming_list_of_forms() { ExportForms forms = new ExportForms(new ArrayList<>(), ExportConfiguration.empty(), new HashMap<>(), new HashMap<>()); assertThat(forms.size(), is(0)); int expectedSize = 10; forms.merge(buildFormStatusList(expectedSize)); assertThat(forms.size(), is(expectedSize)); }
Source:
protected boolean canDoAction() { return (!QuotaHelper.getInstance().checkQuotaValidationForAddEdit(getParameters().getQuota(), getReturnValue().getCanDoActionMessages())); }

Target:
protected boolean canDoAction() { return (QuotaHelper.getInstance().checkQuotaValidationForAddEdit(getParameters().getQuota(), getReturnValue().getCanDoActionMessages())); }
Source:
public List<ConnectorTableLayoutResult> getTableLayouts(ConnectorSession session, ConnectorTableHandle table, Constraint<ColumnHandle> constraint, Optional<Set<ColumnHandle>> desiredColumns) { JdbcTableHandle tableHandle = (JdbcTableHandle) table; ConnectorTableLayout layout = new ConnectorTableLayout(new JdbcTableLayoutHandle(tableHandle, constraint.getSummary())); return ImmutableList.of(new ConnectorTableLayoutResult(layout, TupleDomain.all())); }

Target:
public List<ConnectorTableLayoutResult> getTableLayouts(ConnectorSession session, ConnectorTableHandle table, Constraint<ColumnHandle> constraint, Optional<Set<ColumnHandle>> desiredColumns) { JdbcTableHandle tableHandle = (JdbcTableHandle) table; ConnectorTableLayout layout = new ConnectorTableLayout(new JdbcTableLayoutHandle(tableHandle, constraint.getSummary())); TupleDomain<ColumnHandle> unenforcedTupleDomain = constraint.getSummary().transform(columnHandle -> { JdbcColumnHandle jdbcColumnHandle = (JdbcColumnHandle) columnHandle; if (isAcceptedType(jdbcColumnHandle.getColumnType())) { return null; } return jdbcColumnHandle; }); return ImmutableList.of(new ConnectorTableLayoutResult(layout, unenforcedTupleDomain)); }
Source:
private void handleEndedTask() { if (getState() != AsyncTaskState.Ended) { setState(AsyncTaskState.Ended); setLastStatusAccessTime(); } if (isZombieTask()) { getParameters().getDbAsyncTask().getTaskParameters().setTaskGroupSuccess(false); ExecutionHandler.endTaskStep(privateParameters.getDbAsyncTask().getStepId(), JobExecutionStatus.FAILED); onTaskEndFailure(); } if (isPartiallyCompletedCommandTask()) { getParameters().getDbAsyncTask().getTaskParameters().setTaskGroupSuccess(false); ExecutionHandler.endTaskStep(privateParameters.getDbAsyncTask().getStepId(), JobExecutionStatus.FAILED); onTaskEndFailure(); } if (hasTaskEndedSuccessfully()) { ExecutionHandler.endTaskStep(privateParameters.getDbAsyncTask().getStepId(), JobExecutionStatus.FINISHED); onTaskEndSuccess(); } else if (hasTaskEndedInFailure()) { ExecutionHandler.endTaskStep(privateParameters.getDbAsyncTask().getStepId(), JobExecutionStatus.FAILED); onTaskEndFailure(); } else if (!doesTaskExist()) { ExecutionHandler.endTaskStep(privateParameters.getDbAsyncTask().getStepId(), JobExecutionStatus.UNKNOWN); onTaskDoesNotExist(); } }

Target:
private void handleEndedTask() { if (getState() != AsyncTaskState.Ended) { setState(AsyncTaskState.Ended); setLastStatusAccessTime(); } if (isZombieTask() || isPartiallyCompletedCommandTask()) { getParameters().getDbAsyncTask().getTaskParameters().setTaskGroupSuccess(false); ExecutionHandler.endTaskStep(privateParameters.getDbAsyncTask().getStepId(), JobExecutionStatus.FAILED); onTaskEndFailure(); } if (hasTaskEndedSuccessfully()) { ExecutionHandler.endTaskStep(privateParameters.getDbAsyncTask().getStepId(), JobExecutionStatus.FINISHED); onTaskEndSuccess(); } else if (hasTaskEndedInFailure()) { ExecutionHandler.endTaskStep(privateParameters.getDbAsyncTask().getStepId(), JobExecutionStatus.FAILED); onTaskEndFailure(); } else if (!doesTaskExist()) { ExecutionHandler.endTaskStep(privateParameters.getDbAsyncTask().getStepId(), JobExecutionStatus.UNKNOWN); onTaskDoesNotExist(); } }
Source:
protected void executeVdsIdCommand() { if (_vdsManager == null) { getVDSReturnValue().setSucceeded(false); return; } MigrateBrokerVDSCommand<?> command = new MigrateBrokerVDSCommand<>(getParameters()); command.execute(); VDSReturnValue vdsReturnValue = command.getVDSReturnValue(); final VmDynamic vmDynamic = getVmDynamicDAO().get(getParameters().getVmId()); if (vdsReturnValue.getSucceeded()) { vmDynamic.setStatus(VMStatus.MigratingFrom); vmDynamic.setMigratingToVds(getParameters().getDstVdsId()); vmDynamic.setExitStatus(VmExitStatus.Normal); vmDynamic.setExitMessage(StringUtils.EMPTY); ResourceManager.getInstance().AddAsyncRunningVm(getParameters().getVmId()); getVDSReturnValue().setReturnValue(VMStatus.MigratingFrom); } else { log.error("Failed Vm migration"); getVDSReturnValue().setSucceeded(false); getVDSReturnValue().setReturnValue(vmDynamic.getStatus()); getVDSReturnValue().setVdsError(vdsReturnValue.getVdsError()); getVDSReturnValue().setExceptionString(vdsReturnValue.getExceptionString()); getVDSReturnValue().setExceptionObject(vdsReturnValue.getExceptionObject()); } TransactionSupport.executeInNewTransaction(new TransactionMethod<Void>() { @Override public Void runInTransaction() { getVmDynamicDAO().update(vmDynamic); return null; } }); }

Target:
protected void executeVdsIdCommand() { if (_vdsManager == null) { getVDSReturnValue().setSucceeded(false); return; } MigrateBrokerVDSCommand<?> command = new MigrateBrokerVDSCommand<>(getParameters()); command.execute(); VDSReturnValue vdsReturnValue = command.getVDSReturnValue(); final VM vm = getVmDao().get(getParameters().getVmId()); if (vdsReturnValue.getSucceeded()) { ResourceManager.getInstance().InternalSetVmStatus(vm, VMStatus.MigratingFrom); vm.setMigratingToVds(getParameters().getDstVdsId()); ResourceManager.getInstance().AddAsyncRunningVm(getParameters().getVmId()); getVDSReturnValue().setReturnValue(VMStatus.MigratingFrom); } else { log.error("Failed Vm migration"); getVDSReturnValue().setSucceeded(false); getVDSReturnValue().setReturnValue(vm.getStatus()); getVDSReturnValue().setVdsError(vdsReturnValue.getVdsError()); getVDSReturnValue().setExceptionString(vdsReturnValue.getExceptionString()); getVDSReturnValue().setExceptionObject(vdsReturnValue.getExceptionObject()); } TransactionSupport.executeInNewTransaction(new TransactionMethod<Void>() { @Override public Void runInTransaction() { getVmDynamicDAO().update(vm.getDynamicData()); return null; } }); }
Source:
public Mono<OAuth2AuthorizedClient> clientCredentials( ClientRegistration clientRegistration, Authentication authentication, ServerWebExchange exchange) { OAuth2ClientCredentialsGrantRequest grantRequest = new OAuth2ClientCredentialsGrantRequest(clientRegistration); return this.clientCredentialsTokenResponseClient.getTokenResponse(grantRequest) .flatMap(tokenResponse -> clientCredentialsResponse(clientRegistration, authentication, exchange, tokenResponse)); }

Target:
Mono<OAuth2AuthorizedClient> clientCredentials( ClientRegistration clientRegistration, Authentication authentication, ServerWebExchange exchange) { OAuth2ClientCredentialsGrantRequest grantRequest = new OAuth2ClientCredentialsGrantRequest(clientRegistration); return this.clientCredentialsTokenResponseClient.getTokenResponse(grantRequest) .flatMap(tokenResponse -> clientCredentialsResponse(clientRegistration, authentication, exchange, tokenResponse)); }
Source:
public void onComplete() { if (inMaybe) { actual.onComplete(); } else { inMaybe = true; s = SubscriptionHelper.CANCELLED; MaybeSource<? extends T> c = other; other = null; c.subscribe(this); } }

Target:
public void onComplete() { if (inMaybe) { actual.onComplete(); } else { inMaybe = true; s = SubscriptionHelper.CANCELLED; MaybeSource<? extends T> ms = other; other = null; ms.subscribe(this); } }
Source:
public void removeDataBundle(DataBundle dataBundle) { deleteCourses(dataBundle.courses.values()); for (AccountAttributes account : dataBundle.accounts.values()) { if (account.studentProfile == null) { account.studentProfile = new StudentProfileAttributes(); account.studentProfile.googleId = account.googleId; } } accountsDb.deleteAccounts(dataBundle.accounts.values()); for (AdminEmailAttributes email : dataBundle.adminEmails.values()) { AdminEmailAttributes emailInDb = adminEmailsDb.getAdminEmailBySubject(email.subject); if (emailInDb != null) { adminEmailsDb.deleteEntity(emailInDb); } } }

Target:
public void removeDataBundle(DataBundle dataBundle) { deleteCourses(dataBundle.courses.values()); for (AccountAttributes account : dataBundle.accounts.values()) { if (account.studentProfile == null) { account.studentProfile = new StudentProfileAttributes(); account.studentProfile.googleId = account.googleId; } } accountsDb.deleteAccounts(dataBundle.accounts.values()); for (AdminEmailAttributes email : dataBundle.adminEmails.values()) { AdminEmailAttributes emailInDb = adminEmailsDb.getAdminEmailBySubject(email.subject); if (emailInDb == null) { continue; } adminEmailsDb.deleteEntity(emailInDb); } }
Source:
public void createDocument(String type, int id, String name, String desc, File file) { checkViewAttached(); getMvpView().showProgressbar(true); mSubscriptions.add(mDataManagerDocument .createDocument(type, id, name, desc, getRequestFileBody(file)) .observeOn(AndroidSchedulers.mainThread()) .subscribeOn(Schedulers.io()) .subscribe(new Subscriber<DocumentRelatedResponse>() { @Override public void onCompleted() { getMvpView().showProgressbar(false); } @Override public void onError(Throwable e) { getMvpView().showProgressbar(false); if (e instanceof HttpException) { try { String errorMessage = ((HttpException) e).response().errorBody() .string(); getMvpView().showCreationError(MFErrorParser .parseError(errorMessage) .getErrors().get(0).getDefaultUserMessage()); } catch (Throwable throwable) { RxJavaPlugins.getInstance().getErrorHandler().handleError(e); } } else { getMvpView().showCreationError(e.getLocalizedMessage()); } } @Override public void onNext(DocumentRelatedResponse documentCreationResponse) { getMvpView().showProgressbar(false); getMvpView().showDocumentedCreatedSuccessfully(documentCreationResponse); } })); }

Target:
public void createDocument(String type, int id, String name, String desc, File file) { checkViewAttached(); getMvpView().showProgressbar(true); mSubscriptions.add(mDataManagerDocument .createDocument(type, id, name, desc, getRequestFileBody(file)) .observeOn(AndroidSchedulers.mainThread()) .subscribeOn(Schedulers.io()) .subscribe(new Subscriber<DocumentRelatedResponse>() { @Override public void onCompleted() { getMvpView().showProgressbar(false); } @Override public void onError(Throwable e) { getMvpView().showProgressbar(false); getMvpView().showCreationError(MFErrorParser.errorMessage(e)); } @Override public void onNext(DocumentRelatedResponse documentCreationResponse) { getMvpView().showProgressbar(false); getMvpView().showDocumentedCreatedSuccessfully(documentCreationResponse); } })); }
Source:
public List<ApiClusterTemplateConfig> getRoleConfigs(String roleType, TemplatePreparationObject source) { String adminGroup = virtualGroupService.getVirtualGroup(source.getVirtualGroupRequest(), UmsRight.RANGER_ADMIN.getRight()); if (CloudPlatform.AZURE.equals(source.getCloudPlatform()) && source.getGeneralClusterConfigs().isEnableRangerRaz()) { String servicePrincipals = getServicePrincipalsString(source); return List.of( config(ROLE_SAFETY_VALVE, ConfigUtils.getSafetyValveProperty(RANGER_USERSYNC_UNIX_BACKEND, "nss")), config(ROLE_ASSIGNMENT_RULES, "&ROLE_SYS_ADMIN:g:" + adminGroup), config(RANGER_USERSYNC_AZURE_MAPPING, servicePrincipals)); } else { return List.of( config(ROLE_SAFETY_VALVE, ConfigUtils.getSafetyValveProperty(RANGER_USERSYNC_UNIX_BACKEND, "nss")), config(ROLE_ASSIGNMENT_RULES, "&ROLE_SYS_ADMIN:g:" + adminGroup)); } }

Target:
public List<ApiClusterTemplateConfig> getRoleConfigs(String roleType, TemplatePreparationObject source) { String adminGroup = virtualGroupService.getVirtualGroup(source.getVirtualGroupRequest(), UmsRight.RANGER_ADMIN.getRight()); if (CloudPlatform.AZURE.equals(source.getCloudPlatform()) && source.getGeneralClusterConfigs().isEnableRangerRaz() && source.getServicePrincipals() != null) { String servicePrincipals = getServicePrincipalsString(source); return List.of( config(ROLE_SAFETY_VALVE, ConfigUtils.getSafetyValveProperty(RANGER_USERSYNC_UNIX_BACKEND, "nss")), config(ROLE_ASSIGNMENT_RULES, "&ROLE_SYS_ADMIN:g:" + adminGroup), config(RANGER_USERSYNC_AZURE_MAPPING, servicePrincipals)); } else { return List.of( config(ROLE_SAFETY_VALVE, ConfigUtils.getSafetyValveProperty(RANGER_USERSYNC_UNIX_BACKEND, "nss")), config(ROLE_ASSIGNMENT_RULES, "&ROLE_SYS_ADMIN:g:" + adminGroup)); } }
Source:
private RequestTemplate addQueryMapQueryParameters(Object[] argv, RequestTemplate mutable) { for (int currQueryMapIndex : metadata.queryMapIndices()) { Object value = argv[currQueryMapIndex]; if (value instanceof Map) { Map<String, Object> currQueryMap = (Map<String, Object>) value; for (Entry<String, Object> currEntry : currQueryMap.entrySet()) { Collection<String> values = new ArrayList<String>(); Object currValue = currEntry.getValue(); if (currValue instanceof Iterable<?>) { Iterator<?> iter = ((Iterable<?>) currValue).iterator(); while (iter.hasNext()) { values.add(String.valueOf(iter.next())); } } else { values.add(String.valueOf(currValue)); } mutable.query(currEntry.getKey(), values); } } } return mutable; }

Target:
private RequestTemplate addQueryMapQueryParameters(Object[] argv, RequestTemplate mutable) { Map<Object, Object> queryMap = (Map<Object, Object>) argv[metadata.queryMapIndex()]; for (Entry<Object, Object> currEntry : queryMap.entrySet()) { checkState(currEntry.getKey().getClass() == String.class, "QueryMap key must be a String: %s", currEntry.getKey()); Collection<String> values = new ArrayList<String>(); Object currValue = currEntry.getValue(); if (currValue instanceof Iterable<?>) { Iterator<?> iter = ((Iterable<?>) currValue).iterator(); while (iter.hasNext()) { Object nextObject = iter.next(); values.add(nextObject == null ? null : nextObject.toString()); } } else { values.add(currValue == null ? null : currValue.toString()); } mutable.query((String) currEntry.getKey(), values); } return mutable; }
Source:
public void testZkBarrierForVersionUpgradeWithTimeOut() { String barrierId = String.format("%s/%s", zkUtils1.getKeyBuilder().getRootPath(), RandomStringUtils.randomAlphabetic(4)); List<String> processors = ImmutableList.of("p1", "p2", "p3"); AtomicInteger timeoutStateChangeCalled = new AtomicInteger(0); CountDownLatch latch = new CountDownLatch(2); TestZkBarrierListener listener = new TestZkBarrierListener(latch, timeoutStateChangeCalled, State.TIMED_OUT); ZkBarrierForVersionUpgrade processor1Barrier = new ZkBarrierForVersionUpgrade(barrierId, zkUtils, listener); ZkBarrierForVersionUpgrade processor2Barrier = new ZkBarrierForVersionUpgrade(barrierId, zkUtils1, listener); processor1Barrier.create(BARRIER_VERSION, processors); processor1Barrier.join(BARRIER_VERSION, "p1"); processor2Barrier.join(BARRIER_VERSION, "p2"); processor1Barrier.expire(BARRIER_VERSION); boolean result = false; try { result = latch.await(10000, TimeUnit.MILLISECONDS); } catch (InterruptedException e) { e.printStackTrace(); } assertTrue("Barrier Timeout test failed to complete within test timeout.", result); List<String> children = zkUtils.getZkClient().getChildren(barrierId + "/barrier_1/barrier_participants"); State barrierState = zkUtils.getZkClient().readData(barrierId + "/barrier_1/barrier_state"); assertEquals(State.TIMED_OUT, barrierState); assertNotNull(children); assertEquals("Unexpected barrier state. Didn't find two processors.", 2, children.size()); assertEquals("Unexpected barrier state. Didn't find the expected members.", ImmutableList.of("p1", "p2"), children); assertEquals(2, timeoutStateChangeCalled.get()); }

Target:
public void testZkBarrierForVersionUpgradeWithTimeOut() { String barrierId = String.format("%s/%s", zkUtils1.getKeyBuilder().getRootPath(), RandomStringUtils.randomAlphabetic(4)); List<String> processors = ImmutableList.of("p1", "p2", "p3"); CountDownLatch latch = new CountDownLatch(2); TestZkBarrierListener listener = new TestZkBarrierListener(latch, State.TIMED_OUT); ZkBarrierForVersionUpgrade processor1Barrier = new ZkBarrierForVersionUpgrade(barrierId, zkUtils, listener); ZkBarrierForVersionUpgrade processor2Barrier = new ZkBarrierForVersionUpgrade(barrierId, zkUtils1, listener); processor1Barrier.create(BARRIER_VERSION, processors); processor1Barrier.join(BARRIER_VERSION, "p1"); processor2Barrier.join(BARRIER_VERSION, "p2"); processor1Barrier.expire(BARRIER_VERSION); boolean result = false; try { result = latch.await(10000, TimeUnit.MILLISECONDS); } catch (InterruptedException e) { e.printStackTrace(); } assertTrue("Barrier Timeout test failed to complete within test timeout.", result); List<String> children = zkUtils.getZkClient().getChildren(barrierId + "/barrier_1/barrier_participants"); State barrierState = zkUtils.getZkClient().readData(barrierId + "/barrier_1/barrier_state"); assertEquals(State.TIMED_OUT, barrierState); assertNotNull(children); assertEquals("Unexpected barrier state. Didn't find two processors.", 2, children.size()); assertEquals("Unexpected barrier state. Didn't find the expected members.", ImmutableList.of("p1", "p2"), children); }
Source:
public CloseableLiquibase(String changeLogFile, ResourceAccessor resourceAccessor, Database database, ManagedDataSource dataSource) throws LiquibaseException, SQLException { super(changeLogFile, resourceAccessor, database); this.dataSource = dataSource; }

Target:
CloseableLiquibase( String changeLogFile, ResourceAccessor resourceAccessor, Database database, ManagedDataSource dataSource ) throws LiquibaseException, SQLException { super(changeLogFile, resourceAccessor, database); this.dataSource = dataSource; }
Source:
public boolean submit(final RequestContext requestContext, final Credential credential) { try { final AcceptableUsagePolicyProperties.Jdbc jdbc = properties.getJdbc(); String aupColumnName = properties.getAupAttributeName(); if (StringUtils.isNotBlank(jdbc.getAupColumn())) { aupColumnName = jdbc.getAupColumn(); } final String sql = String.format(jdbc.getSqlUpdateAUP(), jdbc.getTableName(), aupColumnName, jdbc.getPrincipalIdColumn()); String principalId = credential.getId(); if (StringUtils.isNotBlank(jdbc.getPrincipalIdAttribute())) { @NonNull final Principal principal = WebUtils.getAuthentication(requestContext).getPrincipal(); final String pIdAttribName = jdbc.getPrincipalIdAttribute(); if (principal.getAttributes().containsKey(pIdAttribName)) { final Object pIdAttribValue = principal.getAttributes().get(pIdAttribName); if (pIdAttribValue instanceof String) { principalId = pIdAttribValue.toString(); } else { LOGGER.warn("Principal attribute was found, but its value is not a String", pIdAttribName, pIdAttribValue); } } else { LOGGER.warn("Principal attribute cannot be found. Falling back to principal ID", pIdAttribName); } } LOGGER.debug("Executing update query for principal [{}]", sql, principalId); return this.jdbcTemplate.update(sql, principalId) > 0; } catch (final Exception e) { LOGGER.error(e.getMessage(), e); } return false; }

Target:
public boolean submit(final RequestContext requestContext, final Credential credential) { try { final AcceptableUsagePolicyProperties.Jdbc jdbc = properties.getJdbc(); String aupColumnName = properties.getAupAttributeName(); if (StringUtils.isNotBlank(jdbc.getAupColumn())) { aupColumnName = jdbc.getAupColumn(); } final String sql = String.format(jdbc.getSqlUpdateAUP(), jdbc.getTableName(), aupColumnName, jdbc.getPrincipalIdColumn()); final String principalId = determinePrincipalId(requestContext, credential); LOGGER.debug("Executing update query for principal [{}]", sql, principalId); return this.jdbcTemplate.update(sql, principalId) > 0; } catch (final Exception e) { LOGGER.error(e.getMessage(), e); } return false; }
Source:
public Predicate<ChangeData> reviewer(String who) throws QueryParseException, OrmException { if ("self".equals(who)) { if (currentUser instanceof IdentifiedUser) { return new ReviewerPredicate( args.dbProvider, ((IdentifiedUser) currentUser).getAccountId()); } else { throw error("reviewer:self not valid for caller"); } } Set<Account.Id> m = args.accountResolver.findAll(who); if (m.isEmpty()) { throw error("User " + who + " not found"); } else if (m.size() == 1) { Account.Id id = m.iterator().next(); return new ReviewerPredicate(args.dbProvider, id); } else { List<ReviewerPredicate> p = new ArrayList<ReviewerPredicate>(m.size()); for (Account.Id id : m) { p.add(new ReviewerPredicate(args.dbProvider, id)); } return Predicate.or(p); } }

Target:
public Predicate<ChangeData> reviewer(String who) throws QueryParseException, OrmException { Set<Account.Id> m = parseAccount(who); List<ReviewerPredicate> p = Lists.newArrayListWithCapacity(m.size()); for (Account.Id id : m) { p.add(new ReviewerPredicate(args.dbProvider, id)); } return Predicate.or(p); }
Source:
private Optional<KieServerConnectionInfo> get(String confType, BiFunction<String, KieServerConfigurationKey, Optional<String>> propertyProvider) { Optional<String> url = propertyProvider.apply(confType, KieServerConfigurationKey.LOCATION); Optional<String> user = propertyProvider.apply(confType, KieServerConfigurationKey.USER); Optional<String> password = propertyProvider.apply(confType, KieServerConfigurationKey.PASSWORD); Optional<String> token = propertyProvider.apply(confType, KieServerConfigurationKey.TOKEN); if (!url.isPresent() && !user.isPresent() && !password.isPresent() && !token.isPresent()) { return Optional.empty(); } return Optional.of(new KieServerConnectionInfo(url, user, password, token)); }

Target:
private Optional<KieServerConnectionInfo> get(String confType, BiFunction<String, KieServerConfigurationKey, Optional<String>> propertyProvider) { Optional<String> url = propertyProvider.apply(confType, KieServerConfigurationKey.LOCATION); Optional<String> user = propertyProvider.apply(confType, KieServerConfigurationKey.USER); Optional<String> password = propertyProvider.apply(confType, KieServerConfigurationKey.PASSWORD); Optional<String> token = propertyProvider.apply(confType, KieServerConfigurationKey.TOKEN); Optional<String> replaceQueryOp = propertyProvider.apply(confType, KieServerConfigurationKey.REPLACE_QUERY); boolean noPropertyFound = Stream.of(url, user, password, token, replaceQueryOp) .noneMatch(Optional::isPresent); if (noPropertyFound) { return Optional.empty(); } boolean replaceQuery = replaceQueryOp.isPresent() && Boolean.TRUE.toString().equalsIgnoreCase(replaceQueryOp.get()); return Optional.of(new KieServerConnectionInfo(url, user, password, token, replaceQuery)); }
Source:
public static void removeFileMetadataFromList(Collection<FileMetadata> collection, FileMetadata fmToDelete) { if (fmToDelete.getId() != null) { collection.remove(fmToDelete); } else { Iterator<FileMetadata> fmit = collection.iterator(); while (fmit.hasNext()) { FileMetadata fmd = fmit.next(); if (fmToDelete.getDataFile().getStorageIdentifier().equals(fmd.getDataFile().getStorageIdentifier())) { if (fmToDelete.getDatasetVersion().getId() == null) { if (fmd.getDatasetVersion().getId() == null) { fmit.remove(); break; } } else if (fmToDelete.getDatasetVersion().getId().equals(fmd.getDatasetVersion().getId())) { fmit.remove(); break; } } } } }

Target:
public static void removeFileMetadataFromList(Collection<FileMetadata> collection, FileMetadata fmToDelete) { if (fmToDelete.getId() != null) { collection.remove(fmToDelete); } else { Iterator<FileMetadata> fmit = collection.iterator(); while (fmit.hasNext()) { FileMetadata fmd = fmit.next(); if (fmToDelete.getDataFile().getStorageIdentifier().equals(fmd.getDataFile().getStorageIdentifier())) { if(fmToDelete.getDatasetVersion() == null) { fmit.remove(); } else if (fmToDelete.getDatasetVersion().getId() == null) { if (fmd.getDatasetVersion().getId() == null) { fmit.remove(); break; } } else if (fmToDelete.getDatasetVersion().getId().equals(fmd.getDatasetVersion().getId())) { fmit.remove(); break; } } } } }
Source:
public Set<SchemaDescriptor> getRelatedIndexes( long[] changedEntityTokens, long[] unchangedEntityTokens, IntSet properties, EntityType entityType ) { Function<long[],Set<SchemaDescriptor>> byEnitiyIds; BiFunction<long[],IntSet,Set<SchemaDescriptor>> byProperties; if ( entityType == EntityType.NODE ) { byEnitiyIds = labels -> extractIndexesByEntityTokens( labels, descriptorsByLabel, descriptorsForAllLabels ); byProperties = ( unchangedLabels, changedProperties ) -> getDescriptorsByProperties( unchangedLabels, changedProperties, descriptorsByLabel, descriptorsForAllLabels, descriptorsByProperty ); } else { byEnitiyIds = reltypes -> extractIndexesByEntityTokens( reltypes, descriptorsByReltype, descriptorsForAllReltypes ); byProperties = ( unchangedLabels, changedProperties ) -> getDescriptorsByProperties( unchangedLabels, changedProperties, descriptorsByReltype, descriptorsForAllReltypes, relationshipDescriptorsByProperty ); } if ( properties.isEmpty() ) { Set<SchemaDescriptor> descriptors = byEnitiyIds.apply( changedEntityTokens ); return descriptors == null ? Collections.emptySet() : descriptors; } if ( changedEntityTokens.length == 0 ) { return byProperties.apply( unchangedEntityTokens, properties ); } Set<SchemaDescriptor> descriptors = byEnitiyIds.apply( changedEntityTokens ); descriptors.addAll( byProperties.apply( unchangedEntityTokens, properties ) ); return descriptors; }

Target:
public Set<SchemaDescriptor> getRelatedIndexes( long[] changedEntityTokens, long[] unchangedEntityTokens, IntSet properties, EntityType entityType ) { switch ( entityType ) { case NODE: return getRelatedDescriptors( changedEntityTokens, unchangedEntityTokens, properties, descriptorsByLabel, descriptorsForAllLabels, nodeDescriptorsByProperty ); case RELATIONSHIP: return getRelatedDescriptors( changedEntityTokens, unchangedEntityTokens, properties, descriptorsByReltype, descriptorsForAllReltypes, relationshipDescriptorsByProperty ); default: throw new IllegalArgumentException( "The given EntityType cannot be indexed: " + entityType ); } }
Source:
public static Package getBaseProtocol(Element anElement) { if (anElement != null) { IDefaultLanguage language = null; try { IDefaultLanguageService service = ServiceUtilsForEObject.getInstance().getService(IDefaultLanguageService.class, anElement); language = service.getActiveDefaultLanguage(anElement); } catch (ServiceException e) { Activator.log.error(e); } TransactionalEditingDomain domain = TransactionUtil.getEditingDomain(anElement); Collaboration baseProtocol = language.getBaseProtocol(domain.getResourceSet()); if (baseProtocol != null) { return getProtocolContainer(language.getBaseProtocol(domain.getResourceSet())); } } return null; }

Target:
public static Package getBaseProtocol(Element anElement) { if (anElement != null) { IDefaultLanguage language = null; try { IDefaultLanguageService service = ServiceUtilsForEObject.getInstance().getService(IDefaultLanguageService.class, anElement); language = service.getActiveDefaultLanguage(anElement); } catch (ServiceException e) { Activator.log.error(e); } TransactionalEditingDomain domain = TransactionUtil.getEditingDomain(anElement); Collaboration baseProtocol = language.getBaseProtocol(domain.getResourceSet()); if (baseProtocol != null) { return getProtocolContainer(baseProtocol); } } return null; }
Source:
private ValidationResult validateSnapshotsLegality() { Snapshot snapshot = getSnapshotDao().getSnapshotByImageStatus(ImageStatus.ILLEGAL); if (snapshot != null && !snapshot.getId().equals(getParameters().getSnapshotId())) { return new ValidationResult(EngineMessage.ACTION_TYPE_FAILED_VM_SNAPSHOT_WITH_ILLEGAL_VOLUME_EXISTS, String.format("$snapshot %s", snapshot.getDescription())); } return ValidationResult.VALID; }

Target:
private ValidationResult validateSnapshotsLegality() { Optional<Snapshot> snapshot = getSnapshotDao().getSnapshotsByImageStatus(getVmId(), ImageStatus.ILLEGAL).stream().findFirst(); if (snapshot.isPresent() && !snapshot.get().getId().equals(getParameters().getSnapshotId())) { return new ValidationResult(EngineMessage.ACTION_TYPE_FAILED_VM_SNAPSHOT_WITH_ILLEGAL_VOLUME_EXISTS, String.format("$snapshot %s", snapshot.get().getDescription())); } return ValidationResult.VALID; }
Source:
public <T> CompletableFuture<ControllerProxy<T>> createController(String name) { if(StringUtil.isBlank(name)) { throw new IllegalArgumentException("name must not be null or empty!"); } if(destroyed) { throw new IllegalStateException("The client is disconnected!"); } final HighlanderBean bean = platformBeanRepository.getHighlanderBean(); bean.setControllerName(name); return invokeDolphinCommand(PlatformConstants.REGISTER_CONTROLLER_COMMAND_NAME).handle((v, e) -> { if (e != null) { throw new RuntimeException(e); } @SuppressWarnings("unchecked") final T model = (T) bean.getModel(); return new ControllerProxyImpl<>(bean.getControllerId(), model, clientDolphin, platformBeanRepository); }); }

Target:
public <T> CompletableFuture<ControllerProxy<T>> createController(String name) { if(StringUtil.isBlank(name)) { throw new IllegalArgumentException("name must not be null or empty!"); } if(destroyed) { throw new IllegalStateException("The client is disconnected!"); } final InternalAttributesBean bean = platformBeanRepository.getInternalAttributesBean(); bean.setControllerName(name); return invokeDolphinCommand(PlatformConstants.REGISTER_CONTROLLER_COMMAND_NAME).handle((v, e) -> { if (e != null) { throw new RuntimeException(e); } @SuppressWarnings("unchecked") final T model = (T) bean.getModel(); return new ControllerProxyImpl<>(bean.getControllerId(), model, clientDolphin, platformBeanRepository); }); }
Source:
public List<URI> getSupportedClaimTypes() { List<URI> supportedClaimTypes = new ArrayList<>(); for (String claim : supportedClaims) { try { supportedClaimTypes.add(new URI(claim)); } catch (URISyntaxException e) { LOGGER.error("Invalid supported claim: \"{}\"", claim); } } return supportedClaimTypes; }

Target:
public List<URI> getSupportedClaimTypes() { return this.supportedClaims; }
Source:
public Set<Integer> getGermplasmsWithOpenLots(final List<Integer> gids) { Set<Integer> gidsWithOpenLots = new HashSet<>(); try { Query query = this.getSession().createSQLQuery(GET_GIDS_WITH_OPEN_LOTS).setParameterList("gids", gids); gidsWithOpenLots = Sets.newHashSet(query.list()); } catch (Exception e) { this.logAndThrowException("Error at checkGermplasmsWithOpenLots for GIDss = " + gids + AT_LOT_DAO + e.getMessage(), e); } return gidsWithOpenLots; }

Target:
public Set<Integer> getGermplasmsWithOpenLots(final List<Integer> gids) { Set<Integer> gidsWithOpenLots = new HashSet<>(); try { Query query = this.getSession().createSQLQuery(GET_GIDS_WITH_OPEN_LOTS).setParameterList("gids", gids); gidsWithOpenLots = Sets.newHashSet(query.list()); } catch (Exception e) { LotDAO.LOG.error("Error at checkGermplasmsWithOpenLots for GIDss = " + gids + AT_LOT_DAO + e.getMessage(), e); throw new MiddlewareQueryException("Error at checkGermplasmsWithOpenLots for GIDss = " + gids + AT_LOT_DAO + e.getMessage(), e); } return gidsWithOpenLots; }
Source:
public Builder(Retrofit retrofit) { this.platform = retrofit.platform; this.callFactory = retrofit.callFactory; this.baseUrl = retrofit.baseUrl; this.converterFactories = retrofit.converterFactories; this.adapterFactories = retrofit.adapterFactories; this.callbackExecutor = retrofit.callbackExecutor; this.validateEagerly = retrofit.validateEagerly; }

Target:
public Builder(Retrofit retrofit) { this.platform = retrofit.platform; this.callFactory = retrofit.callFactory; this.baseUrl = retrofit.baseUrl; this.converterFactories.addAll(retrofit.converterFactories); this.adapterFactories.addAll(retrofit.adapterFactories); this.callbackExecutor = retrofit.callbackExecutor; this.validateEagerly = retrofit.validateEagerly; }
Source:
public Response invalidate(@Required @QueryParam("oauth_provider") String oauthProvider) throws IOException, BadRequestException { OAuthAuthenticator oauth = getAuthenticator(oauthProvider); final Principal principal = security.getUserPrincipal(); if (principal != null && oauth.invalidateToken(principal.getName())) { return Response.ok().build(); } return Response.status(404) .entity("Not found OAuth token for " + (principal != null ? principal.getName() : null)) .type(MediaType.TEXT_PLAIN).build(); }

Target:
public void invalidate(@Required @QueryParam("oauth_provider") String oauthProvider) throws BadRequestException, NotFoundException, ServerException, ForbiddenException { OAuthAuthenticator oauth = getAuthenticator(oauthProvider); final User user = EnvironmentContext.getCurrent().getUser(); try { if (!oauth.invalidateToken(user.getId())) { throw new NotFoundException("OAuth token for user " + user.getId() + " was not found"); } } catch (IOException e) { throw new ServerException(e.getMessage()); } }