auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public void testGetDetailAst() { final DetailAST ast = new DetailAST(); final FullIdent indent = FullIdent.createFullIdent(ast); Assert.assertEquals("Invalid full indent", ast, indent.getDetailAST()); }

Target:
public void testGetDetailAst() throws Exception { final FileText testFileText = new FileText( new File(getPath("InputFullIdentTestArrayType.java")).getAbsoluteFile(), System.getProperty("file.encoding", StandardCharsets.UTF_8.name())); final DetailAST packageDefinitionNode = JavaParser.parse(new FileContents(testFileText)); final DetailAST packageName = packageDefinitionNode.getFirstChild().getNextSibling(); final FullIdent ident = FullIdent.createFullIdent(packageName); Assert.assertEquals("Invalid full indent", "com[1x8]", ident.getDetailAst().toString()); }
Source:
public int getNumberOfMessages() { while (true) { final long size = producerIndex; if (size == RESIZING) { Thread.yield(); continue; } return (int) Math.min(size, Integer.MAX_VALUE); } }

Target:
public int getNumberOfMessages() { return messages.size(); }
Source:
public AdWebViewHolder(View itemView) { super(itemView); ButterKnife.bind(this, itemView); WebSettings webSettings = webView.getSettings(); webSettings.setJavaScriptEnabled(true); txtSponsored.setVisibility(View.VISIBLE); this.clickUrl = null; }

Target:
public AdWebViewHolder(View itemView) { super(itemView); ButterKnife.bind(this, itemView); webView.getSettings().setJavaScriptEnabled(true); txtSponsored.setVisibility(View.VISIBLE); this.clickUrl = null; }
Source:
public void configure(HttpSecurity http) throws Exception { log.debug("Smart Cosmos Security enabled, all requests must be authorized and no login redirect is offered."); http .exceptionHandling() .accessDeniedHandler(new DirectAccessDeniedHandler()) .authenticationEntryPoint(new DirectUnauthorizedEntryPoint("/login")) .and() .antMatcher("/**").authorizeRequests() .anyRequest().authenticated() .and() .anonymous() .key(SmartCosmosAnonymousUser.ANONYMOUS_AUTHENTICATION_KEY) .principal(SmartCosmosAnonymousUser.ANONYMOUS_USER); }

Target:
public void configure(HttpSecurity http) throws Exception { log.debug("Smart Cosmos Security enabled, all requests must be authorized and no login redirect is offered."); http .exceptionHandling() .accessDeniedHandler(new DirectAccessDeniedHandler()) .authenticationEntryPoint(new DirectUnauthorizedEntryPoint("/login")) .and() .antMatcher("/**").authorizeRequests() .anyRequest().authenticated() .and() .anonymous() .key(SmartCosmosUser.ANONYMOUS_AUTHENTICATION_KEY) .principal(SmartCosmosUser.ANONYMOUS_USER); }
Source:
public void testDepositSwitchCreateSuccess() throws Exception { HashMap<String, String> userAuth = new HashMap<>(); userAuth.put("user_id", "user_good"); userAuth.put("auth_token", "pass_good"); Response<ItemImportResponse> itemImportResponse = client().service() .itemImport(new ItemImportRequest(Arrays.asList("identity", "auth"), userAuth) .withWebhook("<LINK_0>")) .execute(); assertSuccessResponse(itemImportResponse); assertNotNull(itemImportResponse.body().getAccessToken()); String accessToken = itemImportResponse.body().getAccessToken(); Response<AccountsGetResponse> accountsGetResponse = client().service() .accountsGet(new AccountsGetRequest(accessToken)).execute(); assertSuccessResponse(accountsGetResponse); assertNotNull(accountsGetResponse.body().getAccounts()); String accountId = accountsGetResponse.body().getAccounts().get(0).getAccountId(); Response<DepositSwitchCreateResponse> depositSwitchCreateResponse = client().service() .depositSwitchCreate(new DepositSwitchCreateRequest(accountId, accessToken)).execute(); assertSuccessResponse(depositSwitchCreateResponse); assertNotNull(depositSwitchCreateResponse.body().getDepositSwitchId()); }

Target:
public void testDepositSwitchCreateSuccess() throws Exception { HashMap<String, String> userAuth = new HashMap<>(); userAuth.put("user_id", "user_good"); userAuth.put("auth_token", "pass_good"); Response<ItemImportResponse> itemImportResponse = client().service() .itemImport(new ItemImportRequest(Arrays.asList("identity", "auth"), userAuth) .withWebhook("<LINK_0>")) .execute(); assertSuccessResponse(itemImportResponse); assertNotNull(itemImportResponse.body().getAccessToken()); String accessToken = itemImportResponse.body().getAccessToken(); Response<AccountsGetResponse> accountsGetResponse = client().service() .accountsGet(new AccountsGetRequest(accessToken)).execute(); assertSuccessResponse(accountsGetResponse); assertNotNull(accountsGetResponse.body().getAccounts()); List<Account> accounts = accountsGetResponse.body().getAccounts(); String accountId = ""; for (int i = 0; i < accounts.size(); i++) { if (accounts.get(i).getType().equals("depository")) { accountId = accounts.get(i).getAccountId(); break; } } Response<DepositSwitchCreateResponse> depositSwitchCreateResponse = client().service() .depositSwitchCreate(new DepositSwitchCreateRequest(accountId, accessToken)).execute(); assertSuccessResponse(depositSwitchCreateResponse); assertNotNull(depositSwitchCreateResponse.body().getDepositSwitchId()); }
Source:
protected Class<?> loadClass(final String name, final boolean resolve) throws ClassNotFoundException { Class<?> c = findLoadedClass(name); if (c == null) { if (c == null) { try { c = findClass(name); } catch (final ClassNotFoundException e) { c = super.loadClass(name, resolve); } } } if (resolve) { resolveClass(c); } return c; }

