auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public IdentityProvider buildAndCreate(Client client) { IdentityProvider createdIdp = client.createIdentityProvider(client.instantiate(IdentityProvider.class) .setType(IdentityProvider.TypeEnum.GOOGLE) .setName(name) .setProtocol(client.instantiate(Protocol.class) .setType(protocolType) .setScopes(scopes) .setCredentials(client.instantiate(IdentityProviderCredentials.class) .setClient(client.instantiate(IdentityProviderCredentialsClient.class) .setClientId(clientId) .setClientSecret(clientSecret)))) .setPolicy(client.instantiate(IdentityProviderPolicy.class) .setProvisioning(client.instantiate(Provisioning.class) .setAction(Provisioning.ActionEnum.AUTO) .setProfileMaster(isProfileMaster) .setGroups(client.instantiate(ProvisioningGroups.class) .setAction(ProvisioningGroups.ActionEnum.NONE)) .setConditions(client.instantiate(ProvisioningConditions.class) .setDeprovisioned(client.instantiate(ProvisioningDeprovisionedCondition.class) .setAction(ProvisioningDeprovisionedCondition.ActionEnum.NONE)) .setSuspended(client.instantiate(ProvisioningSuspendedCondition.class) .setAction(ProvisioningSuspendedCondition.ActionEnum.NONE)))) .setAccountLink(client.instantiate(PolicyAccountLink.class) .setFilter(null) .setAction(PolicyAccountLink.ActionEnum.AUTO)) .setSubject(client.instantiate(PolicySubject.class) .setUserNameTemplate(client.instantiate(PolicyUserNameTemplate.class) .setTemplate(userNameTemplate)) .setMatchType(policySubjectMatchType)) .setMaxClockSkew(maxClockSkew))); return createdIdp; }

Target:
public IdentityProvider buildAndCreate(Client client) { return client.createIdentityProvider(client.instantiate(IdentityProvider.class) .setType(IdentityProvider.TypeEnum.GOOGLE) .setName(name) .setProtocol(client.instantiate(Protocol.class) .setType(Protocol.TypeEnum.OIDC) .setScopes(scopes) .setCredentials(client.instantiate(IdentityProviderCredentials.class) .setClient(client.instantiate(IdentityProviderCredentialsClient.class) .setClientId(clientId) .setClientSecret(clientSecret)))) .setPolicy(client.instantiate(IdentityProviderPolicy.class) .setProvisioning(client.instantiate(Provisioning.class) .setAction(Provisioning.ActionEnum.AUTO) .setProfileMaster(isProfileMaster) .setGroups(client.instantiate(ProvisioningGroups.class) .setAction(ProvisioningGroups.ActionEnum.NONE)) .setConditions(client.instantiate(ProvisioningConditions.class) .setDeprovisioned(client.instantiate(ProvisioningDeprovisionedCondition.class) .setAction(ProvisioningDeprovisionedCondition.ActionEnum.NONE)) .setSuspended(client.instantiate(ProvisioningSuspendedCondition.class) .setAction(ProvisioningSuspendedCondition.ActionEnum.NONE)))) .setAccountLink(client.instantiate(PolicyAccountLink.class) .setFilter(null) .setAction(PolicyAccountLink.ActionEnum.AUTO)) .setSubject(client.instantiate(PolicySubject.class) .setUserNameTemplate(client.instantiate(PolicyUserNameTemplate.class) .setTemplate(userName)) .setMatchType(matchType)) .setMaxClockSkew(maxClockSkew))); }
Source:
public boolean equals(Object o) { if (this == o) { return true; } if (o == null) { return false; } if (getClass() != o.getClass()) { return false; } VariantEntityRepositoryFilter o1 = (VariantEntityRepositoryFilter) o; return (this.field.equals(o1.field) && Objects.equals(this.value, o1.value) && Objects.equals(this.operator, o1.operator)); }

Target:
public boolean equals(Object o) { if (this == o) return true; if (!(o instanceof VariantEntityRepositoryFilter)) { return false; } VariantEntityRepositoryFilter<?> that = (VariantEntityRepositoryFilter<?>) o; if (!field.equals(that.field)) { return false; } if (!value.equals(that.value)) { return false; } return operator == that.operator; }
Source:
private String getConfigMethodType(ITestResult iTestResult) { if (iTestResult.getMethod().isBeforeSuiteConfiguration()){ return "@BeforeSuite"; } if (iTestResult.getMethod().isBeforeTestConfiguration()) { return "@BeforeTest"; } if (iTestResult.getMethod().isBeforeClassConfiguration()) { return "@BeforeClass"; } if (iTestResult.getMethod().isBeforeMethodConfiguration()) { return "@BeforeMethod"; } if (iTestResult.getMethod().isAfterSuiteConfiguration()){ return "@AfterSuite"; } if (iTestResult.getMethod().isAfterTestConfiguration()) { return "@AfterTest"; } if (iTestResult.getMethod().isAfterClassConfiguration()) { return "@AfterClass"; } if (iTestResult.getMethod().isAfterMethodConfiguration()) { return "@AfterMethod"; } return ""; }

Target:
private ConfigMethodType getConfigMethodType(ITestResult iTestResult) { if (iTestResult.getMethod().isBeforeSuiteConfiguration()){ return ConfigMethodType.BeforeSuite; } if (iTestResult.getMethod().isBeforeTestConfiguration()) { return ConfigMethodType.BeforeTest; } if (iTestResult.getMethod().isBeforeClassConfiguration()) { return ConfigMethodType.BeforeClass; } if (iTestResult.getMethod().isBeforeGroupsConfiguration()) { return ConfigMethodType.BeforeGroups; } if (iTestResult.getMethod().isBeforeMethodConfiguration()) { return ConfigMethodType.BeforeMethod; } if (iTestResult.getMethod().isAfterSuiteConfiguration()){ return ConfigMethodType.AfterSuite; } if (iTestResult.getMethod().isAfterTestConfiguration()) { return ConfigMethodType.AfterTest; } if (iTestResult.getMethod().isAfterClassConfiguration()) { return ConfigMethodType.AfterClass; } if (iTestResult.getMethod().isAfterGroupsConfiguration()) { return ConfigMethodType.AfterGroups; } if (iTestResult.getMethod().isAfterMethodConfiguration()) { return ConfigMethodType.AfterMethod; } return null; }
Source:
void receivedInAppMessageJson(@NonNull JSONArray json) throws JSONException { OneSignalPrefs.saveString(OneSignalPrefs.PREFS_ONESIGNAL, OneSignalPrefs.PREFS_OS_CACHED_IAMS, json.toString()); ArrayList<OSInAppMessage> newMessages = processInAppMessageJson(json); List<OSInAppMessage> updatedRedisplayMessages = inAppMessageRepository.updateInAppMessage(newMessages, redisplayInAppMessages); if (redisplayInAppMessages.size() != updatedRedisplayMessages.size()) { redisplayInAppMessages = updatedRedisplayMessages; } setMessages(newMessages); }

