auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public void handleLifecycleEvent(SaveablesLifecycleEvent event) { ISaveablesLifecycleListener lifecycleListener= getSite().getService(ISaveablesLifecycleListener.class); if (event.getEventType() == SaveablesLifecycleEvent.POST_CLOSE) { if (knownSaveables == null || knownSaveables.isEmpty()) return; java.util.List<Saveable> result = new ArrayList<Saveable>(); Saveable[] all = event.getSaveables(); for (int i = 0; i < all.length; i++) { Saveable saveable = all[i]; if (knownSaveables.contains(saveable)) result.add(saveable); knownSaveables.remove(saveable); } if (result.isEmpty()) return; event = new SaveablesLifecycleEvent(this, SaveablesLifecycleEvent.POST_CLOSE, result.toArray(new Saveable[result.size()]), false); } else if (event.getEventType() == SaveablesLifecycleEvent.POST_OPEN) { recordSaveables(event.getSaveables()); } lifecycleListener.handleLifecycleEvent(event); }

Target:
public void handleLifecycleEvent(SaveablesLifecycleEvent event) { ISaveablesLifecycleListener lifecycleListener= getSite().getService(ISaveablesLifecycleListener.class); if (event.getEventType() == SaveablesLifecycleEvent.POST_CLOSE) { if (knownSaveables == null || knownSaveables.isEmpty()) return; java.util.List<Saveable> result = new ArrayList<>(); Saveable[] all = event.getSaveables(); for (int i = 0; i < all.length; i++) { Saveable saveable = all[i]; if (knownSaveables.contains(saveable)) result.add(saveable); knownSaveables.remove(saveable); } if (result.isEmpty()) return; event = new SaveablesLifecycleEvent(this, SaveablesLifecycleEvent.POST_CLOSE, result.toArray(new Saveable[result.size()]), false); } else if (event.getEventType() == SaveablesLifecycleEvent.POST_OPEN) { recordSaveables(event.getSaveables()); } lifecycleListener.handleLifecycleEvent(event); }
Source:
private SolverManager<TestdataSolution, Integer> createSolverManagerTestableByDifferentConsumers() { final SolverConfig solverConfig = PlannerTestUtils.buildSolverConfig(TestdataSolution.class, TestdataEntity.class) .withPhases(new CustomPhaseConfig().withCustomPhaseCommands( (ScoreDirector<TestdataSolution> scoreDirector) -> { TestdataSolution solution = scoreDirector.getWorkingSolution(); TestdataEntity entity = solution.getEntityList().get(0); scoreDirector.beforeVariableChanged(entity, "value"); entity.setValue(solution.getValueList().get(0)); scoreDirector.afterVariableChanged(entity, "value"); scoreDirector.triggerVariableListeners(); }), new CustomPhaseConfig().withCustomPhaseCommands( (ScoreDirector<TestdataSolution> scoreDirector) -> { TestdataSolution solution = scoreDirector.getWorkingSolution(); TestdataEntity entity = solution.getEntityList().get(1); scoreDirector.beforeVariableChanged(entity, "value"); entity.setValue(solution.getValueList().get(1)); scoreDirector.afterVariableChanged(entity, "value"); scoreDirector.triggerVariableListeners(); })); SolverManagerConfig solverManagerConfig = new SolverManagerConfig(); return SolverManager.create(solverConfig, solverManagerConfig); }

Target:
private SolverManager<TestdataSolution, Integer> createSolverManagerTestableByDifferentConsumers() { final SolverConfig solverConfig = PlannerTestUtils.buildSolverConfig(TestdataSolution.class, TestdataEntity.class) .withPhases(createGraduallyInitializedPhaseConfigs()); SolverManagerConfig solverManagerConfig = new SolverManagerConfig(); return SolverManager.create(solverConfig, solverManagerConfig); }
Source:
protected boolean isInstalledPackage(String pkgName) { try { return service.getPersistence().getActivePackageId(pkgName) != null; } catch (PackageException e) { log.error(e); return false; } }

Target:
protected boolean isInstalledPackage(String pkgName) { try { return service.getPersistence().getActivePackageId(pkgName) != null; } catch (PackageException e) { log.error("Error checking installation of package " + pkgName, e); return false; } }
Source:
public void saveAccount(Account account) { StorageEditor editor = storage.edit(); if (!accounts.containsKey(account.getUuid())) { int accountNumber = generateAccountNumber(); account.setAccountNumber(accountNumber); } DI.get(AccountPreferenceSerializer.class).save(storage, editor, account); }

Target:
public void saveAccount(Account account) { StorageEditor editor = storage.edit(); if (!accounts.containsKey(account.getUuid())) { int accountNumber = generateAccountNumber(); account.setAccountNumber(accountNumber); } processChangedValues(account); accountPreferenceSerializer.save(storage, editor, account); }
Source:
public String getText(Object element) { return "Change " + ((ActivityEvent) element).getAttributes().get("taskId") + ": " + ((ActivityEvent) element).getSummary(); }

Target:
public String getText(Object element) { return NLS.bind("Change {0}: {1}", ((ActivityEvent) element).getAttributes().get("taskId"), ((ActivityEvent) element).getSummary()); }
Source:
private void checkAndUpdateProjectID(String projectID) { if (!preferences.isAuthenticationEnabled() || !preferences.getOrCreateProjectSetting(WatchDogUtils.getProjectName()).enableWatchdog) { preferences.registerProjectId(WatchDogUtils.getProjectName(), projectID); return; } if (projectID.length() < ID_LENGTH) { if(enableWatchdogInput.isSelected() && WatchDogUtils.isEmpty(projectIDInput.getText())) { new ProjectRegistrationWizard("Project Registration", WatchDogUtils.getProject()).show(); return; } Messages.showErrorDialog("Project ID must have 40 characters!", "Invalid Input"); isModified = true; } else { String url = NetworkUtils.buildExistingProjectURL(projectID); switch (NetworkUtils.urlExistsAndReturnsStatus200(url)) { case SUCCESSFUL: preferences.registerProjectId(WatchDogUtils.getProjectName(), projectID); break; case UNSUCCESSFUL: case NETWORK_ERROR: Messages.showErrorDialog("Project ID does not exist!", "Invalid Input"); isModified = true; break; } } }

