auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
private void peekEventsFromIncompleteTransactions(List<GatewaySenderEventImpl> batch, PartitionedRegion prQ) { if (!mustGroupTransactionEvents()) { return; } Map<TransactionId, Integer> incompleteTransactionIdsInBatch = getIncompleteTransactionsInBatch(batch); if (incompleteTransactionIdsInBatch.size() == 0) { return; } boolean areAllEventsForTransactionsInBatch = true; for (Map.Entry<TransactionId, Integer> pendingTransaction : incompleteTransactionIdsInBatch .entrySet()) { TransactionId transactionId = pendingTransaction.getKey(); int bucketId = pendingTransaction.getValue(); boolean areAllEventsForTransactionInBatch = false; int retries = 0; while (!areAllEventsForTransactionInBatch && retries++ < GET_TRANSACTION_EVENTS_FROM_QUEUE_RETRIES) { List<Object> events = peekEventsWithTransactionId(prQ, bucketId, transactionId); for (Object object : events) { GatewaySenderEventImpl event = (GatewaySenderEventImpl) object; batch.add(event); peekedEvents.add(event); areAllEventsForTransactionInBatch = event.isLastEventInTransaction(); if (logger.isDebugEnabled()) { logger.debug( "Peeking extra event: {}, bucketId: {}, isLastEventInTransaction: {}, batch size: {}", event.getKey(), bucketId, event.isLastEventInTransaction(), batch.size()); } } } if (!areAllEventsForTransactionInBatch) { areAllEventsForTransactionsInBatch = false; logger.warn("Not able to retrieve all events for transaction after tries", transactionId, retries); } } if (!areAllEventsForTransactionsInBatch) { stats.incBatchesWithIncompleteTransactions(); } }

Target:
private void peekEventsFromIncompleteTransactions(List<GatewaySenderEventImpl> batch, PartitionedRegion prQ) { if (!mustGroupTransactionEvents()) { return; } Map<TransactionId, Integer> incompleteTransactionIdsInBatch = getIncompleteTransactionsInBatch(batch); if (incompleteTransactionIdsInBatch.size() == 0) { return; } boolean batchHasIncompleteTransactions = false; for (Map.Entry<TransactionId, Integer> pendingTransaction : incompleteTransactionIdsInBatch .entrySet()) { TransactionId transactionId = pendingTransaction.getKey(); int bucketId = pendingTransaction.getValue(); boolean areAllEventsForTransactionInBatch = false; int retries = 0; while (!areAllEventsForTransactionInBatch && retries++ < GET_TRANSACTION_EVENTS_FROM_QUEUE_RETRIES) { List<Object> events = peekEventsWithTransactionId(prQ, bucketId, transactionId); for (Object object : events) { GatewaySenderEventImpl event = (GatewaySenderEventImpl) object; batch.add(event); peekedEvents.add(event); areAllEventsForTransactionInBatch = event.isLastEventInTransaction(); if (logger.isDebugEnabled()) { logger.debug( "Peeking extra event: {}, bucketId: {}, isLastEventInTransaction: {}, batch size: {}", event.getKey(), bucketId, event.isLastEventInTransaction(), batch.size()); } } } if (!areAllEventsForTransactionInBatch) { batchHasIncompleteTransactions = true; logger.warn("Not able to retrieve all events for transaction after tries", transactionId, retries); } } if (batchHasIncompleteTransactions) { stats.incBatchesWithIncompleteTransactions(); } }
Source:
public RemoveNetworksModel(ListModel sourceListModel) { this.sourceListModel = sourceListModel; setTitle(ConstantsManager.getInstance().getConstants().removeLogicalNetworkTitle()); setHelpTag(HelpTag.remove_logical_network); setHashName("remove_logical_network"); ArrayList<String> list = new ArrayList<>(); Set<Guid> externalProviderIds = new HashSet(); for (Network network : (Iterable<Network>) sourceListModel.getSelectedItems()) { if (network instanceof NetworkView) { NetworkView netView = (NetworkView) network; if (netView.getDescription() == null || netView.getDescription().trim().equals("")) { list.add(ConstantsManager.getInstance() .getMessages() .networkDc(netView.getName(), netView.getDataCenterName())); } else { list.add(ConstantsManager.getInstance() .getMessages() .networkDcDescription(netView.getName(), netView.getDataCenterName(), netView.getDescription())); } } else { if (network.getDescription() == null || "".equals(network.getDescription().trim())) { list.add(network.getName()); } else { list.add(StringFormat.format("%1$s (%2$s)", network.getName(), network.getDescription())); } } if (network.isExternal()) { externalProviderIds.add(network.getProvidedBy().getProviderId()); } } setItems(list); adjustRemoveExternalForNetworkReadOnlyProperty(externalProviderIds); UICommand tempVar = UICommand.createDefaultOkUiCommand("onRemove", this); getCommands().add(tempVar); UICommand tempVar2 = UICommand.createCancelUiCommand("cancel", this); getCommands().add(tempVar2); }

Target:
public RemoveNetworksModel(ListModel sourceListModel) { this.sourceListModel = sourceListModel; setTitle(ConstantsManager.getInstance().getConstants().removeLogicalNetworkTitle()); setHelpTag(HelpTag.remove_logical_network); setHashName("remove_logical_network"); ArrayList<String> list = new ArrayList<>(); Set<Guid> externalProviderIds = new HashSet(); for (Network network : (Iterable<Network>) sourceListModel.getSelectedItems()) { if (network instanceof NetworkView) { NetworkView netView = (NetworkView) network; if (netView.getDescription() == null || netView.getDescription().trim().equals("")) { list.add(ConstantsManager.getInstance() .getMessages() .networkDc(netView.getName(), netView.getDataCenterName())); } else { list.add(ConstantsManager.getInstance() .getMessages() .networkDcDescription(netView.getName(), netView.getDataCenterName(), netView.getDescription())); } } else { if (network.getDescription() == null || "".equals(network.getDescription().trim())) { list.add(network.getName()); } else { list.add(StringFormat.format("%1$s (%2$s)", network.getName(), network.getDescription())); } } if (network.isExternal()) { externalProviderIds.add(network.getProvidedBy().getProviderId()); } } setItems(list); adjustRemoveExternalOptions(externalProviderIds); UICommand tempVar = UICommand.createDefaultOkUiCommand("onRemove", this); getCommands().add(tempVar); UICommand tempVar2 = UICommand.createCancelUiCommand("cancel", this); getCommands().add(tempVar2); }
Source:
public ElytronManagedThreadFactory(String name, ContextServiceImpl contextService, int priority) { super(name, contextService, priority); fccl = WildFlySecurityManager.getCurrentContextClassLoaderPrivileged(); }