Target:
void receivedInAppMessageJson(@NonNull JSONArray json) throws JSONException { OneSignalPrefs.saveString(OneSignalPrefs.PREFS_ONESIGNAL, OneSignalPrefs.PREFS_OS_CACHED_IAMS, json.toString()); resetRedisplayMessagesBySession(); processInAppMessageJson(json); deleteOldRedisplayedInAppMessages(); }
Source:
public String toString() { return jobId + "|" + goal; }

Target:
public String toString() { return Objects.toStringHelper(this) .add("jobId", jobId) .add("goal", goal) .add("deployerUser", deployerUser) .toString(); }
Source:
public List<Section> processResult(ApiResult result) throws Throwable { if (result.asObject().has("error")) { JSONObject errorJSON = result.asObject().optJSONObject("error"); throw new SectionsFetchException(errorJSON.optString("code"), errorJSON.optString("info")); } JSONArray sectionsJSON = result.asObject().optJSONObject("mobileview").optJSONArray("sections"); ArrayList<Section> sections = new ArrayList<Section>(); if (sectionsJSON != null) { for (int i = 0; i < sectionsJSON.length(); i++) { Section newSection = new Section(sectionsJSON.getJSONObject(i)); sections.add(newSection); } } if (WikipediaApp.isWikipediaZeroDevmodeOn()) { Utils.processHeadersForZero(app, result); } return sections; }

Target:
public List<Section> processResult(ApiResult result) throws Throwable { if (result.asObject().has("error")) { JSONObject errorJSON = result.asObject().optJSONObject("error"); throw new SectionsFetchException(errorJSON.optString("code"), errorJSON.optString("info")); } JSONArray sectionsJSON = result.asObject().optJSONObject("mobileview").optJSONArray("sections"); ArrayList<Section> sections = new ArrayList<Section>(); if (sectionsJSON == null) { throw new ApiException(new JSONException("FIXME: server returned 0 sections with no error.")); } for (int i = 0; i < sectionsJSON.length(); i++) { Section newSection = new Section(sectionsJSON.getJSONObject(i)); sections.add(newSection); } if (WikipediaApp.isWikipediaZeroDevmodeOn()) { Utils.processHeadersForZero(app, result); } return sections; }
Source:
public void testOpenAndCloseConcurrency() { SWTBotUtils.createProject(TRACE_PROJECT_NAME); File fTestFile = new File(CtfTmfTestTraceUtils.getTrace(CTF_TRACE).getPath()); CtfTmfTestTraceUtils.dispose(CTF_TRACE); String path = fTestFile.getAbsolutePath(); assertNotNull(fTestFile); assumeTrue(fTestFile.exists()); final MultiStatus status = new MultiStatus("lttn2.kernel.ui.swtbot.tests", IStatus.OK, null, null); IJobManager mgr = Job.getJobManager(); JobChangeAdapter changeListener = new JobChangeAdapter() { @Override public void done(IJobChangeEvent event) { Job job = event.getJob(); String jobNamePrefix = NLS.bind(Messages.TmfAbstractAnalysisModule_RunningAnalysis, ""); if ((job.getName().startsWith(jobNamePrefix)) && (job.getResult().getSeverity() == IStatus.ERROR)) { status.add(job.getResult()); } } }; mgr.addJobChangeListener(changeListener); for (int i = 0; i < 5; i++) { SWTBotUtils.openTrace(TRACE_PROJECT_NAME, path, TRACE_TYPE, false); SWTBotUtils.openTrace(TRACE_PROJECT_NAME, path, TRACE_TYPE, false); SWTBotUtils.openTrace(TRACE_PROJECT_NAME, path, TRACE_TYPE, false); SWTBotUtils.openTrace(TRACE_PROJECT_NAME, path, TRACE_TYPE, false); SWTBotUtils.openTrace(TRACE_PROJECT_NAME, path, TRACE_TYPE, false); SWTBotUtils.delay(50); workbenchbot.closeAllEditors(); if (!status.isOK()) { SWTBotUtils.deleteProject(TRACE_PROJECT_NAME, workbenchbot); fail(handleErrorStatus(status)); } } SWTBotUtils.deleteProject(TRACE_PROJECT_NAME, workbenchbot); }

Target:
public void testOpenAndCloseConcurrency() { SWTBotUtils.createProject(TRACE_PROJECT_NAME); File fTestFile = new File(CtfTmfTestTraceUtils.getTrace(CTF_TRACE).getPath()); CtfTmfTestTraceUtils.dispose(CTF_TRACE); String path = fTestFile.getAbsolutePath(); assertNotNull(fTestFile); assumeTrue(fTestFile.exists()); final MultiStatus status = new MultiStatus("lttn2.kernel.ui.swtbot.tests", IStatus.OK, null, null); IJobManager mgr = Job.getJobManager(); JobChangeAdapter changeListener = new JobChangeAdapter() { @Override public void done(IJobChangeEvent event) { Job job = event.getJob(); String jobNamePrefix = NLS.bind(Messages.TmfAbstractAnalysisModule_RunningAnalysis, ""); if ((job.getName().startsWith(jobNamePrefix)) && (job.getResult().getSeverity() == IStatus.ERROR)) { status.add(job.getResult()); } } }; mgr.addJobChangeListener(changeListener); for (int i = 0; i < 10; i++) { SWTBotUtils.openTrace(TRACE_PROJECT_NAME, path, TRACE_TYPE, false); SWTBotUtils.openTrace(TRACE_PROJECT_NAME, path, TRACE_TYPE, false); SWTBotUtils.openTrace(TRACE_PROJECT_NAME, path, TRACE_TYPE, false); SWTBotUtils.openTrace(TRACE_PROJECT_NAME, path, TRACE_TYPE, false); SWTBotUtils.openTrace(TRACE_PROJECT_NAME, path, TRACE_TYPE, false); SWTBotUtils.delay(1000); workbenchbot.closeAllEditors(); if (!status.isOK()) { SWTBotUtils.deleteProject(TRACE_PROJECT_NAME, workbenchbot); fail(handleErrorStatus(status)); } } SWTBotUtils.deleteProject(TRACE_PROJECT_NAME, workbenchbot); }
Source:
private boolean clientHasPermission(EntityRef callingClient, String requiredPermission) { PermissionManager permissionManager = CoreRegistry.get(PermissionManager.class); boolean hasPermission = true; if (permissionManager != null && requiredPermission != null && !requiredPermission.isEmpty()) { hasPermission = false; ClientComponent clientComponent = callingClient.getComponent(ClientComponent.class); if (clientComponent != null) { EntityRef character = clientComponent.character; if (permissionManager.hasPermission(character, requiredPermission)) { hasPermission = true; } } } return hasPermission; }

