auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public ResultScanner<FlatRow> readFlatRows(ReadRowsRequest request) { ResponseQueueReader reader = new ResponseQueueReader(retryOptions.getStreamingBufferSize()); final ReadRowsRetryListener listener = createReadRowsRetryListener(request, reader); return new ResumingStreamingResultScanner(reader, new ScanHandler() { @Override public void handleTimeout(ScanTimeoutException rte) throws BigtableRetriesExhaustedException { listener.handleTimeout(rte); } @Override public void cancel() { listener.cancel(); } }); }

Target:
public ResultScanner<FlatRow> readFlatRows(ReadRowsRequest request) { ResponseQueueReader reader = new ResponseQueueReader(retryOptions.getStreamingBufferSize()); final ReadRowsRetryListener listener = createReadRowsRetryListener(request, reader); return new ResumingStreamingResultScanner(reader, listener); }
Source:
private static <T> LobResponse _request(APIResource.RequestMethod method, String url, Map<String, Object> params, Class<T> clazz, APIResource.RequestType type, RequestOptions options) throws AuthenticationException, APIException, IOException { if (options == null) { options = RequestOptions.getDefault(); } String apiKey = options.getApiKey(); if (apiKey == null || apiKey.trim().length() == 0) { throw new AuthenticationException("Missing API Key. (HINT: set your API key using 'Lob.init(<API_KEY>);')", null); } LobResponse response; String lobURL = String.format("%s%s", Lob.API_BASE_URL, url); String query = createQuery(params); return makeURLConnectionRequest(method, clazz, lobURL, query, options); }

Target:
private static <T> LobResponse _request(APIResource.RequestMethod method, String url, Map<String, Object> params, Class<T> clazz, APIResource.RequestType type, RequestOptions options) throws AuthenticationException, APIException, IOException { if (options == null) { options = RequestOptions.getDefault(); } String apiKey = options.getApiKey(); if (apiKey == null || apiKey.trim().length() == 0) { throw new AuthenticationException("Missing API Key. Make sure 'Lob.init(<API_KEY>)' is called with a key from your Dashboard.", null); } LobResponse response; String lobURL = String.format("%s%s", Lob.API_BASE_URL, url); String query = createQuery(params); return makeURLConnectionRequest(method, clazz, lobURL, query, options); }
Source:
private List<VanityUrl> searchAndPopulate(final String luceneQuery, final User user) { final ImmutableList.Builder<VanityUrl> results = new ImmutableList.Builder(); final PriorityQueue<VanityUrl> vanityUrls; List<VanityUrl> vanityUrlsToReturn = Collections.emptyList(); try { final List<Contentlet> contentResults = contentletAPI.search(luceneQuery, 0, 0, StringPool.BLANK, user, false); if (null == contentResults || contentResults.isEmpty()) { return results.build(); } vanityUrls = new PriorityQueue<>(contentResults.size(), (vanity1, vanity2) -> vanity1.getOrder() - vanity2.getOrder()); contentResults.stream().forEach((Contentlet con) -> { VanityUrl vanityUrl = getVanityUrlFromContentlet(con); addToVanityURLCache(vanityUrl); vanityUrls.offer(vanityUrl); }); vanityUrlsToReturn = results.addAll(vanityUrls).build(); } catch (Exception e) { if (e instanceof IndexMissingException || e.getCause() instanceof IndexMissingException) { Logger.error(this, "Error when initializing Vanity URLs, no index found ", e); } else if (e instanceof DotDataException || e instanceof DotSecurityException) { Logger.error(this, "Error searching for active Vanity URLs [" + luceneQuery + "]", e); } else { throw new DotRuntimeException("Error searching and populating the Vanity URL Cache", e); } } return vanityUrlsToReturn; }

Target:
private List<VanityUrl> searchAndPopulate(final String luceneQuery, final User user) { final ImmutableList.Builder<VanityUrl> results = new ImmutableList.Builder(); final PriorityQueue<VanityUrl> vanityUrls; List<VanityUrl> vanityUrlsToReturn = Collections.emptyList(); try { final List<Contentlet> contentResults = contentletAPI.search(luceneQuery, 0, 0, StringPool.BLANK, user, false); if (null == contentResults || contentResults.isEmpty()) { return results.build(); } vanityUrls = new PriorityQueue<>(contentResults.size(), (vanity1, vanity2) -> vanity1.getOrder() - vanity2.getOrder()); contentResults.stream().forEach((Contentlet con) -> { VanityUrl vanityUrl = getVanityUrlFromContentlet(con); addToVanityURLCache(vanityUrl); vanityUrls.offer(vanityUrl); }); vanityUrlsToReturn = results.addAll(vanityUrls).build(); } catch (IndexMissingException e){ Logger.error(this, "Error when initializing Vanity URLs, no index found ", e); } catch (DotDataException | DotSecurityException e ){ Logger.error(this, "Error searching for active Vanity URLs [" + luceneQuery + "]", e); } catch (Exception e){ if ( e.getCause() instanceof IndexMissingException){ Logger.error(this, "Error when initializing Vanity URLs, no index found ", e); }else{ throw new DotRuntimeException("Error searching and populating the Vanity URL Cache", e); } } return vanityUrlsToReturn; }
Source:
public void testTxRollback() throws Exception { executeTestForAllCaches(new CI2Exc<Ignite, IgniteCache<Integer, Integer>>() { @Override public void applyx(Ignite ignite, final IgniteCache<Integer, Integer> cache) throws Exception { for (TransactionIsolation isolation : TransactionIsolation.values()) { final Transaction tx = ignite.transactions().txStart(transactionConcurrency(), isolation); cache.put(1, 1); cache.put(2, 2); tx.suspend(); assertNull("There is no transaction for current thread", ignite.transactions().tx()); assertEquals(SUSPENDED, tx.state()); GridTestUtils.runAsync(new Runnable() { @Override public void run() { tx.resume(); assertEquals(ACTIVE, tx.state()); cache.put(3, 3); tx.rollback(); } }).get(FUT_TIMEOUT); assertTrue(GridTestUtils.waitForCondition(new PA() { @Override public boolean apply() { return tx.state() == ROLLED_BACK; } }, getTestTimeout())); assertEquals(ROLLED_BACK, tx.state()); assertFalse(cache.containsKey(1)); assertFalse(cache.containsKey(2)); assertFalse(cache.containsKey(3)); cache.removeAll(); } } }); }