Target:
public ElytronManagedThreadFactory(String name, ContextServiceImpl contextService, int priority) { super(name, contextService, priority); }
Source:
public String getPageRendered(final HttpServletRequest request, final HttpServletResponse response, final User user, final String uri, PageMode mode) throws ResourceNotFoundException, ParseErrorException, DotRuntimeException, Exception { final Context velocityContext = VelocityUtil.getWebContext(request, response); final String siteName = null == request.getParameter(Host.HOST_VELOCITY_VAR_NAME) ? request.getServerName() : request.getParameter(Host.HOST_VELOCITY_VAR_NAME); final Host site = this.hostWebAPI.resolveHostName(siteName, user, RESPECT_FE_ROLES); final String pageUri = (uri.length()>0 && '/' == uri.charAt(0)) ? uri : ("/" + uri); final HTMLPageAsset page = (HTMLPageAsset) this.htmlPageAssetAPI.getPageByPath(pageUri, site, this.languageAPI.getDefaultLanguage().getId(), mode.respectAnonPerms); if(null==page) { response.sendError(404); return null; } if(mode.isAdmin ) { APILocator.getPermissionAPI().checkPermission(page, PermissionLevel.READ, user); } switch (mode) { case PREVIEW_MODE: return new VelocityPreviewMode(request, response, pageUri, site).eval(); case EDIT_MODE: return new VelocityEditMode(request, response, pageUri, site).eval(); default: return new VelocityLiveMode(request, response, pageUri, site).eval(); } }

Target:
public String getPageRendered(final HttpServletRequest request, final HttpServletResponse response, final User user, final String uri, PageMode mode) throws DotDataException, DotSecurityException, IOException { final String siteName = null == request.getParameter(Host.HOST_VELOCITY_VAR_NAME) ? request.getServerName() : request.getParameter(Host.HOST_VELOCITY_VAR_NAME); final Host site = this.hostWebAPI.resolveHostName(siteName, user, RESPECT_FE_ROLES); final String pageUri = (uri.length()>0 && '/' == uri.charAt(0)) ? uri : ("/" + uri); final HTMLPageAsset page = (HTMLPageAsset) this.htmlPageAssetAPI.getPageByPath(pageUri, site, this.languageAPI.getDefaultLanguage().getId(), mode.respectAnonPerms); if(null==page) { response.sendError(HttpServletResponse.SC_NOT_FOUND); return null; } if(mode.isAdmin ) { APILocator.getPermissionAPI().checkPermission(page, PermissionLevel.READ, user); } switch (mode) { case PREVIEW_MODE: return new VelocityPreviewMode(request, response, pageUri, site).eval(); case EDIT_MODE: return new VelocityEditMode(request, response, pageUri, site).eval(); default: return new VelocityLiveMode(request, response, pageUri, site).eval(); } }
Source:
public TransactionTemplate retries( int retries ) { if ( retries < 1 ) { throw new IllegalArgumentException( "Number of retries must be greater than or equal to 1" ); } return new TransactionTemplate( gds, monitor, retries, backoff, retryPredicate ); }

Target:
public TransactionTemplate retries( int retries ) { return new TransactionTemplate( gds, monitor, retries, backoff, retryPredicate ); }
Source:
public List<RadiologyReport> getRadiologyReportsByRadiologyOrderAndRadiologyReportStatus(RadiologyOrder radiologyOrder, RadiologyReportStatus radiologyReportStatus) { List<RadiologyReport> result = sessionFactory.getCurrentSession() .createCriteria(RadiologyReport.class) .add(Restrictions.eq("radiologyOrder", radiologyOrder)) .add(Restrictions.eq("reportStatus", radiologyReportStatus)) .list(); return result == null ? new ArrayList<RadiologyReport>() : result; }

Target:
public List<RadiologyReport> getRadiologyReportsByRadiologyOrderAndRadiologyReportStatus(RadiologyOrder radiologyOrder, RadiologyReportStatus radiologyReportStatus) { final List<RadiologyReport> result = sessionFactory.getCurrentSession() .createCriteria(RadiologyReport.class) .add(Restrictions.eq("radiologyOrder", radiologyOrder)) .add(Restrictions.eq("reportStatus", radiologyReportStatus)) .list(); return result == null ? new ArrayList<RadiologyReport>() : result; }
Source:
public void show(@NonNull View anchorView, @Nullable Callback callback) { this.callback = callback; popupWindowHost = new PopupWindow(this, ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT, true); popupWindowHost.setBackgroundDrawable(new ColorDrawable(Color.TRANSPARENT)); PopupWindowCompat.setOverlapAnchor(popupWindowHost, true); final int compatOffset = 8; PopupWindowCompat.showAsDropDown(popupWindowHost, anchorView, 0, Build.VERSION.SDK_INT < Build.VERSION_CODES.LOLLIPOP ? -DimenUtil.getToolbarHeightPx(anchorView.getContext()) + DimenUtil.roundedDpToPx(compatOffset) : 0, Gravity.END); String lastSyncTime = Prefs.getReadingListsLastSyncTime(); lastSync.setVisibility(TextUtils.isEmpty(lastSyncTime) ? View.GONE : View.VISIBLE); if (!TextUtils.isEmpty(lastSyncTime)) { try { lastSync.setText(String.format(getContext().getString(R.string.reading_list_menu_last_sync), DateUtil.getReadingListsLastSyncDateString(Prefs.getReadingListsLastSyncTime()))); } catch (Exception e) { } } }

Target:
public void show(@NonNull View anchorView, @Nullable Callback callback) { this.callback = callback; popupWindowHost = new PopupWindow(this, ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT, true); popupWindowHost.setBackgroundDrawable(new ColorDrawable(Color.TRANSPARENT)); PopupWindowCompat.setOverlapAnchor(popupWindowHost, true); final int compatOffset = 8; PopupWindowCompat.showAsDropDown(popupWindowHost, anchorView, 0, Build.VERSION.SDK_INT < Build.VERSION_CODES.LOLLIPOP ? -DimenUtil.getToolbarHeightPx(anchorView.getContext()) + DimenUtil.roundedDpToPx(compatOffset) : 0, Gravity.END); String lastSyncTime = Prefs.getReadingListsLastSyncTime(); lastSync.setVisibility(TextUtils.isEmpty(lastSyncTime) ? View.GONE : View.VISIBLE); if (!TextUtils.isEmpty(lastSyncTime)) { try { lastSync.setText(String.format(getContext().getString(R.string.reading_list_menu_last_sync), DateUtil.getReadingListsLastSyncDateString(Prefs.getReadingListsLastSyncTime()))); } catch (ParseException e) { } } }
Source:
public RecoverPasswordController(final ContentRenderer contentRenderer, final FormFactory formFactory, final RecoverPasswordPageContentFactory pageContentFactory, final RecoverPasswordFormData formData, final RecoverPasswordControllerAction controllerAction, final AuthenticationReverseRouter authenticationReverseRouter) { super(contentRenderer, formFactory, pageContentFactory, formData, controllerAction); this.authenticationReverseRouter = authenticationReverseRouter; }