Target:
protected Class<?> loadClass(final String name, final boolean resolve) throws ClassNotFoundException { Class<?> c = findLoadedClass(name); if (c == null) { try { c = findClass(name); } catch (final ClassNotFoundException e) { c = super.loadClass(name, resolve); } } if (resolve) { resolveClass(c); } return c; }
Source:
public void prepare() { configureServices(); logger.debug("Preparing kjar"); KieServices ks = KieServices.Factory.get(); ReleaseId releaseId = ks.newReleaseId(GROUP_ID, ARTIFACT_ID, VERSION); List<String> processes = new ArrayList<String>(); processes.add("repo/processes/general/BPMN2-SimpleRestartTest.bpmn2"); processes.add("repo/processes/general/BPMN2-SimpleRestartWithTimerTest.bpmn2"); processes.add("repo/processes/general/BPMN2-SimpleRestartWithObsoleteTest.bpmn2"); InternalKieModule kJar1 = createKieJar(ks, releaseId, processes); File pom = new File("target/kmodule", "pom.xml"); pom.getParentFile().mkdir(); try { FileOutputStream fs = new FileOutputStream(pom); fs.write(getPom(releaseId).getBytes()); fs.close(); } catch (Exception e) { } KieMavenRepository repository = getKieMavenRepository(); repository.deployArtifact(releaseId, kJar1, pom); ReleaseId releaseId3 = ks.newReleaseId(GROUP_ID, ARTIFACT_ID, "1.1.0"); InternalKieModule kJar3 = createKieJar(ks, releaseId3, processes); File pom3 = new File("target/kmodule3", "pom.xml"); pom3.getParentFile().mkdirs(); try { FileOutputStream fs = new FileOutputStream(pom3); fs.write(getPom(releaseId3).getBytes()); fs.close(); } catch (Exception e) { } repository = getKieMavenRepository(); repository.deployArtifact(releaseId3, kJar3, pom3); }

Target:
public void prepare() { configureServices(); logger.debug("Preparing kjar"); KieServices ks = KieServices.Factory.get(); ReleaseId releaseId = ks.newReleaseId(GROUP_ID, ARTIFACT_ID, VERSION); List<String> processes = new ArrayList<String>(); processes.add("repo/processes/general/BPMN2-SimpleRestartTest.bpmn2"); processes.add("repo/processes/general/BPMN2-SimpleRestartWithTimerTest.bpmn2"); processes.add("repo/processes/general/BPMN2-SimpleRestartWithObsoleteTest.bpmn2"); InternalKieModule kJar1 = createKieJar(ks, releaseId, processes); File pom = new File("target/kmodule", "pom.xml"); pom.getParentFile().mkdir(); try { FileOutputStream fs = new FileOutputStream(pom); fs.write(getPom(releaseId).getBytes()); fs.close(); } catch (Exception e) { } KieMavenRepository repository = getKieMavenRepository(); repository.deployArtifact(releaseId, kJar1, pom); ReleaseId releaseId2 = ks.newReleaseId(GROUP_ID, ARTIFACT_ID, "1.1.0"); InternalKieModule kJar2 = createKieJar(ks, releaseId2, processes); File pom2 = new File("target/kmodule2", "pom.xml"); pom2.getParentFile().mkdirs(); try { FileOutputStream fs = new FileOutputStream(pom2); fs.write(getPom(releaseId2).getBytes()); fs.close(); } catch (Exception e) { } repository = getKieMavenRepository(); repository.deployArtifact(releaseId2, kJar2, pom2); }
Source:
public HistoricJobLogQuery hostname(String hostname) { ensureNotNull("hostName", hostname); ensureNotContainsEmptyString("hostName", Collections.singletonList(hostname)); this.hostname = hostname; return this; }

Target:
public HistoricJobLogQuery hostname(String hostname) { ensureNotEmpty("hostName", hostname); this.hostname = hostname; return this; }
Source:
public void detach(Attachable service) { if (ServoController.class.isAssignableFrom(service.getClass())) { detachServoController((ServoController) service); return; } error("%s doesn't know how to attach a %s", getClass().getSimpleName(), service.getClass().getSimpleName()); }

Target:
public void detach(Attachable service) { if (!isAttached(controller)) { return; } if (ServoController.class.isAssignableFrom(service.getClass())) { disable(); if (controller != null) { ServoController temp = controller; controller = null; controllerName = null; temp.detach(this); } broadcastState(); } else { error("%s doesn't know how to detach a %s", getClass().getSimpleName(), service.getClass().getSimpleName()); } }
Source:
private void resetRoles(Role role) { try { PermissionCollector permissionCollector = (PermissionCollector) findByClass(PermissionCollector.class); if (permissionCollector != null) { permissionCollector.resetRoles(role); } } catch (Exception e) { e.printStackTrace(); } }

Target:
private void resetRoles(Role role) { try { PermissionCollector permissionCollector = (PermissionCollector) findByClass(PermissionCollector.class); if (permissionCollector != null) { permissionCollector.resetRoles(role); } } catch (Exception e) { Logger.getLogger(getClass().getName()).log(Level.SEVERE, String.format("Reset permissions of role %s failed", role.name()), e); } }
Source:
public void handleEvent(ITmfStateSystemBuilder ss, ITmfEvent event) throws AttributeNotFoundException { ITmfEventField content = event.getContent(); Integer cpuId = content.getFieldValue(Integer.class, CPU_ID_FIELD); Long cpuState = content.getFieldValue(Long.class, CPU_STATE); long timestamp = KernelEventHandlerUtils.getTimestamp(event); if (cpuId == null || cpuState == null) { return; } final int cpuQuark = KernelEventHandlerUtils.getCurrentCPUNode(cpuId, ss); int quark = ss.getQuarkRelativeAndAdd(cpuQuark, Attributes.CURRENT_FREQUENCY); ss.modifyAttribute(timestamp, cpuState, quark); quark = ss.getQuarkRelativeAndAdd(cpuQuark, Attributes.MIN_FREQUENCY); Object currentValue = ss.queryOngoing(quark); Long minVal = (!(currentValue instanceof Long)) ? cpuState : Long.min(cpuState, (Long) currentValue); ss.updateOngoingState(minVal, quark); quark = ss.getQuarkRelativeAndAdd(cpuQuark, Attributes.MAX_FREQUENCY); currentValue = ss.queryOngoing(quark); Long maxVal = (!(currentValue instanceof Long)) ? cpuState : Long.max(cpuState, (Long) currentValue); ss.updateOngoingState(maxVal, quark); }

