auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
private List getUniqKVCount(List<MemKey> memKeys) { List<Integer> kvCounts = new ArrayList<Integer>(); for (MemKey m : memKeys) { kvCounts.add(m.getKVCount()); } return ImmutableSet.copyOf(kvCounts).asList(); }

Target:
private int getUniqKVCount(List<MemKey> memKeys) { List<Integer> kvCounts = new ArrayList<Integer>(); for (MemKey m : memKeys) { kvCounts.add(m.getKVCount()); } return ImmutableSet.copyOf(kvCounts).size(); }
Source:
public void refreshTraceType() { try { fTraceTypeId = getResource().getPersistentProperty(TmfCommonConstants.TRACETYPE); } catch (CoreException e) { Activator.getDefault().logError("Error refreshing trace type pesistent property for trace " + getName(), e); } }

Target:
public void refreshTraceType() { try { fTraceTypeId = getResource().getPersistentProperty(TmfCommonConstants.TRACETYPE); } catch (CoreException e) { Activator.getDefault().logError(Messages.TmfCommonProjectElement_ErrorRefreshingProperty + getName(), e); } }
Source:
public boolean equals(Object obj) { return obj != null && obj.equals(children); }

Target:
public boolean equals(Object obj) { return obj instanceof NotLoadedFragmentMatch && obj.equals(children); }
Source:
public PlannedTime.ItcOverheadProvider getInst() { if (instr.site().displayName.equals("Gemini North")) { return new InstGmosNorth(); } else if (instr.site().displayName.equals("Gemini South")) { return new InstGmosSouth(); } else { throw new Error("invalid site"); } }

Target:
public PlannedTime.ItcOverheadProvider getInst() { if (instr.site().equals(Site.GN)) { return new InstGmosNorth(); } else if (instr.site().equals(Site.GS)) { return new InstGmosSouth(); } else { throw new Error("invalid site"); } }
Source:
public FixedHistogramJacknifeStateStrategy(long bucketCount, double min, double max) { histogram = new FixedDoubleBreakdownHistogram((int) bucketCount, min, max); }

Target:
public FixedHistogramJacknifeStateStrategy(long bucketCount, double min, double max) { FixedHistogramStateStrategyUtils.validateParameters( bucketCount, min, max); histogram = new FixedDoubleBreakdownHistogram(toIntExact(bucketCount), min, max); }
Source:
private void onSource(TransferPanelForm view, TransferForms forms, Source<?> source) { source.getFormList().thenAccept(formList -> { forms.load(formList); view.refresh(); updateActionButtons(); }).onError(cause -> { log.warn("Unable to load form list from {}", source.getDescription(), cause); errorMessage("Error Loading Forms", "Briefcase hasn’t been able to load forms using the configured source. Try Reload or Reset."); }); }

Target:
private void onSource(TransferPanelForm view, TransferForms forms, Source<?> source) { source.getFormList().thenAccept(formList -> { forms.load(formList); view.refresh(); updateActionButtons(); }).onError(cause -> { log.warn("Unable to load form list from {}", source.getDescription(), cause); errorMessage("Error Loading Forms", "Briefcase wasn't able to load forms using the configured source. Try Reload or Reset."); }); }
Source:
public Response generateDescriptor() { String consoleString = HexUtils.hex2string(consoleId); GraphicsConsole console = new GraphicsConsole(); console.setProtocol(consoleString); validateEnums(GraphicsConsole.class, console); GraphicsType type = GraphicsType.valueOf(consoleString); org.ovirt.engine.core.common.businessentities.GraphicsType graphicsType = getMappingLocator().getMapper(GraphicsType.class, org.ovirt.engine.core.common.businessentities.GraphicsType.class).map(type, null); ConsoleOptions consoleOptions = new ConsoleOptions(graphicsType); consoleOptions.setVmId(vmGuid); ConsoleOptions configuredOptions = runQuery(VdcQueryType.ConfigureConsoleOptions, new ConfigureConsoleOptionsParams(consoleOptions, true)).getReturnValue(); String descriptor = runQuery(VdcQueryType.GetConsoleDescriptorFile, new ConsoleOptionsParams(configuredOptions)) .getReturnValue(); Response.ResponseBuilder builder = Response.ok(descriptor.getBytes(), ApiMediaType.APPLICATION_X_VIRT_VIEWER); return builder.build(); }

Target:
public Response generateDescriptor() { String consoleString = HexUtils.hex2string(consoleId); GraphicsConsole console = new GraphicsConsole(); console.setProtocol(consoleString); validateEnums(GraphicsConsole.class, console); GraphicsType type = GraphicsType.valueOf(consoleString); org.ovirt.engine.core.common.businessentities.GraphicsType graphicsType = getMappingLocator().getMapper(GraphicsType.class, org.ovirt.engine.core.common.businessentities.GraphicsType.class).map(type, null); ConsoleOptions consoleOptions = new ConsoleOptions(graphicsType); consoleOptions.setVmId(vmGuid); ConsoleOptions configuredOptions = runQuery(VdcQueryType.ConfigureConsoleOptions, new ConfigureConsoleOptionsParams(consoleOptions, true)).getReturnValue(); String descriptor = runQuery(VdcQueryType.GetConsoleDescriptorFile, new ConsoleOptionsParams(configuredOptions)) .getReturnValue(); Response.ResponseBuilder builder = Response.ok(descriptor.getBytes(Charset.forName("UTF-8")), ApiMediaType.APPLICATION_X_VIRT_VIEWER); return builder.build(); }
Source:
public static void returnBuffer(@NotNull byte[] buf) { if (enableStatistics) { numReturns.incrementAndGet(); } int len = buf.length; if (len <= T1) { pool1.returnBuffer(buf); } else if (len <= T2) { pool2.returnBuffer(buf); } else if (len < 2000) { pool3.returnBuffer(buf); } else { logger.warn( "Received a suspiciously large buffer (size = " + len + ")"); } if (ENABLE_BOOKKEEPING) { Integer arrayId = System.identityHashCode(buf); logger.info("Thread " + threadId() + " returned array " + arrayId); if (bookkeeping.containsKey(arrayId)) { returnedBookkeeping.put(arrayId, new ReturnedBufferBookkeepingInfo(bookkeeping.get(arrayId), getStackTrace())); bookkeeping.remove(arrayId); } else if (returnedBookkeeping.containsKey(arrayId)) { logger.info("Thread " + threadId() + " returned a previously-returned buffer at\n" + getStackTraceAsString() + "previously returned at\n" + stackTraceAsString(returnedBookkeeping.get(arrayId).deallocTrace)); } else { logger.info("Thread " + threadId() + " returned a buffer we didn't give out from\n" + getStackTraceAsString()); } } }