Target:
RecoverPasswordController(final ContentRenderer contentRenderer, final FormFactory formFactory, final RecoverPasswordPageContentFactory pageContentFactory, final RecoverPasswordFormData formData, final RecoverPasswordControllerAction controllerAction, final AuthenticationReverseRouter authenticationReverseRouter) { super(contentRenderer, formFactory, pageContentFactory, formData, controllerAction); this.authenticationReverseRouter = authenticationReverseRouter; }
Source:
protected void initialize() throws ResourceManagerException { try { resourceManagerDriver.initialize( this, command -> getMainThreadExecutor().execute(command)); } catch (Throwable t) { throw new ResourceManagerException("Cannot initialize resource provider.", t); } }

Target:
protected void initialize() throws ResourceManagerException { try { resourceManagerDriver.initialize( this, command -> getMainThreadExecutor().execute(command)); } catch (Exception e) { throw new ResourceManagerException("Cannot initialize resource provider.", e); } }
Source:
private Result giveConsentForVersion(int version, SubpopulationGuid subpopGuid) { final UserSession session = getAuthenticatedSession(); final Study study = studyService.getStudy(session.getStudyIdentifier()); final ConsentSignature consentSignature = ConsentSignature.fromJSON(requestToJSON(request())); final SharingOption sharing = SharingOption.fromJson(requestToJSON(request()), version); Map<SubpopulationGuid,ConsentStatus> consentStatuses = session.getConsentStatuses(); ConsentStatus status = consentStatuses.get(subpopGuid); if (status == null) { throw new EntityNotFoundException(Subpopulation.class); } consentService.consentToResearch(study, subpopGuid, session.getParticipant(), consentSignature, sharing.getSharingScope(), true); CriteriaContext context = getCriteriaContext(session); Map<SubpopulationGuid,ConsentStatus> statuses = consentService.getConsentStatuses(context); sessionUpdateService.updateConsentStatus(session, statuses, sharing.getSharingScope(), false); if (session.doesConsent()) { notificationsService.createSmsRegistrationAfterConsent(session.getParticipant(), getCriteriaContext(session)); } return createdResult(UserSessionInfo.toJSON(session)); }

Target:
private Result giveConsentForVersion(int version, SubpopulationGuid subpopGuid) { final UserSession session = getAuthenticatedSession(); final Study study = studyService.getStudy(session.getStudyIdentifier()); final ConsentSignature consentSignature = ConsentSignature.fromJSON(requestToJSON(request())); final SharingOption sharing = SharingOption.fromJson(requestToJSON(request()), version); Map<SubpopulationGuid,ConsentStatus> consentStatuses = session.getConsentStatuses(); ConsentStatus status = consentStatuses.get(subpopGuid); if (status == null) { throw new EntityNotFoundException(Subpopulation.class); } consentService.consentToResearch(study, subpopGuid, session.getParticipant(), consentSignature, sharing.getSharingScope(), true); CriteriaContext context = getCriteriaContext(session); Map<SubpopulationGuid,ConsentStatus> statuses = consentService.getConsentStatuses(context); sessionUpdateService.updateConsentStatus(session, statuses, sharing.getSharingScope(), false); return createdResult(UserSessionInfo.toJSON(session)); }
Source:
public static PosetTriplet computePosetInfo(List<PVariable> variables, PBody body, IQueryMetaContext context) { Map<PVariable, Set<TypeJudgement>> typeMap = TypeHelper.inferUnaryTypes(body.getConstraints(), context); PosetTriplet result = new PosetTriplet(); List<Integer> coreIndices = new ArrayList<Integer>(); List<Integer> posetIndices = new ArrayList<Integer>(); List<IInputKey> filtered = new ArrayList<IInputKey>(); boolean posetKey = false; for (int i = 0; i < variables.size(); i++) { posetKey = false; Set<TypeJudgement> judgements = typeMap.get(variables.get(i)); if (judgements.size() == 1) { IInputKey key = judgements.iterator().next().getInputKey(); if (key != null && context.isPosetKey(key)) { posetKey = true; filtered.add(key); } } if (posetKey) { posetIndices.add(i); } else { coreIndices.add(i); } } result.comparator = context.getPosetComparator(filtered); result.coreMask = RecipesHelper.mask(variables.size(), coreIndices); result.posetMask = RecipesHelper.mask(variables.size(), posetIndices); return result; }

Target:
public static PosetTriplet computePosetInfo(List<PVariable> variables, PBody body, IQueryMetaContext context) { Map<PVariable, Set<TypeJudgement>> typeMap = TypeHelper.inferUnaryTypes(body.getConstraints(), context); List<Set<IInputKey>> keys = new LinkedList<Set<IInputKey>>(); for (int i = 0; i < variables.size(); i++) { Set<IInputKey> _keys = new HashSet<IInputKey>(); PVariable current = variables.get(i); while (current != null) { Set<TypeJudgement> judgements = typeMap.get(current); if (judgements != null) { for (TypeJudgement judgement : judgements) { _keys.add(judgement.getInputKey()); } } current = current.getDirectUnifiedInto(); } keys.add(_keys); } return computePosetInfo(keys, context); }
Source:
private SynchronizationModel createSynchronizationModel(ITypedElement left, ITypedElement right, ITypedElement origin, IProgressMonitor monitor) throws InterruptedException { final IFile leftFile = findFile(left); final IFile rightFile = findFile(right); if (leftFile != null && rightFile != null) { return resolver.resolveLocalModels(leftFile, rightFile, findFile(origin), monitor); } final IStorage leftStorage = StreamAccessorStorage.fromTypedElement(left); final IStorage rightStorage; if (right instanceof IStreamContentAccessor) { rightStorage = StreamAccessorStorage.fromTypedElement(right); } else { rightStorage = null; } final IStorage originStorage; if (origin != null) { originStorage = StreamAccessorStorage.fromTypedElement(origin); } else { originStorage = null; } return loadSingleResource(leftStorage, rightStorage, originStorage); }