Target:
private void checkAndUpdateProjectID(String projectID) { String projectName = WatchDogUtils.getProjectName(); if (!preferences.isAuthenticationEnabled() || !preferences.getOrCreateProjectSetting(projectName).enableWatchdog) { preferences.registerProjectId(WatchDogUtils.getProjectName(), projectID); return; } if (projectID.length() < ID_LENGTH) { if(enableWatchdogInput.isSelected() && WatchDogUtils.isEmpty(projectIDInput.getText())) { new ProjectRegistrationWizard("Project Registration", WatchDogUtils.getProject()).show(); return; } Messages.showErrorDialog("Project ID must have 40 characters!", "Invalid Input"); isModified = true; } else { String url = NetworkUtils.buildExistingProjectURL(projectID); switch (NetworkUtils.urlExistsAndReturnsStatus200(url)) { case SUCCESSFUL: preferences.registerProjectId(WatchDogUtils.getProjectName(), projectID); break; case UNSUCCESSFUL: case NETWORK_ERROR: Messages.showErrorDialog("Project ID does not exist!", "Invalid Input"); isModified = true; break; } } }
Source:
boolean match(AccountGroup.UUID uuid, boolean isChangeOwner) { if (AccountGroup.PROJECT_OWNERS.equals(uuid)) { return isDeclaredOwner(); } else if (AccountGroup.CHANGE_OWNERS.equals(uuid) && isChangeOwner) { return true; } else { return user.getEffectiveGroups().contains(uuid); } }

Target:
boolean match(AccountGroup.UUID uuid, boolean isChangeOwner) { if (AccountGroup.PROJECT_OWNERS.equals(uuid)) { return isDeclaredOwner(); } else if (AccountGroup.CHANGE_OWNERS.equals(uuid)) { return isChangeOwner; } else { return user.getEffectiveGroups().contains(uuid); } }
Source:
private void configureCacheHeaders(final HttpServletResponse res, final String module) { final String cacheScopeProperty = String.format(CACHE_SCOPE_PROPERTY_FORMAT, module); final String cacheScopeValue = environment.getProperty(cacheScopeProperty); logger.debug("Selecting cacheScopeValue='{}' for property '{}'", cacheScopeValue, cacheScopeProperty); final String cacheMaxAgeProperty = String.format(CACHE_MAXAGE_PROPERTY_FORMAT, module); final String cacheMaxAgeValue = environment.getProperty(cacheMaxAgeProperty); logger.debug("Selecting cacheMaxAgeValue='{}' for property '{}'", cacheMaxAgeValue, cacheMaxAgeProperty); final String cacheControl = (StringUtils.isNotEmpty(cacheScopeValue) && StringUtils.isNotEmpty(cacheMaxAgeValue)) ? cacheScopeValue + ", max-age=" + cacheMaxAgeValue : CACHE_CONTROL_NOSTORE; logger.debug("Setting cache-control='{}' for module '{}'", cacheControl, module); res.setHeader(Headers.CACHE_CONTROL.getName(), cacheControl); }

Target:
private void configureCacheHeaders(final HttpServletResponse res, final String module) { final String cacheScopeProperty = String.format(CACHE_SCOPE_PROPERTY_FORMAT, module); final String cacheScopeValue = environment.getProperty(cacheScopeProperty); logger.debug("Selecting cacheScopeValue='{}' for property '{}'", cacheScopeValue, cacheScopeProperty); final String cacheMaxAgeProperty = String.format(CACHE_MAXAGE_PROPERTY_FORMAT, module); final Integer cacheMaxAgeValueSeconds = environment.getProperty(cacheMaxAgeProperty, Integer.class); logger.debug("Selecting cacheMaxAgeValueSeconds='{}' for property '{}'", cacheMaxAgeValueSeconds, cacheMaxAgeProperty); final String cacheControl = (StringUtils.isNotEmpty(cacheScopeValue) && cacheMaxAgeValueSeconds != null) ? cacheScopeValue + ", max-age=" + cacheMaxAgeValueSeconds : CACHE_CONTROL_NOSTORE; logger.debug("Setting cache-control='{}' for module '{}'", cacheControl, module); res.setHeader(Headers.CACHE_CONTROL.getName(), cacheControl); }
Source:
public Optional<PlanNode> apply(PlanNode node, Lookup lookup, PlanNodeIdAllocator idAllocator, SymbolAllocator symbolAllocator, Session session) { LateralJoinNode lateralJoinNode = (LateralJoinNode) node; if (lateralJoinNode.getType() == JoinType.INNER) { return Optional.empty(); } if (!lateralJoinNode.getCorrelation().isEmpty()) { return Optional.empty(); } return Optional.of(new JoinNode( idAllocator.getNextId(), JoinType.INNER, lateralJoinNode.getInput(), lateralJoinNode.getSubquery(), ImmutableList.of(), ImmutableList.<Symbol>builder() .addAll(lateralJoinNode.getInput().getOutputSymbols()) .addAll(lateralJoinNode.getSubquery().getOutputSymbols()) .build(), Optional.empty(), Optional.empty(), Optional.empty(), Optional.empty())); }

Target:
public Optional<PlanNode> apply(PlanNode node, Lookup lookup, PlanNodeIdAllocator idAllocator, SymbolAllocator symbolAllocator, Session session) { LateralJoinNode lateralJoinNode = (LateralJoinNode) node; if (lateralJoinNode.getType() != JoinType.INNER) { return Optional.empty(); } if (!lateralJoinNode.getCorrelation().isEmpty()) { return Optional.empty(); } return Optional.of(new JoinNode( idAllocator.getNextId(), JoinType.INNER, lateralJoinNode.getInput(), lateralJoinNode.getSubquery(), ImmutableList.of(), ImmutableList.<Symbol>builder() .addAll(lateralJoinNode.getInput().getOutputSymbols()) .addAll(lateralJoinNode.getSubquery().getOutputSymbols()) .build(), Optional.empty(), Optional.empty(), Optional.empty(), Optional.empty())); }
Source:
public void canRetrieveUsers() throws Exception { MatcherAssert.assertThat( "Retrieved inexistent user", new User.Smart( new MkGithub().users().get("other") ).exists(), new IsEqual<>(true) ); }