Target:
public static void returnBuffer(@NotNull byte[] buf) { if (enableStatistics) { numReturns.incrementAndGet(); } int len = buf.length; if (ENABLE_BOOKKEEPING) { Integer arrayId = System.identityHashCode(buf); logger.info("Thread " + threadId() + " returned " + len + "-byte buffer " + arrayId); String s; ReturnedBufferBookkeepingInfo b; if ((s = bookkeeping.remove(arrayId)) != null) { returnedBookkeeping.put(arrayId, new ReturnedBufferBookkeepingInfo(s, UtilKt.getStackTrace())); } else if ((b = returnedBookkeeping.get(arrayId)) != null) { logger.info("Thread " + threadId() + " returned a previously-returned " + len + "-byte buffer at\n" + UtilKt.getStackTrace() + "previously returned at\n" + b.deallocTrace); } else { logger.info("Thread " + threadId() + " returned a " + len + "-byte buffer we didn't give out from\n" + UtilKt.getStackTrace()); } } if (len <= T1) { pool1.returnBuffer(buf); } else if (len <= T2) { pool2.returnBuffer(buf); } else if (len < 2000) { pool3.returnBuffer(buf); } else { logger.warn( "Received a suspiciously large buffer (size = " + len + ")"); } }
Source:
protected void doOperation() { Datastore.initialize(); List<FeedbackQuestion> feedbackQuestions; if (target == ScriptTarget.BY_TIME) { Calendar startCal = Calendar.getInstance(); startCal.add(Calendar.DAY_OF_YEAR, -1 * numDays); feedbackQuestions = getOldQuestionsSince(startCal.getTime()); } else if (target == ScriptTarget.BY_COURSE) { feedbackQuestions = getFeedbackQuestionEntitiesForCourse(courseId); } else if (target == ScriptTarget.ALL) { feedbackQuestions = getAllOldQuestions(); } else { feedbackQuestions = null; Assumption.fail("no target selected"); } List<FeedbackQuestionAttributes> feedbackQuestionAttributes = FeedbackQuestionsDb.getListOfQuestionAttributes(feedbackQuestions); for (FeedbackQuestionAttributes old : feedbackQuestionAttributes) { FeedbackSessionAttributes session = new Logic().getFeedbackSession(old.getFeedbackSessionName(), old.getCourseId()); if (session == null) { System.out.println("question: " + old.getIdentificationString()); System.out.println(String.format("error finding session %s", old.getFeedbackSessionName() + ":" + old.getCourseId())); System.out.println("possibly due to orphaned responses"); continue; } if (isPreview) { FeedbackQuestionAttributes existingQn = new QuestionsDb().getFeedbackQuestion(old.feedbackSessionName, old.courseId, old.getId()); if (existingQn == null) { System.out.println("Will create question: " + old.getIdentificationString()); } else { System.out.println("new qn type already exists for question:" + existingQn.getIdentificationString()); } } else { try { new QuestionsDb().createFeedbackQuestion(session, old); } catch (EntityDoesNotExistException | InvalidParametersException e) { e.printStackTrace(); throw new RuntimeException( String.format("Unable to update existing session %s with question %s", session.getIdentificationString(), old.getIdentificationString()), e); } catch (EntityAlreadyExistsException e) { System.out.println("new qn type already exists for question:" + old.getIdentificationString()); } } } Datastore.getPersistenceManager().close(); }

Target:
protected void doOperation() { Datastore.initialize(); List<FeedbackQuestionAttributes> feedbackQuestions = getFeedbackQuestionsToMigrate(target); int studentsSize = feedbackQuestions.size(); System.out.println("Size of feedbackQuestions = " + studentsSize); int i = 0; for (FeedbackQuestionAttributes old : feedbackQuestions) { i += 1; if (i % 100 == 0) { System.out.println("Question " + i + " out of " + studentsSize); } FeedbackSessionAttributes session = new Logic().getFeedbackSession(old.getFeedbackSessionName(), old.getCourseId()); if (session == null) { printErrorMessageForOrphanedQuestion(old); continue; } if (isPreview) { previewMigratedQuestion(old); } else { migrateQuestionInSession(old, session); } } System.out.println("Completed :)"); }
Source:
private void logReturnedToken(final AuthenticationRequest request, final AuthenticationResult result) { if (result != null && result.getAccessToken() != null) { String accessTokenHash = createHash(result.getAccessToken()); Logger.v(TAG, String.format("Token with hash %s returned. CorrelationId: %s", accessTokenHash, request.getCorrelationId())); } }

Target:
private void logReturnedToken(final AuthenticationRequest request, final AuthenticationResult result) { if (result != null && result.getAccessToken() != null) { String accessTokenHash = createHash(result.getAccessToken()); String refreshTokenHash = createHash(result.getRefreshToken()); Logger.v(TAG, String.format( "Access TokenID %s and Refresh TokenID %s returned. CorrelationId: %s", accessTokenHash, refreshTokenHash, request.getCorrelationId())); } }
Source:
public void shouldPerformExactLookupInCompositeIndex() throws Exception { int label = token.nodeLabel( "Person" ); int firstName = token.propertyKey( "firstname" ); int surname = token.propertyKey( "surname" ); CapableIndexReference index = schemaRead.index( label, firstName, surname ); try ( NodeValueIndexCursor node = cursors.allocateNodeValueIndexCursor(); PrimitiveLongSet uniqueIds = Primitive.longSet() ) { IndexValueCapability valueCapability = index.valueCapability( ValueGroup.TEXT ); read.nodeIndexSeek( index, node, IndexOrder.NONE, IndexQuery.exact( firstName, "Joe" ), IndexQuery.exact( firstName, "Dalton" ) ); assertFoundNodesAndValue( node, uniqueIds, valueCapability, joeDalton ); } }

Target:
public void shouldPerformExactLookupInCompositeIndex() throws Exception { int label = token.nodeLabel( "Person" ); int firstName = token.propertyKey( "firstname" ); int surname = token.propertyKey( "surname" ); CapableIndexReference index = schemaRead.index( label, firstName, surname ); try ( NodeValueIndexCursor node = cursors.allocateNodeValueIndexCursor(); PrimitiveLongSet uniqueIds = Primitive.longSet() ) { IndexValueCapability valueCapability = index.valueCapability( ValueGroup.TEXT ); read.nodeIndexSeek( index, node, IndexOrder.NONE, IndexQuery.exact( firstName, "Joe" ), IndexQuery.exact( surname, "Dalton" ) ); assertFoundNodesAndValue( node, uniqueIds, valueCapability, joeDalton ); } }
Source:
private static <T> T _request( APIResource.RequestMethod method, String url, Map<String, Object> params, Class<T> clazz, APIResource.RequestType type, RequestOptions options) throws AuthenticationException, InvalidRequestException, APIConnectionException, CardException, APIException { StripeResponse response = _rawRequest(method, url, params, type, options); int rCode = response.code(); String rBody = response.body(); String requestId = response.requestId(); if (rCode < 200 || rCode >= 300) { handleAPIError(rBody, rCode, requestId); } T resource = APIResource.GSON.fromJson(rBody, clazz); if (resource instanceof StripeObject) { StripeObject obj = (StripeObject)resource; obj.response = response; } return resource; }