Target:
public void testTxRollback() throws Exception { executeTestForAllCaches(new CI2Exc<Ignite, IgniteCache<Integer, Integer>>() { @Override public void applyx(Ignite ignite, final IgniteCache<Integer, Integer> cache) throws Exception { for (TransactionIsolation isolation : TransactionIsolation.values()) { final Transaction tx = ignite.transactions().txStart(transactionConcurrency(), isolation); cache.put(1, 1); cache.put(2, 2); tx.suspend(); assertNull("There is no transaction for current thread", ignite.transactions().tx()); assertEquals(SUSPENDED, tx.state()); GridTestUtils.runAsync(() -> { tx.resume(); assertEquals(ACTIVE, tx.state()); cache.put(3, 3); tx.rollback(); }).get(FUT_TIMEOUT); assertTrue(GridTestUtils.waitForCondition(() -> tx.state() == ROLLED_BACK, getTestTimeout())); assertEquals(ROLLED_BACK, tx.state()); assertFalse(cache.containsKey(1)); assertFalse(cache.containsKey(2)); assertFalse(cache.containsKey(3)); cache.removeAll(); } } }); }
Source:
protected void populateInitial(BasicBrooklynCatalog catalog) { if (disallowLocal) { if (!hasRunOfficial()) { log.debug("CLI initial catalog not being read with disallow-local mode set."); } return; } if (initialUri!=null) { populateInitialFromUri(catalog, initialUri, PopulateMode.AUTODETECT); return; } String catalogUrl = managementContext.getConfig().getConfig(BrooklynServerConfig.BROOKLYN_CATALOG_URL); if (Strings.isNonBlank(catalogUrl)) { populateInitialFromUri(catalog, catalogUrl, PopulateMode.AUTODETECT); return; } catalogUrl = Urls.mergePaths(BrooklynServerConfig.getMgmtBaseDir( managementContext.getConfig() ), "catalog.bom"); if (new File(catalogUrl).exists()) { populateInitialFromUri(catalog, "file:"+catalogUrl, PopulateMode.YAML); return; } catalogUrl = Urls.mergePaths(BrooklynServerConfig.getMgmtBaseDir( managementContext.getConfig() ), "catalog.xml"); if (new File(catalogUrl).exists()) { populateInitialFromUri(catalog, "file:"+catalogUrl, PopulateMode.XML); return; } catalogUrl = "classpath:/brooklyn/default.catalog.bom"; if (new ResourceUtils(this).doesUrlExist(catalogUrl)) { populateInitialFromUri(catalog, catalogUrl, PopulateMode.YAML); return; } log.info("No catalog found on classpath or specified; catalog will not be initialized."); return; }

Target:
protected void populateInitial(BasicBrooklynCatalog catalog) { if (disallowLocal) { if (!hasRunFinalInitialization()) { log.debug("CLI initial catalog not being read when local catalog load mode is disallowed."); } return; } if (initialUri!=null) { populateInitialFromUri(catalog, initialUri, PopulateMode.AUTODETECT); return; } String catalogUrl = managementContext.getConfig().getConfig(BrooklynServerConfig.BROOKLYN_CATALOG_URL); if (Strings.isNonBlank(catalogUrl)) { populateInitialFromUri(catalog, catalogUrl, PopulateMode.AUTODETECT); return; } catalogUrl = Os.mergePaths(BrooklynServerConfig.getMgmtBaseDir( managementContext.getConfig() ), "catalog.bom"); if (new File(catalogUrl).exists()) { populateInitialFromUri(catalog, new File(catalogUrl).toURI().toString(), PopulateMode.YAML); return; } catalogUrl = Os.mergePaths(BrooklynServerConfig.getMgmtBaseDir( managementContext.getConfig() ), "catalog.xml"); if (new File(catalogUrl).exists()) { populateInitialFromUri(catalog, new File(catalogUrl).toURI().toString(), PopulateMode.XML); return; } catalogUrl = "classpath:/brooklyn/default.catalog.bom"; if (new ResourceUtils(this).doesUrlExist(catalogUrl)) { populateInitialFromUri(catalog, catalogUrl, PopulateMode.YAML); return; } log.info("No catalog found on classpath or specified; catalog will not be initialized."); return; }
Source:
private void SaveDataToDb() { if (_saveVdsDynamic) { _vdsManager.UpdateDynamicData(_vds.getDynamicData()); } if (_saveVdsStatistics) { VdsStatistics stat = _vds.getStatisticsData(); _vdsManager.UpdateStatisticsData(stat); CheckVdsMemoryThreshold(stat); final List<VdsNetworkStatistics> statistics = new LinkedList<VdsNetworkStatistics>(); for (VdsNetworkInterface iface : _vds.getInterfaces()) { statistics.add(iface.getStatistics()); } if (!statistics.isEmpty()) { TransactionSupport.executeInScope(TransactionScopeOption.Required, new TransactionMethod<Void>() { @Override public Void runInTransaction() { DbFacade.getInstance().getInterfaceDAO().massUpdateStatisticsForVds(statistics); return null; } }); } } updateAllInTransaction(_vmDynamicToSave.values(), DbFacade.getInstance().getVmDynamicDAO()); updateAllInTransaction(_vmStatisticsToSave.values(), DbFacade.getInstance().getVmStatisticsDAO()); final List<VmNetworkStatistics> allVmInterfaceStatistics = new LinkedList<VmNetworkStatistics>(); for (List<VmNetworkInterface> list : _vmInterfaceStatisticsToSave.values()) { for (VmNetworkInterface iface : list) { allVmInterfaceStatistics.add(iface.getStatistics()); } } updateAllInTransaction(allVmInterfaceStatistics, DbFacade.getInstance().getVmNetworkStatisticsDAO()); updateAllInTransaction(_vmDiskImageDynamicToSave.values(), DbFacade.getInstance().getDiskImageDynamicDAO()); updateAllInTransaction(vmDeviceToSave.values(), DbFacade.getInstance().getVmDeviceDAO()); DbFacade.getInstance().getVmDeviceDAO().removeAll(removedDeviceIds); DbFacade.getInstance().getVmDeviceDAO().saveAll(newVmDevices); }