Target:
public void canRetrieveUsers() throws Exception { MatcherAssert.assertThat( "Retrieved inexistent user", new User.Smart( new MkGithub().users().get("other") ).exists(), new IsEqual<Boolean>(false) ); }
Source:
public static void main(String...argv) throws Exception { Preconditions.checkElementIndex(0, argv.length, "Must specify broker URL"); String url = argv[0]; System.setProperty(ClientProperties.AMQP_VERSION, "0-10"); System.setProperty(ClientProperties.DEST_SYNTAX, "ADDR"); AMQConnectionFactory factory = new AMQConnectionFactory(url); Connection connection = factory.createConnection(); connection.start(); Session session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE); System.out.printf("Waiting up to %s milliseconds to receive %s messages\n", MESSAGE_TIMEOUT_MILLIS, MESSAGE_COUNT); try { Queue destination = session.createQueue(QUEUE); MessageConsumer messageConsumer = session.createConsumer(destination); int n = MESSAGE_COUNT; do { TextMessage msg = (TextMessage) messageConsumer.receive(MESSAGE_TIMEOUT_MILLIS); if (msg == null) break; System.out.printf("Got message: '%s'\n", msg.getText()); } while (--n > 0); } catch (Exception e) { System.err.printf("Error while receiving - %s\n", e.getMessage()); System.err.printf("Cause: %s\n", Throwables.getStackTraceAsString(e)); } finally { session.close(); connection.close(); } }

Target:
public static void main(String...argv) throws Exception { Preconditions.checkElementIndex(0, argv.length, "Must specify broker URL"); String url = argv[0]; System.setProperty(ClientProperties.AMQP_VERSION, "0-10"); System.setProperty(ClientProperties.DEST_SYNTAX, "ADDR"); AMQConnectionFactory factory = new AMQConnectionFactory(url); Connection connection = factory.createConnection(); connection.start(); Session session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE); System.out.printf("Waiting up to %s milliseconds to receive %s messages\n", MESSAGE_TIMEOUT_MILLIS, MESSAGE_COUNT); try { Queue destination = session.createQueue(QUEUE); MessageConsumer messageConsumer = session.createConsumer(destination); for (int n = 0; n < MESSAGE_COUNT; n++) { TextMessage msg = (TextMessage) messageConsumer.receive(MESSAGE_TIMEOUT_MILLIS); if (msg == null) { System.out.printf("No message received in %s milliseconds, exiting", MESSAGE_TIMEOUT_MILLIS); break; } System.out.printf("Got message %d: '%s'\n", n+1, msg.getText()); } } catch (Exception e) { System.err.printf("Error while receiving - %s\n", e.getMessage()); System.err.printf("Cause: %s\n", Throwables.getStackTraceAsString(e)); } finally { session.close(); connection.close(); } }
Source:
public BigDecimal getExchangeRateLast(String cryptoCurrency, String fiatCurrency) { if (!getFiatCurrencies().contains(fiatCurrency)) { return null; } final BnbTickerData BTC_USD_Price = api.getTicker("BTCUSDT"); final BnbTickerData Coin_BTC_Price = api.getTicker(cryptoCurrency + "BTC"); final List<Object> USDT_Fiat_data = api_tether.getTetherPrice(fiatCurrency.toLowerCase(), "tether"); if (USDT_Fiat_data != null && BTC_USD_Price.getPrice()!=null && Coin_BTC_Price.getPrice() !=null ) { final Map<String, Object> USDT_Fiat_json = (Map<String, Object>) USDT_Fiat_data.get(0); final Double USDT_Fiat = (Double) USDT_Fiat_json.get("current_price"); if (USDT_Fiat != 0) { final Float Coin_Fiat_Price = (float) (BTC_USD_Price.getPrice() * Coin_BTC_Price.getPrice() * USDT_Fiat); return new BigDecimal(String.format( "%.3f", Coin_Fiat_Price )); } else return null; } return null; }

Target:
public BigDecimal getExchangeRateLast(String cryptoCurrency, String fiatCurrency) { if (!getFiatCurrencies().contains(fiatCurrency)) { return null; } final BinanceTickerData btcUsdt = api.getTicker("BTCUSDT"); final BinanceTickerData lskBtc = api.getTicker(cryptoCurrency + "BTC"); CoinmarketcapRateSource coinMarketCapSource = new CoinmarketcapRateSource(fiatCurrency); BigDecimal lastUsdtFiat = coinMarketCapSource.getExchangeRateLast("USDT", fiatCurrency); if (lastUsdtFiat != null && btcUsdt.getPrice()!=null && lskBtc.getPrice() !=null ) { BigDecimal lastBtcPriceInUsdt = btcUsdt.getPrice(); BigDecimal lastLskPriceInBtc = lskBtc.getPrice(); BigDecimal lastLskPriceInUsdt = lastLskPriceInBtc.multiply(lastBtcPriceInUsdt); BigDecimal lastLskPriceInFiat = lastLskPriceInUsdt.multiply(lastUsdtFiat); return lastLskPriceInFiat; } return null; }
Source:
public void start() { advancedListener = new AdvancedPurgeListener<>(expirationManager); preloaded = false; enabled = configuration.persistence().usingStores(); if (!enabled) return; try { createLoadersAndWriters(); Transaction xaTx = null; if (transactionManager != null) { xaTx = transactionManager.suspend(); } storesMutex.readLock().lock(); try { Set<Lifecycle> undelegated = new HashSet<>(); nonTxWriters.forEach(w -> startWriter(w, undelegated)); txWriters.forEach(w -> startWriter(w, undelegated)); loaders.forEach(l -> startLoader(l, undelegated)); List<Observable<StoreAvailability>> availabilityChecks = storeStatuses.values().stream().map(s -> s.observable).collect(Collectors.toList()); Observable.merge(availabilityChecks) .observeOn(Schedulers.from(persistenceExecutor)) .subscribe(storeAvailability -> { storesMutex.writeLock().lock(); try { StoreStatus storeStatus = storeStatuses.get(storeAvailability.store); if (storeStatus.available != storeAvailability.available) { storeStatus.available = storeAvailability.available; cacheNotifier.notifyPersistenceAvailabilityChanged(storeAvailability.available); for (StoreStatus s : storeStatuses.values()) { if (!s.available) { unavailableException = new StoreUnavailableException(String.format("Store %s is unavailable", storeAvailability.store)); managerAvailable = false; return; } } if (!managerAvailable) { managerAvailable = true; unavailableException = null; } } } finally { storesMutex.writeLock().unlock(); } }); } finally { if (xaTx != null) { transactionManager.resume(xaTx); } storesMutex.readLock().unlock(); } } catch (Exception e) { throw new CacheException("Unable to start cache loaders", e); } }