Target:
private static <T> T _request( APIResource.RequestMethod method, String url, Map<String, Object> params, Class<T> clazz, APIResource.RequestType type, RequestOptions options) throws AuthenticationException, InvalidRequestException, APIConnectionException, CardException, APIException { StripeResponse response = _rawRequest(method, url, params, type, options); int rCode = response.code(); String rBody = response.body(); String requestId = response.requestId(); if (rCode < 200 || rCode >= 300) { handleAPIError(rBody, rCode, requestId); } T resource = APIResource.GSON.fromJson(rBody, clazz); if (resource instanceof StripeObject) { StripeObject obj = (StripeObject)resource; obj.setLastResponse(response); } return resource; }
Source:
public static OrganisationUnit getOrgUnitByPhone(String imei) throws ApiCallException, ExistsMoreThanOneOrgUnitByPhoneException { String url = PreferencesState.getInstance().getDhisURL() + "/api/organisationUnits.json?filter=phoneNumber:like:%s&fields=id,name," + "description," + "code," + "ancestors[id," + "code,level],attributeValues[value,attribute[code]"; url = String.format(url, imei); try { if (!isNetworkAvailable()) { throw new NetworkException(); } Response response = ServerApiCallExecution.executeCall(null, url, "GET"); JSONObject body = ServerApiUtils.getApiResponseAsJSONObject(response); JSONArray orgUnitsArray = (JSONArray) body.get(TAG_ORGANISATIONUNITS); boolean moreThanOneOrgUnit = false; if (orgUnitsArray.length() == 0) { Log.e(TAG, String.format("getOrgUnitData(%s) -> Found %d matches", imei, orgUnitsArray.length())); return null; } else if (orgUnitsArray.length() > 1) { moreThanOneOrgUnit = true; } JSONObject orgUnitJO = (JSONObject) orgUnitsArray.get(0); OrganisationUnit organisationUnit = parseOrgUnit(orgUnitJO); if (moreThanOneOrgUnit) { throw new ExistsMoreThanOneOrgUnitByPhoneException(imei, organisationUnit); } else { return organisationUnit; } } catch (ExistsMoreThanOneOrgUnitByPhoneException existsMoreThanOneOrgUnitByPhoneException) { throw existsMoreThanOneOrgUnitByPhoneException; } catch (Exception ex) { throw new ApiCallException(ex); } }

Target:
public static OrganisationUnit getOrgUnitByPhone(String imei) throws ApiCallException, ExistsMoreThanOneOrgUnitByPhoneException { String url = PreferencesState.getInstance().getDhisURL() + "/api/organisationUnits.json?filter=phoneNumber:like:%s&fields=id,name," + "description," + "code," + "ancestors[id," + "code,level],attributeValues[value,attribute[code]"; url = String.format(url, imei); try { if (!isNetworkAvailable()) { throw new NetworkException(); } Response response = ServerApiCallExecution.executeCall(null, url, "GET"); JSONObject body = ServerApiUtils.getApiResponseAsJSONObject(response); JSONArray orgUnitsArray = (JSONArray) body.get(TAG_ORGANISATIONUNITS); if (orgUnitsArray.length() == 0) { Log.e(TAG, String.format("getOrgUnitData(%s) -> Found %d matches", imei, orgUnitsArray.length())); return null; } JSONObject orgUnitJO = (JSONObject) orgUnitsArray.get(0); OrganisationUnit organisationUnit = parseOrgUnit(orgUnitJO); if (orgUnitsArray.length() > 1) { throw new ExistsMoreThanOneOrgUnitByPhoneException(imei, organisationUnit); } else { return organisationUnit; } } catch (ExistsMoreThanOneOrgUnitByPhoneException existsMoreThanOneOrgUnitByPhoneException) { throw existsMoreThanOneOrgUnitByPhoneException; } catch (Exception ex) { throw new ApiCallException(ex); } }
Source:
private void loggedInAndFinish(ArrayList<Integer> oldSitesIds, boolean doLoginUpdate) { switch (getLoginMode()) { case FULL: case WPCOM_LOGIN_ONLY: ActivityLauncher.showMainActivityAndLoginEpilogue(this, oldSitesIds, doLoginUpdate); setResult(Activity.RESULT_OK); finish(); break; case JETPACK_STATS: ActivityLauncher.showLoginEpilogueForResult(this, true, oldSitesIds, true); break; case WPCOM_LOGIN_DEEPLINK: case WPCOM_REAUTHENTICATE: ActivityLauncher.showLoginEpilogueForResult(this, true, oldSitesIds, false); break; case SHARE_INTENT: case SELFHOSTED_ONLY: ArrayList<Integer> currentSiteIds = new ArrayList<>(); int newlyAddedSiteId = -1; for (SiteModel site : mSiteStore.getSites()) { currentSiteIds.add(site.getId()); } currentSiteIds.removeAll(oldSitesIds); if (currentSiteIds.size() == 1) { newlyAddedSiteId = currentSiteIds.get(0); } Intent intent = new Intent(); intent.putExtra(SitePickerActivity.KEY_LOCAL_ID, newlyAddedSiteId); setResult(Activity.RESULT_OK, intent); finish(); break; } }