Target:
private void SaveDataToDb() { if (_saveVdsDynamic) { _vdsManager.UpdateDynamicData(_vds.getDynamicData()); } if (_saveVdsStatistics) { VdsStatistics stat = _vds.getStatisticsData(); _vdsManager.UpdateStatisticsData(stat); CheckVdsMemoryThreshold(stat); final List<VdsNetworkStatistics> statistics = new LinkedList<VdsNetworkStatistics>(); for (VdsNetworkInterface iface : _vds.getInterfaces()) { statistics.add(iface.getStatistics()); } if (!statistics.isEmpty()) { TransactionSupport.executeInScope(TransactionScopeOption.Required, new TransactionMethod<Void>() { @Override public Void runInTransaction() { DbFacade.getInstance().getInterfaceDAO().massUpdateStatisticsForVds(statistics); return null; } }); } } updateAllInTransaction(_vmDynamicToSave.values(), DbFacade.getInstance().getVmDynamicDAO()); updateAllInTransaction(_vmStatisticsToSave.values(), DbFacade.getInstance().getVmStatisticsDAO()); final List<VmNetworkStatistics> allVmInterfaceStatistics = new LinkedList<VmNetworkStatistics>(); for (List<VmNetworkInterface> list : _vmInterfaceStatisticsToSave.values()) { for (VmNetworkInterface iface : list) { allVmInterfaceStatistics.add(iface.getStatistics()); } } updateAllInTransaction(allVmInterfaceStatistics, DbFacade.getInstance().getVmNetworkStatisticsDAO()); updateAllInTransaction(_vmDiskImageDynamicToSave.values(), DbFacade.getInstance().getDiskImageDynamicDAO()); saveVmDevicesToDb(); }
Source:
public AbstractNetworkPopupView(EventBus eventBus) { super(eventBus); dataCenterEditor = new ListModelListBoxEditor<>(new NameRenderer<StoragePool>()); externalProviderEditor = new ListModelListBoxEditor<>(new NameRenderer<Provider>()); qosEditor = new ListModelListBoxEditor<>(new NameRenderer<HostNetworkQos>()); externalEditor = new EntityModelCheckBoxEditor(Align.RIGHT); externalEditor.asCheckBox().addValueChangeHandler(event -> refreshClustersTable()); datacenterPhysicalNetwork = new ListModelListBoxOnlyEditor<>(new NameRenderer<Network>()); physicalNetworkDatacenterRadioButtonEditor = new EntityModelRadioButtonEditor("1"); physicalNetworkCustomRadioButtonEditor = new EntityModelRadioButtonEditor("1"); physicalNetworkEditor = new EntityModelCheckBoxEditor(Align.RIGHT); physicalNetworkEditor.asCheckBox().addValueChangeHandler(event -> onPhysicalNetworkChange()); physicalNetworkEditor.asCheckBox().setValue(true); isVmNetworkEditor = new EntityModelCheckBoxEditor(Align.RIGHT); vlanTagging = new EntityModelCheckBoxEditor(Align.RIGHT); mtuEditor = new IntegerEntityModelTextBoxOnlyEditor(); mtuEditor.setUsePatternFly(true); createSubnetEditor = new EntityModelCheckBoxEditor(Align.RIGHT); this.clustersTable = new EntityModelCellTable<>(SelectionMode.NONE, true); this.clustersTable.setHeight(CLUSTERS_TABLE_HEIGHT + Unit.PX.getType()); shouldSetDnsConfigurationEditor = new EntityModelCheckBoxEditor(Align.RIGHT); initWidget(ViewUiBinder.uiBinder.createAndBindUi(this)); initEntityModelCellTable(); localize(); dnsServersWidget.setUsePatternFly(true); }

Target:
public AbstractNetworkPopupView(EventBus eventBus) { super(eventBus); dataCenterEditor = new ListModelListBoxEditor<>(new NameRenderer<StoragePool>()); externalProviderEditor = new ListModelListBoxEditor<>(new NameRenderer<Provider>()); qosEditor = new ListModelListBoxEditor<>(new NameRenderer<HostNetworkQos>()); externalEditor = new EntityModelCheckBoxEditor(Align.RIGHT); externalEditor.asCheckBox().addValueChangeHandler(event -> refreshClustersTable()); datacenterPhysicalNetworkEditor = new ListModelListBoxOnlyEditor<>(new NameRenderer<Network>()); physicalNetworkDatacenterRadioButtonEditor = new EntityModelRadioButtonEditor("1"); physicalNetworkCustomRadioButtonEditor = new EntityModelRadioButtonEditor("1"); physicalNetworkEditor = new EntityModelCheckBoxEditor(Align.RIGHT); physicalNetworkEditor.asCheckBox() .addValueChangeHandler(event -> physicalNetworkLabel.setVisible(event.getValue())); isVmNetworkEditor = new EntityModelCheckBoxEditor(Align.RIGHT); vlanTagging = new EntityModelCheckBoxEditor(Align.RIGHT); mtuEditor = new IntegerEntityModelTextBoxOnlyEditor(); mtuEditor.setUsePatternFly(true); createSubnetEditor = new EntityModelCheckBoxEditor(Align.RIGHT); this.clustersTable = new EntityModelCellTable<>(SelectionMode.NONE, true); this.clustersTable.setHeight(CLUSTERS_TABLE_HEIGHT + Unit.PX.getType()); shouldSetDnsConfigurationEditor = new EntityModelCheckBoxEditor(Align.RIGHT); initWidget(ViewUiBinder.uiBinder.createAndBindUi(this)); initEntityModelCellTable(); localize(); dnsServersWidget.setUsePatternFly(true); }
Source:
public static <KEY1, VALUE> void putCollectionToNestedList(Map<KEY1, List<VALUE>> map, KEY1 k1, Collection<VALUE> list) { if (map.containsKey(k1)) { map.get(k1).addAll(list); } else { List inputList = new ArrayList<>(); inputList.addAll(list); map.put(k1, inputList); } }

Target:
public static <KEY1, VALUE> void putCollectionToNestedList(Map<KEY1, List<VALUE>> map, KEY1 k1, Collection<VALUE> list) { if (map.containsKey(k1)) { map.get(k1).addAll(list); } else { map.put(k1, new ArrayList<>(list)); } }
Source:
private <T> Map<T, List<byte[]>> generateState(BiFunction<Integer, Integer, T> descriptorCreator) { return range(0, stateParLevel).boxed().flatMap( gateId -> range(0, stateParLevel).mapToObj( channelId -> descriptorCreator.apply(gateId, channelId))).collect(toMap( identity(), descUnused -> range(0, statePartsPerChannel).mapToObj(unused -> randomStateBytes()).collect(toList()) )); }

Target:
private <T> Map<T, List<byte[]>> generateState(BiFunction<Integer, Integer, T> descriptorCreator) { return range(0, stateParLevel).boxed().flatMap( gateId -> range(0, stateParLevel).mapToObj( channelId -> descriptorCreator.apply(gateId, channelId)) ).collect(toMap(identity(), this::generateSingleChannelState)); }
Source:
void writeTo(File dir, OutputStream os) throws IOException { final MessageDigest foot = Constants.newMessageDigest(); final DigestOutputStream dos = new DigestOutputStream(os, foot); boolean extended = false; for (int i = 0; i < entryCnt; i++) { if (sortedEntries[i].isExtended()) { extended = true; break; } } final byte[] tmp = new byte[128]; System.arraycopy(SIG_DIRC, 0, tmp, 0, SIG_DIRC.length); NB.encodeInt32(tmp, 4, extended ? 3 : 2); NB.encodeInt32(tmp, 8, entryCnt); dos.write(tmp, 0, 12); final int smudge_s; final int smudge_ns; if (myLock != null) { myLock.createCommitSnapshot(); snapshot = myLock.getCommitSnapshot(); smudge_s = (int) (snapshot.lastModifiedInstant().getEpochSecond()); smudge_ns = snapshot.lastModifiedInstant().getNano(); } else { smudge_ns = 0; smudge_s = 0; } final boolean writeTree = tree != null; if (repository != null && entryCnt > 0) updateSmudgedEntries(); for (int i = 0; i < entryCnt; i++) { final DirCacheEntry e = sortedEntries[i]; if (e.mightBeRacilyClean(Instant.ofEpochSecond(smudge_s, smudge_ns))) e.smudgeRacilyClean(); e.write(dos); } if (writeTree) { @SuppressWarnings("resource") TemporaryBuffer bb = new TemporaryBuffer.LocalFile(dir, 5 << 20); try { tree.write(tmp, bb); bb.close(); NB.encodeInt32(tmp, 0, EXT_TREE); NB.encodeInt32(tmp, 4, (int) bb.length()); dos.write(tmp, 0, 8); bb.writeTo(dos, null); } finally { bb.destroy(); } } writeIndexChecksum = foot.digest(); os.write(writeIndexChecksum); os.close(); }