Target:
public void start() { advancedListener = new AdvancedPurgeListener<>(expirationManager); preloaded = false; enabled = configuration.persistence().usingStores(); if (!enabled) return; try { createLoadersAndWriters(); Transaction xaTx = null; if (transactionManager != null) { xaTx = transactionManager.suspend(); } storesMutex.writeLock().lock(); try { Set<Lifecycle> undelegated = new HashSet<>(); nonTxWriters.forEach(w -> startWriter(w, undelegated)); txWriters.forEach(w -> startWriter(w, undelegated)); loaders.forEach(l -> startLoader(l, undelegated)); pollStoreAvailability(); long interval = configuration.persistence().availabilityInterval(); availabilityFuture = persistenceExecutor.scheduleAtFixedRate(this::pollStoreAvailability, interval, interval, TimeUnit.MILLISECONDS); } finally { if (xaTx != null) { transactionManager.resume(xaTx); } storesMutex.writeLock().unlock(); } } catch (Exception e) { throw new CacheException("Unable to start cache loaders", e); } }
Source:
private void signJar(File outputFile) { SecurityLogger.audit("Signing exported data. file: [{}]", outputFile.getName()); console.println("Signing zip file..."); Instant start = Instant.now(); jarSigner.signJar( outputFile, System.getProperty(SystemBaseUrl.EXTERNAL_HOST), AccessController.doPrivileged( (PrivilegedAction<String>) () -> System.getProperty("javax.net.ssl.keyStorePassword")), AccessController.doPrivileged( (PrivilegedAction<String>) () -> System.getProperty("javax.net.ssl.keyStore")), AccessController.doPrivileged( (PrivilegedAction<String>) () -> System.getProperty("javax.net.ssl.keyStorePassword"))); console.println("zip file signed in: " + getFormattedDuration(start)); }

Target:
private void signJar(File outputFile) { SecurityLogger.audit("Signing exported data. file: [{}]", outputFile.getName()); console.println("Signing zip file..."); Instant start = Instant.now(); jarSigner.signJar( outputFile, AccessController.doPrivileged( (PrivilegedAction<String>) () -> System.getProperty(SystemBaseUrl.EXTERNAL_HOST)), AccessController.doPrivileged( (PrivilegedAction<String>) () -> System.getProperty("javax.net.ssl.keyStorePassword")), AccessController.doPrivileged( (PrivilegedAction<String>) () -> System.getProperty("javax.net.ssl.keyStore")), AccessController.doPrivileged( (PrivilegedAction<String>) () -> System.getProperty("javax.net.ssl.keyStorePassword"))); console.println("zip file signed in: " + getFormattedDuration(start)); }
Source:
protected void end() { log.debug("end called"); if(execThread != null) { log.debug("Interrupting exec thread"); this.execThread.interrupt(); } log.debug("Cancelling invoked commands"); if(this.invokedCommands != null) { for(Command command : invokedCommands) { command.cancel(); } this.invokedCommands = null; } }

Target:
public void end() { log.info("Ending"); if(execThread != null) { log.debug("Interrupting exec thread"); this.execThread.interrupt(); } log.debug("Cancelling invoked commands"); if(this.invokedCommands != null) { for(BaseCommand command : invokedCommands) { log.info("Cancelling command " + command); command.cancel(); } this.invokedCommands = null; } else { log.info("No invoked commands to cancel"); } }
Source:
public boolean canLogAtLevel(LogLevel logLevel) { switch (logLevel) { case VERBOSE: return logger.isDebugEnabled(); case INFORMATIONAL: return logger.isInfoEnabled(); case WARNING: return logger.isWarnEnabled(); case ERROR: return logger.isErrorEnabled(); default: return false; } }

Target:
public boolean canLogAtLevel(LogLevel logLevel) { if (logLevel == null) { return false; } switch (logLevel) { case VERBOSE: return logger.isDebugEnabled(); case INFORMATIONAL: return logger.isInfoEnabled(); case WARNING: return logger.isWarnEnabled(); case ERROR: return logger.isErrorEnabled(); default: return false; } }
Source:
public static long millisUntilNextAvailableRequest(long secondsToNextAvailableRequest) { return secondsToNextAvailableRequest * 8000; }

Target:
public static long millisUntilNextAvailableRequest(long secondsToNextAvailableRequest) { return secondsToNextAvailableRequest * 1000; }
Source:
private static void registerSpellcasterFactionNpc() { NpcFactionDeclaration reg; Supplier<Runnable> register_wizardry_spellcaster = () -> () -> { wizreg = new NpcFactionDeclaration(NpcFactionSpellcasterWizardry.class, AWEntityRegistry.NPC_FACTION_SPELLCASTER, SPELLCASTER_SUBTYPE); addNpcRegistration(wizreg); }; if (Loader.isModLoaded("ebwizardry")) { register_wizardry_spellcaster.get().run(); } else { reg = new NpcFactionDeclaration(NpcFactionSpellcaster.class, AWEntityRegistry.NPC_FACTION_SPELLCASTER, SPELLCASTER_SUBTYPE); addNpcRegistration(reg); } }

Target:
private static void registerSpellcasterFactionNpc() { NpcFactionDeclaration reg; Supplier<Runnable> registerWizardrySpellcaster = () -> () -> { wizreg = new NpcFactionDeclaration(NpcFactionSpellcasterWizardry.class, AWEntityRegistry.NPC_FACTION_SPELLCASTER, SPELLCASTER_SUBTYPE); addNpcRegistration(wizreg); }; if (Loader.isModLoaded("ebwizardry")) { registerWizardrySpellcaster.get().run(); } else { reg = new NpcFactionDeclaration(NpcFactionSpellcaster.class, AWEntityRegistry.NPC_FACTION_SPELLCASTER, SPELLCASTER_SUBTYPE); addNpcRegistration(reg); } }
Source:
private boolean updateParameters() { for (MoveDiskParameters moveDiskParameters : getParameters().getParametersList()) { DiskImage diskImage = getDiskImageDao().getAncestor(moveDiskParameters.getImageId()); if (diskImage == null) { return failCanDoAction(VdcBllMessages.ACTION_TYPE_FAILED_DISK_NOT_EXIST); } List<VM> allVms = getVmDAO().getVmsListForDisk(diskImage.getId()); VM vm = !allVms.isEmpty() ? allVms.get(0) : null; SnapshotsValidator snapshotsValidator = new SnapshotsValidator(); if (vm != null && !validate(snapshotsValidator.vmNotInPreview(vm.getId()))) { return false; } else if (vm == null || isVmDown(vm)) { moveParametersList.add(moveDiskParameters); } else if (isVmRunning(vm)) { MultiValueMapUtils.addToMap(vm.getId(), createLiveMigrateDiskParameters(moveDiskParameters, vm.getId()), vmsLiveMigrateParametersMap); } else { addCanDoActionMessage(String.format("$%1$s %2$s", "VmName", vm.getVmName())); return failCanDoAction(VdcBllMessages.ACTION_TYPE_FAILED_VM_IS_NOT_DOWN_OR_UP); } } return true; }