Target:
private void loggedInAndFinish(ArrayList<Integer> oldSitesIds, boolean doLoginUpdate) { switch (getLoginMode()) { case FULL: case WPCOM_LOGIN_ONLY: ActivityLauncher.showMainActivityAndLoginEpilogue(this, oldSitesIds, doLoginUpdate); setResult(Activity.RESULT_OK); finish(); break; case JETPACK_STATS: ActivityLauncher.showLoginEpilogueForResult(this, true, oldSitesIds, true); break; case WPCOM_LOGIN_DEEPLINK: case WPCOM_REAUTHENTICATE: ActivityLauncher.showLoginEpilogueForResult(this, true, oldSitesIds, false); break; case SHARE_INTENT: case SELFHOSTED_ONLY: ArrayList<Integer> newSitesIds = new ArrayList<>(); for (SiteModel site : mSiteStore.getSites()) { newSitesIds.add(site.getId()); } newSitesIds.removeAll(oldSitesIds); if (newSitesIds.size() > 0) { Intent intent = new Intent(); intent.putExtra(SitePickerActivity.KEY_LOCAL_ID, newSitesIds.get(0)); setResult(Activity.RESULT_OK, intent); } else { AppLog.e(T.MAIN, "Couldn't detect newly added self-hosted site. " + "Expected at least 1 site ID but was 0."); ToastUtils.showToast(this, R.string.site_picker_failed_selecting_added_site); setResult(Activity.RESULT_OK); } finish(); break; } }
Source:
public void start() { Jmx.register(EsSettingsMBean.OBJECT_NAME, settings); initBootstrap(); Settings esSettings = settings.build(); if (esSettings.getAsInt("discovery.zen.minimum_master_nodes", 1) >= 2) { LOGGER.info("Elasticsearch is waiting for node(s) to be up to start.", esSettings.get("discovery.initial_state_timeout"), esSettings.get("discovery.zen.minimum_master_nodes") ); } node = NodeBuilder.nodeBuilder().settings(esSettings).build(); node.start(); }

Target:
public void start() { Jmx.register(EsSettingsMBean.OBJECT_NAME, settings); initBootstrap(); Settings esSettings = settings.build(); if (esSettings.getAsInt(MIMINUM_MASTER_NODES, 1) >= 2) { LOGGER.info("Elasticsearch is waiting for node(s) to be up to start.", esSettings.get(INITIAL_STATE_TIMEOUT), esSettings.get(MIMINUM_MASTER_NODES) ); } node = NodeBuilder.nodeBuilder().settings(esSettings).build(); node.start(); }
Source:
private boolean doIsSubType(HierarchyType other) { if (fSuperclass != null && (other.isTypeEquivalentTo(fSuperclass) || fSuperclass.doIsSubType(other))) return true; for (HierarchyType fInterface : fInterfaces) { if (other.isTypeEquivalentTo(fInterface) || fInterface.doIsSubType(other)) { return true; } } return false; }

Target:
private boolean doIsSubType(HierarchyType other) { if (fSuperclass != null && (other.isTypeEquivalentTo(fSuperclass) || fSuperclass.doIsSubType(other))) return true; for (HierarchyType intf : fInterfaces) { if (other.isTypeEquivalentTo(intf) || intf.doIsSubType(other)) { return true; } } return false; }
Source:
public JavascriptTestExecutor login() { return login((JSObjectBuilder)null, null); }

Target:
public JavascriptTestExecutor login() { return login((String)null, null); }
Source:
private void updateProgress() { int correctIndex = mIndex + 1; if (correctIndex > mCardList.length) { correctIndex = mIndex; } progressSeekBar.setProgress(correctIndex); String progress = correctIndex + "/" + mCardList.length; progressText.setText(progress); }

Target:
private void updateProgress() { if (progressSeekBar.getProgress() != mIndex) { progressSeekBar.setProgress(mIndex); } String progress = (mIndex + 1) + "/" + mCardList.length; progressText.setText(progress); }
Source:
public void addToDBBatch(OMMetadataManager omMetadataManager, BatchOperation batchOperation) throws IOException { if (getOMResponse().getStatus() == OzoneManagerProtocolProtos.Status.OK) { omMetadataManager.getVolumeTable().putWithBatch(batchOperation, omMetadataManager.getVolumeKey(omVolumeArgs.getVolume()), omVolumeArgs); } }

Target:
public void addToDBBatch(OMMetadataManager omMetadataManager, BatchOperation batchOperation) throws IOException { if (getOMResponse().getSuccess()) { if ((getOMResponse().hasAddAclResponse() && getOMResponse().getAddAclResponse().getResponse()) || (getOMResponse().hasRemoveAclResponse() && getOMResponse().getRemoveAclResponse().getResponse()) || (getOMResponse().hasSetAclResponse() && getOMResponse().getSetAclResponse().getResponse())) { omMetadataManager.getVolumeTable().putWithBatch(batchOperation, omMetadataManager.getVolumeKey(omVolumeArgs.getVolume()), omVolumeArgs); } } }
Source:
public static boolean isDyeable(Item item) { if (item.equals(Items.DYE)) { return true; } final Block block = Block.getBlockFromItem(item); return block.equals(Blocks.WOOL) || block.equals(Blocks.STAINED_GLASS) || block.equals(Blocks.CARPET) || block.equals(Blocks.STAINED_GLASS_PANE) || block.equals(Blocks.STAINED_HARDENED_CLAY) || block.equals(Blocks.CONCRETE) || block.equals(Blocks.CONCRETE_POWDER) || block.equals(Blocks.BED); }

Target:
public static boolean isDyeable(Item item) { if (item.equals(Items.DYE) || item.equals(Items.BED)) { return true; } final Block block = Block.getBlockFromItem(item); return block.equals(Blocks.WOOL) || block.equals(Blocks.STAINED_GLASS) || block.equals(Blocks.CARPET) || block.equals(Blocks.STAINED_GLASS_PANE) || block.equals(Blocks.STAINED_HARDENED_CLAY) || block.equals(Blocks.CONCRETE) || block.equals(Blocks.CONCRETE_POWDER); }
Source:
private String getCommitMessage(MergeRequest mergeRequest) { if (!step.useMRDescription) return step.mergeCommitMessage; println("Merge description is: "+mergeRequest.getDescription()); String message = "Merge branch '"+mergeRequest.getSourceBranch()+"' into '"+mergeRequest.getTargetBranch()+"'\n\n"+ mergeRequest.getTitle()+"\n\n"+ mergeRequest.getDescription()+"\n\n" + "See merge request !"+mergeRequest.getIid(); return message; }

Target:
private String getCommitMessage(MergeRequest mergeRequest) { if (!step.useMRDescription) return step.mergeCommitMessage; String message = "Merge branch '"+mergeRequest.getSourceBranch()+"' into '"+mergeRequest.getTargetBranch()+"'\n\n"+ mergeRequest.getTitle()+"\n\n"+ mergeRequest.getDescription()+"\n\n" + "See merge request !"+mergeRequest.getIid(); return message; }
Source:
private <T> boolean mainConstraintNeedsEvaluation(ValidationContext<T> executionContext, Set<ConstraintViolation<T>> constraintViolations) { if ( descriptor.getApplyingConstraintValidatorClasses().isEmpty() ) { return false; } if ( descriptor.isReportAsSingleViolation() && descriptor.getCompositionType() == AND && !constraintViolations.isEmpty() ) { return false; } if ( executionContext.isFailFastModeEnabled() && !constraintViolations.isEmpty() ) { return false; } return true; }