Target:
public void handleEvent(ITmfStateSystemBuilder ss, ITmfEvent event) throws AttributeNotFoundException { ITmfEventField content = event.getContent(); Integer cpuId = content.getFieldValue(Integer.class, CPU_ID_FIELD); Long cpuState = content.getFieldValue(Long.class, CPU_STATE); long timestamp = KernelEventHandlerUtils.getTimestamp(event); if (cpuId == null || cpuState == null) { return; } cpuState *= FREQUENCY_MULTIPLIER; final int cpuQuark = KernelEventHandlerUtils.getCurrentCPUNode(cpuId, ss); int quark = ss.getQuarkRelativeAndAdd(cpuQuark, Attributes.CURRENT_FREQUENCY); ss.modifyAttribute(timestamp, cpuState, quark); quark = ss.getQuarkRelativeAndAdd(cpuQuark, Attributes.MIN_FREQUENCY); Object currentValue = ss.queryOngoing(quark); Long minVal = (!(currentValue instanceof Long)) ? cpuState : Long.min(cpuState, (Long) currentValue); ss.updateOngoingState(minVal, quark); quark = ss.getQuarkRelativeAndAdd(cpuQuark, Attributes.MAX_FREQUENCY); currentValue = ss.queryOngoing(quark); Long maxVal = (!(currentValue instanceof Long)) ? cpuState : Long.max(cpuState, (Long) currentValue); ss.updateOngoingState(maxVal, quark); }
Source:
public final T doCheckValid(RuleComponentModel data) { Map<String, ParameterModel> params = data.getParameters(); for (Map.Entry<String, ParameterDefinition> entry : this.getParameterDefinitions().entrySet()) { try{ entry.getValue().checkValid(params.get(entry.getKey())); }catch(InvalidConditionParameterException e){ throw e; } } T instance; try { instance = instanceFrom(params); } catch (RuleEngineException e) { throw e; } catch (Exception e) { throw new RuleConstructionFailedException(e, "Could not create Component Instance of type %s from provided model %s.", this.getId(), data.toString()); } return instance; }

Target:
public final T doCheckValid(RuleComponentModel data) { Map<String, ParameterModel> params = data.getParameters(); for (Map.Entry<String, ParameterDefinition> entry : this.getParameterDefinitions().entrySet()) { entry.getValue().checkValid(params.get(entry.getKey())); } T instance; try { instance = instanceFrom(params); } catch (RuleEngineException e) { throw e; } catch (Exception e) { throw new RuleConstructionFailedException(e, "Could not create Component Instance of type %s from provided model %s.", this.getId(), data.toString()); } return instance; }
Source:
private String readPid() throws IOException { @SuppressWarnings("DMI_HARDCODED_ABSOLUTE_FILENAME") Path pidFile = Paths.get(PID_FILE); return (new String(Files.readAllBytes(pidFile))).trim(); }

Target:
private String readPid() throws IOException { Path pidFile = Paths.get(PID_FILE); return (new String(Files.readAllBytes(pidFile))).trim(); }
Source:
public void setAggregators(List<MetricAggregatorProvider> aggregators) { for (MetricAggregatorProvider map : aggregators) { aggregatorsWithSettings.add(new MetricAggregatorProviderWithSettings(map)); } }

Target:
public void setAggregators(List<MetricAggregatorProvider> aggregators) { for (MetricAggregatorProvider aggregator : aggregators) { settingsMap.put(aggregator, MetricAggregatorSettings.EMPTY_SETTINGS); } }
Source:
private int addToDictionary(final String s) { int idx = reverseDictionary.getInt(s); if (idx == UNKNOWN_DICTIONARY_KEY) { final long additionalEstimatedSize = estimateStringKeySize(s); if (currentEstimatedSize + additionalEstimatedSize > maxDictionarySize) { return -1; } idx = dictionary.size(); reverseDictionary.put(s, idx); dictionary.add(s); currentEstimatedSize += additionalEstimatedSize; } return idx; }

Target:
private int addToDictionary(final String s) { int idx = reverseDictionary.getInt(s); if (idx == UNKNOWN_DICTIONARY_ID) { final long additionalEstimatedSize = estimateStringKeySize(s); if (currentEstimatedSize + additionalEstimatedSize > maxDictionarySize) { return -1; } idx = dictionary.size(); reverseDictionary.put(s, idx); dictionary.add(s); currentEstimatedSize += additionalEstimatedSize; } return idx; }
Source:
protected boolean canDoAction() { if (!validate(new StoragePoolValidator(getStoragePool()).isUp())) { return false; } if (getDiskImage() == null) { return failCanDoAction(VdcBllMessages.ACTION_TYPE_FAILED_DISK_NOT_EXIST); } if (!getDiskImage().getParentId().equals(Guid.Empty)) { return failCanDoAction(VdcBllMessages.ACTION_TYPE_FAILED_DISK_CONFIGURATION_NOT_SUPPORTED); } for (VM vm : getVmDAO().getVmsListForDisk(getDiskImage().getId())) { if (vm.isRunningOrPaused()) { return failCanDoAction(VdcBllMessages.ACTION_TYPE_FAILED_VM_IS_RUNNING); } } return true; }

Target:
protected boolean canDoAction() { if (getDiskImage() == null) { return failCanDoAction(VdcBllMessages.ACTION_TYPE_FAILED_DISK_NOT_EXIST); } if (!validate(new StoragePoolValidator(getStoragePool()).isUp())) { return false; } if (!getDiskImage().getParentId().equals(Guid.Empty)) { return failCanDoAction(VdcBllMessages.ACTION_TYPE_FAILED_DISK_CONFIGURATION_NOT_SUPPORTED); } for (VM vm : getVmDAO().getVmsListForDisk(getDiskImage().getId())) { if (vm.getStatus() != VMStatus.Down) { return failCanDoAction(VdcBllMessages.ACTION_TYPE_FAILED_VM_IS_RUNNING); } } return true; }
Source:
public static List<ElementTag> getNationalitiesAsElementTags(String existingNationality) { List<String> nationalities = NationalityHelper.getNationalities(); ArrayList<ElementTag> result = new ArrayList<ElementTag>(); boolean isEditingExistingNationality = existingNationality != null; for (String nationality : nationalities) { ElementTag option = createOption(nationality, nationality, isEditingExistingNationality && nationality.equals(existingNationality)); result.add(option); } return result; }

Target:
public static List<ElementTag> getNationalitiesAsElementTags(String existingNationality) { List<String> nationalities = NationalityHelper.getNationalities(); List<ElementTag> result = new ArrayList<ElementTag>(); result.add(createOption("--- Select ---", "", !nationalities.contains(existingNationality))); for (String nationality : nationalities) { ElementTag option = createOption(nationality, nationality, nationality.equals(existingNationality)); result.add(option); } return result; }
Source:
protected ExecutionStrategy() { super(); dataFetcherExceptionHandler = params -> handleDataFetchingException( params.getExecutionContext(), params.getFieldDefinition(), params.getArgumentValues(), params.getPath(), params.getException() ); }