Target:
private boolean updateParameters() { for (MoveDiskParameters moveDiskParameters : getParameters().getParametersList()) { DiskImage diskImage = getDiskImageDao().get(moveDiskParameters.getImageId()); if (diskImage == null) { return failCanDoAction(VdcBllMessages.ACTION_TYPE_FAILED_DISK_NOT_EXIST); } List<VM> allVms = getVmDAO().getVmsListForDisk(diskImage.getId()); VM vm = !allVms.isEmpty() ? allVms.get(0) : null; SnapshotsValidator snapshotsValidator = new SnapshotsValidator(); if (vm != null && !validate(snapshotsValidator.vmNotInPreview(vm.getId()))) { return false; } if (vm == null || isVmDown(vm)) { moveParametersList.add(moveDiskParameters); } else if (isVmRunning(vm)) { MultiValueMapUtils.addToMap(vm.getId(), createLiveMigrateDiskParameters(moveDiskParameters, vm.getId()), vmsLiveMigrateParametersMap); } else { addCanDoActionMessage(String.format("$%1$s %2$s", "VmName", vm.getVmName())); return failCanDoAction(VdcBllMessages.ACTION_TYPE_FAILED_VM_IS_NOT_DOWN_OR_UP); } } return true; }
Source:
public String getContent() { String contentUrl = this.getAsString(WikiXPath.enclosureUrl); StringWriter writer = new StringWriter(); try { InputStream contentStream = (InputStream)getService().getEndpoint().xhrGet(contentUrl).getData(); IOUtils.copy(contentStream, writer, "UTF-8"); contentStream.close(); } catch (IOException e) { e.printStackTrace(); } catch (ClientServicesException e) { e.printStackTrace(); } String content = writer.toString(); return content; }

Target:
public String getContent() { if (fields.containsKey(AtomXPath.content.getName())){ Object value = fields.get(AtomXPath.content.getName()); return (value == null) ? null : value.toString(); } String content = ""; try { content = getHtmlMarkup(); } catch (ClientServicesException e) { e.printStackTrace(); } return content; }
Source:
private void notifySerialDataReceived(final String address, final byte[] data) { logger.info("Serial data received from >> {}.", address, HexUtils.prettyHexString(HexUtils.byteArrayToHexString(data))); try { synchronized (serialDataReceiveListeners) { ScheduledExecutorService executor = Executors.newScheduledThreadPool(Math.min(MAXIMUM_PARALLEL_LISTENER_THREADS, serialDataReceiveListeners.size())); for (final ISerialDataReceiveListener listener:serialDataReceiveListeners) { executor.execute(new Runnable() { public void run() { listener.serialDataReceived(address, data); } }); } executor.shutdown(); } } catch (Exception e) { logger.error(e.getMessage(), e); } }

Target:
private void notifySerialDataReceived(final String address, final byte[] data) { logger.info(connectionInterface.toString() + "Serial data received from >> {}.", address, HexUtils.prettyHexString(HexUtils.byteArrayToHexString(data))); try { synchronized (serialDataReceiveListeners) { ScheduledExecutorService executor = Executors.newScheduledThreadPool(Math.min(MAXIMUM_PARALLEL_LISTENER_THREADS, serialDataReceiveListeners.size())); for (final ISerialDataReceiveListener listener:serialDataReceiveListeners) { executor.execute(new Runnable() { public void run() { listener.serialDataReceived(address, data); } }); } executor.shutdown(); } } catch (Exception e) { logger.error(e.getMessage(), e); } }
Source:
private UnbackedAnnotatedType(AnnotatedType<X> source, AnnotatedTypeIdentifier identifier, SharedObjectCache cache) { super(source.getBaseType(), source.getTypeClosure(), source.getAnnotations()); this.javaClass = source.getJavaClass(); Set<AnnotatedConstructor<X>> constructors = new HashSet<AnnotatedConstructor<X>>(source.getConstructors().size()); for (AnnotatedConstructor<X> constructor : source.getConstructors()) { constructors.add(UnbackedAnnotatedConstructor.of(constructor, this, cache)); } this.constructors = immutableSet(constructors); Set<AnnotatedMethod<? super X>> methods = new HashSet<AnnotatedMethod<? super X>>(source.getMethods().size()); for (AnnotatedMethod<? super X> originalMethod : source.getMethods()) { methods.add(UnbackedAnnotatedMethod.of(originalMethod, this, cache)); } this.methods = immutableSet(methods); Set<AnnotatedField<? super X>> fields = new HashSet<AnnotatedField<? super X>>(source.getFields().size()); for (AnnotatedField<? super X> originalField : source.getFields()) { fields.add(UnbackedAnnotatedField.of(originalField, this, cache)); } this.fields = immutableSet(fields); this.identifier = identifier; }

Target:
private UnbackedAnnotatedType(AnnotatedType<X> source, AnnotatedTypeIdentifier identifier, SharedObjectCache cache) { super(source.getBaseType(), source.getTypeClosure(), source.getAnnotations()); this.javaClass = source.getJavaClass(); ImmutableSet.Builder<AnnotatedConstructor<X>> constructors = ImmutableSet.builder(); for (AnnotatedConstructor<X> constructor : source.getConstructors()) { constructors.add(UnbackedAnnotatedConstructor.of(constructor, this, cache)); } this.constructors = constructors.build(); ImmutableSet.Builder<AnnotatedMethod<? super X>> methods = ImmutableSet.builder(); for (AnnotatedMethod<? super X> originalMethod : source.getMethods()) { methods.add(UnbackedAnnotatedMethod.of(originalMethod, this, cache)); } this.methods = methods.build(); ImmutableSet.Builder<AnnotatedField<? super X>> fields = ImmutableSet.builder(); for (AnnotatedField<? super X> originalField : source.getFields()) { fields.add(UnbackedAnnotatedField.of(originalField, this, cache)); } this.fields = fields.build(); this.identifier = identifier; }
Source:
public int hashCode() { return Objects.hashCode( address, emailAddress, firstName, gifterName, lastName, method, personalMessage ); }

Target:
public int hashCode() { return Objects.hashCode( address, deliverAt, emailAddress, firstName, gifterName, lastName, method, personalMessage ); }
Source:
public static void init() { SQLUnitTest.init(); requestHeaders.add("bypassingCache", "true"); }