Target:
private <T> boolean mainConstraintNeedsEvaluation(ValidationContext<T> executionContext, Set<ConstraintViolation<T>> constraintViolations) { if ( descriptor.getMatchingConstraintValidatorClasses().isEmpty() ) { return false; } if ( descriptor.isReportAsSingleViolation() && descriptor.getCompositionType() == AND && !constraintViolations.isEmpty() ) { return false; } if ( executionContext.isFailFastModeEnabled() && !constraintViolations.isEmpty() ) { return false; } return true; }
Source:
public EntityMetadata lookup(DBCollection collection,String entityName,String version) { EntityMetadata md; EntityVersion v=new EntityVersion(entityName,version); WeakReference<EntityMetadata> ref=cache.get(v); if(ref!=null) md=ref.get(); else md=null; long now=System.currentTimeMillis(); if(lastCacheRefreshTime+cacheTTLMsecs<now) fullRefresh(collection,now); else if(lastVersionLookupTime+versionLookupPeriodMsecs<now) refreshCollectionVersion(collection,now,false); return md; }

Target:
public EntityMetadata lookup(DBCollection collection,String entityName,String version) { long now=System.currentTimeMillis(); if(lastCacheRefreshTime+cacheTTLMsecs<now) fullRefresh(collection,now); else if(lastVersionLookupTime+versionLookupPeriodMsecs<now) refreshCollectionVersion(collection,now,false); EntityMetadata md; EntityVersion v=new EntityVersion(entityName,version); WeakReference<EntityMetadata> ref=cache.get(v); if(ref!=null) md=ref.get(); else md=null; return md; }
Source:
public Obs saveObs(Obs obs, String changeMessage) throws APIException { if(obs == null){ throw new APIException("obs cannot be null!!", (Object[]) null); } if(obs.getId() != null && changeMessage == null){ throw new APIException("Obs.error.ChangeMessage.required", (Object[]) null); } handleExistingObsWithComplexConcept(obs); ensureRequirePrivilege(obs); if (obs.getObsId() == null || obs.getVoided()) { return saveNewAndVoidedObs(obs,changeMessage); } else if(!obs.isDirty()){ setPersonFromEncounter(obs); return saveObsNotDirty(obs, changeMessage); } else { setPersonFromEncounter(obs); return saveExistingObs(obs,changeMessage); } }

Target:
public Obs saveObs(Obs obs, String changeMessage) throws APIException { if(obs == null){ throw new APIException("Obs.error.cannot.be.null", (Object[]) null); } if(obs.getId() != null && changeMessage == null){ throw new APIException("Obs.error.ChangeMessage.required", (Object[]) null); } handleExistingObsWithComplexConcept(obs); ensureRequirePrivilege(obs); if (obs.getObsId() == null || obs.getVoided()) { return saveNewOrVoidedObs(obs,changeMessage); } else if(!obs.isDirty()){ setPersonFromEncounter(obs); return saveObsNotDirty(obs, changeMessage); } else { setPersonFromEncounter(obs); return saveExistingObs(obs,changeMessage); } }
Source:
public Collection<Component> getOppositeAlignedItems() { return oppositeAlignedItems; }

Target:
public Collection<Component> getOppositeAlignedItems() { return Collections.unmodifiableCollection(oppositeAlignedItems); }
Source:
public void duplicateForm( ModelMap model, HttpServletRequest request, HttpServletResponse response, @RequestParam(required = true, value = "formId") Integer formId, @RequestParam(required = true, value = "patientId") Integer patientId, @RequestParam(required = true, value = "date") String date, @RequestParam(required = false, value = "dateFormat") String dateFormat) throws Exception { response.setContentType("text/html"); ServletOutputStream out = response.getOutputStream(); List<Locale> l = new Vector<Locale>(); l.add(Context.getLocale()); List<Encounter> encounters = Context.getEncounterService().getEncountersByPatientId(patientId); SimpleDateFormat dateFormatter; if (dateFormat == null) { dateFormatter = Context.getDateFormat(); System.out.println("The default date format is " + dateFormatter.toString()); } else { dateFormatter = new SimpleDateFormat(dateFormat); } Date dateToCheck = dateFormatter.parse(date); boolean duplicate = false; for(Encounter enc: encounters) { if(enc.getForm() != null) { Form encForm = enc.getForm(); HtmlForm htmlForm = HtmlFormEntryUtil.getService().getHtmlFormByForm(encForm); System.out.println(" Encounter form " + enc.getForm().getFormId() + " encounter date " + enc.getEncounterDatetime() + " passed date " + dateToCheck); if(htmlForm != null && htmlForm.getId().equals(formId) && dateToCheck.compareTo(enc.getEncounterDatetime()) == 0) { System.out.println("Duplicate exists"); duplicate = true; } } } if(duplicate) { out.print("true"); } else { out.print("false"); } }

Target:
public void duplicateForm( ModelMap model, HttpServletRequest request, HttpServletResponse response, @RequestParam(required = true, value = "formId") Integer formId, @RequestParam(required = true, value = "patientId") Integer patientId, @RequestParam(required = true, value = "date") String date, @RequestParam(required = false, value = "dateFormat") String dateFormat) throws Exception { response.setContentType("text/html"); ServletOutputStream out = response.getOutputStream(); List<Locale> l = new Vector<Locale>(); l.add(Context.getLocale()); List<Encounter> encounters = Context.getEncounterService().getEncountersByPatientId(patientId); SimpleDateFormat dateFormatter; if (dateFormat != null) { dateFormatter = new SimpleDateFormat(dateFormat); } else { dateFormatter = Context.getDateFormat(); } Date dateToCheck = dateFormatter.parse(date); boolean duplicate = false; for(Encounter enc: encounters) { if(enc.getForm() != null) { Form encForm = enc.getForm(); HtmlForm htmlForm = HtmlFormEntryUtil.getService().getHtmlFormByForm(encForm); if(htmlForm != null && htmlForm.getId().equals(formId) && dateToCheck.compareTo(enc.getEncounterDatetime()) == 0) { duplicate = true; } } } if(duplicate) { out.print("true"); } else { out.print("false"); } }
Source:
public void testDistributedSQLForOnlyENTRYIterationType() throws InterruptedException { dsDistributedMap1.put(1, new User(1, "TestName1", "TestSurname1", 10)); dsDistributedMap1.put(2, new User(2, "TestName2", "TestSurname2", 20)); dsDistributedMap1.put(3, new User(3, "TestName3", "TestSurname3", 30)); dsDistributedMap1.put(4, new User(4, "TestName4", "TestSurname4", 40)); dsDistributedMap1.put(5, new User(5, "TestName5", "TestSurname5", 50)); Message<?> msg = null; for (int i = 0; i < 10; i++) { msg = dsMapChannel1.receive(); if (((Collection) msg.getPayload()).iterator().hasNext()) { break; } Thread.sleep(1_000); } Assert.assertNotNull(msg); Assert.assertNotNull(msg.getPayload()); Assert.assertTrue(msg.getPayload() instanceof Collection); Assert.assertEquals(4, (((Map.Entry) ((Collection) msg.getPayload()).iterator() .next()).getKey())); Assert.assertEquals(4, ((User) ((Map.Entry) ((Collection) msg.getPayload()) .iterator().next()).getValue()).getId()); Assert.assertEquals("TestName4", ((User) ((Map.Entry) ((Collection) msg .getPayload()).iterator().next()).getValue()).getName()); Assert.assertEquals("TestSurname4", ((User) ((Map.Entry) ((Collection) msg .getPayload()).iterator().next()).getValue()).getSurname()); }