Target:
private SynchronizationModel createSynchronizationModel(ITypedElement left, ITypedElement right, ITypedElement origin, IProgressMonitor monitor) throws InterruptedException { final IFile leftFile = findFile(left); final IFile rightFile = findFile(right); if (leftFile != null && rightFile != null) { return resolver.resolveLocalModels(leftFile, rightFile, findFile(origin), monitor); } final IStorage leftStorage = StreamAccessorStorage.fromTypedElement(left); Assert.isNotNull(leftStorage); final IStorage rightStorage; if (right instanceof IStreamContentAccessor) { rightStorage = StreamAccessorStorage.fromTypedElement(right); } else { rightStorage = null; } final IStorage originStorage; if (origin != null) { originStorage = StreamAccessorStorage.fromTypedElement(origin); } else { originStorage = null; } return loadSingleResource(leftStorage, rightStorage, originStorage); }
Source:
protected MapSqlParameterSource createFullParametersMapper(VmDevice entity) { return createIdParameterMapper(entity.getId()) .addValue("device", entity.getDevice()) .addValue("type", entity.getType().getValue()) .addValue("address", entity.getAddress()) .addValue("boot_order", entity.getBootOrder()) .addValue("spec_params", entity.getSpecParams() == null ? null : SerializationFactory .getSerializer() .serialize(entity.getSpecParams())) .addValue("is_managed", entity.getIsManaged()) .addValue("is_plugged", entity.getIsPlugged()) .addValue("is_readonly", entity.getIsReadOnly()) .addValue("alias", entity.getAlias()) .addValue("custom_properties", entity.getCustomProperties() == null ? null : SerializationFactory .getSerializer() .serialize(entity.getCustomProperties())); }

Target:
protected MapSqlParameterSource createFullParametersMapper(VmDevice entity) { return createIdParameterMapper(entity.getId()) .addValue("device", entity.getDevice()) .addValue("type", entity.getType().getValue()) .addValue("address", entity.getAddress()) .addValue("boot_order", entity.getBootOrder()) .addValue("spec_params", serializeIfNotNull(entity.getSpecParams())) .addValue("is_managed", entity.getIsManaged()) .addValue("is_plugged", entity.getIsPlugged()) .addValue("is_readonly", entity.getIsReadOnly()) .addValue("alias", entity.getAlias()) .addValue("custom_properties", serializeIfNotNull(entity.getCustomProperties())); }
Source:
private boolean validateInputSchemaType(Schema.Type inputSchemaType) { if (!Schema.Type.STRING.equals(inputSchemaType) && !Schema.Type.BYTES.equals(inputSchemaType)) { String message = String.format("Unsupported inputType in schema, only Schema.Type.BYTES and Schema.Type.STRING are supported " + "InputType: %s", inputSchemaType.toString()); LOG.error(message); return false; } return true; }

Target:
private void validateInputSchemaType(Schema.Type inputSchemaType) { if (!Schema.Type.STRING.equals(inputSchemaType) && !Schema.Type.BYTES.equals(inputSchemaType)) { throw new IllegalArgumentException(String.format( "Unsupported inputType in schema, only Schema.Type.BYTES and Schema.Type.STRING are supported " + "InputType: %s", inputSchemaType.toString())); } }
Source:
public static boolean isValidContext( Evaluator context, boolean disallowVirtualCube, Level levels, boolean strict, FunDef fun) { if (context == null) { return false; } RolapCube cube = (RolapCube) context.getCube(); if (disallowVirtualCube) { if (cube.isVirtual()) { return false; } } if (cube.isVirtual()) { Query query = context.getQuery(); Set<RolapCube> baseCubes = new HashSet<RolapCube>(); List<RolapCube> baseCubeList = new ArrayList<RolapCube>(); if (!findVirtualCubeBaseCubes(query, baseCubes, baseCubeList)) { return false; } assert levels != null; query.setBaseCubes(baseCubeList); } if (SqlConstraintUtils.measuresConflictWithMembers( context.getQuery().getMeasuresMembers(), context.getMembers())) { return false; } if (!strict) { return true; } Member[] members = context.getMembers(); for (int i = 0; i < members.length; i++) { boolean isCalculated = members[i].isCalculated(); if (isCalculated && !SqlConstraintUtils .isSupportedCalculatedMember(members[i])) { return false; } } int maxConstraints = MondrianProperties.instance().MaxConstraints.get(); int supportedCalculatedMembersQuantity = SqlConstraintUtils .expandSupportedCalculatedMembers( members, context).length; if (supportedCalculatedMembersQuantity > maxConstraints) { String message = MondrianResource.instance() .MembersQuantityExceedsMaxConstraints .str(String.valueOf(supportedCalculatedMembersQuantity)); alertNonNative(context, fun, message); return false; } return true; }

Target:
public static boolean isValidContext( Evaluator context, boolean disallowVirtualCube, Level levels, boolean strict, FunDef fun) { if (context == null) { return false; } RolapCube cube = (RolapCube) context.getCube(); if (disallowVirtualCube) { if (cube.isVirtual()) { return false; } } if (cube.isVirtual()) { Query query = context.getQuery(); Set<RolapCube> baseCubes = new HashSet<RolapCube>(); List<RolapCube> baseCubeList = new ArrayList<RolapCube>(); if (!findVirtualCubeBaseCubes(query, baseCubes, baseCubeList)) { return false; } assert levels != null; query.setBaseCubes(baseCubeList); } if (SqlConstraintUtils.measuresConflictWithMembers( context.getQuery().getMeasuresMembers(), context.getMembers())) { return false; } if (!strict) { return true; } int maxConstraints = MondrianProperties.instance().MaxConstraints.get(); Member[] members = context.getMembers(); int calculatedMembersQuantity = 0; for (int i = 0; i < members.length; i++) { if (!(members[i].isCalculated())) { continue; } if (!SqlConstraintUtils.isSupportedCalculatedMember(members[i])) { return false; } List<Member> listMembers = SqlConstraintUtils .expandExpressions(members[i], null, context); Set<Member> uniqueMembers = new HashSet<Member>(listMembers); calculatedMembersQuantity = uniqueMembers.size(); if (calculatedMembersQuantity > maxConstraints) { String message = MondrianResource.instance() .MembersQuantityExceedsMaxConstraints .str(String.valueOf(calculatedMembersQuantity)); alertNonNative(context, fun, message); return false; } } return true; }
Source:
public HandleStatus handle(MessageReference ref) throws Exception { if (filter != null && !filter.match(ref.getMessage())) { return HandleStatus.NO_MATCH; } synchronized (this) { ref.handled(); Message message = ref.getMessage(); synchronized (refs) { refs.put(ref.getMessage().getMessageID(), ref); } Integer partition = null; SimpleString groupdID = message.getGroupID(); if (groupdID != null) { List partitions = kafkaProducer.partitionsFor(topicName); int numPartitions = partitions.size(); partition = Utils.toPositive(Utils.murmur2(groupdID.getData())) % numPartitions; } SimpleString key = message.getLastValueProperty(); ProducerRecord<String, Message> producerRecord = new ProducerRecord<>( topicName, partition, message.getTimestamp(), key == null ? null : key.toString(), message); if (ActiveMQServerLogger.LOGGER.isTraceEnabled()) { ActiveMQServerLogger.LOGGER.trace("KafkaProducerBridge::going to send message: " + message + " from " + this.queue); } pendingAcks.countUp(); try { kafkaProducer.send(producerRecord, new MessageAwareCallback(ref)); } catch (Exception e) { pendingAcks.countDown(); throw e; } return HandleStatus.HANDLED; } }