Target:
private boolean clientHasPermission(EntityRef callingClient, String requiredPermission) { Preconditions.checkNotNull(callingClient, "The calling client must not be null!"); PermissionManager permissionManager = CoreRegistry.get(PermissionManager.class); boolean hasPermission = true; if (permissionManager != null && requiredPermission != null && !requiredPermission.isEmpty()) { hasPermission = false; ClientComponent clientComponent = callingClient.getComponent(ClientComponent.class); EntityRef character = clientComponent.character; if (permissionManager.hasPermission(character, requiredPermission)) { hasPermission = true; } } return hasPermission; }
Source:
protected Composite createAdditionalControls(Composite parent) { Composite container = new Composite(parent, SWT.NULL); GridLayoutFactory.swtDefaults().applyTo(container); Button showUILegend = new Button(filterComposite, SWT.PUSH); showUILegend.setImage(CommonImages.QUESTION.createImage()); showUILegend.setToolTipText(Messages.TaskListFilteredTree_Show_Tasks_UI_Legend); showUILegend.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { UiLegendDialog uiLegendDialog = new UiLegendDialog(WorkbenchUtil.getShell()); uiLegendDialog.open(); } }); return container; }

Target:
protected Composite createAdditionalControls(Composite parent) { Composite container = new Composite(parent, SWT.NULL); GridLayoutFactory.swtDefaults().applyTo(container); Button showUILegend = new Button(container, SWT.PUSH); showUILegend.setImage(CommonImages.QUESTION.createImage()); showUILegend.setToolTipText(Messages.TaskListFilteredTree_Show_Tasks_UI_Legend); showUILegend.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { UiLegendDialog uiLegendDialog = new UiLegendDialog(WorkbenchUtil.getShell()); uiLegendDialog.open(); } }); return container; }
Source:
static byte[] concatByteArrays(byte[]... arrays) { int totalLength = 0; for (byte[] array : arrays) { totalLength += array.length; } byte[] output = new byte[totalLength]; int offset = 0; for (byte[] array : arrays) { int arrayLength = array.length; System.arraycopy(array, 0, output, offset, arrayLength); offset += arrayLength; } return output; }

Target:
static byte[] concatByteArrays(byte[]... arrays) { int totalLength = 0; for (byte[] array : arrays) { totalLength += array.length; } byte[] output = new byte[totalLength]; int offset = 0; for (byte[] array : arrays) { System.arraycopy(array, 0, output, offset, array.length); offset += array.length; } return output; }
Source:
private SimpleJdbcCallOperations obtainSimpleJdbcCall(String storedProcedureName) { if (guavaPresent) { return this.jdbcCallOperationsCache.getUnchecked(storedProcedureName); } else { SimpleJdbcCallOperations operations = this.jdbcCallOperationsMap.get(storedProcedureName); if (operations == null) { operations = createSimpleJdbcCall(storedProcedureName); this.jdbcCallOperationsMap.putIfAbsent(storedProcedureName, operations); } return operations; } }

Target:
private SimpleJdbcCallOperations obtainSimpleJdbcCall(String storedProcedureName) { if (guavaPresent) { return this.guavaCacheWrapper.jdbcCallOperationsCache.getUnchecked(storedProcedureName); } else { SimpleJdbcCallOperations operations = this.jdbcCallOperationsMap.get(storedProcedureName); if (operations == null) { synchronized (this.jdbcCallOperationsMapMonitor) { operations = this.jdbcCallOperationsMap.get(storedProcedureName); if (operations == null) { operations = createSimpleJdbcCall(storedProcedureName); this.jdbcCallOperationsMap.put(storedProcedureName, operations); } } } return operations; } }
Source:
public void testSuccessfulReadAhead() throws Exception { AbfsClient client = getMockAbfsClient(); AbfsRestOperation op = getMockRestOp(); doReturn(op) .doReturn(op) .doReturn(op) .doThrow(new TimeoutException("Internal Server error for RAH-X")) .doThrow(new TimeoutException("Internal Server error for RAH-Y")) .doThrow(new TimeoutException("Internal Server error for RAH-Z")) .when(client) .read(any(String.class), any(Long.class), any(byte[].class), any(Integer.class), any(Integer.class), any(String.class)); AbfsInputStream inputStream = getAbfsInputStream(client, "testSuccessfulReadAhead.txt"); inputStream.read(new byte[1 * KILOBYTE]); verifyReadCallCount(client, 3); inputStream.read(1 * KILOBYTE, new byte[1 * KILOBYTE], 0, 1 * KILOBYTE); verifyReadCallCount(client, 3); checkEvictedStatus(inputStream, 0, true); }

Target:
public void testSuccessfulReadAhead() throws Exception { AbfsClient client = getMockAbfsClient(); AbfsRestOperation op = getMockRestOp(); doReturn(op) .doReturn(op) .doReturn(op) .doThrow(new TimeoutException("Internal Server error for RAH-X")) .doThrow(new TimeoutException("Internal Server error for RAH-Y")) .doThrow(new TimeoutException("Internal Server error for RAH-Z")) .when(client) .read(any(String.class), any(Long.class), any(byte[].class), any(Integer.class), any(Integer.class), any(String.class), any(String.class)); AbfsInputStream inputStream = getAbfsInputStream(client, "testSuccessfulReadAhead.txt"); inputStream.read(new byte[ONE_KB]); verifyReadCallCount(client, 3); inputStream.read(ONE_KB, new byte[ONE_KB], 0, ONE_KB); verifyReadCallCount(client, 3); checkEvictedStatus(inputStream, 0, true); }
Source:
public void init(SortedKeyValueIterator<Key,Value> source, Map<String,String> options, IteratorEnvironment env) throws IOException { super.init(source, options, env); combineAllColumns = false; if (options.containsKey(ALL_OPTION)) { combineAllColumns = Boolean.parseBoolean(options.get(ALL_OPTION)); if (combineAllColumns) return; } if (!options.containsKey(COLUMNS_OPTION)) throw new IllegalArgumentException("Must specify " + COLUMNS_OPTION + " option"); String encodedColumns = options.get(COLUMNS_OPTION); if (encodedColumns.length() == 0) throw new IllegalArgumentException("The " + COLUMNS_OPTION + " must not be empty"); combiners = new ColumnSet(Lists.newArrayList(Splitter.on(",").split(encodedColumns))); isPartialCompaction = ((env.getIteratorScope() == IteratorScope.majc) && !env.isFullMajorCompaction()); if (options.containsKey(DELETE_HANDLING_ACTION_OPTION)) { deleteHandlingAction = DeleteHandlingAction.valueOf(options.get(DELETE_HANDLING_ACTION_OPTION)); } else { deleteHandlingAction = DeleteHandlingAction.LOG_ERROR; } if (deleteHandlingAction == DeleteHandlingAction.REDUCE_ON_FULL_COMPACTION_ONLY && isPartialCompaction) { combineAllColumns = false; combiners = new ColumnSet(); } }