Target:
protected ExecutionStrategy() { dataFetcherExceptionHandler = params -> handleDataFetchingException( params.getExecutionContext(), params.getFieldDefinition(), params.getArgumentValues(), params.getPath(), params.getException() ); }
Source:
public static boolean existsTable(final String dbFileAbsolutePath, final RelationKey relationKey) throws IOException, SQLiteException { boolean exists = false; SQLiteConnection sqliteConnection = null; SQLiteStatement statement = null; try { final File f = new File(dbFileAbsolutePath); if (!f.getParentFile().exists()) { f.getParentFile().mkdirs(); } sqliteConnection = new SQLiteConnection(f); sqliteConnection.open(true); statement = sqliteConnection.prepare("SELECT * FROM sqlite_master WHERE type='table' AND name=" + relationKey.toString(MyriaConstants.STORAGE_SYSTEM_SQLITE)); if (statement.step()) { return true; } } finally { if (statement != null) { statement.dispose(); } if (sqliteConnection != null) { sqliteConnection.dispose(); } } return exists; }

Target:
public static boolean existsTable(final String dbFileAbsolutePath, final RelationKey relationKey) throws IOException, SQLiteException { boolean exists = false; SQLiteConnection sqliteConnection = null; SQLiteStatement statement = null; try { final File f = new File(dbFileAbsolutePath); if (!f.getParentFile().exists()) { f.getParentFile().mkdirs(); } sqliteConnection = new SQLiteConnection(f); sqliteConnection.open(true); statement = sqliteConnection.prepare("SELECT * FROM sqlite_master WHERE type='table' AND name=?"); statement.bind(1, relationKey.toString()); if (statement.step()) { return true; } } finally { if (statement != null) { statement.dispose(); } if (sqliteConnection != null) { sqliteConnection.dispose(); } } return exists; }
Source:
public void save() { for (int i = 0; i < size; i++) { cfg.setValue(PlayerBackpack.backpacks + id + ".contents." + i, inventory.getItem(i)); } }

Target:
public void save() { for (int i = 0; i < size; i++) { cfg.setValue(CONFIG_PREFIX + id + ".contents." + i, inventory.getItem(i)); } }
Source:
private <V> Map<Long, V> executeLocalOperation(final RangeKeyOperation<Long, V> operation, final Map<Integer, List<Pair<Long, Long>>> blockToSubKeyRangesMap) { if (blockToSubKeyRangesMap.isEmpty()) { return Collections.emptyMap(); } final Map<Long, V> outputData; final Iterator<Map.Entry<Integer, List<Pair<Long, Long>>>> blockToSubKeyRangesIterator = blockToSubKeyRangesMap.entrySet().iterator(); if (blockToSubKeyRangesIterator.hasNext()) { final Map.Entry<Integer, List<Pair<Long, Long>>> blockToSubKeyRanges = blockToSubKeyRangesIterator.next(); final int blockId = blockToSubKeyRanges.getKey(); final Lock readLock = router.resolveEvalWithLock(blockId).getValue(); try { final Block<V> block = blocks.get(blockId); final List<Pair<Long, Long>> subKeyRanges = blockToSubKeyRanges.getValue(); outputData = block.executeSubOperation(operation, subKeyRanges); } finally { readLock.unlock(); } } else { return Collections.emptyMap(); } while (blockToSubKeyRangesIterator.hasNext()) { final Map<Long, V> partialOutput; final Map.Entry<Integer, List<Pair<Long, Long>>> blockToSubKeyRanges = blockToSubKeyRangesIterator.next(); final int blockId = blockToSubKeyRanges.getKey(); final Lock readLock = router.resolveEvalWithLock(blockId).getValue(); try { final Block<V> block = blocks.get(blockId); final List<Pair<Long, Long>> subKeyRanges = blockToSubKeyRanges.getValue(); partialOutput = block.executeSubOperation(operation, subKeyRanges); } finally { readLock.unlock(); } outputData.putAll(partialOutput); } return outputData; }

Target:
private <V> Map<Long, V> executeLocalOperation(final RangeKeyOperation<Long, V> operation, final Map<Integer, List<Pair<Long, Long>>> blockToSubKeyRangesMap) { if (blockToSubKeyRangesMap.isEmpty()) { return Collections.emptyMap(); } final Map<Long, V> outputData; final Iterator<Map.Entry<Integer, List<Pair<Long, Long>>>> blockToSubKeyRangesIterator = blockToSubKeyRangesMap.entrySet().iterator(); if (blockToSubKeyRangesIterator.hasNext()) { final Map.Entry<Integer, List<Pair<Long, Long>>> blockToSubKeyRanges = blockToSubKeyRangesIterator.next(); final int blockId = blockToSubKeyRanges.getKey(); final List<Pair<Long, Long>> subKeyRanges = blockToSubKeyRanges.getValue(); outputData = executeLocalSubOperation(operation, blockId, subKeyRanges); } else { return Collections.emptyMap(); } while (blockToSubKeyRangesIterator.hasNext()) { final Map<Long, V> partialOutput; final Map.Entry<Integer, List<Pair<Long, Long>>> blockToSubKeyRanges = blockToSubKeyRangesIterator.next(); final int blockId = blockToSubKeyRanges.getKey(); final List<Pair<Long, Long>> subKeyRanges = blockToSubKeyRanges.getValue(); partialOutput = executeLocalSubOperation(operation, blockId, subKeyRanges); outputData.putAll(partialOutput); } return outputData; }
Source:
protected List<RefNode> getRefNodes(RevCommit commit, Repository repo, String... refPrefixes) { List<Ref> availableBranches = new ArrayList<Ref>(); List<RefNode> nodes = new ArrayList<RefNode>(); try { Map<String, Ref> branches = new HashMap<String, Ref>(); for (String refPrefix : refPrefixes) { branches.putAll(repo.getRefDatabase().getRefs(refPrefix)); } for (Ref branch : branches.values()) { if (branch.getLeaf().getObjectId().equals(commit.getId())) availableBranches.add(branch); } RepositoryNode repoNode = new RepositoryNode(null, repo); for (Ref ref : availableBranches) nodes.add(new RefNode(repoNode, repo, ref)); } catch (IOException e) { } return nodes; }