Target:
void writeTo(File dir, OutputStream os) throws IOException { final MessageDigest foot = Constants.newMessageDigest(); final DigestOutputStream dos = new DigestOutputStream(os, foot); boolean extended = false; for (int i = 0; i < entryCnt; i++) { if (sortedEntries[i].isExtended()) { extended = true; break; } } final byte[] tmp = new byte[128]; System.arraycopy(SIG_DIRC, 0, tmp, 0, SIG_DIRC.length); NB.encodeInt32(tmp, 4, extended ? 3 : 2); NB.encodeInt32(tmp, 8, entryCnt); dos.write(tmp, 0, 12); Instant smudge; if (myLock != null) { myLock.createCommitSnapshot(); snapshot = myLock.getCommitSnapshot(); smudge = snapshot.lastModifiedInstant(); } else { smudge = Instant.EPOCH; } final boolean writeTree = tree != null; if (repository != null && entryCnt > 0) updateSmudgedEntries(); for (int i = 0; i < entryCnt; i++) { final DirCacheEntry e = sortedEntries[i]; if (e.mightBeRacilyClean(smudge)) { e.smudgeRacilyClean(); } e.write(dos); } if (writeTree) { @SuppressWarnings("resource") TemporaryBuffer bb = new TemporaryBuffer.LocalFile(dir, 5 << 20); try { tree.write(tmp, bb); bb.close(); NB.encodeInt32(tmp, 0, EXT_TREE); NB.encodeInt32(tmp, 4, (int) bb.length()); dos.write(tmp, 0, 8); bb.writeTo(dos, null); } finally { bb.destroy(); } } writeIndexChecksum = foot.digest(); os.write(writeIndexChecksum); os.close(); }
Source:
public static KeyStore buildKeystore(final String alias, final String cert, final String privateKey, final String storePassword) throws KeyStoreException, CertificateException, NoSuchAlgorithmException, InvalidKeySpecException, IOException { final KeyStore ks = KeyStore.getInstance("JKS"); ks.load(null, storePassword != null ? storePassword.toCharArray() : null); final Certificate[] certs = new Certificate[1]; certs[0] = buildCertificate(cert); ks.setKeyEntry(alias, buildPrivateKey(privateKey), storePassword != null ? storePassword.toCharArray() : null, certs); return ks; }

Target:
public static KeyStore buildKeystore(final String alias, final String cert, final String privateKey, final String storePassword) throws KeyStoreException, CertificateException, NoSuchAlgorithmException, InvalidKeySpecException, IOException { Preconditions.checkArgument(!Strings.isNullOrEmpty(alias), "Certificate alias cannot be blank"); Preconditions.checkArgument(!Strings.isNullOrEmpty(cert), "Certificate cannot be blank"); Preconditions.checkArgument(!Strings.isNullOrEmpty(privateKey), "Private key cannot be blank"); char password[] = null; if (storePassword != null) { password = storePassword.toCharArray(); } final KeyStore ks = KeyStore.getInstance("JKS"); ks.load(null, password); final Certificate[] certs = new Certificate[1]; certs[0] = buildCertificate(cert); ks.setKeyEntry(alias, buildPrivateKey(privateKey), password, certs); return ks; }
Source:
public void getUserByActivationKey_shouldGetUserByActivationKey(){ User u = new User(); u.setPerson(new Person()); u.addName(new PersonName("Benjamin", "A", "Wolfe")); u.setUsername("bwolfe"); u.getPerson().setGender("M"); User createdUser = userService.createUser(u, "Openmr5xy"); String key="h4ph0fpNzQCIPSw8plJI"; int validTime = 10*60*1000; Long tokenTime = System.currentTimeMillis() + validTime; LoginCredential credentials = dao.getLoginCredential(createdUser); credentials.setActivationKey("b071c88d6d877922e35af2e6a90dd57d37ac61143a03bb986c5f353566f3972a86ce9b2604c31a22dfa467922dcfd54fa7d18b0a7c7648d94ca3d97a88ea2fd0:"+tokenTime); dao.updateLoginCredential(credentials); User user = userService.getUserByActivationKey(key); assertEquals(createdUser, user); }

Target:
public void getUserByActivationKey_shouldGetUserByActivationKey(){ User u = new User(); u.setPerson(new Person()); u.addName(new PersonName("Benjamin", "A", "Wolfe")); u.setUsername("bwolfe"); u.getPerson().setGender("M"); User createdUser = userService.createUser(u, "Openmr5xy"); String key="h4ph0fpNzQCIPSw8plJI"; int validTime = 10*60*1000; Long tokenTime = System.currentTimeMillis() + validTime; LoginCredential credentials = dao.getLoginCredential(createdUser); credentials.setActivationKey("b071c88d6d877922e35af2e6a90dd57d37ac61143a03bb986c5f353566f3972a86ce9b2604c31a22dfa467922dcfd54fa7d18b0a7c7648d94ca3d97a88ea2fd0:"+tokenTime); dao.updateLoginCredential(credentials); assertEquals(createdUser, userService.getUserByActivationKey(key)); }
Source:
public HttpConnectionFilterContext filterResponse(HttpConnectionFilterContext context) { HttpURLConnection connection = context.connection.getConnection(); if (context.connection.getResponseCode() == 401) { cookie = getCookie(connection.getURL()); if(cookie != null) { context.replayRequest = true; connection.setRequestProperty("Cookie", cookie); context = new HttpConnectionFilterContext(context); } else { context.replayRequest = false; } } return context; }