Target:
public static void init() { SQLUnitTest.init(); }
Source:
public <T extends AbstractNodeMapping> void iterate(final MappingsListVisitor visitor, final DragAndDropTarget container) { if (descriptionMappings.isLayerMode() && container instanceof DSemanticDecorator && !new DSemanticDecoratorQuery((DSemanticDecorator) container).hasDetachedTarget()) { if (container instanceof DDiagram) { iterateOnMappings(getContainerMappings(), visitor); iterateOnMappings(getNodeMappings(), visitor); } else if (container instanceof DNodeContainer) { iterateOnMappings(getContainerMappings((DNodeContainer) container), visitor); iterateOnMappings(getNodeMappings((DNodeContainer) container), visitor); iterateOnMappings(getBorderedNodeMappings((DNodeContainer) container), visitor); } else if (container instanceof DNodeList) { iterateOnMappings(getNodeMappings((DNodeList) container), visitor); } else if (container instanceof DNode) { iterateOnMappings(getBorderedNodeMappings((DNode) container), visitor); } } }

Target:
public <T extends AbstractNodeMapping> void iterate(final MappingsListVisitor visitor, final DragAndDropTarget container) { if (descriptionMappings.isLayerMode()) { if (container instanceof DSemanticDecorator) { DSemanticDecorator dSemanticDecorator = (DSemanticDecorator) container; if (!new DSemanticDecoratorQuery(dSemanticDecorator).hasDetachedTarget()) { safeIterate(visitor, container); } } else { safeIterate(visitor, container); } } }
Source:
public void onRefresh() { mSwipeLayout.setRefreshing(false); }

Target:
public void onRefresh() { supportInvalidateOptionsMenu(); mSwipeLayout.setRefreshing(false); }
Source:
public void contextMenuDisabling_noIssueInListView_contextMenuItemsDisabled() { clickFilterTextFieldAtPanel(0); type("asdf"); push(KeyCode.ENTER); sleep(EVENT_DELAY); rightClickPanel(0); sleep(EVENT_DELAY); ContextMenu contextMenu = issuePanel.getContextMenu(); assertNull(contextMenu.getItems().get(0).getText()); }

Target:
public void contextMenuDisabling_noIssueInListView_contextMenuItemsDisabled() { clickFilterTextFieldAtPanel(0); type("asdf"); push(KeyCode.ENTER); sleep(EVENT_DELAY); rightClickPanel(0); sleep(EVENT_DELAY); ContextMenu contextMenu = issuePanel.getContextMenu(); isDisabledContextMenu(contextMenu); }
Source:
static void updateThreadName(Request data) { String name = data.getName(); StringBuilder builder = BUILDER.get(); builder.setLength(0); builder.ensureCapacity(Utils.THREAD_PREFIX.length() + name.length()); builder.append(Utils.THREAD_PREFIX); builder.append(name); Thread.currentThread().setName(builder.toString()); }

Target:
static void updateThreadName(Request data) { String name = data.getName(); StringBuilder builder = NAME_BUILDER.get(); builder.ensureCapacity(Utils.THREAD_PREFIX.length() + name.length()); builder.replace(Utils.THREAD_PREFIX.length(), builder.length(), name); Thread.currentThread().setName(builder.toString()); }
Source:
protected static void writeResource(String url, Object content) throws RegistryResourceException { try { Gson gson = new Gson(); Resource resource = registry.newResource(); resource.setContent(gson.toJson(content)); resource.setMediaType("application/json"); registry.put(url, resource); } catch (Exception re) { String errorMessage = "Unable to write resource at url:" + url; logger.error(errorMessage); throw new RegistryResourceException(errorMessage); } }

Target:
public static void writeResource(String url, Object content) throws RegistryException { Gson gson = new Gson(); Resource resource = registry.newResource(); resource.setContent(gson.toJson(content)); resource.setMediaType(APPLICATION_JSON); registry.put(url, resource); }
Source:
public void remove(String path) throws IOException { final File fileToDelete = new File(path); if (!fileToDelete.exists()) { LOGGER.debug(String.format("Cannot remove file or directory: path \"%s\" does not exist", path)); return; } assertInDirectory(fileToDelete); if (fileToDelete.isDirectory()) { FileUtils.deleteDirectory(fileToDelete); } else { Files.deleteIfExists(fileToDelete.toPath()); } }

Target:
public void remove(String path) throws IOException { final File fileToDelete = new File(path); assertInDirectory(fileToDelete); if (!fileToDelete.exists()) { LOGGER.debug(String.format("Cannot remove file or directory: path \"%s\" does not exist", path)); return; } if (fileToDelete.isDirectory()) { FileUtils.deleteDirectory(fileToDelete); } else { Files.deleteIfExists(fileToDelete.toPath()); } }
Source:
public void getMemberships_shouldGetMembershipsAsOfADate() throws Exception { executeDataSet(COHORT_XML); Cohort cohort = Context.getCohortService().getCohort(1); CohortMembership newMember = new CohortMembership((new Patient(4))); SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); Date dateToTest = dateFormat.parse("2016-11-01 00:00:00"); newMember.setStartDate(dateToTest); service.addMembershipToCohort(cohort, newMember); List<CohortMembership> membersAsOfDate = cohort.getMemberships(dateToTest); assertFalse(membersAsOfDate.isEmpty()); }

Target:
public void getMemberships_shouldGetMembershipsAsOfADate() throws Exception { executeDataSet(COHORT_XML); Cohort cohort = Context.getCohortService().getCohort(1); CohortMembership newMember = new CohortMembership((new Patient(4))); SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); Date dateToTest = dateFormat.parse("2016-11-01 00:00:00"); newMember.setStartDate(dateToTest); service.addMembershipToCohort(cohort, newMember); List<CohortMembership> membersAsOfDate = cohort.getMemberships(dateToTest); assertFalse(membersAsOfDate.isEmpty()); assertTrue(membersAsOfDate.stream().anyMatch(m -> m.getStartDate().equals(dateToTest))); }
Source:
private void deployJob(final Job job) throws Exception { if (job != null) { ModuleDescriptor descriptor = createJobModuleDescriptor(job.getName(), job.getJobModuleDescriptor().getModuleName()); ModuleDeploymentWriter.ModuleDeploymentPropertiesProvider provider = new ModuleDeploymentWriter.ModuleDeploymentPropertiesProvider() { @Override public ModuleDeploymentProperties propertiesForDescriptor(ModuleDescriptor descriptor) { return DeploymentUtility.createModuleDeploymentProperties(job.getDeploymentProperties(), descriptor); } }; List<ModuleDescriptor> descriptors = new ArrayList<ModuleDescriptor>(); descriptors.add(descriptor); Collection<ModuleDeploymentWriter.Result> results = moduleDeploymentWriter.writeDeployment(descriptors.iterator(), provider); moduleDeploymentWriter.validateResults(results); } }