Target:
public void init(SortedKeyValueIterator<Key,Value> source, Map<String,String> options, IteratorEnvironment env) throws IOException { super.init(source, options, env); combineAllColumns = false; if (options.containsKey(ALL_OPTION)) { combineAllColumns = Boolean.parseBoolean(options.get(ALL_OPTION)); if (combineAllColumns) return; } if (!options.containsKey(COLUMNS_OPTION)) throw new IllegalArgumentException("Must specify " + COLUMNS_OPTION + " option"); String encodedColumns = options.get(COLUMNS_OPTION); if (encodedColumns.length() == 0) throw new IllegalArgumentException("The " + COLUMNS_OPTION + " must not be empty"); combiners = new ColumnSet(Lists.newArrayList(Splitter.on(",").split(encodedColumns))); isMajorCompaction = env.getIteratorScope() == IteratorScope.majc; String rofco = options.get(REDUCE_ON_FULL_COMPACTION_ONLY_OPTION); if (rofco != null) { reduceOnFullCompactionOnly = Boolean.parseBoolean(rofco); } else { reduceOnFullCompactionOnly = false; } if (reduceOnFullCompactionOnly && isMajorCompaction && !env.isFullMajorCompaction()) { combineAllColumns = false; combiners = new ColumnSet(); } }
Source:
public void testStatefulTimeout0() throws Exception { Annotated0TimeoutBean timeout0 = lookup(Annotated0TimeoutBean.class); timeout0.doStuff(); Thread.sleep(2000); try { timeout0.doStuff(); throw new RuntimeException("Expecting NoSuchEJBException"); } catch (NoSuchEJBException expected) { } Assert.assertTrue(Annotated0TimeoutBean.preDestroy); }

Target:
public void testStatefulTimeout0() throws Exception { Annotated0TimeoutBean timeout0 = lookup(Annotated0TimeoutBean.class); timeout0.doStuff(); try { timeout0.doStuff(); throw new RuntimeException("Expecting NoSuchEJBException"); } catch (NoSuchEJBException expected) { } Assert.assertTrue(Annotated0TimeoutBean.preDestroy); }
Source:
private String getFingerprint(String hostName) { wrapper = getVdsInstallerSSHInstance(); String fingerPrint = ""; try { fingerPrint = wrapper.getServerKeyFingerprint(hostName); } catch (Throwable e) { log.errorFormat("Could not fetch fingerprint of server {0} with message: {1}", hostName, ExceptionUtils.getMessage(e)); } finally { wrapper.shutdown(); } return fingerPrint; }

Target:
private String getFingerprint(String hostName) { connect(hostName); String fingerprint = "Unknown"; try { PublicKey serverKey = this.client.getServerKey(); if (serverKey == null) { log.error("Unable to get host key"); } else { String tmpFingerprint = OpenSSHUtils.getKeyFingerprintString(serverKey); if (tmpFingerprint == null) { log.error("Unable to get host fingerprint"); } else { fingerprint = tmpFingerprint; } } } catch (Throwable e) { log.errorFormat("Could not fetch fingerprint of server {0} with message: {1}", hostName, ExceptionUtils.getMessage(e)); } return fingerprint; }
Source:
public String rewriteName(String original) { if (original == null ) return original; return original.toUpperCase(Locale.ROOT); }

Target:
public String rewriteName(String original) { return (original == null) ? null : original.toUpperCase(Locale.ROOT); }
Source:
public InstructorFeedbackResultsFilterPanel getFilterPanel() { return new InstructorFeedbackResultsFilterPanel( isStatsShown(), bundle.feedbackSession, isAllSectionsSelected(), selectedSection, isGroupedByTeam(), sortType, getInstructorFeedbackSessionResultsLink(), getSections(), getMissingResponsesShown()); }

Target:
public InstructorFeedbackResultsFilterPanel getFilterPanel() { return new InstructorFeedbackResultsFilterPanel( isStatsShown(), bundle.feedbackSession, isAllSectionsSelected(), selectedSection, isGroupedByTeam(), sortType, getInstructorFeedbackSessionResultsLink(), getSections(), isMissingResponsesShown); }
Source:
private Bundle prepareBundleToAccessLoginActivity( AccountAuthenticatorResponse accountAuthenticatorResponse, Account account, String authTokenType, Bundle options ) { final Intent intent = new Intent(mContext, LoginActivity.class); intent.putExtra(AccountManager.KEY_ACCOUNT_AUTHENTICATOR_RESPONSE, accountAuthenticatorResponse); intent.putExtra(KEY_AUTH_TOKEN_TYPE, authTokenType); intent.putExtra(KEY_LOGIN_OPTIONS, options); intent.putExtra(AuthenticatorConstants.EXTRA_ACCOUNT, account); intent.putExtra( AuthenticatorConstants.EXTRA_ACTION, AuthenticatorConstants.ACTION_UPDATE_EXPIRED_TOKEN ); final Bundle bundle = new Bundle(); bundle.putParcelable(AccountManager.KEY_INTENT, intent); return bundle; }

Target:
private Bundle prepareBundleToAccessLoginActivity( AccountAuthenticatorResponse accountAuthenticatorResponse, Account account, String authTokenType, Bundle options ) { final Intent intent = new Intent(mContext, LoginActivity.class); intent.putExtra(AccountManager.KEY_ACCOUNT_AUTHENTICATOR_RESPONSE, accountAuthenticatorResponse); intent.putExtra(KEY_AUTH_TOKEN_TYPE, authTokenType); intent.putExtra(AuthenticatorConstants.EXTRA_ACCOUNT, account); intent.putExtra( AuthenticatorConstants.EXTRA_ACTION, AuthenticatorConstants.ACTION_UPDATE_EXPIRED_TOKEN ); final Bundle bundle = new Bundle(); bundle.putParcelable(AccountManager.KEY_INTENT, intent); return bundle; }
Source:
public Set<Class<?>> getProviderClasses() { if (providerClasses == null && parent != null) return parent.getProviderClasses(); return providerClasses; }