Target:
public HttpConnectionFilterContext filterResponse(HttpConnectionFilterContext context) { HttpURLConnection connection = context.connection.getConnection(); try { if (context.connection.getConnection().getResponseCode() == 401) { cookie = getCookie(connection.getURL()); if(cookie != null) { context.replayRequest = true; } else { context.replayRequest = false; } } } catch (IOException e) { logger.log(Level.SEVERE, "Failed to get response code from request",e); } return context; }
Source:
private void handleVmLease() { Guid importedLeaseStorageDomainId = getVmTemplate().getLeaseStorageDomainId(); if (importedLeaseStorageDomainId == null) { return; } if (!getVmTemplate().isAutoStartup() || !shouldAddLease(getVmTemplate())) { getVmTemplate().setLeaseStorageDomainId(null); return; } if (!FeatureSupported.isVmLeasesSupported(getEffectiveCompatibilityVersion())) { getVmTemplate().setLeaseStorageDomainId(null); auditLogDirector.log(this, AuditLogType.CANNOT_IMPORT_VM_WITH_LEASE_COMPAT_VERSION); return; } if (validateLeaseStorageDomain(importedLeaseStorageDomainId) && addVmLease(importedLeaseStorageDomainId, getVmTemplate().getId(), false)) { return; } getVmTemplate().setLeaseStorageDomainId(addVmLeaseToDefaultStorageDomain()); if (getVmTemplate().getLeaseStorageDomainId() == null) { auditLogDirector.log(this, AuditLogType.CANNOT_IMPORT_VM_WITH_LEASE_STORAGE_DOMAIN); } else { log.warn("Creating the lease for the VM Template '{}' on storage domain '{}', because storage domain '{}' is unavailable", getVmTemplate().getId(), getVmTemplate().getLeaseStorageDomainId(), importedLeaseStorageDomainId); } }

Target:
private void handleVmLease() { Guid importedLeaseStorageDomainId = getVmTemplate().getLeaseStorageDomainId(); if (importedLeaseStorageDomainId == null) { return; } if (!getVmTemplate().isAutoStartup() || !shouldAddLease(getVmTemplate())) { getVmTemplate().setLeaseStorageDomainId(null); return; } if (!FeatureSupported.isVmLeasesSupported(getEffectiveCompatibilityVersion())) { getVmTemplate().setLeaseStorageDomainId(null); auditLogDirector.log(this, AuditLogType.CANNOT_IMPORT_VM_TEMPLATE_WITH_LEASE_COMPAT_VERSION); return; } if (validateLeaseStorageDomain(importedLeaseStorageDomainId)) { return; } getVmTemplate().setLeaseStorageDomainId(setVmLeaseToDefaultStorageDomain()); if (getVmTemplate().getLeaseStorageDomainId() == null) { auditLogDirector.log(this, AuditLogType.CANNOT_IMPORT_VM_TEMPLATE_WITH_LEASE_STORAGE_DOMAIN); } else { log.warn("Setting the lease for the VM Template '{}' to the storage domain '{}', because the storage domain '{}' is unavailable", getVmTemplate().getId(), getVmTemplate().getLeaseStorageDomainId(), importedLeaseStorageDomainId); } }
Source:
public ValidationResult validate(Object value) { assert value == null || value instanceof String : "This validation must be run on a String!"; String mask = (String) value; boolean isValidFormat = isPrefixSupported ? MaskValidator.getInstance().isMaskFormatValid(mask) : MaskValidator.getInstance() .isNetmaskFormatValid(mask); boolean isValidValue = isValidFormat ? (isPrefixSupported ? MaskValidator.getInstance().isMaskValid(mask) : MaskValidator.getInstance() .isNetmaskValid(mask)) : false; if (!isValidFormat) { return failWith(getSubnetBadFormatMessage()); } else if (!isValidValue) { return failWith(getInvalidMask()); } return new ValidationResult(); }

Target:
public ValidationResult validate(Object value) { assert value == null || value instanceof String : "This validation must be run on a String!"; String mask = (String) value; if (!MaskValidator.getInstance().isMaskFormatValid(mask, isPrefixSupported)) { return failWith(getSubnetBadFormatMessage()); } else if (!MaskValidator.getInstance().isMaskValid(mask, isPrefixSupported)) { return failWith(getInvalidMask()); } return new ValidationResult(); }
Source:
private Criterion getHypervisorIdRestriction(Iterable<String> hypervisorIds) { List<Criterion> ors = new LinkedList<Criterion>(); for (String hypervisorId : hypervisorIds) { ors.add(Restrictions.eq("hvsr.hypervisorId", hypervisorId.toLowerCase())); } return Restrictions.or(ors.toArray(new Criterion[0])); }

Target:
private Criterion getHypervisorIdRestriction(Iterable<String> hypervisorIds) { Disjunction disjunction = Restrictions.disjunction(); for (String hid : hypervisorIds) { disjunction.add(Restrictions.eq("hvsr.hypervisorId", hid.toLowerCase())); } return disjunction; }
Source:
private Message constructMockMessage() { StreamManager.TupleMessage.Builder message = StreamManager.TupleMessage.newBuilder(); HeronTuples.HeronTupleSet.Builder heronTupleSet = HeronTuples.HeronTupleSet.newBuilder(); HeronTuples.HeronDataTupleSet.Builder dataTupleSet = HeronTuples.HeronDataTupleSet.newBuilder(); TopologyAPI.StreamId.Builder streamId = TopologyAPI.StreamId.newBuilder(); streamId.setComponentName("test-spout"); streamId.setId("default"); dataTupleSet.setStream(streamId); for (int i = 0; i < 10; i++) { HeronTuples.HeronDataTuple.Builder dataTuple = HeronTuples.HeronDataTuple.newBuilder(); dataTuple.setKey(19901017 + i); HeronTuples.RootId.Builder rootId = HeronTuples.RootId.newBuilder(); rootId.setKey(19901017 + i); rootId.setTaskid(0); dataTuple.addRoots(rootId); String s; if ((i & 1) == 0) { s = "A"; } else { s = "B"; } ByteString byteString = ByteString.copyFrom(s.getBytes()); dataTuple.addValues(byteString); dataTupleSet.addTuples(dataTuple); } heronTupleSet.setData(dataTupleSet); message.setSet(heronTupleSet); return message.build(); }

Target:
private Message constructMockMessage() { StreamManager.TupleMessage.Builder message = StreamManager.TupleMessage.newBuilder(); HeronTuples.HeronTupleSet.Builder heronTupleSet = HeronTuples.HeronTupleSet.newBuilder(); HeronTuples.HeronDataTupleSet.Builder dataTupleSet = HeronTuples.HeronDataTupleSet.newBuilder(); TopologyAPI.StreamId.Builder streamId = TopologyAPI.StreamId.newBuilder(); streamId.setComponentName("test-spout"); streamId.setId("default"); dataTupleSet.setStream(streamId); for (int i = 0; i < 10; i++) { HeronTuples.HeronDataTuple.Builder dataTuple = HeronTuples.HeronDataTuple.newBuilder(); dataTuple.setKey(19901017 + i); HeronTuples.RootId.Builder rootId = HeronTuples.RootId.newBuilder(); rootId.setKey(19901017 + i); rootId.setTaskid(0); dataTuple.addRoots(rootId); String tupleData = ((i & 1) == 0) ? "A" : "B"; dataTuple.addValues(ByteString.copyFrom(tupleData.getBytes())); dataTupleSet.addTuples(dataTuple); } heronTupleSet.setData(dataTupleSet); message.setSet(heronTupleSet); return message.build(); }
Source:
private static int getFontSize() { if (Toolkit.getDefaultToolkit().getScreenResolution() >= 110) { return Toolkit.getDefaultToolkit().getScreenResolution() / 7 + 1; } else { GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment(); if (ge.getMaximumWindowBounds().getWidth() > 4000) { return 56; } else if (ge.getMaximumWindowBounds().getWidth() > 2000) { return 28; } else { return 14; } } }