Target:
public HandleStatus handle(MessageReference ref) throws Exception { if (filter != null && !filter.match(ref.getMessage())) { return HandleStatus.NO_MATCH; } synchronized (this) { ref.handled(); Message message = ref.getMessage(); synchronized (refs) { refs.put(ref.getMessage().getMessageID(), ref); } SimpleString key = message.getLastValueProperty(); ProducerRecord<String, Message> producerRecord = new ProducerRecord<>( topicName, null, message.getTimestamp(), key == null ? null : key.toString(), message); if (ActiveMQServerLogger.LOGGER.isTraceEnabled()) { ActiveMQServerLogger.LOGGER.trace("KafkaProducerBridge::going to send message: " + message + " from " + this.queue); } pendingAcks.countUp(); try { kafkaProducer.send(producerRecord, new MessageAwareCallback(ref)); } catch (Exception e) { pendingAcks.countDown(); throw e; } return HandleStatus.HANDLED; } }
Source:
public Map<ByteBuffer, List<ColumnOrSuperColumn>> multiget_slice(String kvsMethodName, TableReference tableRef, List<ByteBuffer> keys, SlicePredicate predicate, ConsistencyLevel consistency_level) throws InvalidRequestException, UnavailableException, TimedOutException, TException { int numberOfQueriedRows = keys.size(); return qosClient.executeRead( () -> client.multiget_slice(kvsMethodName, tableRef, keys, predicate, consistency_level), ThriftQueryWeighers.multigetSlice(numberOfQueriedRows)); }

Target:
public Map<ByteBuffer, List<ColumnOrSuperColumn>> multiget_slice(String kvsMethodName, TableReference tableRef, List<ByteBuffer> keys, SlicePredicate predicate, ConsistencyLevel consistency_level) throws InvalidRequestException, UnavailableException, TimedOutException, TException { return qosClient.executeRead( () -> client.multiget_slice(kvsMethodName, tableRef, keys, predicate, consistency_level), ThriftQueryWeighers.multigetSlice(keys)); }
Source:
private void runClassLoaderReleaseHook(ClassLoader classLoader) { AwsSdkMetrics.unregisterMetricAdminMBean(); try { Class<?> fileAgeManagerClazz = Class.forName("com.amazonaws.services.kinesis.producer.FileAgeManager", true, classLoader); Field instanceField = fileAgeManagerClazz.getDeclaredField("instance"); instanceField.setAccessible(true); Field modifiersField = Field.class.getDeclaredField("modifiers"); modifiersField.setAccessible(true); modifiersField.setInt(instanceField, instanceField.getModifiers() & ~Modifier.FINAL); Object fileAgeManager = instanceField.get(null); instanceField.set(null, null); Field executorField = fileAgeManagerClazz.getDeclaredField("executorService"); executorField.setAccessible(true); ExecutorService executorService = (ExecutorService) executorField.get(fileAgeManager); executorService.shutdown(); executorService.awaitTermination(1, TimeUnit.MINUTES); Class<?> credProviderClazz = Class.forName("com.amazonaws.auth.InstanceProfileCredentialsProvider", true, classLoader); Field credProviderInstanceField = credProviderClazz.getDeclaredField("INSTANCE"); credProviderInstanceField.setAccessible(true); modifiersField.setInt(credProviderInstanceField, instanceField.getModifiers() & ~Modifier.FINAL); credProviderInstanceField.set(null, null); } catch (ClassNotFoundException | NoSuchFieldException | IllegalAccessException | InterruptedException e) { LOG.info("Unable to unregister static fields of KinesisProducer", e); } }

Target:
private void runClassLoaderReleaseHook(ClassLoader classLoader) { AwsSdkMetrics.unregisterMetricAdminMBean(); try { Class<?> fileAgeManagerClazz = Class.forName("com.amazonaws.services.kinesis.producer.FileAgeManager", true, classLoader); Field instanceField = fileAgeManagerClazz.getDeclaredField("instance"); instanceField.setAccessible(true); Object fileAgeManager = instanceField.get(null); Field executorField = fileAgeManagerClazz.getDeclaredField("executorService"); executorField.setAccessible(true); ExecutorService executorService = (ExecutorService) executorField.get(fileAgeManager); executorService.shutdown(); executorService.awaitTermination(1, TimeUnit.MINUTES); } catch (ClassNotFoundException | NoSuchFieldException | IllegalAccessException | InterruptedException e) { LOG.info("Unable to shutdown thread pool of KinesisProducer/FileAgeManager.", e); } }
Source:
public ByteBuffer encode() { int size = 0; for (DataHolder dataHolder : data) { size += dataHolder.size(true); } ByteBuffer bb = ByteBuffer.allocate(size + VLQ.encodedSize(size)); WriteBuffer writeBuffer = new WriteBuffer(bb); writeBuffer.putVlqInt(size); for (DataHolder dataHolder : data) { dataHolder.encode(writeBuffer, true); } return bb; }

Target:
public ByteBuffer encode() { int size = calculateSize(); ByteBuffer bb = ByteBuffer.allocate(size + VLQ.encodedSize(size)); return performEncoding(bb, size); }
Source:
public void directConversionToAccessorTest(ArgumentsAccessor accessor) { assertTrue(accessor.size() == 10); int sum = IntStream.range(0, 10).map(i -> accessor.getInteger(i)).sum(); assertEquals(55, sum); }