Target:
public Set<Class<?>> getProviderClasses() { if(initialized) { return providerClasses; } Set<Class<?>> set = new HashSet<Class<?>>(); if (parent != null) set.addAll(parent.getProviderClasses()); set.addAll(providerClasses); return set; }
Source:
public void onPageFinished(WebView view, String url) { Timber.d("onPageFinished triggered"); drawFlag(); drawMark(); view.loadUrl("javascript:onPageFinished();"); view.loadUrl("javascript:ankiGetCardCount(" + newCount.toString() + "," + lrnCount.toString() + "," + revCount.toString() + ")" ); view.loadUrl("javascript:ankiGetDeckName('" + title + "')"); view.loadUrl("javascript:ankiGetETA(" + eta +")"); view.loadUrl("javascript:ankiGetCardMark(" + isCardMarked +")"); view.loadUrl("javascript:ankiGetCardFlag(" + currentCardFlagStatus +")"); }

Target:
public void onPageFinished(WebView view, String url) { Timber.d("onPageFinished triggered"); drawFlag(); drawMark(); view.loadUrl("javascript:onPageFinished();"); }
Source:
protected void markAlignmentEnd() { if (startOfAlignmentTimestamp > 0) { markAlignmentEnd(System.nanoTime() - startOfAlignmentTimestamp); } else { markAlignmentEnd(0); } }

Target:
protected void markAlignmentEnd() { markAlignmentEnd(System.nanoTime() - startOfAlignmentTimestamp); }
Source:
public void storeWorkerMetrics(final String workerId, final WorkerMetrics metrics) { if (metricCollectionEnabled) { if (numBlockByEvalIdForWorker != null && numBlockByEvalIdForWorker.containsKey(workerId)) { final int numDataBlocks = numBlockByEvalIdForWorker.get(workerId); final DataInfo dataInfo = new DataInfoImpl(numDataBlocks); final EvaluatorParameters evaluatorParameters = new WorkerEvaluatorParameters(workerId, dataInfo, metrics); if (metrics.getMiniBatchIdx() == null) { synchronized (workerEvalEpochParams) { if (!workerEvalEpochParams.containsKey(workerId)) { workerEvalEpochParams.put(workerId, new ArrayList<>()); } else { workerEvalEpochParams.get(workerId).add(evaluatorParameters); } } } else { synchronized (workerEvalMiniBatchParams) { if (!workerEvalMiniBatchParams.containsKey(workerId)) { workerEvalMiniBatchParams.put(workerId, new ArrayList<>()); } else { workerEvalMiniBatchParams.get(workerId).add(evaluatorParameters); } } } } else { LOG.log(Level.FINE, "No information about {0}. Dropping metric.", workerId); } } else { LOG.log(Level.FINE, "Metric collection disabled. Dropping metric from {0}", workerId); } if (dashboardSetupStatus.dashboardEnabled) { try { metricsRequestQueue.put(String.format("id=%s&metrics=%s&time=%d", workerId, metrics, System.currentTimeMillis())); } catch (InterruptedException e) { LOG.log(Level.WARNING, "Dashboard: Interrupted while taking metrics to send from the queue.", e); } } }

Target:
public void storeWorkerMetrics(final String workerId, final WorkerMetrics metrics) { if (metricCollectionEnabled) { if (numBlockByEvalIdForWorker != null && numBlockByEvalIdForWorker.containsKey(workerId)) { final int numDataBlocks = numBlockByEvalIdForWorker.get(workerId); final DataInfo dataInfo = new DataInfoImpl(numDataBlocks); final EvaluatorParameters evaluatorParameters = new WorkerEvaluatorParameters(workerId, dataInfo, metrics); if (metrics.getMiniBatchIdx() == null) { synchronized (workerEvalEpochParams) { if (!workerEvalEpochParams.containsKey(workerId)) { workerEvalEpochParams.put(workerId, new ArrayList<>()); } else { if (metrics.getNumDataBlocks() == numDataBlocks) { workerEvalEpochParams.get(workerId).add(evaluatorParameters); } else { LOG.log(Level.SEVERE, "Inconsistent NumDataBlocks: driver = {0}, {1} = {2}", new Object[] {numDataBlocks, workerId, metrics.getNumDataBlocks()}); } } } } else { synchronized (workerEvalMiniBatchParams) { if (workerEvalEpochParams.containsKey(workerId)) { if (!workerEvalMiniBatchParams.containsKey(workerId)) { workerEvalMiniBatchParams.put(workerId, new ArrayList<>()); } workerEvalMiniBatchParams.get(workerId).add(evaluatorParameters); } } } } else { LOG.log(Level.FINE, "No information about {0}. Dropping metric.", workerId); } } else { LOG.log(Level.FINE, "Metric collection disabled. Dropping metric from {0}", workerId); } if (dashboardSetupStatus.dashboardEnabled) { try { metricsRequestQueue.put(String.format("id=%s&metrics=%s&time=%d", workerId, metrics, System.currentTimeMillis())); } catch (InterruptedException e) { LOG.log(Level.WARNING, "Dashboard: Interrupted while taking metrics to send from the queue.", e); } } }
Source:
protected void doInitialise() throws InitialisationException { if (!initialised) { initRetryPolicyResolver(); try { transactionConfig = buildTransactionConfig(); } catch (MuleException e) { throw new InitialisationException(createStaticMessage("Could not resolve transactional configuration"), e, this); } returnDelegate = createReturnDelegate(); valueReturnDelegate = getValueReturnDelegate(); targetValueCompiledExpression = expressionManager.compile(targetValue, getTargetBindingContext(Message.of(""))); initialiseIfNeeded(resolverSet, muleContext); componentExecutor = createComponentExecutor(); executionMediator = createExecutionMediator(); initialiseIfNeeded(componentExecutor, true, muleContext); resolvedProcessorRepresentation = getRepresentation(); initProcessingStrategy(); initialised = true; } }

Target:
protected void doInitialise() throws InitialisationException { if (!initialised) { initRetryPolicyResolver(); try { transactionConfig = buildTransactionConfig(); } catch (MuleException e) { throw new InitialisationException(createStaticMessage("Could not resolve transactional configuration"), e, this); } returnDelegate = createReturnDelegate(); valueReturnDelegate = getValueReturnDelegate(); initialiseIfNeeded(resolverSet, muleContext); componentExecutor = createComponentExecutor(); executionMediator = createExecutionMediator(); initialiseIfNeeded(componentExecutor, true, muleContext); resolvedProcessorRepresentation = getRepresentation(); initProcessingStrategy(); initialised = true; } }
Source:
public NewCommentsConsumer(JiraEndpoint endpoint, Processor processor) { super(endpoint, processor); LOG.info("JIRA NewCommentsConsumer: Indexing current issue comments."); getComments(); }