Target:
public void testDistributedSQLForOnlyENTRYIterationType() throws InterruptedException { dsDistributedMap1.put(1, new HazelcastIntegrationTestUser(1, "TestName1", "TestSurname1", 10)); dsDistributedMap1.put(2, new HazelcastIntegrationTestUser(2, "TestName2", "TestSurname2", 20)); dsDistributedMap1.put(3, new HazelcastIntegrationTestUser(3, "TestName3", "TestSurname3", 30)); dsDistributedMap1.put(4, new HazelcastIntegrationTestUser(4, "TestName4", "TestSurname4", 40)); dsDistributedMap1.put(5, new HazelcastIntegrationTestUser(5, "TestName5", "TestSurname5", 50)); Message<?> msg = dsMapChannel1.receive(2_000); Assert.assertNotNull(msg); Assert.assertNotNull(msg.getPayload()); Assert.assertTrue(msg.getPayload() instanceof Collection); Assert.assertEquals(4, (((Map.Entry<?,?>) ((Collection<?>) msg.getPayload()).iterator() .next()).getKey())); Assert.assertEquals(4, ((HazelcastIntegrationTestUser) ((Map.Entry<?,?>) ((Collection<?>) msg.getPayload()) .iterator().next()).getValue()).getId()); Assert.assertEquals("TestName4", ((HazelcastIntegrationTestUser) ((Map.Entry<?,?>) ((Collection<?>) msg .getPayload()).iterator().next()).getValue()).getName()); Assert.assertEquals("TestSurname4", ((HazelcastIntegrationTestUser) ((Map.Entry<?,?>) ((Collection<?>) msg .getPayload()).iterator().next()).getValue()).getSurname()); }
Source:
private void saveLastReloadInStorage(Date date) { StorageUtil.setLocalItem(LAST_RELOAD_KEY_IN_STORAGE, date.getHours() + ":" + date.getMinutes() + ":" + date.getSeconds()); }

Target:
private void saveLastReloadInStorage(Date date) { StorageUtil.setSessionItem(LAST_RELOAD_KEY_IN_STORAGE, date.getHours() + ":" + date.getMinutes() + ":" + date.getSeconds()); }
Source:
public static Plan getPlan(String serviceName, String serviceType) { Plan root = new Plan(); MetaData temp = getMetaData(serviceName, serviceType); if (temp != null) { root.put(serviceName, serviceType); } Map<String, ServiceReservation> peers = temp.getPeers(); for (ServiceReservation peer : peers.values()) { getPlan(root, serviceName, peer); } return root; }

Target:
public static Plan getPlan(String serviceName, String serviceType) { Plan root = new Plan(); AbstractMetaData temp = getMetaData(serviceName, serviceType); if (temp != null) { root.put(serviceName, serviceType); } Map<String, ServiceReservation> peers = temp.getPeers(); for (ServiceReservation peer : peers.values()) { getPlan(root, serviceName, peer); } return root; }
Source:
public void diffOrderTooHighTest() { @SuppressWarnings("unused") DoubleMatrix2D d = getDifferanceMatrix(6, 6); }

Target:
public void diffOrderTooHighTest() { getDifferenceMatrix(6, 6); }
Source:
protected void delete(FulfillerDetails delegate, String reason, RequestContext context) throws ResponseException { Context.getOrderService().updateOrderFulfillerStatus(delegate.getOrder(), null, null); }

Target:
protected void delete(FulfillerDetails delegate, String reason, RequestContext context) throws ResponseException { throw new ResourceDoesNotSupportOperationException(); }
Source:
public void ImageStorage_001_deleteImage() { WikiBasePageObject base = new WikiBasePageObject(driver); base.logInCookie(credentials.userNameStaff, credentials.passwordStaff); SpecialNewFilesPageObject newFiles = base.openSpecialNewFiles(wikiURL); FilePagePageObject file = newFiles.openRandomImage(); imageURL = file.getImageUrl(); imageThumbnailURL = file.getImageThumbnailUrl(); newFiles.verifyURLStatus(200, imageURL); newFiles.verifyURLStatus(200, imageThumbnailURL); DeletePageObject delete = newFiles.deletePage(); delete.submitDeletion(); delete.verifyNotificationMessage(); base.verifyURLStatus(404, imageURL); base.verifyURLStatus(404, imageThumbnailURL); SpecialRestorePageObject restore = delete.undeleteByFlashMessage(); restore.giveReason("asd"); restore.restorePage(); restore.verifyNotificationMessage(); newFiles.verifyURLStatus(200, imageURL); newFiles.verifyURLStatus(200, imageThumbnailURL); }

Target:
public void ImageStorage_001_deleteImage() { WikiBasePageObject base = new WikiBasePageObject(driver); base.logInCookie(credentials.userNameStaff, credentials.passwordStaff, wikiURL); SpecialNewFilesPageObject newFiles = base.openSpecialNewFiles(wikiURL); FilePagePageObject file = newFiles.openRandomImage(); imageURL = file.getImageUrl(); imageThumbnailURL = file.getImageThumbnailUrl(); newFiles.verifyURLStatus(200, imageURL); newFiles.verifyURLStatus(200, imageThumbnailURL); DeletePageObject delete = newFiles.deletePage(); delete.submitDeletion(); delete.verifyNotificationMessage(); base.verifyURLStatus(404, imageURL); base.verifyURLStatus(404, imageThumbnailURL); SpecialRestorePageObject restore = delete.undeleteByFlashMessage(); restore.giveReason(PageContent.caption); restore.restorePage(); restore.verifyNotificationMessage(); newFiles.verifyURLStatus(200, imageURL); newFiles.verifyURLStatus(200, imageThumbnailURL); }
Source:
public boolean execute(CommandSender sender, String label, String[] args) { if (!testPermission(sender)) { return false; } if (args.length == 0 || args.length == 2) { sender.sendMessage(ChatColor.RED + "Usage: " + usageMessage); return false; } GlowWorld world = CommandUtils.getWorld(sender); Location location = CommandUtils.getLocation(sender); if (world == null) { return false; } String functionName = args[0]; CommandFunction function = world.getFunctions().get(functionName); if (function == null) { sender.sendMessage(ChatColor.RED + "Unknown function '" + functionName + "'"); return false; } if (args.length > 2 && location != null) { String condition = args[1].toLowerCase(); CommandTarget target = new CommandTarget(sender, args[2]); Entity[] matched = target.getMatched(location); if (condition.equals("if")) { if (matched.length == 0) { sender.sendMessage("Skipped execution of function '" + function.getFullName() + "'"); return false; } } else if (condition.equals("unless")) { if (matched.length > 0) { sender.sendMessage("Skipped execution of function '" + function.getFullName() + "'"); return false; } } else { sender.sendMessage(ChatColor.RED + "Usage: " + usageMessage); return false; } } function.execute(sender); return true; }