Target:
public void directConversionToAccessorTest(ArgumentsAccessor accessor) { assertEquals(10, accessor.size()); int sum = IntStream.range(0, 10).map(i -> accessor.getInteger(i)).sum(); assertEquals(55, sum); }
Source:
public static Set<SequencingParametersDto> asSequencingParametersDtos(Collection<SequencingParameters> from) { Set<SequencingParametersDto> dtoSet = Sets.newTreeSet(new Comparator<SequencingParametersDto>() { @Override public int compare(SequencingParametersDto o1, SequencingParametersDto o2) { return o1.getName().compareTo(o2.getName()); } }); for (SequencingParameters kd : from) { dtoSet.add(asDto(kd)); } return dtoSet; }

Target:
public static Set<SequencingParametersDto> asSequencingParametersDtos(Collection<SequencingParameters> from) { Set<SequencingParametersDto> dtoSet = Sets.newTreeSet(new Comparator<SequencingParametersDto>() { @Override public int compare(SequencingParametersDto o1, SequencingParametersDto o2) { return o1.getName().compareTo(o2.getName()); } }); for (SequencingParameters sp : from) { dtoSet.add(asDto(sp)); } return dtoSet; }
Source:
public static List<ReceiveCommand> filter(List<ReceiveCommand> commands, final Result want) { final List<ReceiveCommand> r = new ArrayList<ReceiveCommand>(commands .size()); for (final ReceiveCommand cmd : commands) { if (cmd.getResult() == want) r.add(cmd); } return r; }

Target:
public static List<ReceiveCommand> filter(List<ReceiveCommand> commands, final Result want) { List<ReceiveCommand> r = new ArrayList<ReceiveCommand>(commands.size()); for (final ReceiveCommand cmd : commands) { if (cmd.getResult() == want) r.add(cmd); } return r; }
Source:
public Response distributeTAs(@PathParam("courseCode") String courseCode, @PathParam("editionCode") String editionCode, @PathParam("assignmentId") long assignmentId) { CourseEdition course = courses.find(courseCode, editionCode); Assignment assignment = assignmentsDAO.find(course, assignmentId); if(!(currentUser.isAdmin() || currentUser.isAssisting(course))) { throw new UnauthorizedException(); } List<Delivery> deliveries = deliveriesDAO.getLastDeliveries(assignment); List<Group> groups = Lists.transform(deliveries, Delivery::getGroup); Set<User> TAs = course.getAssistants(); groups.removeAll(Lists.transform(assignment.getAssignedTAS(), AssignedTA::getGroup)); List<AssignedTA> assignedTAS = AssignTAs.assignGroups(TAs, groups, assignment, new Random()); assignedTAS.forEach(this.assignedTAs::persist); return Response.seeOther(assignment.getURI()).build(); }

Target:
public Response distributeTAs(@PathParam("courseCode") String courseCode, @PathParam("editionCode") String editionCode, @PathParam("assignmentId") long assignmentId) { CourseEdition course = courses.find(courseCode, editionCode); Assignment assignment = assignmentsDAO.find(course, assignmentId); if(!(currentUser.isAdmin() || currentUser.isAssisting(course))) { throw new UnauthorizedException(); } List<Delivery> deliveries = deliveriesDAO.getLastDeliveries(assignment); List<Group> groups = Lists.transform(deliveries, Delivery::getGroup); Set<User> TAs = course.getAssistants(); groups.removeAll(Lists.transform(assignment.getAssignedTAS(), AssignedTA::getGroup)); List<AssignedTA> assignedTAS = assignGroups(TAs, groups, assignment, ThreadLocalRandom.current()); assignedTAS.forEach(this.assignedTAs::persist); return Response.seeOther(assignment.getURI()).build(); }
Source:
public <T> void publish(EventScope scope, String topic, Object sender, T payload) throws UnsupportedOperationException { logger.debug("Trying to publish payload from sender using scope on event bus int topic [{}]", payload, sender, scope, this, topic); if (eventScope.equals(scope)) { publish(topic, sender, payload); } else if (parentEventBus != null) { parentEventBus.publish(scope, topic, sender, payload); } else { logger.warn("Could not publish payload with scope on event bus [{}]", scope, this); throw new UnsupportedOperationException("Could not publish event with scope " + scope); } }

Target:
public <T> void publish(EventScope scope, String topic, Object sender, T payload) throws UnsupportedOperationException { logger.debug("Trying to publish payload from sender using scope on event bus in topic [{}]", payload, sender, scope, this, topic); if (eventScope.equals(scope)) { publish(topic, sender, payload); } else if (parentEventBus != null) { parentEventBus.publish(scope, topic, sender, payload); } else { logger.warn("Could not publish payload with scope on event bus [{}]", scope, this); throw new UnsupportedOperationException("Could not publish event with scope " + scope); } }
Source:
public Multimap<ServiceId, Channel> getAllServiceIdsToChannels() { return channelMap; }

Target:
public ImmutableMultimap<ServiceId, Channel> getAllServiceIdsToChannels() { return channelMap; }
Source:
private ThreadPool threadPool(Config cfg) { int maxThreads = cfg.getInt("httpd", null, "maxthreads", 25); int minThreads = cfg.getInt("httpd", null, "minthreads", 5); int maxQueued = cfg.getInt("httpd", null, "maxqueued", 50); int idleTimeout = (int)MILLISECONDS.convert(60, SECONDS); int maxCapacity = maxQueued == 0 ? Integer.MAX_VALUE : maxQueued; QueuedThreadPool pool = new QueuedThreadPool( maxThreads, minThreads, idleTimeout, new BlockingArrayQueue<Runnable>( minThreads, minThreads, maxCapacity )); pool.setName("HTTP"); return pool; }

Target:
private ThreadPool threadPool(Config cfg) { int maxThreads = cfg.getInt("httpd", null, "maxthreads", 25); int minThreads = cfg.getInt("httpd", null, "minthreads", 5); int maxQueued = cfg.getInt("httpd", null, "maxqueued", 50); int idleTimeout = (int)MILLISECONDS.convert(60, SECONDS); int maxCapacity = maxQueued == 0 ? Integer.MAX_VALUE : Math.max(minThreads, maxQueued); QueuedThreadPool pool = new QueuedThreadPool( maxThreads, minThreads, idleTimeout, new BlockingArrayQueue<Runnable>( minThreads, minThreads, maxCapacity )); pool.setName("HTTP"); return pool; }
Source:
private void fillBucket(GlowPlayer player, GlowBlock block) { if (block.getData() != LEVEL_FULL) { return; } if (!setCauldronLevel(block, LEVEL_EMPTY, player, CauldronLevelChangeEvent.ChangeReason.BUCKET_FILL)) { return; } if (player.getGameMode() != GameMode.CREATIVE) { Map<Integer, ItemStack> dummyInventory = player.getInventory() .addItem(new ItemStack(Material.WATER_BUCKET)); if (!dummyInventory.isEmpty()) { player.getWorld() .dropItemNaturally(player.getLocation(), new ItemStack(Material.WATER_BUCKET)); } } player.getItemInHand().setAmount(player.getItemInHand().getAmount() - 1); }