Target:
protected List<RefNode> getRefNodes(RevCommit commit, Repository repo, String... refPrefixes) { List<Ref> availableBranches = new ArrayList<Ref>(); List<RefNode> nodes = new ArrayList<RefNode>(); try { Map<String, Ref> branches = new HashMap<String, Ref>(); for (String refPrefix : refPrefixes) branches.putAll(repo.getRefDatabase().getRefs(refPrefix)); for (Ref branch : branches.values()) { if (branch.getLeaf().getObjectId().equals(commit.getId())) availableBranches.add(branch); } RepositoryNode repoNode = new RepositoryNode(null, repo); for (Ref ref : availableBranches) nodes.add(new RefNode(repoNode, repo, ref)); } catch (IOException e) { } return nodes; }
Source:
public List<DocumentReference> loadBacklinks(DocumentReference documentReference, boolean bTransaction, XWikiContext inputxcontext) throws XWikiException { XWikiContext context = getExecutionXContext(inputxcontext, true); Set<DocumentReference> backlinkReferences = new HashSet<DocumentReference>(); try { if (bTransaction) { checkHibernate(context); bTransaction = beginTransaction(false, context); } Session session = getSession(context); Query query = session .createQuery("select backlink.fullName from XWikiLink as backlink where backlink.id.link = :backlink" + " or backlink.id.link = :backlinkwithwiki"); query.setString("backlink", this.localEntityReferenceSerializer.serialize(documentReference)); query.setString("backlinkwithwiki", this.defaultEntityReferenceSerializer.serialize(documentReference)); @SuppressWarnings("unchecked") List<String> backlinkNames = query.list(); for (String backlinkName : backlinkNames) { backlinkReferences.add(this.currentMixedDocumentReferenceResolver.resolve(backlinkName)); } if (bTransaction) { endTransaction(context, false, false); } } catch (Exception e) { throw new XWikiException(XWikiException.MODULE_XWIKI_STORE, XWikiException.ERROR_XWIKI_STORE_HIBERNATE_LOADING_BACKLINKS, "Exception while loading backlinks", e); } finally { try { if (bTransaction) { endTransaction(context, false, false); } } catch (Exception e) { } restoreExecutionXContext(); } return new ArrayList<DocumentReference>(backlinkReferences); }

Target:
public List<DocumentReference> loadBacklinks(DocumentReference documentReference, boolean bTransaction, XWikiContext inputxcontext) throws XWikiException { XWikiContext context = getExecutionXContext(inputxcontext, true); Set<DocumentReference> backlinkReferences = new HashSet<DocumentReference>(); try { if (bTransaction) { checkHibernate(context); bTransaction = beginTransaction(false, context); } Session session = getSession(context); Query query = session .createQuery("select backlink.fullName from XWikiLink as backlink where backlink.id.link = :backlink"); query.setString("backlink", this.compactWikiEntityReferenceSerializer.serialize(documentReference)); @SuppressWarnings("unchecked") List<String> backlinkNames = query.list(); for (String backlinkName : backlinkNames) { DocumentReference backlinkreference = this.currentMixedDocumentReferenceResolver.resolve(backlinkName); backlinkReferences.add(backlinkreference); } } catch (Exception e) { throw new XWikiException(XWikiException.MODULE_XWIKI_STORE, XWikiException.ERROR_XWIKI_STORE_HIBERNATE_LOADING_BACKLINKS, "Exception while loading backlinks", e); } finally { try { if (bTransaction) { endTransaction(context, false, false); } } catch (Exception e) { } restoreExecutionXContext(); } return new ArrayList<DocumentReference>(backlinkReferences); }
Source:
public void setInitJobContent(String jobContent) { try { this.jobContentAsByteArray = ByteCompressionUtils.compress(jobContent.getBytes()); } catch (Exception e) { LOGGER.error(e.getMessage(), e); this.jobContentAsByteArray = null; } }

Target:
public void setInitJobContent(String jobContent) { try { this.jobContentAsByteArray = ByteCompressionUtils.compress(jobContent.getBytes()); } catch (Exception e) { LOGGER.error(e.getMessage(), e); this.jobContentAsByteArray = new byte[0]; } }
Source:
private void addLocalScopes(APIIdentifier apiIdentifier, int tenantId, Set<URITemplate> uriTemplates) throws APIManagementException { String tenantDomain = APIUtil.getTenantDomainFromTenantId(tenantId); Map<String, KeyManagerDto> tenantKeyManagers = KeyManagerHolder.getTenantKeyManagers(tenantDomain); Set<Scope> scopesToRegister = getScopesToRegisterFromURITemplates(apiIdentifier, tenantId, uriTemplates); scopesDAO.addScopes(scopesToRegister, tenantId); for (Scope scope : scopesToRegister) { for (Map.Entry<String, KeyManagerDto> keyManagerDtoEntry : tenantKeyManagers.entrySet()) { KeyManager keyManager = keyManagerDtoEntry.getValue().getKeyManager(); if (keyManager != null) { String scopeKey = scope.getKey(); try{ if (!keyManager.isScopeExists(scopeKey)) { keyManager.registerScope(scope); } else { if (log.isDebugEnabled()) { log.debug("Scope: " + scopeKey + " already registered in KM. Skipping registering scope."); } } }catch (APIManagementException e){ log.error("Error while registering Scope " + scopeKey + "in KeyManager " + keyManagerDtoEntry.getKey(), e); } } } } }

Target:
private void addLocalScopes(APIIdentifier apiIdentifier, int tenantId, Set<URITemplate> uriTemplates) throws APIManagementException { String tenantDomain = APIUtil.getTenantDomainFromTenantId(tenantId); Map<String, KeyManagerDto> tenantKeyManagers = KeyManagerHolder.getTenantKeyManagers(tenantDomain); Set<Scope> scopesToRegister = getScopesToRegisterFromURITemplates(apiIdentifier, tenantId, uriTemplates); for (Scope scope : scopesToRegister) { for (Map.Entry<String, KeyManagerDto> keyManagerDtoEntry : tenantKeyManagers.entrySet()) { KeyManager keyManager = keyManagerDtoEntry.getValue().getKeyManager(); if (keyManager != null) { String scopeKey = scope.getKey(); try { if (!keyManager.isScopeExists(scopeKey)) { keyManager.registerScope(scope); } else { if (log.isDebugEnabled()) { log.debug("Scope: " + scopeKey + " already registered in KM. Skipping registering scope."); } } } catch (APIManagementException e) { log.error("Error while registering Scope " + scopeKey + "in Key Manager " + keyManagerDtoEntry.getKey(), e); } } } } addScopes(scopesToRegister, tenantId); }
Source:
public static GridSqlQuery selectForInsertOrMerge(GridSqlColumn[] cols, List<GridSqlElement[]> rows, GridSqlQuery subQry, GridH2RowDescriptor desc) { if (!F.isEmpty(rows)) { assert !F.isEmpty(cols); GridSqlSelect sel = new GridSqlSelect(); GridSqlFunction from = new GridSqlFunction(GridSqlFunctionType.TABLE); sel.from(from); GridSqlArray[] args = new GridSqlArray[cols.length]; for (int i = 0; i < cols.length; i++) { GridSqlArray arr = new GridSqlArray(rows.size()); String colName = cols[i].columnName(); GridSqlAlias alias = new GridSqlAlias(colName, arr); alias.resultType(cols[i].resultType()); from.addChild(alias); args[i] = arr; GridSqlColumn newCol = new GridSqlColumn(null, from, null,"TABLE", colName); newCol.resultType(cols[i].resultType()); sel.addColumn(newCol, true); } for (GridSqlElement[] row : rows) { assert cols.length == row.length; for (int i = 0; i < row.length; i++) args[i].addChild(row[i]); } sel.getSQL(); return sel; } else { assert subQry != null; return subQry; } }