Target:
public boolean execute(CommandSender sender, String label, String[] args) { if (!testPermission(sender)) { return false; } if (args.length == 0 || args.length == 2) { sender.sendMessage(ChatColor.RED + "Usage: " + usageMessage); return false; } GlowWorld world = CommandUtils.getWorld(sender); Location location = CommandUtils.getLocation(sender); if (world == null) { return false; } String functionName = args[0]; Map<String, CommandFunction> functions = world.getFunctions(); if (!functions.containsKey(functionName)) { sender.sendMessage(ChatColor.RED + "Unknown function '" + functionName + "'"); return false; } CommandFunction function = functions.get(functionName); if (args.length > 2 && location != null) { String condition = args[1].toLowerCase(); CommandTarget target = new CommandTarget(sender, args[2]); Entity[] matched = target.getMatched(location); if (condition.equals("if")) { if (matched.length == 0) { sender.sendMessage("Skipped execution of function '" + function.getFullName() + "'"); return false; } } else if (condition.equals("unless")) { if (matched.length > 0) { sender.sendMessage("Skipped execution of function '" + function.getFullName() + "'"); return false; } } else { sender.sendMessage(ChatColor.RED + "Usage: " + usageMessage); return false; } } function.execute(sender); return true; }
Source:
public void init(IWorkbench workbench, IStructuredSelection selection) { System.out.println("!!!!!!!!!!!!!!!!"); }

Target:
public void init(IWorkbench workbench, IStructuredSelection selection) { }
Source:
public Class<?> getObjectType() { return Array.class; }

Target:
public Class<?> getObjectType() { return Partition[].class; }
Source:
Worker(String applicationName, IRecordProcessorFactory recordProcessorFactory, KinesisClientLibConfiguration config, StreamConfig streamConfig, InitialPositionInStreamExtended initialPositionInStream, long parentShardPollIntervalMillis, long shardSyncIdleTimeMillis, boolean cleanupLeasesUponShardCompletion, ICheckpoint checkpoint, KinesisClientLibLeaseCoordinator leaseCoordinator, ExecutorService execService, IMetricsFactory metricsFactory, long taskBackoffTimeMillis, long failoverTimeMillis, boolean skipShardSyncAtWorkerInitializationIfLeasesExist, ShardPrioritization shardPrioritization) { this(applicationName, recordProcessorFactory, config, streamConfig, initialPositionInStream, parentShardPollIntervalMillis, shardSyncIdleTimeMillis, cleanupLeasesUponShardCompletion, checkpoint, leaseCoordinator, execService, metricsFactory, taskBackoffTimeMillis, failoverTimeMillis, skipShardSyncAtWorkerInitializationIfLeasesExist, shardPrioritization, Optional.empty(), Optional.empty(), new NoOpWorkerStateChangeListener()); }

Target:
Worker(String applicationName, IRecordProcessorFactory recordProcessorFactory, KinesisClientLibConfiguration config, StreamConfig streamConfig, InitialPositionInStreamExtended initialPositionInStream, long parentShardPollIntervalMillis, long shardSyncIdleTimeMillis, boolean cleanupLeasesUponShardCompletion, ICheckpoint checkpoint, KinesisClientLibLeaseCoordinator leaseCoordinator, ExecutorService execService, IMetricsFactory metricsFactory, long taskBackoffTimeMillis, long failoverTimeMillis, boolean skipShardSyncAtWorkerInitializationIfLeasesExist, ShardPrioritization shardPrioritization) { this(applicationName, recordProcessorFactory, config, streamConfig, initialPositionInStream, parentShardPollIntervalMillis, shardSyncIdleTimeMillis, cleanupLeasesUponShardCompletion, checkpoint, leaseCoordinator, execService, metricsFactory, taskBackoffTimeMillis, failoverTimeMillis, skipShardSyncAtWorkerInitializationIfLeasesExist, shardPrioritization, Optional.empty(), Optional.empty(), DEFAULT_WORKER_STATE_CHANGE_LISTENER); }
Source:
public String getName() { String name = path.getFileName().toString(); if (name.toLowerCase().endsWith(Aes256Cryptor.FOLDER_EXTENSION.toLowerCase())) { name = name.substring(0, name.length() - Aes256Cryptor.FOLDER_EXTENSION.length()); } return name; }

Target:
public String getName() { String name = path.getFileName().toString(); if (StringUtils.endsWithIgnoreCase(name, Aes256Cryptor.FOLDER_EXTENSION)) { name = name.substring(0, name.length() - Aes256Cryptor.FOLDER_EXTENSION.length()); } return name; }
Source:
public String getRequestHeaderByName(String headerName) { String headerValue = (this.requestHeaders.isPresent() && this.requestHeaders.get().get(headerName) != null) ? this.requestHeaders.get().get(headerName).get(0) : null; return headerValue; }

Target:
public String getRequestHeaderByName(String headerName) { if (this.requestHeaders.get(headerName) == null) { return null; } else { return this.requestHeaders.get(headerName).get(0); } }
Source:
public void testCreateMtlsKeyStoreSuccess() throws Exception { InputStream certAndKey = getClass() .getClassLoader() .getResourceAsStream("com/google/api/client/util/mtlsCertAndKey.pem"); KeyStore mtlsKeyStore = SecurityUtils.createMtlsKeyStore(certAndKey); assertEquals(mtlsKeyStore.size(), 1); }