Target:
private void fillBucket(GlowPlayer player, GlowBlock block) { if (block.getData() != LEVEL_FULL) { return; } if (!setCauldronLevel(block, LEVEL_EMPTY, player, CauldronLevelChangeEvent.ChangeReason.BUCKET_FILL)) { return; } if (player.getGameMode() != GameMode.CREATIVE) { if (player.getItemInHand().getAmount() == 1) { player.getItemInHand().setType(Material.WATER_BUCKET); } else { Map<Integer, ItemStack> drops = player.getInventory() .addItem(new ItemStack(Material.WATER_BUCKET)); if (!drops.isEmpty()) { player.getWorld() .dropItemNaturally(player.getLocation(), new ItemStack(Material.WATER_BUCKET)); } player.getItemInHand().setAmount(player.getItemInHand().getAmount() - 1); } } }
Source:
private void carryOntoHistoryInnerLoop(RevCommit c, int carry) { for (;;) { RevCommit[] parents = c.parents; if (parents == null || parents.length == 0) { break; } int e = parents.length - 1; for (int i = 0; i < e; i++) { RevCommit p = parents[i]; if (carryOntoOne(p, carry) == CONTINUE) { stack = new CarryStack(stack, p, carry); } } c = parents[e]; if (carryOntoOne(c, carry) == CONTINUE) { continue; } break; } }

Target:
private void carryOntoHistoryInnerLoop(RevCommit c, int carry) { for (;;) { RevCommit[] parents = c.parents; if (parents == null || parents.length == 0) { break; } int e = parents.length - 1; for (int i = 0; i < e; i++) { RevCommit p = parents[i]; if (carryOntoOne(p, carry) == CONTINUE) { stack = new CarryStack(stack, p, carry); } } c = parents[e]; if (carryOntoOne(c, carry) != CONTINUE) { break; } } }
Source:
protected Response doAction(final VdcActionType task, final VdcActionParametersBase params, final Action action, AbstractBackendResource.PollingType pollingType) { awaitGrace(action); try { VdcReturnValueBase actionResult = doAction(task, params); if (actionResult.getJobId() != null) { setJobLink(action, actionResult); } if (actionResult.getHasAsyncTasks()) { if (expectBlocking(action)) { CreationStatus status = awaitCompletion(actionResult, pollingType); return actionStatus(status, action, addLinks(newModel(id))); } else { return actionAsync(actionResult, action); } } else { return actionSuccess(action, addLinks(newModel(id))); } } catch (Exception e) { return handleError(e, action); } }

Target:
protected Response doAction(final VdcActionType task, final VdcActionParametersBase params, final Action action, AbstractBackendResource.PollingType pollingType) { awaitGrace(action); try { VdcReturnValueBase actionResult = doAction(task, params); if (action.isAsync()) { setJobLink(action, actionResult); } if (actionResult.getHasAsyncTasks()) { if (expectBlocking(action)) { CreationStatus status = awaitCompletion(actionResult, pollingType); return actionStatus(status, action, addLinks(newModel(id))); } else { return actionAsync(actionResult, action); } } else { return actionSuccess(action, addLinks(newModel(id))); } } catch (Exception e) { return handleError(e, action); } }
Source:
protected boolean canDoAction() { StorageServerConnections connection = getParameters().getStorageServerConnection(); if (connection.getstorage_type() == StorageType.NFS && !new NfsMountPointConstraint().isValid(connection.getconnection(), null)) { return failCanDoAction(VdcBllMessages.VALIDATION_STORAGE_CONNECTION_INVALID); } String connectionId = connection.getid(); oldConnection = getDbFacade().getStorageServerConnectionDao().get(connectionId); if(oldConnection == null) { return failCanDoAction(VdcBllMessages.ACTION_TYPE_FAILED_STORAGE_CONNECTION_NOT_EXIST); } return super.canDoAction(); }

Target:
protected boolean canDoAction() { StorageServerConnections newConnectionDetails = getParameters().getStorageServerConnection(); if (newConnectionDetails.getstorage_type() != StorageType.NFS) { return failCanDoAction(VdcBllMessages.ACTION_TYPE_FAILED_STORAGE_CONNECTION_UNSUPPORTED_ACTION_FOR_STORAGE); } if (newConnectionDetails.getstorage_type() == StorageType.NFS && !new NfsMountPointConstraint().isValid(newConnectionDetails.getconnection(), null)) { return failCanDoAction(VdcBllMessages.VALIDATION_STORAGE_CONNECTION_INVALID); } String connectionId = newConnectionDetails.getid(); oldConnection = getStorageConnDao().get(connectionId); if (oldConnection == null) { return failCanDoAction(VdcBllMessages.ACTION_TYPE_FAILED_STORAGE_CONNECTION_NOT_EXIST); } List<StorageServerConnections> connections = getStorageConnDao().getAllForStorage(newConnectionDetails.getconnection()); if (connections != null) { if (connections.size() > 1) { return failCanDoAction(VdcBllMessages.ACTION_TYPE_FAILED_STORAGE_CONNECTION_BELONGS_TO_SEVERAL_STORAGE_DOMAINS); } else if (connections.size() == 1 && !connections.get(0).getid().equals(oldConnection.getid())) { return failCanDoAction(VdcBllMessages.ACTION_TYPE_FAILED_STORAGE_CONNECTION_ALREADY_EXISTS); } } List<StorageDomain> domains = getStorageDomainsByConnId(newConnectionDetails.getid()); if (domains != null) { if (domains.size() != 1) { return failCanDoAction(VdcBllMessages.ACTION_TYPE_FAILED_STORAGE_CONNECTION_BELONGS_TO_SEVERAL_STORAGE_DOMAINS); } setStorageDomain(domains.get(0)); if (!isNfsPathEditable(getStorageDomain())) { return failCanDoAction(VdcBllMessages.ACTION_TYPE_FAILED_STORAGE_CONNECTION_UNSUPPORTED_ACTION_FOR_STORAGE); } } return super.canDoAction(); }
Source:
public Map<String, Statistic> provideCatalogMap() { return this.statisticMappings; }