Target:
private static int getFontSize() { if (Toolkit.getDefaultToolkit().getScreenResolution() >= 110) { return Toolkit.getDefaultToolkit().getScreenResolution() / 7 + 1; } else { GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment(); if (ge.getMaximumWindowBounds().getWidth() > 4096) { return 56; } else if (ge.getMaximumWindowBounds().getWidth() > 2048) { return 28; } else { return 14; } } }
Source:
Object createNew0(Object delegate) throws Exception { Constructor<?> constructor = targetClass.getConstructor(Long.TYPE, Long.TYPE, Long.TYPE); Object create = getFieldValueReflectively(delegate, "create"); Object access = getFieldValueReflectively(delegate, "access"); Object update = getFieldValueReflectively(delegate, "update"); Object[] args = new Object[]{ getFieldValueReflectively(create, "durationAmount"), getFieldValueReflectively(access, "durationAmount"), getFieldValueReflectively(update, "durationAmount") }; return constructor.newInstance(args); }

Target:
Object createNew0(Object delegate) throws Exception { Constructor<?> constructor = targetClass.getConstructor(Long.TYPE, Long.TYPE, Long.TYPE); Duration create = getFieldValueReflectively(delegate, "create"); Duration access = getFieldValueReflectively(delegate, "access"); Duration update = getFieldValueReflectively(delegate, "update"); Object[] args = new Object[]{ create.getTimeUnit().toMillis(create.getDurationAmount()), access.getTimeUnit().toMillis(access.getDurationAmount()), update.getTimeUnit().toMillis(update.getDurationAmount()), }; return constructor.newInstance(args); }
Source:
@Override public void toJson(JsonWriter writer, Object value) throws IOException { if (!baseTypeIsObject) { objectJsonAdapter.toJson(writer, toJsonMap(value)); return; } if (reentrantFromObjectAdapter) { objectJsonAdapter.toJson(writer, value); return; } reentrantFromObjectAdapter = true; try { objectJsonAdapter.toJson(writer, toJsonMap(value)); } finally { reentrantFromObjectAdapter = false; } }

Target:
@Override public void toJson(JsonWriter writer, Object value) throws IOException { Class<?> type = value.getClass(); String label = typeToLabel.get(type); if (label == null) { throw new IllegalArgumentException("Expected one of " + typeToLabel.keySet() + " but found " + value + ", a " + value.getClass() + ". Register this subtype."); } JsonAdapter<Object> adapter = labelToAdapter.get(label); Map<String, Object> jsonValue = (Map<String, Object>) adapter.toJsonValue(value); Map<String, Object> valueWithLabel = new LinkedHashMap<>(1 + jsonValue.size()); valueWithLabel.put(labelKey, label); valueWithLabel.putAll(jsonValue); objectJsonAdapter.toJson(writer, valueWithLabel); }
Source:
static short getCurrentVersion() { return getResponseVersionToUse; }

Target:
static short getCurrentVersion() { return CURRENT_VERSION; }
Source:
private static String trimLeadingPlusOfLongString(String metricValueString) { if (metricValueString.isEmpty()) { return metricValueString; } if (metricValueString.charAt(0) == '+') { if (metricValueString.length() > 1) { char secondChar = metricValueString.charAt(1); if (secondChar >= '0' && secondChar <= '9') { metricValueString = metricValueString.substring(1); } } } return metricValueString; }

Target:
private static String trimLeadingPlusOfLongString(String metricValueString) { if (metricValueString.length() > 1 && metricValueString.charAt(0) == '+') { char secondChar = metricValueString.charAt(1); if (secondChar >= '0' && secondChar <= '9') { metricValueString = metricValueString.substring(1); } } return metricValueString; }
Source:
public void testSvgzImageLoad() { openRepresentation(localSession.getOpenedSession(), REPRESENTATION_DESCRIPTION_NAME, REPRESENTATION_NAME, DDiagram.class); openErrorLogView(); SWTBotView logViewBot = bot.viewByTitle("Error Log"); assertTrue("There must be no errors during the load of svgz image.", checkNoErrorLogMessage(logViewBot)); logViewBot.close(); }

Target:
public void testSvgzImageLoad() { editor = (SWTBotSiriusDiagramEditor) openRepresentation(localSession.getOpenedSession(), REPRESENTATION_DESCRIPTION_NAME, REPRESENTATION_NAME, DDiagram.class); SWTBotGefEditPart editPartBot = editor.getEditPart("C1").parent(); EditPart editPart = editPartBot.part(); IGraphicalEditPart graphicalEditPart = (IGraphicalEditPart) editPart.getChildren().get(1); IFigure figure = (IFigure) graphicalEditPart.getFigure().getChildren().get(0); SVGWorkspaceImageFigure svgWorkspaceImageFigure = (SVGWorkspaceImageFigure) figure; String uri = svgWorkspaceImageFigure.getURI(); WorkspaceImage workspaceImage = getWorkspaceImage(editPartBot); String imageFile = FileProvider.getDefault().getFile(new Path(workspaceImage.getWorkspacePath())).toURI().toString(); assertEquals("The svg image doesn't corresponds to " + workspaceImage.getWorkspacePath(), imageFile, uri); }
Source:
public <R> AcquireLockResponse<R> acquireLock(@Nonnull final LockOptions lockOptions, @Nonnull final Callable<R> onLockAcquiredCallback) { int maxHeartbeatCount = Integer.MAX_VALUE; if (lockOptions instanceof RefreshableLockOptions) { maxHeartbeatCount = ((RefreshableLockOptions) lockOptions).getMaxHeartbeatCount(); } lockOptions.validateInputs(); Lock lock = null; R workResult = null; LockStatus status = LockStatus.TAKEN; HeartbeatLockRequest heartbeatLockRequest = null; lockOptions.setVersion(clock.millis()); try { try { lock = tryCreateLock(lockOptions); } catch (IOException e) { throw new IllegalStateException("Failed to deserialize lock content", e); } if (!matchesLock(lockOptions, lock)) { log.info("Could not acquire already taken lock {}", lock); } else { LongTaskTimer acquireDurationTimer = registry.longTaskTimer(String.format("redis.lock.acquireDuration.%s", lock.getName())); status = LockStatus.ACQUIRED; log.info("Acquired Lock {}.", lock); long timer = acquireDurationTimer.start(); heartbeatLockRequest = new HeartbeatLockRequest(lock, new AtomicInteger(maxHeartbeatCount)); queueHeartbeat(heartbeatLockRequest); synchronized (heartbeatLockRequest.getLock()) { try { workResult = onLockAcquiredCallback.call(); } catch (Exception e) { log.error("Callback failed using lock {}", lock, e); throw new LockCallbackException(e); } finally { acquireDurationTimer.stop(timer); lock = heartbeatLockRequest.getLock(); } } } return new AcquireLockResponse<>(lock, workResult, status, null, tryLockReleaseQuietly(lock)); } catch (Exception e) { if (e instanceof LockCallbackException) { throw e; } log.error("Failed to acquire lock", e); status = LockStatus.ERROR; return new AcquireLockResponse<>(lock, workResult, status, e, tryLockReleaseQuietly(lock)); } finally { Optional.ofNullable(heartbeatLockRequest).ifPresent(r -> heartbeatQueue.remove(r)); registry.counter( acquireId .withTag("lockName", lockOptions.getLockName()) .withTag("status", status.toString()) ).increment(); } }