Target:
public void testCreateMtlsKeyStoreSuccess() throws Exception { InputStream certAndKey = getClass() .getClassLoader() .getResourceAsStream("com/google/api/client/util/mtlsCertAndKey.pem"); KeyStore mtlsKeyStore = SecurityUtils.createMtlsKeyStore(certAndKey); assertEquals(1, mtlsKeyStore.size()); }
Source:
private void writePage0(long pageId, ByteBuffer pageBuf) throws IOException { assert fileIo != null : "Delta pages storage is not inited: " + this; assert pageBuf.position() == 0; assert pageBuf.order() == ByteOrder.nativeOrder() : "Page buffer order " + pageBuf.order() + " should be same with " + ByteOrder.nativeOrder(); int crc = PageIO.getCrc(pageBuf); int crc32 = FastCrc.calcCrc(pageBuf, pageBuf.limit()); if (log.isDebugEnabled()) { log.debug("onPageWrite [pageId=" + pageId + ", pageIdBuff=" + PageIO.getPageId(pageBuf) + ", fileSize=" + fileIo.size() + ", crcBuff=" + crc32 + ", crcPage=" + crc + ']'); } pageBuf.rewind(); fileIo.writeFully(pageBuf); }

Target:
private void writePage0(long pageId, ByteBuffer pageBuf) throws IOException { assert deltaFileIo != null : "Delta pages storage is not inited: " + this; assert pageBuf.position() == 0; assert pageBuf.order() == ByteOrder.nativeOrder() : "Page buffer order " + pageBuf.order() + " should be same with " + ByteOrder.nativeOrder(); if (log.isDebugEnabled()) { log.debug("onPageWrite [pageId=" + pageId + ", pageIdBuff=" + PageIO.getPageId(pageBuf) + ", fileSize=" + deltaFileIo.size() + ", crcBuff=" + FastCrc.calcCrc(pageBuf, pageBuf.limit()) + ", crcPage=" + PageIO.getCrc(pageBuf) + ']'); pageBuf.rewind(); } deltaFileIo.writeFully(pageBuf); }
Source:
public void reject_null_value() { CurrentTenant.set(null); }

Target:
public void reject_null_value() { CurrentTenant.set(Tests.<TenantId>nullRef()); }
Source:
public StripesBehavior behave(IStripesPipe pipe, StripesAction act, ItemStack is) { if (act == StripesAction.DESTROY) { return StripesBehavior.DEFAULT; } Pipe th = is.getItem() != null ? BlockGenericPipe.createPipe(is.getItem()) : null; if (th != null && th.transport instanceof PipeTransportItems) { World wrd = pipe.getWorld(); Position loc = pipe.getPosition(); ForgeDirection dir = pipe.getOpenOrientation(); TileGenericPipe stripes = (TileGenericPipe) loc.getTile(wrd); if (!loc.shift(dir).blockExists(wrd)) { th.transport = stripes.pipe.transport; stripes.pipe = th; th.setTile(stripes); stripes.coreState.pipeId = Item.getIdFromItem(th.item); stripes.validate(); is.stackSize--; if (!wrd.isRemote) { place(wrd, loc, BuildCraftTransport.pipeItemsStripes); } } return StripesBehavior.DROP; } return StripesBehavior.DEFAULT; }

Target:
public StripesBehavior behave(IStripesPipe pipe, StripesAction act, ItemStack is) { if (act == StripesAction.DESTROY) { return StripesBehavior.DEFAULT; } Pipe<?> th = is.getItem() != null ? BlockGenericPipe.createPipe(is.getItem()) : null; if (th != null && th.transport instanceof PipeTransportItems) { World wrd = pipe.getWorld(); Position loc = pipe.getPosition(); ForgeDirection dir = pipe.getOpenOrientation(); TileGenericPipe stripes = (TileGenericPipe) loc.getTile(wrd); if (!loc.shift(dir).blockExists(wrd)) { th.setTile(stripes); stripes.pipe = th; is.stackSize--; place(wrd, loc, BuildCraftTransport.pipeItemsStripes); } return StripesBehavior.DROP; } return StripesBehavior.DEFAULT; }
Source:
private VDS getServer(Guid clusterId, String hostnameOrIp) { List<VDS> servers = getVdsDao().getAllForHostname(hostnameOrIp); if(servers.size() > 0) { return getServerOfCluster(clusterId, servers); } List<VdsNetworkInterface> ifaces = getInterfaceDao().getAllInterfacesWithIpAddress(hostnameOrIp); if(ifaces.size() > 0) { for(VdsNetworkInterface iface : ifaces) { VDS server = getVdsDao().get(iface.getVdsId()); if(server.getvds_group_id().equals(clusterId)) { return server; } } } return null; }

Target:
private VDS getServer(Guid clusterId, String hostnameOrIp) { List<VDS> servers = getVdsDao().getAllForHostname(hostnameOrIp); if(servers.size() > 0) { return getServerOfCluster(clusterId, servers); } List<VdsNetworkInterface> ifaces = getInterfaceDao().getAllInterfacesWithIpAddress(clusterId, hostnameOrIp); if(ifaces.size() == 1) { for(VdsNetworkInterface iface : ifaces) { VDS server = getVdsDao().get(iface.getVdsId()); if(server.getvds_group_id().equals(clusterId)) { return server; } } } else if(ifaces.size() > 1) { throw new RuntimeException(String.format("There are multiple servers in DB having same IP address %1$s! " + "Cannot arrive at correct server id for bricks related to this ip address in cluster %2$s", hostnameOrIp, clusterId)); } return null; }
Source:
private void authenticateUser(HttpSession session, HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { try { Credentials userCredentials = getUserCredentialsFromRequest(request); if (userCredentials == null) { userCredentials = getUserCredentialsFromSession(request); } if (userCredentials == null) { throw new AuthenticationException("Credentials Required"); } try { AuthenticationUtils.handleCredentials( session, userCredentials.getUsername(), userCredentials.getPassword(), userCredentials.getProfile()); request.getRequestDispatcher(SSOUtils.LOGIN_PHASE3_URI).forward(request, response); } catch (SQLException ex) { log.error("Internal Database Error", ex); throw new AuthenticationException("Internal Database Error", ex); } } catch (AuthenticationException ex) { request.getRequestDispatcher("/WEB-INF/login.jsp?msg=" + ex.getMessage()).forward(request, response); } finally { request.getSession().removeAttribute(SSOUtils.USER_CREDENTIALS); } }

Target:
private void authenticateUser(HttpSession session, HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException, AuthenticationException { Credentials userCredentials = getUserCredentialsFromRequest(request); if (userCredentials == null) { userCredentials = getUserCredentialsFromSession(request); } if (userCredentials == null) { throw new AuthenticationException("Credentials Required"); } try { AuthenticationUtils.handleCredentials( session, userCredentials.getUsername(), userCredentials.getPassword(), userCredentials.getProfile()); request.getRequestDispatcher(SSOUtils.LOGIN_PHASE3_URI).forward(request, response); } catch (SQLException ex) { log.error("Internal Database Error", ex); throw new AuthenticationException("Internal Database Error", ex); } }