Target:
public NewCommentsConsumer(JiraEndpoint endpoint, Processor processor) { super(endpoint, processor); }
Source:
private void updateLunsInDb(List<LUNs> lunsToUpdateInDb) { TransactionSupport.executeInNewTransaction(() -> { lunsToUpdateInDb.stream().forEach(lun -> getLunDao().update(lun)); return null; }); log.debug("LUNs with IDs: [" + lunsToUpdateInDb.stream().map(LUNs::getLUNId).collect(Collectors.joining(", ")) + "] were updated in the DB."); }

Target:
private void updateLunsInDb(List<LUNs> lunsToUpdateInDb) { TransactionSupport.executeInNewTransaction(() -> { CompensationContext context = getCompensationContext(); context.snapshotEntities(getParameters().getLunsList()); getLunDao().updateAllInBatch(lunsToUpdateInDb); context.stateChanged(); return null; }); log.debug("LUNs with IDs: [" + lunsToUpdateInDb.stream().map(LUNs::getLUNId).collect(Collectors.joining(", ")) + "] were updated in the DB."); }
Source:
public Status process() throws EventDeliveryException { Status status = Status.READY; Channel channel = getChannel(); Transaction transaction = channel.getTransaction(); try { tryReopenClientConnection(); transaction.begin(); Event event = channel.take(); if (event != null) { ListenableFuture future = writer.write(ByteBuffer.wrap(event.getBody()), event.getHeaders()); Futures.addCallback(future, new FutureCallback<Void>() { @Override public void onSuccess(Void result) { writeStatus = EventWriteStatusCode.OK; LOG.info("Success write to stream {}", streamName); } @Override public void onFailure(Throwable t) { writeStatus = EventWriteStatusCode.FAIL; LOG.error("Error during writing event to stream {}", streamName, t); } }); if (writeStatus == EventWriteStatusCode.FAIL) { throw new EventDeliveryException("Failed to send events to stream: " + streamName); } } transaction.commit(); } catch (Throwable t) { transaction.rollback(); if (t instanceof Error) { throw (Error) t; } else if (t instanceof ChannelException) { LOG.error("Stream Sink {}: Unable to get event from channel ", getName(), channel.getName()); status = Status.BACKOFF; } else { LOG.debug("Closing writer due to stream error ", t); closeClientQuietly(); closeWriterQuietly(); throw new EventDeliveryException("Sink event sending error", t); } } finally { transaction.close(); } return status; }

Target:
public Status process() throws EventDeliveryException { Status status = Status.READY; Channel channel = getChannel(); Transaction transaction = channel.getTransaction(); try { tryReopenClientConnection(); transaction.begin(); Event event = channel.take(); if (event != null) { try { writer.write(ByteBuffer.wrap(event.getBody()), event.getHeaders()).get(); LOG.trace("Success write to stream: ", streamName); } catch (Throwable t) { if (t instanceof ExecutionException) { t = t.getCause(); } LOG.error("Error during writing event to stream {}", streamName, t); throw new EventDeliveryException("Failed to send events to stream: " + streamName, t); } } transaction.commit(); } catch (Throwable t) { transaction.rollback(); if (t instanceof Error) { throw (Error) t; } else if (t instanceof ChannelException) { LOG.error("Stream Sink {}: Unable to get event from channel ", getName(), channel.getName()); status = Status.BACKOFF; } else { LOG.debug("Closing writer due to stream error ", t); closeClientQuietly(); closeWriterQuietly(); throw new EventDeliveryException("Sink event sending error", t); } } finally { transaction.close(); } return status; }
Source:
private Map<Guid, SubchainInfo> getDomainsToSnapshotsMap(List<SubchainInfo> snapshots) { Map<Guid, SubchainInfo> domainsToPairMap = new HashMap<>(); for (SubchainInfo subchain: snapshots) { Guid storageId = subchain.getStorageDomainId(); domainsToPairMap.put(storageId, subchain); } return domainsToPairMap; }

Target:
private Map<Guid, SubchainInfo> getDomainsToSnapshotsMap(List<SubchainInfo> snapshots) { return snapshots .stream() .collect(Collectors.toMap(SubchainInfo::getStorageDomainId, Function.identity())); }
Source:
public void deleteAccount(AccountId accountId) { HibernateAccount hibernateAccount = getHibernateAccount(accountId); if (hibernateAccount != null) { hibernateHelper.deleteById(HibernateAccount.class, hibernateAccount.getId()); } }

Target:
public void deleteAccount(AccountId accountId) { String userId = accountId.getUnguardedAccountId().getId(); if (userId == null) { HibernateAccount hibernateAccount = getHibernateAccount(accountId); userId = hibernateAccount.getId(); } hibernateHelper.deleteById(HibernateAccount.class, userId); }
Source:
public DTreeUserInteraction expand(IProgressMonitor monitor) { try { monitor.beginTask("Tree item expandion", tree.getOwnedTreeItems().size()); for (DTreeItem child : tree.getOwnedTreeItems()) { if (!child.isExpanded()) { new DTreeItemUserInteraction(child, ctx).expand(new SubProgressMonitor(monitor, 1)); } } } finally { monitor.done(); } return this; }

Target:
public DTreeUserInteraction expand(IProgressMonitor monitor) { try { monitor.beginTask("Tree item expanding", tree.getOwnedTreeItems().size()); for (DTreeItem child : tree.getOwnedTreeItems()) { if (!child.isExpanded()) { new DTreeItemUserInteraction(child, ctx).expand(new SubProgressMonitor(monitor, 1)); } else { monitor.worked(1); } } } finally { monitor.done(); } return this; }
Source:
public Multimap<Integer, Integer> getBinderMap() { if (isBinder()) { return productionAttributes.getAttr(Attribute.Key.get( new TypeToken<Multimap<Integer, Integer>>() { }, Names.named("binder"))); } else { return null; } }