Target:
private void deployJob(final Job job) throws Exception { if (job != null) { ModuleDeploymentWriter.ModuleDeploymentPropertiesProvider provider = new ModuleDeploymentWriter.ModuleDeploymentPropertiesProvider() { @Override public ModuleDeploymentProperties propertiesForDescriptor(ModuleDescriptor descriptor) { return DeploymentPropertiesUtility.createModuleDeploymentProperties( job.getDeploymentProperties(), descriptor); } }; List<ModuleDescriptor> descriptors = new ArrayList<ModuleDescriptor>(); descriptors.add(job.getJobModuleDescriptor()); Collection<ModuleDeploymentWriter.Result> results = moduleDeploymentWriter.writeDeployment(descriptors.iterator(), provider); moduleDeploymentWriter.validateResults(results); } }
Source:
public void createSubnet() throws InterruptedException { server.enqueue(jsonResponse("/createsubnetresponse.json").setResponseCode(200)); final SubnetApi subnetApi = api.getSubnetApi(resourcegroup, virtualNetwork); Subnet.SubnetProperties properties = Subnet.SubnetProperties.create(null, "10.2.0.0/24", null); Subnet subnet = subnetApi.createOrUpdateSubnet(subnetName, properties); String path = String.format("/subscriptions/%s/resourcegroups/%s/providers/Microsoft.Network/virtualNetworks/%s/subnets/%s?%s", subscriptionid, resourcegroup, virtualNetwork, subnetName, apiVersion); String json = String.format("{ \"properties\":{\"addressPrefix\":\"%s\"}}", "10.2.0.0/24"); assertSent(server, "PUT", path, json); assertEquals(subnet.name(), subnetName); assertEquals(subnet.properties().addressPrefix(), "10.2.0.0/24"); }

Target:
public void createSubnet() throws InterruptedException { server.enqueue(jsonResponse("/createsubnetresponse.json").setResponseCode(200)); final SubnetApi subnetApi = api.getSubnetApi(resourcegroup, virtualNetwork); Subnet.SubnetProperties properties = Subnet.SubnetProperties.builder().addressPrefix("10.2.0.0/24").build(); Subnet subnet = subnetApi.createOrUpdate(subnetName, properties); String path = String.format("/subscriptions/%s/resourcegroups/%s/providers/Microsoft.Network/virtualNetworks/%s/subnets/%s?%s", subscriptionid, resourcegroup, virtualNetwork, subnetName, apiVersion); String json = "{ \"properties\":{\"addressPrefix\":\"10.2.0.0/24\"}}"; assertSent(server, "PUT", path, json); assertEquals(subnet.name(), subnetName); assertEquals(subnet.properties().addressPrefix(), "10.2.0.0/24"); }
Source:
private String buildCounterName(String prefix, String name, Map<String, String> tags) { return prefix + "." + name + "." + tags.values().stream().collect(Collectors.joining(".")); }

Target:
private String buildCounterName(String prefix, String name, Map<String, String> tags) { return prefix + "." + name + "." + String.join(".", tags.values()); }
Source:
private void executeAddSecurityConstraintCommand(List<InputPair> inputs) throws Exception { try (CommandController commandController = testHarness .createCommandController(AddSecurityConstraintCommand.class, project.getRoot())) { commandController.initialize(); for (InputPair input : inputs) { commandController.setValueFor(input.inputName, input.inputValue); } commandController.execute(); } }

Target:
private void executeAddSecurityConstraintCommand(List<InputPair> inputs) throws Exception { try (CommandController commandController = testHarness .createCommandController(AddSecurityConstraintCommand.class, project.getRoot())) { commandController.initialize(); for (InputPair input : inputs) { commandController.setValueFor(input.inputName, input.inputValue); } Result result = commandController.execute(); assertFalse(result instanceof Failed); } }
Source:
private void addLastUpdateTime(BusinessDetail businessDetail) { try { if(PropertyAccessor.getInstance().getPropertyBoolean(GATEWAY_PROPERTY_FILE, UDDI_UPDATE_TIME)) { businessDetail.setUddiUpdatetime(getTimestamp()); } } catch (PropertyAccessException ex) { LOG.error("Unable to access property: " + UDDI_UPDATE_TIME, ex); } catch (DatatypeConfigurationException ex) { LOG.error("Unable to create timestamp for: " + UDDI_UPDATE_TIME, ex); } }

Target:
private void addLastUpdateTime(BusinessDetail businessDetail) { try { if(PropertyAccessor.getInstance().getPropertyBoolean(GATEWAY_PROPERTY_FILE, UDDI_UPDATE_TIME)) { businessDetail.setUddiUpdatetime(getTimestamp()); } } catch (PropertyAccessException ex) { LOG.error("Unable to access property: {}", UDDI_UPDATE_TIME, ex); } catch (DatatypeConfigurationException ex) { LOG.error("Unable to create timestamp for: {}", UDDI_UPDATE_TIME, ex); } }
Source:
public List<AudioData> speakBlocking(String toSpeak) { if (mouth != null && !mute) { try { return mouth.speakBlocking(toSpeak); } catch (Exception e) { Logging.logError(e); } } return null; }

Target:
public List<AudioData> speakBlocking(String toSpeak) { if (mouth == null) { log.error("speakBlocking is called, but my mouth is NULL..."); return null; } if (!mute) { try { return mouth.speakBlocking(toSpeak); } catch (Exception e) { Logging.logError(e); } } return null; }
Source:
public void testCreateEmailMessage(){ List<String> senderList = new ArrayList<String>(); senderList.add("sender@xxx.com"); EmailMessage emailMessage = null; Props props = new Props(); props.put("mail.port",445); props.put("mail.user","somebody"); props.put("mail.password","pwd"); props.put("mail.sender","somebody@xxx.com"); props.put("server.port","114"); props.put("server.useSSL","false"); AbstractMailer mailer = new AbstractMailer(props); emailMessage = mailer.createEmailMessage("subject","text/html",senderList); assert emailMessage.getMailPort()==445; Props defaultProps = new Props(); defaultProps.put("mail.user","somebody"); defaultProps.put("mail.password","pwd"); defaultProps.put("mail.sender","somebody@xxx.com"); defaultProps.put("server.port","114"); defaultProps.put("server.useSSL","false"); mailer = new AbstractMailer(defaultProps); emailMessage = mailer.createEmailMessage("subject","text/html",senderList); assert emailMessage.getMailPort()==25; }