Target:
public <R> AcquireLockResponse<R> acquireLock(@Nonnull final LockOptions lockOptions, @Nonnull final Callable<R> onLockAcquiredCallback) { return acquire(lockOptions, onLockAcquiredCallback); }
Source:
public Lease_newBreakOption(Lease lease) { super(Lease_newBreakOption.class); this.lease = lease; }

Target:
public Lease_newBreakOption(Lease lease) { this.lease = lease; }
Source:
public void simpleTableTest1() throws Exception { String tableName = "testTable"; Path path = new Path(); AbstractGriffinTest.assertMemoryLeak(() -> { compiler.compile("create table " + tableName + " as (select" + " rnd_symbol(4,4,4,2) sym," + " rnd_double(2) d," + " timestamp_sequence(0, 1000000000) ts" + " from long_sequence(10000)) timestamp(ts)", sqlExecutionContext); }); TableBackupManager tableBackupManager = new TableBackupManager(configuration, engine, compiler); AbstractGriffinTest.assertMemoryLeak(() -> { tableBackupManager.backupTable(sqlExecutionContext.getCairoSecurityContext(), tableName, path); }); String sourceSelectAll = selectAll(tableName); setup(backupRoot, null); String backupSelectAll = selectAll(tableName); Assert.assertEquals(sourceSelectAll, backupSelectAll); }

Target:
public void simpleTableTest1() throws Exception { assertMemoryLeak(() -> { String tableName = "testTable1"; mainCompiler.compile("create table " + tableName + " as (select" + " rnd_symbol(4,4,4,2) sym," + " rnd_double(2) d," + " timestamp_sequence(0, 1000000000) ts" + " from long_sequence(10000)) timestamp(ts)", mainSqlExecutionContext); mainCompiler.compile("backup table " + tableName, mainSqlExecutionContext); setFinalBackupPath(); String sourceSelectAll = selectAll(tableName, false); String backupSelectAll = selectAll(tableName, true); Assert.assertEquals(sourceSelectAll, backupSelectAll); }); }
Source:
private void showUpdates(ChangeInfo newInfo) { JsArray<MessageInfo> om = changeInfo.messages(); JsArray<MessageInfo> nm = newInfo.messages(); if (om == null) { om = JsArray.createArray().cast(); } if (nm == null) { nm = JsArray.createArray().cast(); } if (availableUpdate == null) { availableUpdate = new UpdatedBar() { @Override void onShow() { reload.reload(); } void onIgnore(Timestamp newTime) { lastDisplayedUpdate = newTime; } }; availableUpdate.addCloseHandler(new CloseHandler<PopupPanel>() { @Override public void onClose(CloseEvent<PopupPanel> event) { availableUpdate = null; } }); } availableUpdate.set( Natives.asList(nm).subList(om.length(), nm.length()), newInfo.updated()); if (!availableUpdate.isShowing()) { availableUpdate.popup(); } }

Target:
void showUpdates(ChangeInfo newInfo) { if (!isAttached() || newInfo.updated().equals(lastDisplayedUpdate)) { return; } JsArray<MessageInfo> om = changeInfo.messages(); JsArray<MessageInfo> nm = newInfo.messages(); if (om == null) { om = JsArray.createArray().cast(); } if (nm == null) { nm = JsArray.createArray().cast(); } if (updateAvailable == null) { updateAvailable = new UpdateAvailableBar() { @Override void onShow() { reload.reload(); } void onIgnore(Timestamp newTime) { lastDisplayedUpdate = newTime; } }; updateAvailable.addCloseHandler(new CloseHandler<PopupPanel>() { @Override public void onClose(CloseEvent<PopupPanel> event) { updateAvailable = null; } }); } updateAvailable.set( Natives.asList(nm).subList(om.length(), nm.length()), newInfo.updated()); if (!updateAvailable.isShowing()) { updateAvailable.popup(); } }
Source:
public Status update(String table, String key, Map<String, ByteIterator> values) { try { Set<String> fields = values.keySet(); PreparedStatement stmt = updateStmts.get(fields); if (stmt == null) { Update updateStmt = QueryBuilder.update(table); for (String field : fields) { updateStmt.with(QueryBuilder.set(field, QueryBuilder.bindMarker())); } updateStmt.where(QueryBuilder.eq(YCSB_KEY, QueryBuilder.bindMarker())); stmt = session.prepare(updateStmt); stmt.setConsistencyLevel(writeConsistencyLevel); if (trace) { stmt.enableTracing(); } PreparedStatement prevStmt = updateStmts.putIfAbsent(new HashSet(fields), stmt); if (prevStmt != null) { stmt = prevStmt; } } if (logger.isDebugEnabled()) { logger.debug(stmt.getQueryString()); logger.debug("key = {}", key); for (Map.Entry<String, ByteIterator> entry : values.entrySet()) { logger.debug("{} = {}", entry.getKey(), entry.getValue()); } } ColumnDefinitions vars = stmt.getVariables(); BoundStatement boundStmt = stmt.bind(); for (int i = 0; i < vars.size() - 1; i++) { boundStmt.setString(i, values.get(vars.getName(i)).toString()); } boundStmt.setString(vars.size() - 1, key); session.execute(boundStmt); return Status.OK; } catch (Exception e) { e.printStackTrace(); } return Status.ERROR; }