Target:
public Multimap<Integer, Integer> getBinderMap() { if (isBinder()) { Multimap<Integer, Integer> binder = productionAttributes.getAttr(Attribute.Key.get( new TypeToken<Multimap<Integer, Integer>>() {}, Names.named("binder"))); return binder == null ? ImmutableMultimap.of(0, 1) : binder; } else { return null; } }
Source:
public MainDesktop() throws URISyntaxException, InterruptedException { this.injector = Guice.createInjector(this); Client client = new Client("localhost", this.configureRendererProtocol()); RenderController cntrl = this.injector.getInstance(RenderController.class); cntrl.setClient(client); client.setController(cntrl); this.eventDispatcher = this.injector.getInstance(EventDispatcher.class); this.setupGraphics(); Thread.sleep(500); eventDispatcher.dispatch(new GameWaitingEvent()); Thread.sleep(1000); AnimalAddedEvent event = new AnimalAddedEvent(); event.setTeam(0); event.setVariation(0); event.setAnimal(0); event.setSector(Sector.BACK); eventDispatcher.dispatch(event); Thread.sleep(500); event = new AnimalAddedEvent(); event.setTeam(1); event.setVariation(0); event.setAnimal(1); event.setSector(Sector.FRONT_MIDDLE); eventDispatcher.dispatch(event); Thread.sleep(500); eventDispatcher.dispatch(new GameAboutToStartEvent()); Thread.sleep(500); eventDispatcher.dispatch(new GameStartedEvent()); }

Target:
public MainDesktop() throws URISyntaxException, InterruptedException { this.injector = Guice.createInjector(this); Client client = new Client("localhost", this.configureRendererProtocol()); RenderController cntrl = this.injector.getInstance(RenderController.class); cntrl.setClient(client); client.setController(cntrl); this.eventDispatcher = this.injector.getInstance(EventDispatcher.class); this.setupGraphics(); client.connect(); }
Source:
public String noLastSongInfo() { return "No recuerdo que me hayas dado informaci�n sobre una canci�n..."; }

Target:
public String noLastSongInfo() { return "No recuerdo haberte dado informaci�n sobre alguna canci�n..."; }
Source:
private void checkElementAndSubtree(Object element) { Object e = element; checkElement(e); for (Object child : fContentProvider.getChildren(e)) { checkElementAndSubtree(child); } }

Target:
private void checkElementAndSubtree(Object element) { checkElement(element); for (Object child : fContentProvider.getChildren(element)) { checkElementAndSubtree(child); } }
Source:
private String getVersion(String nodeExecutable) { StringBuilder output = new StringBuilder(); NodeCommand nodeCommand = new NodeCommand(processWrapper, nodeExecutable, singletonList("-v"), scriptFilename, emptyList(), output::append, LOG::error); nodeCommand.start(); int exitValue = nodeCommand.waitFor(); if (exitValue != 0) { throw new IllegalStateException("Failed to determine Node.js version"); } return output.toString(); }

Target:
private String getVersion(String nodeExecutable) { StringBuilder output = new StringBuilder(); NodeCommand nodeCommand = new NodeCommand(processWrapper, nodeExecutable, singletonList("-v"), null, emptyList(), output::append, LOG::error); nodeCommand.start(); int exitValue = nodeCommand.waitFor(); if (exitValue != 0) { throw new NodeCommandException("Failed to run Node.js with -v to determine the version"); } return output.toString(); }
Source:
protected boolean createGeoRepSession(Guid upServerId, String masterVolumeName, String remoteHost, String remoteVolumeName, String userName, Boolean force, Boolean handleError) { GlusterVolumeGeoRepSessionVDSParameters params = new GlusterVolumeGeoRepSessionVDSParameters(upServer.getId(), getGlusterVolumeName(), slaveHost.getHostName(), getParameters().getSlaveVolumeName(), getParameters().getUserName(), getParameters().isForce()); VDSReturnValue createSessionReturnValue = runVdsCommand(VDSCommandType.CreateGlusterVolumeGeoRepSession, params); if (createSessionReturnValue.getSucceeded()) { setSucceeded(true); return true; } else { setSucceeded(false); if (handleError) { handleVdsError(AuditLogType.GLUSTER_GEOREP_SESSION_CREATE_FAILED, createSessionReturnValue.getVdsError().getMessage()); } return false; } }

Target:
protected boolean createGeoRepSession(Guid upServerId, String masterVolumeName, String remoteHost, String remoteVolumeName, String userName, Boolean force, Boolean handleError) { GlusterVolumeGeoRepSessionVDSParameters params = new GlusterVolumeGeoRepSessionVDSParameters(upServerId, masterVolumeName, remoteHost, remoteVolumeName, userName, force); VDSReturnValue createSessionReturnValue = runVdsCommand(VDSCommandType.CreateGlusterVolumeGeoRepSession, params); if (createSessionReturnValue.getSucceeded()) { setSucceeded(true); return true; } else { setSucceeded(false); if (handleError) { handleVdsError(AuditLogType.GLUSTER_GEOREP_SESSION_CREATE_FAILED, createSessionReturnValue.getVdsError().getMessage()); } return false; } }
Source:
public void handle(final ArtifactEvent event) { final Repository repository = getRepository(event); if (!Maven2LayoutProvider.ALIAS.equals(repository.getLayout())) { return; } if (event.getType() != ArtifactEventTypeEnum.EVENT_ARTIFACT_PATH_DELETED.getType()) { return; } try { mavenMetadataGroupRepositoryComponent.cleanupGroupsContaining(event.getStorageId(), event.getRepositoryId(), event.getPath()); if (maybeMavenIndexGroupRepositoryComponent.isPresent()) { maybeMavenIndexGroupRepositoryComponent.get().cleanupGroupsContaining(event.getStorageId(), event.getRepositoryId(), event.getPath()); } } catch (IOException e) { throw Throwables.propagate(e); } }

Target:
public void handle(final ArtifactEvent event) { final Repository repository = getRepository(event); if (!Maven2LayoutProvider.ALIAS.equals(repository.getLayout())) { return; } if (event.getType() != ArtifactEventTypeEnum.EVENT_ARTIFACT_PATH_DELETED.getType()) { return; } try { mavenMetadataGroupRepositoryComponent.cleanupGroupsContaining(event.getStorageId(), event.getRepositoryId(), event.getPath()); } catch (IOException e) { throw Throwables.propagate(e); } }
Source:
private void importDatabase() { AlertDialog.Builder builder = new AlertDialog.Builder(getActivity()); builder.setTitle(R.string.database_import_label); builder.setMessage(R.string.database_import_warning); builder.setNegativeButton("NO", null); builder.setPositiveButton("Replace", (dialog, which) -> { if (Build.VERSION.SDK_INT >= 19) { Intent intent = new Intent(Intent.ACTION_OPEN_DOCUMENT); intent.setType("* *"); startActivityForResult(Intent.createChooser(intent, getString(R.string.import_select_file)), REQUEST_CODE_RESTORE_DATABASE); } } ); AlertDialog dialog = builder.create(); dialog.show(); }