Target:
public static GridSqlQuery selectForInsertOrMerge(GridSqlColumn[] cols, List<GridSqlElement[]> rows, GridSqlQuery subQry, GridH2RowDescriptor desc) { if (!F.isEmpty(rows)) { assert !F.isEmpty(cols); GridSqlSelect sel = new GridSqlSelect(); GridSqlFunction from = new GridSqlFunction(GridSqlFunctionType.TABLE); sel.from(from); GridSqlArray[] args = new GridSqlArray[cols.length]; for (int i = 0; i < cols.length; i++) { GridSqlArray arr = new GridSqlArray(rows.size()); String colName = cols[i].columnName(); GridSqlAlias alias = new GridSqlAlias(colName, arr); alias.resultType(cols[i].resultType()); from.addChild(alias); args[i] = arr; GridSqlColumn newCol = new GridSqlColumn(null, from, null,"TABLE", colName); newCol.resultType(cols[i].resultType()); sel.addColumn(newCol, true); } for (GridSqlElement[] row : rows) { assert cols.length == row.length; for (int i = 0; i < row.length; i++) args[i].addChild(row[i]); } return sel; } else { assert subQry != null; return subQry; } }
Source:
public static JsonNode readJsonNodeFromResource(final String resourcePath) throws IOException { final ObjectMapper mapper = new ObjectMapper(); try(final InputStream resourceAsStream = Thread.currentThread().getContextClassLoader().getResourceAsStream(resourcePath)) { return mapper.readTree(new InputStreamReader(resourceAsStream, StandardCharsets.UTF_8.name())); } }

Target:
public static JsonNode readJsonNodeFromResource(final String resourcePath) throws IOException { try(final InputStream resourceAsStream = Thread.currentThread().getContextClassLoader().getResourceAsStream(resourcePath)) { return MAPPER.readTree(new InputStreamReader(resourceAsStream, StandardCharsets.UTF_8.name())); } }
Source:
public String execute() throws Exception { ActionContext nestedContext = ActionContext.getContext(); ActionContext.bound(invocation.getInvocationContext()); String retCode = null; try { retCode = invocation.invoke(); } finally { if (cleanupContext) { ActionContext.bound(nestedContext); } } return retCode; }

Target:
public String execute() throws Exception { ActionContext nestedContext = ActionContext.getContext(); ActionContext.bind(invocation.getInvocationContext()); String retCode = null; try { retCode = invocation.invoke(); } finally { if (cleanupContext) { ActionContext.bind(nestedContext); } } return retCode; }
Source:
private List<Unit> addMustMoveWith( final List<Unit> best, final Map<Unit, Collection<Unit>> dependentUnits) { final MustMoveWithDetails mustMoveWithDetails = MoveValidator.getMustMoveWith( route.getStart(), route.getStart().getUnits(), dependentUnits, data, player); final List<Unit> bestWithDependents = new ArrayList<>(best); for (final Unit u : best) { if (mustMoveWithDetails.getMustMoveWith().containsKey(u)) { final Collection<Unit> mustMoveWith = mustMoveWithDetails.getMustMoveWith().get(u); if (mustMoveWith != null) { for (final Unit m : mustMoveWith) { if (!bestWithDependents.contains(m)) { bestWithDependents.addAll(mustMoveWith); } } } } } return bestWithDependents; }

Target:
private List<Unit> addMustMoveWith( final List<Unit> best, final Map<Unit, Collection<Unit>> dependentUnits) { final MustMoveWithDetails mustMoveWithDetails = MoveValidator.getMustMoveWith(route.getStart(), dependentUnits, player); final List<Unit> bestWithDependents = new ArrayList<>(best); for (final Unit u : best) { final Collection<Unit> mustMoveWith = mustMoveWithDetails.getMustMoveWithForUnit(u); for (final Unit m : mustMoveWith) { if (!bestWithDependents.contains(m)) { bestWithDependents.addAll(mustMoveWith); } } } return bestWithDependents; }
Source:
public String getRawSignature() { List<Type> inputTypes = new ArrayList<>(); TypeTuple typeTuple = getInputTypes(); for (int i = 0; i < typeTuple.size(); i++) { if (i == 0 && this.isStatic()) { continue; } Type type = typeTuple.get(i); if (type.isGeneric()) { type = type.getRawtype(); } inputTypes.add(type); } String methodName = declaringType.getRawtype().toString() + (this.isMethodCall() ? "." + super.getName() : ""); return methodName + "(" + UtilMDE.join(inputTypes, ",") + ")"; }

Target:
public RawSignature getRawSignature() { if (!this.isConstructorCall() && !this.isMethodCall()) { return null; } if (rawSignature == null) { Package classPackage = this.declaringType.getPackage(); String packageName = (classPackage != null) ? classPackage.getName() : ""; String classname = this.getDeclaringType().getRawtype().getUnqualifiedName(); String name = this.getUnqualifiedName().equals("<init>") ? classname : this.getUnqualifiedName(); Class<?>[] parameterTypes = this.isMethodCall() ? ((MethodCall) getOperation()).getMethod().getParameterTypes() : ((ConstructorCall) getOperation()).getConstructor().getParameterTypes(); rawSignature = new RawSignature(packageName, classname, name, parameterTypes); } return rawSignature; }
Source:
public void requestPhoneSignIn() { study.setShortName("AppName"); String cacheKey = TestConstants.PHONE.getNumber() + ":api:phoneSignInRequest"; when(accountDao.getAccount(SIGN_IN_WITH_PHONE.getAccountId())).thenReturn(account); when(service.getPhoneToken()).thenReturn("123456"); service.requestPhoneSignIn(SIGN_IN_REQUEST_WITH_PHONE); verify(cacheProvider).getString(cacheKey); verify(cacheProvider).setString(eq(cacheKey), stringCaptor.capture(), eq(300)); verify(notificationsService).sendSMSMessage(eq(study.getStudyIdentifier()), eq(TestConstants.PHONE), stringCaptor.capture()); assertEquals("123456", stringCaptor.getAllValues().get(0)); assertEquals("Enter 123-456 to sign in to AppName", stringCaptor.getAllValues().get(1)); }