Target:
public void testCreateEmailMessage(){ Props props = createMailProperties(); props.put("mail.port","445"); AbstractMailer mailer = new AbstractMailer(props); EmailMessage emailMessage = mailer.createEmailMessage("subject","text/html",senderList); assert emailMessage.getMailPort()==445; }
Source:
public static void main(String[] args) { CommandLineParameters params = new CommandLineParameters(); try { JCommander jc = new JCommander(params, args); if (params.help) { jc.setProgramName("java -Xmx[several]G -jar otp.jar"); jc.usage(); System.exit(0); } if (params.version) { ch.qos.logback.classic.Logger mavenVersionLogger = (ch.qos.logback.classic.Logger)LoggerFactory.getLogger(MavenVersion.class); mavenVersionLogger.setLevel(Level.OFF); MavenVersion version = MavenVersion.VERSION; System.out.println(version.getVersion(params.versionFragment)); System.exit(0); } params.infer(); } catch (ParameterException pex) { LOG.error("Parameter error: {}", pex.getMessage()); System.exit(1); } if (params.build == null && !params.visualize && !params.server && params.scriptFile == null) { LOG.info("Nothing to do. Use --help to see available tasks."); System.exit(-1); } OTPMain main = new OTPMain(params); main.run(); }

Target:
public static void main(String[] args) { CommandLineParameters params = new CommandLineParameters(); try { JCommander jc = new JCommander(params, args); if (params.help) { jc.setProgramName("java -Xmx[several]G -jar otp.jar"); jc.usage(); System.exit(0); } if (params.version) { MavenVersion version = MavenVersion.VERSION; System.out.println(version.getVersion()); System.exit(0); } params.infer(); } catch (ParameterException pex) { LOG.error("Parameter error: {}", pex.getMessage()); System.exit(1); } if (params.build == null && !params.visualize && !params.server && params.scriptFile == null) { LOG.info("Nothing to do. Use --help to see available tasks."); System.exit(-1); } OTPMain main = new OTPMain(params); main.run(); }
Source:
public HttpResponse addApplicationWithCustomAttributes (String application, String tier, String callbackUrl, String description, String applicationAttributes) throws APIManagerIntegrationTestException { try { checkAuthentication(); String urlAppAttributes = URLEncoder.encode(applicationAttributes, "UTF-8"); return HTTPSClientUtils.doPost( new URL(backendURL + "store/site/blocks/application/application-add" + "/ajax/application-add.jag?action=addApplication&tier=" + tier + "&callbackUrl=" + callbackUrl + "&description=" + description + "&application=" + application + "&applicationAttributes=" + urlAppAttributes), "", requestHeaders); } catch (Exception e) { throw new APIManagerIntegrationTestException("Unable to add application - " + application + " with custom attributes. Error: " + e.getMessage(), e); } }

Target:
public HttpResponse addApplicationWithCustomAttributes (String application, String tier, String callbackUrl, String description, String applicationAttributes) throws APIManagerIntegrationTestException { try { checkAuthentication(); String urlAppAttributes = URLEncoder.encode(applicationAttributes, "UTF-8"); return HTTPSClientUtils.doPost( new URL(backendURL + "store/site/blocks/application/application-add" + "/ajax/application-add.jag?action=addApplication&tier=" + tier + "&callbackUrl=" + callbackUrl + "&description=" + description + "&application=" + application + "&applicationAttributes=" + urlAppAttributes), "", requestHeaders); } catch (IOException e) { String message = "Unable to add application - " + application + " with custom attributes. Error: " + e.getMessage(); log.error(message); throw new APIManagerIntegrationTestException(message, e); } }
Source:
private static String getLinkedResourceExpectedUri( final String entityApi, final String entityId, final Set<String> optionalHalParams, final String linkedEntityType) throws URISyntaxException { final String uriPath = new StringBuilder() .append(entityApi) .append("/") .append(entityId) .append("/") .append(linkedEntityType) .toString(); final String uriString = new URI(URI_SCHEME, URI_HOST, uriPath, null).toString(); String halParams = ""; if (optionalHalParams != null && !optionalHalParams.isEmpty()) { halParams = new StringBuilder() .append("{?") .append(StringUtils.join(optionalHalParams, ",")) .append("}") .toString(); } return uriString + halParams; }

Target:
private static String getLinkedResourceExpectedUri( final String entityApi, final String entityId, final Set<String> optionalHalParams, final String linkedEntityType) throws URISyntaxException { final String uriPath = new StringBuilder() .append(entityApi) .append("/") .append(entityId) .append("/") .append(linkedEntityType) .toString(); final String uriString = new URI(URI_SCHEME, URI_HOST, uriPath, null).toString(); final StringBuilder halParamsStringBuilder = new StringBuilder(); if (optionalHalParams != null && !optionalHalParams.isEmpty()) { halParamsStringBuilder .append("{?") .append(StringUtils.join(optionalHalParams, ",")) .append("}") .toString(); } return uriString + halParamsStringBuilder.toString(); }
Source:
public CborObject toCbor() { Map<String, CborObject> result = new TreeMap<>(); result.put("b", dummySource.toCbor()); result.put("k", cipher.toCbor()); return CborObject.CborMap.build(result); }

Target:
public CborObject toCbor() { Map<String, CborObject> result = new TreeMap<>(); result.put("k", dummySource.toCbor()); result.put("f", followRequest.toCbor()); return CborObject.CborMap.build(result); }
Source:
public List<Capability> findByIds(List<Integer> ids) { ids = ImmutableList.copyOf(new TreeSet<>(ids)); List<Capability> capabilities = Lists.newArrayList(); for (Integer id : ids) { if (this.capabilities.containsKey(id)) { Capability capability = this.capabilities.get(id); capabilities.add(capability); } } return capabilities; }

Target:
public CapabilityList findByIds(List<Integer> ids) { ids = Lists.newArrayList(new TreeSet<>(ids)); List<Capability> capabilities = Lists.newArrayList(); for (Integer id : ids) { if (this.capabilities.containsKey(id)) { Capability capability = this.capabilities.get(id); capabilities.add(capability); } } return new CapabilityList(capabilities); }