Target:
private void importDatabase() { AlertDialog.Builder builder = new AlertDialog.Builder(getActivity()); builder.setTitle(R.string.database_import_label); builder.setMessage(R.string.database_import_warning); builder.setNegativeButton(R.string.no, null); builder.setPositiveButton(R.string.confirm_label, (dialog, which) -> { if (Build.VERSION.SDK_INT >= 19) { Intent intent = new Intent(Intent.ACTION_OPEN_DOCUMENT); intent.setType("* *"); startActivityForResult(Intent.createChooser(intent, getString(R.string.import_select_file)), REQUEST_CODE_RESTORE_DATABASE); } } ); builder.show(); }
Source:
public void setScrollView(@Nullable ObservableWebView webView) { webview = webView; if (webview != null) { webview.addOnScrollChangeListener(this); webview.addOnDownMotionEventListener(this); webview.addOnUpOrCancelMotionEventListener(this); webview.addOnClickListener(this); } }

Target:
public void setScrollView(@Nullable ObservableWebView webView) { this.webView = webView; if (webView != null) { webView.addOnScrollChangeListener(this); webView.addOnDownMotionEventListener(this); webView.addOnUpOrCancelMotionEventListener(this); webView.addOnClickListener(this); } }
Source:
public VoiceInterpreterParams(Configuration configuration, DaoManager storage, ActorRef callManager, ActorRef conferences, ActorRef bridgeManager, ActorRef smsService, Sid account, Sid phone, String version, URI url, String method, URI fallbackUrl, String fallbackMethod, URI statusCallback, String statusCallbackMethod, String referTarget, String emailAddress, ActorRef monitoring, String rcml, boolean asImsUa, String imsUaLogin, String imsUaPassword, String transferor, String transferee) { this.configuration = configuration; this.storage = storage; this.callManager = callManager; this.conferenceCenter = conferences; this.bridgeManager = bridgeManager; this.smsService = smsService; this.account = account; this.phone = phone; this.version = version; this.url = url; this.method = method; this.fallbackUrl = fallbackUrl; this.fallbackMethod = fallbackMethod; this.statusCallback = statusCallback; this.statusCallbackMethod = statusCallbackMethod; this.referTarget = referTarget; this.emailAddress = emailAddress; this.monitoring = monitoring; this.rcml = rcml; this.asImsUa = asImsUa; this.imsUaLogin = imsUaLogin; this.imsUaPassword = imsUaPassword; this.transferor = transferor; this.transferee = transferee; }

Target:
private VoiceInterpreterParams(Configuration configuration, DaoManager storage, ActorRef callManager, ActorRef conferences, ActorRef bridgeManager, ActorRef smsService, Sid account, Sid phone, String version, URI url, String method, URI fallbackUrl, String fallbackMethod, URI statusCallback, String statusCallbackMethod, String referTarget, String emailAddress, ActorRef monitoring, String rcml, boolean asImsUa, String imsUaLogin, String imsUaPassword, String transferor, String transferee) { this.configuration = configuration; this.storage = storage; this.callManager = callManager; this.conferenceCenter = conferences; this.bridgeManager = bridgeManager; this.smsService = smsService; this.account = account; this.phone = phone; this.version = version; this.url = url; this.method = method; this.fallbackUrl = fallbackUrl; this.fallbackMethod = fallbackMethod; this.statusCallback = statusCallback; this.statusCallbackMethod = statusCallbackMethod; this.referTarget = referTarget; this.emailAddress = emailAddress; this.monitoring = monitoring; this.rcml = rcml; this.asImsUa = asImsUa; this.imsUaLogin = imsUaLogin; this.imsUaPassword = imsUaPassword; this.transferor = transferor; this.transferee = transferee; }
Source:
protected BaseLoginInteractor createInteractor(String actionName) { if (authenticationType.equals(AuthenticationType.COOKIE)) { return new LoginCookieInteractor(); } else if (BASIC_AUTH.equals(actionName)) { return new LoginBasicInteractor(); } else { LoginOAuthInteractor oauthInteractor = new LoginOAuthInteractor(); OAuthConfig config = new OAuthConfig(LiferayServerContext.getServer(), oauthConsumerKey, oauthConsumerSecret); oauthInteractor.setOAuthConfig(config); return oauthInteractor; } }

Target:
protected BaseLoginInteractor createInteractor(String actionName) { if (authenticationType.equals(AuthenticationType.COOKIE)) { return new LoginCookieInteractor(); } else if (authenticationType.equals(AuthenticationType.OAUTH)) { LoginOAuthInteractor oauthInteractor = new LoginOAuthInteractor(); OAuthConfig config = new OAuthConfig(LiferayServerContext.getServer(), oauthConsumerKey, oauthConsumerSecret); oauthInteractor.setOAuthConfig(config); return oauthInteractor; } else { return new LoginBasicInteractor(); } }
Source:
public void signOut() throws Exception { HibernateAccount hibernateAccount = makeValidHibernateAccount(false, true); hibernateAccount.setReauthTokenAlgorithm(PasswordAlgorithm.DEFAULT_PASSWORD_ALGORITHM); hibernateAccount.setReauthTokenHash("AAA"); hibernateAccount.setReauthTokenModifiedOn(DateTime.now().getMillis()); when(mockHibernateHelper.queryGet(any(), any(), any(), any())).thenReturn(ImmutableList.of( hibernateAccount)); ArgumentCaptor<HibernateAccount> accountCaptor = ArgumentCaptor.forClass(HibernateAccount.class); dao.signOut(STUDY, EMAIL); verify(mockHibernateHelper).update(accountCaptor.capture()); HibernateAccount captured = accountCaptor.getValue(); assertNull(captured.getReauthTokenAlgorithm()); assertNull(captured.getReauthTokenHash()); assertNull(captured.getReauthTokenModifiedOn()); }

Target:
public void signOut() throws Exception { HibernateAccount hibernateAccount = makeValidHibernateAccount(false, false); hibernateAccount.setReauthTokenAlgorithm(PasswordAlgorithm.DEFAULT_PASSWORD_ALGORITHM); hibernateAccount.setReauthTokenHash("AAA"); hibernateAccount.setReauthTokenModifiedOn(DateTime.now().getMillis()); when(mockHibernateHelper.queryGet(any(), any(), any(), any())).thenReturn(ImmutableList.of( hibernateAccount)); ArgumentCaptor<HibernateAccount> accountCaptor = ArgumentCaptor.forClass(HibernateAccount.class); dao.signOut(STUDY, EMAIL); verify(mockHibernateHelper).update(accountCaptor.capture()); HibernateAccount captured = accountCaptor.getValue(); assertNull(captured.getReauthTokenAlgorithm()); assertNull(captured.getReauthTokenHash()); assertNull(captured.getReauthTokenModifiedOn()); }