Target:
public Status update(String table, String key, Map<String, ByteIterator> values) { try { Set<String> fields = values.keySet(); PreparedStatement stmt = updateStmts.get(fields); if (stmt == null) { Update updateStmt = QueryBuilder.update(table); for (String field : fields) { updateStmt.with(QueryBuilder.set(field, QueryBuilder.bindMarker())); } updateStmt.where(QueryBuilder.eq(YCSB_KEY, QueryBuilder.bindMarker())); stmt = session.prepare(updateStmt); stmt.setConsistencyLevel(writeConsistencyLevel); if (trace) { stmt.enableTracing(); } PreparedStatement prevStmt = updateStmts.putIfAbsent(new HashSet(fields), stmt); if (prevStmt != null) { stmt = prevStmt; } } if (logger.isDebugEnabled()) { logger.debug(stmt.getQueryString()); logger.debug("key = {}", key); for (Map.Entry<String, ByteIterator> entry : values.entrySet()) { logger.debug("{} = {}", entry.getKey(), entry.getValue()); } } ColumnDefinitions vars = stmt.getVariables(); BoundStatement boundStmt = stmt.bind(); for (int i = 0; i < vars.size() - 1; i++) { boundStmt.setString(i, values.get(vars.getName(i)).toString()); } boundStmt.setString(vars.size() - 1, key); session.execute(boundStmt); return Status.OK; } catch (Exception e) { logger.error(MessageFormatter.format("Error updating key: {}", key).getMessage(), e); } return Status.ERROR; }
Source:
public void accept(PubSubMessage pubSubMessage, Context context) { OcrTranslateApiMessage ocrMessage = OcrTranslateApiMessage.fromPubsubData( pubSubMessage.data.getBytes()); String text = ocrMessage.getText(); String filename = ocrMessage.getFilename(); String lang = ocrMessage.getLang(); LOGGER.info("Received request to save file " + filename); String newFileName = String.format("%s_to_%s.txt", filename, lang); END functions_ocr_rename] LOGGER.info(String.format("Saving result to %s in bucket %s", newFileName, RESULT_BUCKET)); BlobInfo blobInfo = BlobInfo.newBuilder(BlobId.of(RESULT_BUCKET, newFileName)).build(); storage.create(blobInfo, text.getBytes()); LOGGER.info("File saved"); }

Target:
public void accept(PubSubMessage pubSubMessage, Context context) { OcrTranslateApiMessage ocrMessage = OcrTranslateApiMessage.fromPubsubData( pubSubMessage.data.getBytes(StandardCharsets.UTF_8)); LOGGER.info("Received request to save file " + ocrMessage.getFilename()); String newFileName = String.format( "%s_to_%s.txt", ocrMessage.getFilename(), ocrMessage.getLang()); END functions_ocr_rename] LOGGER.info(String.format("Saving result to %s in bucket %s", newFileName, RESULT_BUCKET)); BlobInfo blobInfo = BlobInfo.newBuilder(BlobId.of(RESULT_BUCKET, newFileName)).build(); storage.create(blobInfo, ocrMessage.getText().getBytes(StandardCharsets.UTF_8)); LOGGER.info("File saved"); }
Source:
public void removeGroupUnion(PerunSession sess, Group resultGroup, Group operandGroup) throws InternalErrorException, GroupNotExistsException, PrivilegeException, GroupRelationDoesNotExist, GroupRelationCannotBeRemoved, ExternallyManagedException { Utils.checkPerunSession(sess); getGroupsManagerBl().checkGroupExists(sess, resultGroup); getGroupsManagerBl().checkGroupExists(sess, operandGroup); if (getGroupsManagerBl().isGroupInStructureSynchronizationTree(sess, resultGroup)) { throw new ExternallyManagedException("Result group: " + resultGroup + " is externally managed!"); } else if (getGroupsManagerBl().isGroupInStructureSynchronizationTree(sess, operandGroup)) { throw new ExternallyManagedException("Operand group: " + operandGroup + " is externally managed!"); } if ( (!AuthzResolver.isAuthorized(sess, Role.VOADMIN, resultGroup) && !AuthzResolver.isAuthorized(sess, Role.GROUPADMIN, resultGroup)) || (!AuthzResolver.isAuthorized(sess, Role.VOADMIN, operandGroup) && !AuthzResolver.isAuthorized(sess, Role.GROUPADMIN, operandGroup)) ) { throw new PrivilegeException(sess, "removeGroupUnion"); } getGroupsManagerBl().removeGroupUnion(sess, resultGroup, operandGroup, false); }

Target:
public void removeGroupUnion(PerunSession sess, Group resultGroup, Group operandGroup) throws InternalErrorException, GroupNotExistsException, PrivilegeException, GroupRelationDoesNotExist, GroupRelationCannotBeRemoved, ExternallyManagedException { Utils.checkPerunSession(sess); getGroupsManagerBl().checkGroupExists(sess, resultGroup); getGroupsManagerBl().checkGroupExists(sess, operandGroup); if (getGroupsManagerBl().isGroupInStructureSynchronizationTree(sess, resultGroup)) { throw new ExternallyManagedException("Result group: " + resultGroup + " is externally managed!"); } if ( (!AuthzResolver.isAuthorized(sess, Role.VOADMIN, resultGroup) && !AuthzResolver.isAuthorized(sess, Role.GROUPADMIN, resultGroup)) || (!AuthzResolver.isAuthorized(sess, Role.VOADMIN, operandGroup) && !AuthzResolver.isAuthorized(sess, Role.GROUPADMIN, operandGroup)) ) { throw new PrivilegeException(sess, "removeGroupUnion"); } getGroupsManagerBl().removeGroupUnion(sess, resultGroup, operandGroup, false); }
Source:
public CompiledSchemaRepository<Schema> provide() { CompiledSchemaRepository repository = new DirectCompiledSchemaRepository<>(rawSchemaClient, SchemaCompilersFactory.avroSchemaCompiler()); if (configFactory.getBooleanProperty(SCHEMA_CACHE_ENABLED)) { return new CachedCompiledSchemaRepository<>(repository, configFactory.getIntProperty(SCHEMA_CACHE_COMPILED_MAXIMUM_SIZE), configFactory.getIntProperty(Configs.SCHEMA_CACHE_COMPILED_EXPIRE_AFTER_ACCESS_MINUTES)); } else { return repository; } }

Target:
public CompiledSchemaRepository<Schema> provide() { CompiledSchemaRepository<Schema> repository = new DirectCompiledSchemaRepository<>(rawSchemaClient, SchemaCompilersFactory.avroSchemaCompiler()); if (configFactory.getBooleanProperty(SCHEMA_CACHE_ENABLED)) { return new CachedCompiledSchemaRepository<>(repository, configFactory.getIntProperty(SCHEMA_CACHE_COMPILED_MAXIMUM_SIZE), configFactory.getIntProperty(Configs.SCHEMA_CACHE_COMPILED_EXPIRE_AFTER_ACCESS_MINUTES)); } else { return repository; } }
Source:
public void render(Context context, VDS host, SafeHtmlBuilder sb, String id) { if (host == null || !host.isUpdateAvailable()) { return; } ImageResource statusImage = resources.updateAvailableImage(); SafeHtml statusImageHtml = SafeHtmlUtils.fromTrustedString(AbstractImagePrototype.create(statusImage).getHTML()); sb.append(statusImageHtml); templates.hostAdditionalStatusIcon(id, statusImageHtml); }

Target:
public void render(Context context, VDS host, SafeHtmlBuilder sb, String id) { if (host == null || !host.isUpdateAvailable()) { return; } ImageResource statusImage = resources.updateAvailableImage(); SafeHtml statusImageHtml = SafeHtmlUtils.fromTrustedString(AbstractImagePrototype.create(statusImage).getHTML()); sb.append(templates.hostAdditionalStatusIcon(id, statusImageHtml)); }