Target:
public Map<String, Statistic> provideCatalogMap() { return Maps.newHashMap(this.statisticMappings); }
Source:
public Object getValue() { DecimalFormat format = new DecimalFormat("###0.00"); double mean = getBean().getQuantile(1); double lowerCI = getBean().getQuantile(0); double upperCI = getBean().getQuantile(2); return format.format(transformContinuous(mean)) + " (" + format.format(transformContinuous(lowerCI)) + ", " + format.format(transformContinuous(upperCI)) + ")"; }

Target:
public Object getValue() { DecimalFormat format = new DecimalFormat("###0.00"); double mean = getBean().getQuantile(getBean().indexOf(0.5)); double lowerCI = getBean().getQuantile(getBean().indexOf(0.025)); double upperCI = getBean().getQuantile(getBean().indexOf(0.975)); return format.format(transformContinuous(mean)) + " (" + format.format(transformContinuous(lowerCI)) + ", " + format.format(transformContinuous(upperCI)) + ")"; }
Source:
public void testServerDefaultsWithMinimalCaching() throws Exception { Configuration clusterConf = new HdfsConfiguration(); long originalBlockSize = DFS_BLOCK_SIZE_DEFAULT * 2; clusterConf.setLong(DFS_BLOCK_SIZE_KEY, originalBlockSize); MiniDFSCluster cluster = new MiniDFSCluster.Builder(clusterConf) .numDataNodes(0) .build(); cluster.waitActive(); FSNamesystem spyNamesystem = NameNodeAdapter.spyOnNamesystem(cluster.getNameNode()); InetSocketAddress nameNodeAddr = cluster.getNameNode().getNameNodeAddress(); try { Configuration clientConf = new HdfsConfiguration(); clientConf.setLong(DFS_CLIENT_SERVER_DEFAULTS_VALIDITY_PERIOD_MS_KEY, 0L); DFSClient dfsClient = new DFSClient(nameNodeAddr, clientConf); FsServerDefaults defaults = dfsClient.getServerDefaults(); assertEquals(originalBlockSize, defaults.getBlockSize()); long updatedDefaultBlockSize = DFS_BLOCK_SIZE_DEFAULT * 3; FsServerDefaults newDefaults = new FsServerDefaults(updatedDefaultBlockSize, defaults.getBytesPerChecksum(), defaults.getWritePacketSize(), defaults.getReplication(), defaults.getFileBufferSize(), defaults.getEncryptDataTransfer(), defaults.getTrashInterval(), defaults.getChecksumType(), defaults.getKeyProviderUri(), defaults.getDefaultStoragePolicyId()); doReturn(newDefaults).when(spyNamesystem).getServerDefaults(); GenericTestUtils.waitFor(()->{ try { FsServerDefaults currDef = dfsClient.getServerDefaults(); return (currDef.getBlockSize() == updatedDefaultBlockSize); } catch (IOException e) { return false; } }, 1, 100); } finally { cluster.shutdown(); } }

Target:
public void testServerDefaultsWithMinimalCaching() throws Exception { Configuration clusterConf = new HdfsConfiguration(); long originalBlockSize = DFS_BLOCK_SIZE_DEFAULT * 2; clusterConf.setLong(DFS_BLOCK_SIZE_KEY, originalBlockSize); MiniDFSCluster cluster = new MiniDFSCluster.Builder(clusterConf) .numDataNodes(0) .build(); cluster.waitActive(); FSNamesystem spyNamesystem = NameNodeAdapter.spyOnNamesystem(cluster.getNameNode()); InetSocketAddress nameNodeAddr = cluster.getNameNode().getNameNodeAddress(); try { Configuration clientConf = new HdfsConfiguration(); clientConf.setLong(DFS_CLIENT_SERVER_DEFAULTS_VALIDITY_PERIOD_MS_KEY, 0L); DFSClient dfsClient = new DFSClient(nameNodeAddr, clientConf); FsServerDefaults defaults = dfsClient.getServerDefaults(); assertEquals(originalBlockSize, defaults.getBlockSize()); long updatedDefaultBlockSize = DFS_BLOCK_SIZE_DEFAULT * 3; FsServerDefaults newDefaults = new FsServerDefaults(updatedDefaultBlockSize, defaults.getBytesPerChecksum(), defaults.getWritePacketSize(), defaults.getReplication(), defaults.getFileBufferSize(), defaults.getEncryptDataTransfer(), defaults.getTrashInterval(), defaults.getChecksumType(), defaults.getKeyProviderUri(), defaults.getDefaultStoragePolicyId()); doReturn(newDefaults).when(spyNamesystem).getServerDefaults(); GenericTestUtils.waitFor(()->{ try { FsServerDefaults currDef = dfsClient.getServerDefaults(); return (currDef.getBlockSize() == updatedDefaultBlockSize); } catch (IOException e) { return false; } }, 1, 3000); } finally { cluster.shutdown(); } }
Source:
private boolean isSuperAdminRole(User user) { return (user.isSuperAdmin() != null && user.isSuperAdmin()) || user.getPermissionList() .equals(Integer.toString(AppRole.SUPER_ADMIN.getLevel())); }

Target:
private boolean isSuperAdminRole(User user) { return user.isSuperAdmin() || user.getPermissionList() .equals(Integer.toString(AppRole.SUPER_ADMIN.getLevel())); }
Source:
public void removeUserExtSource(PerunSession sess, User user, UserExtSource userExtSource, boolean forceDelete) throws InternalErrorException, UserNotExistsException, UserExtSourceNotExistsException, PrivilegeException, UserExtSourceAlreadyRemovedException { Utils.checkPerunSession(sess); if(!AuthzResolver.isAuthorized(sess, Role.SELF, user)) { throw new PrivilegeException(sess, "removeUserExtSource"); } getUsersManagerBl().checkUserExists(sess, user); userExtSource.setUserId(user.getId()); getUsersManagerBl().checkUserExtSourceExists(sess, userExtSource); getUsersManagerBl().removeUserExtSource(sess, user, userExtSource); }

Target:
public void removeUserExtSource(PerunSession sess, User user, UserExtSource userExtSource, boolean forceDelete) throws InternalErrorException, UserNotExistsException, UserExtSourceNotExistsException, PrivilegeException, UserExtSourceAlreadyRemovedException { Utils.checkPerunSession(sess); if (forceDelete) { if(!AuthzResolver.isAuthorized(sess, Role.PERUNADMIN, user)) { throw new PrivilegeException(sess, "removeUserExtSource"); } getUsersManagerBl().checkUserExists(sess, user); userExtSource.setUserId(user.getId()); getUsersManagerBl().checkUserExtSourceExists(sess, userExtSource); getUsersManagerBl().removeUserExtSource(sess, user, userExtSource); } else { removeUserExtSource(sess, user, userExtSource); } }