Target:
public void requestPhoneSignIn() { study.setShortName("AppName"); String cacheKey = TestConstants.PHONE.getNumber() + ":api:phoneSignInRequest"; when(accountDao.getAccount(SIGN_IN_WITH_PHONE.getAccountId())).thenReturn(account); when(service.getPhoneToken()).thenReturn("123456"); service.requestPhoneSignIn(SIGN_IN_REQUEST_WITH_PHONE); verify(cacheProvider).getString(cacheKey); verify(cacheProvider).setString(cacheKey, "123456", 300); verify(notificationsService).sendSMSMessage(study.getStudyIdentifier(), TestConstants.PHONE, "Enter 123-456 to sign in to AppName"); }
Source:
public HttpRequestBase buildRequest(MMSUtils.HttpRequestType type, File sendData, ContentType contentType, Project project) throws IOException, URISyntaxException { if(uriBuilder != null) { URI requestDest = uriBuilder.build(); final HttpRequestBase request; if (type == MMSUtils.HttpRequestType.GET && sendData != null) { throw new IOException("GETs with body are not supported"); } switch (type) { case DELETE: request = new HttpDeleteWithBody(requestDest); break; case GET: default: request = new HttpGet(requestDest); break; case POST: request = new HttpPost(requestDest); break; case PUT: request = new HttpPut(requestDest); break; } request.addHeader("Authorization", "Bearer " + TicketUtils.getTicket(project)); request.addHeader("Content-Type", "application/json"); request.addHeader("charset", (contentType != null ? contentType.getCharset() : Consts.UTF_8).displayName()); if (sendData != null) { if (contentType != null) { request.addHeader("Content-Type", contentType.getMimeType()); } HttpEntity reqEntity = new FileEntity(sendData, contentType); ((HttpEntityEnclosingRequest) request).setEntity(reqEntity); } return request; } return null; }

Target:
public HttpRequestBase buildRequest(MMSUtils.HttpRequestType type, File sendData, ContentType contentType, Project project) throws IOException, URISyntaxException { if(uriBuilder != null) { URI requestDest = uriBuilder.build(); final HttpRequestBase request; if (type == GET && sendData != null) { throw new IOException("GETs with body are not supported"); } switch (type) { case DELETE: request = new HttpDeleteWithBody(requestDest); break; case GET: default: request = new HttpGet(requestDest); break; case POST: request = new HttpPost(requestDest); break; case PUT: request = new HttpPut(requestDest); break; } request.addHeader("Authorization", "Bearer " + TicketUtils.getTicket(project)); request.addHeader("charset", (contentType != null ? contentType.getCharset() : Consts.UTF_8).displayName()); if (sendData != null) { if (contentType != null) { request.addHeader(HTTP.CONTENT_TYPE, contentType.getMimeType()); } FileEntity reqEntity = new FileEntity(sendData, contentType); reqEntity.setChunked(true); ((HttpEntityEnclosingRequest) request).setEntity(reqEntity); } return request; } return null; }
Source:
public List<Contentlet> getRelated(final String variableName) { if (this.relatedIds.containsKey(variableName)) { return this.relatedIds.get(variableName).stream().map(identifier -> { try { return this.contentletAPI.findContentletByIdentifierAnyLanguage(identifier); } catch (DotDataException | DotSecurityException e) { throw new DotStateException(e); } }).collect(Collectors.toList()); } else { try { com.dotcms.contenttype.model.field.Field field = APILocator.getContentTypeFieldAPI() .byContentTypeIdAndVar(getContentTypeId(), variableName); final List<Contentlet> relatedList = this.contentletAPI .getRelatedContent(this, RelationshipUtil .getRelationshipFromField(field, getContentType().variable()), this.userAPI.getSystemUser(), false); if (UtilMethods.isSet(relatedList)) { this.relatedIds.put(variableName, relatedList.stream().map(contentlet -> contentlet.getIdentifier()) .collect( Collectors.toList())); return relatedList; } } catch (DotDataException e) { Logger.warn(this, "No field found with this variable name " + variableName, e); throw new DotStateException(e); } catch (DotSecurityException e) { throw new DotStateException(e); } } return Collections.emptyList(); }

Target:
public List<Contentlet> getRelated(final String variableName) { if (this.relatedIds.containsKey(variableName)) { return this.relatedIds.get(variableName).stream().map(identifier -> { try { return this.contentletAPI.findContentletByIdentifierAnyLanguage(identifier); } catch (DotDataException | DotSecurityException e) { Logger.warn(this, "No field found with this variable name " + variableName, e); throw new DotStateException(e); } }).collect(Collectors.toList()); } else { try { com.dotcms.contenttype.model.field.Field field = APILocator.getContentTypeFieldAPI() .byContentTypeIdAndVar(getContentTypeId(), variableName); final List<Contentlet> relatedList = this.contentletAPI .getRelatedContent(this, RelationshipUtil .getRelationshipFromField(field, getContentType().variable()), this.userAPI.getSystemUser(), false); if (UtilMethods.isSet(relatedList)) { this.relatedIds.put(variableName, relatedList.stream().map(contentlet -> contentlet.getIdentifier()) .collect( CollectionsUtils.toImmutableList())); return relatedList; } } catch (DotDataException | DotSecurityException e) { Logger.warn(this, "No field found with this variable name " + variableName, e); throw new DotStateException(e); } } return Collections.emptyList(); }
Source:
public boolean contains( long[] value ) { assert value.length == width : "all elements must have the same size"; int slot = slotFor( value ); int result; do { result = table.checkSlot( slot, value ); slot = (slot + 1) & table.tableMask; } while ( result == CONTINUE_PROBING ); return result == VALUE_FOUND; }

Target:
public boolean contains( long[] value ) { assert validValue( value ); int slot = slotFor( value ); int result; do { result = table.checkSlot( slot, value ); slot = (slot + 1) & table.tableMask; } while ( result == CONTINUE_PROBING ); return result == VALUE_FOUND; }
Source:
public AbstractValidationProblem(SourceInfo sourceInfo, ASTNode node) { this.sourceInfo = sourceInfo; this.sourceStart = node.getStartPosition(); this.sourceEnd = node.getStartPosition() + node.getLength(); this.lineNumber = sourceInfo.getSourceLineNumber(getSourceEnd()); }

Target:
public AbstractValidationProblem(SourceInfo sourceInfo, ASTNode node) { this.sourceInfo = sourceInfo; ASTNode nodeToMark = getNodeToMark(node); this.sourceStart = nodeToMark.getStartPosition(); this.sourceEnd = nodeToMark.getStartPosition() + nodeToMark.getLength(); this.lineNumber = sourceInfo.getSourceLineNumber(getSourceEnd()); }
Source:
public BasicInvocationStage visitGetKeyValueCommand(InvocationContext ctx, GetKeyValueCommand command) throws Throwable { if (streamSummaryContainer.isEnabled() && ctx.isOriginLocal()) { streamSummaryContainer.addGet(command.getKey(), false); } return invokeNext(ctx, command); }

Target:
public BasicInvocationStage visitGetKeyValueCommand(InvocationContext ctx, GetKeyValueCommand command) throws Throwable { if (streamSummaryContainer.isEnabled() && ctx.isOriginLocal()) { streamSummaryContainer.addGet(command.getKey(), isRemote(command.getKey())); } return invokeNext(ctx, command); }
Source:
private void loadCheProjects() { projectServiceClient.getProjects(false).then(new Operation<List<ProjectDescriptor>>() { @Override public void apply(List<ProjectDescriptor> result) throws OperationException { cheProjects = FluentIterable.from(result).transform( new com.google.common.base.Function<ProjectDescriptor, String>() { @Override public String apply(ProjectDescriptor input) { return input.getName(); } }).toList(); } }); }

Target:
private void loadCheProjects() { projectServiceClient.getProjects(false).then(new Operation<List<ProjectDescriptor>>() { @Override public void apply(List<ProjectDescriptor> result) throws OperationException { cheProjects.clear(); for (ProjectDescriptor project : result) { cheProjects.add(project.getName()); } } }); }
Source:
private PageTitle makeTitleFrom(@NonNull ReadingListPageDiskRow row) { ReadingListPageRow pageRow = row.dat(); if (pageRow == null) { return null; } String namespace = pageRow.namespace().toString(); return new PageTitle(namespace, pageRow.title(), pageRow.site()); }

Target:
private PageTitle makeTitleFrom(@NonNull ReadingListPageDiskRow row) { ReadingListPageRow pageRow = row.dat(); if (pageRow == null) { return null; } String namespace = pageRow.namespace().toLegacyString(); return new PageTitle(namespace, pageRow.title(), pageRow.site()); }
Source:
public int getLockPriority() { return getContextValue("lockPriority") == null ? DEFAULT_TASK_PRIORITY : Integer.parseInt(getContextValue("lockPriority").toString()); }

Target:
public int getLockPriority() { return getLockPriority(DEFAULT_TASK_PRIORITY); }
Source:
public void approve(String ip, String name, boolean approve) { AgentInfo agentInfoInDB = agentManagerRepository.findByIpAndName(ip, name); if (agentInfoInDB != null) { agentInfoInDB.setApproved(approve); } else { agentInfoInDB = new AgentInfo(); agentInfoInDB.setIp(ip); agentInfoInDB.setName(name); agentInfoInDB.setApproved(approve); agentManagerRepository.save(agentInfoInDB); } agentManagerRepository.flush(); AgentInfo agentInfo = agentInfoStore.getAgentInfo(createAgentKey(ip, name)); agentInfo.setApproved(approve); agentInfoStore.updateAgentInfo(agentInfo.getAgentKey(), agentInfo); }

Target:
public void approve(String ip, String name, boolean approve) { AgentInfo agentInfoInDB = agentManagerRepository.findByIpAndName(ip, name); if (agentInfoInDB != null) { agentInfoInDB.setApproved(approve); } else { agentInfoInDB = new AgentInfo(); agentInfoInDB.setIp(ip); agentInfoInDB.setName(name); agentInfoInDB.setApproved(approve); agentManagerRepository.save(agentInfoInDB); } agentManagerRepository.flush(); updateApproveInStore(ip, name, approve); }
Source:
public static ResultSpec convertToResultSpec(final VisualizationObject visualizationObject, final VisualizationClass visualizationClass) throws Exception { if (!visualizationObject.getVisualizationClassUri().equals(visualizationClass.getUri())) { throw new Exception("VisualizationClass URI does not match the VisualizationObject URI, " + "you're trying to create ResultSpec for incompatible objects"); } List<SortItem> sorts = getSorting(visualizationObject); List<Dimension> dimensions = getDimensions(visualizationObject, visualizationClass.getVisualizationType()); return new ResultSpec(dimensions, sorts); }

Target:
public static ResultSpec convertToResultSpec(final VisualizationObject visualizationObject, final VisualizationClass visualizationClass) { notNull(visualizationObject, "visualizationObject"); notNull(visualizationClass, "visualizationClass"); isTrue(visualizationObject.getVisualizationClassUri().equals(visualizationClass.getUri()), "visualizationClass URI does not match the URI within visualizationObject, " + "you're trying to create ResultSpec for incompatible objects"); List<SortItem> sorts = getSorting(visualizationObject); List<Dimension> dimensions = getDimensions(visualizationObject, visualizationClass.getVisualizationType()); return new ResultSpec(dimensions, sorts); }
Source:
private Subject buildUnixSubject(int uid, int gid, int[] gids) { final Subject unixSubject = new Subject(); final Set<Principal> principals = unixSubject.getPrincipals(); principals.add(new UnixNumericUserPrincipal(uid)); principals.add(new UnixNumericGroupPrincipal(gid, true)); for (int gidElem : gids) { principals.add(new UnixNumericGroupPrincipal(gidElem, false)); } return unixSubject; }

Target:
private static Subject buildUnixSubject(int uid, int gid, int[] gids) { final Subject unixSubject = new Subject(); final Set<Principal> principals = unixSubject.getPrincipals(); principals.add(new UnixNumericUserPrincipal(uid)); principals.add(new UnixNumericGroupPrincipal(gid, true)); for (int gidElem : gids) { principals.add(new UnixNumericGroupPrincipal(gidElem, false)); } return unixSubject; }
Source:
private boolean filterByMimeType( Set<MimeType> mimeTypes, Map<String, Object> serviceProperties, MimeType userMimeType) { Set<String> baseTypes = mimeTypes.stream().map(MimeType::getBaseType).collect(Collectors.toSet()); String userIdValue = userMimeType.getParameter(Constants.SERVICE_ID); String userBaseType = userMimeType.getBaseType(); String serviceId = getServiceId(serviceProperties); return CollectionUtils.isNotEmpty(mimeTypes) && baseTypes.contains(userBaseType) && (userIdValue == null || StringUtils.equals(userIdValue, serviceId)); }

Target:
private boolean filterByMimeType( Set<MimeType> mimeTypes, Map<String, Object> serviceProperties, MimeType userMimeType) { Set<String> baseTypes = mimeTypes.stream().map(MimeType::getBaseType).collect(Collectors.toSet()); String userIdValue = userMimeType.getParameter(Constants.SERVICE_ID); String userBaseType = userMimeType.getBaseType(); String serviceId = getServiceId(serviceProperties); return baseTypes.contains(userBaseType) && (userIdValue == null || StringUtils.equals(userIdValue, serviceId)); }