auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public void testStatusBasedFilter() throws ParseException { DataStoreTransaction dtx = elide.getDataStore().beginTransaction(); transactionRegistry.addRunningTransaction(UUID.fromString("edc4a871-dff2-4054-804e-d80075cf828d"), dtx); transactionRegistry.addRunningTransaction(UUID.fromString("edc4a871-dff2-4054-804e-d80075cf827d"), dtx); transactionRegistry.addRunningTransaction(UUID.fromString("edc4a871-dff2-4054-804e-d80075cf826d"), dtx); AsyncQuery asyncQuery1 = createAsyncQueryTestObject("edc4a871-dff2-4054-804e-d80075cf828d", 1577883600000L, QueryStatus.CANCEL_COMPLETE); AsyncQuery asyncQuery2 = createAsyncQueryTestObject("edc4a871-dff2-4054-804e-d80075cf827d", 1577883600000L, QueryStatus.CANCELLED); AsyncQuery asyncQuery3 = createAsyncQueryTestObject("edc4a871-dff2-4054-804e-d80075cf826d", 1577883600000L, QueryStatus.PROCESSING); Collection<AsyncQuery> asyncCollection = new ArrayList<AsyncQuery>(); asyncCollection.add(asyncQuery1); asyncCollection.add(asyncQuery2); asyncCollection.add(asyncQuery3); when(cancelThread.getAsyncQueryDao().loadAsyncQueryCollection(any())).thenReturn(asyncCollection); cancelThread.cancelAsyncQuery(); ArgumentCaptor<FilterExpression> fltStatusCaptor = ArgumentCaptor.forClass(FilterExpression.class); verify(asyncQueryDao, times(1)).loadAsyncQueryCollection(fltStatusCaptor.capture()); assertEquals("asyncQuery.status IN [[CANCELLED, PROCESSING, QUEUED]]", fltStatusCaptor.getValue().toString()); }

Target:
public void testStatusBasedFilter() throws ParseException { DataStoreTransaction dtx = elide.getDataStore().beginTransaction(); transactionRegistry.addRunningTransaction(UUID.fromString("edc4a871-dff2-4054-804e-d80075cf828d"), dtx); transactionRegistry.addRunningTransaction(UUID.fromString("edc4a871-dff2-4054-804e-d80075cf827d"), dtx); transactionRegistry.addRunningTransaction(UUID.fromString("edc4a871-dff2-4054-804e-d80075cf826d"), dtx); AsyncQuery asyncQuery1 = createAsyncQueryTestObject("edc4a871-dff2-4054-804e-d80075cf828d", 1577883600000L, QueryStatus.CANCEL_COMPLETE); AsyncQuery asyncQuery2 = createAsyncQueryTestObject("edc4a871-dff2-4054-804e-d80075cf827d", 1577883600000L, QueryStatus.CANCELLED); AsyncQuery asyncQuery3 = createAsyncQueryTestObject("edc4a871-dff2-4054-804e-d80075cf826d", 1577883600000L, QueryStatus.PROCESSING); Collection<AsyncQuery> asyncCollection = new ArrayList<AsyncQuery>(); asyncCollection.add(asyncQuery1); asyncCollection.add(asyncQuery2); asyncCollection.add(asyncQuery3); when(cancelThread.getAsyncQueryDao().loadAsyncQueryCollection(any())).thenReturn(asyncCollection); cancelThread.cancelAsyncQuery(); ArgumentCaptor<FilterExpression> fltStatusCaptor = ArgumentCaptor.forClass(FilterExpression.class); verify(asyncQueryDao, times(1)).loadAsyncQueryCollection(fltStatusCaptor.capture()); assertEquals("asyncQuery.status IN [[CANCELLED, PROCESSING, QUEUED]]", fltStatusCaptor.getValue().toString()); verify(asyncQueryDao, times(1)).updateStatusAsyncQueryCollection(any(), any()); }
Source:
public void destroyObject(PooledObject<CassandraClient> client) { try (CassandraClient cassandraClient = client.getObject()) { cassandraClient.close(); log.debug("Closed transport for client of host {}", UnsafeArg.of("client", client), SafeArg.of("cassandraClient", CassandraLogHelper.host(addr))); } }

Target:
public void destroyObject(PooledObject<CassandraClient> client) { client.getObject().close(); log.debug("Closed transport for client of host {}", UnsafeArg.of("client", client), SafeArg.of("cassandraClient", CassandraLogHelper.host(addr))); }
Source:
public IndexManager(Datastore datastore) { this.datastore = datastore; validFieldName = Pattern.compile(INDEX_FIELD_NAME_PATTERN); queue = Executors.newSingleThreadExecutor(); final String filename = datastore.extensionDataFolder(EXTENSION_NAME) + File.separator + "indexes.sqlite"; SQLDatabase sqlDatabase = null; try { sqlDatabase = queue.submit(new Callable<SQLDatabase>() { @Override public SQLDatabase call() throws Exception { SQLDatabase db = SQLDatabaseFactory.openSqlDatabase(filename); String[] schemaIndex; if (db.getVersion() == 1) { schemaIndex = new String[] { "ALTER TABLE " + INDEX_METADATA_TABLE_NAME + " " + "ADD COLUMN index_settings TEXT NULL;" }; } else { schemaIndex = new String[] { "CREATE TABLE " + INDEX_METADATA_TABLE_NAME + " ( " + "index_name TEXT NOT NULL, " + "index_type TEXT NOT NULL, " + "index_settings TEXT NULL, " + "field_name TEXT NOT NULL, " + "last_sequence INTEGER NOT NULL);" }; } SQLDatabaseFactory.updateSchema(db, schemaIndex, VERSION); return db; } }).get(); } catch (InterruptedException e) { logger.log(Level.SEVERE, "Problem opening or creating database.", e); } catch (ExecutionException e) { logger.log(Level.SEVERE, "Problem opening or creating database.", e); } database = sqlDatabase; }

Target:
public IndexManager(Datastore datastore) { this.datastore = datastore; validFieldName = Pattern.compile(INDEX_FIELD_NAME_PATTERN); queue = Executors.newSingleThreadExecutor(); final String filename = datastore.extensionDataFolder(EXTENSION_NAME) + File.separator + "indexes.sqlite"; SQLDatabase sqlDatabase = null; try { sqlDatabase = queue.submit(new Callable<SQLDatabase>() { @Override public SQLDatabase call() throws Exception { SQLDatabase db = SQLDatabaseFactory.openSqlDatabase(filename); SQLDatabaseFactory.updateSchema(db, QueryConstants.getSchemaVersion1(), 1); SQLDatabaseFactory.updateSchema(db, QueryConstants.getSchemaVersion2(), 2); return db; } }).get(); } catch (InterruptedException e) { logger.log(Level.SEVERE, "Problem opening or creating database.", e); } catch (ExecutionException e) { logger.log(Level.SEVERE, "Problem opening or creating database.", e); } database = sqlDatabase; }
Source:
public T get() { return getOr(defaultValue); }

Target:
public final T get() { return getOr(defaultValue); }
Source:
public void singleLockHashMap() throws InterruptedException { (new SingleLock()).doWork(new HashMap<String,String>(), THREADS, SLOTS); }

Target:
public Map<String,String> singleLockHashMap() throws InterruptedException { return singleLock.doWork(new HashMap<String,String>(), THREADS, SLOTS); }
Source:
public String getBuildName() { return properties.get("build.name"); }

Target:
public String getBuildName() { return properties.get(BuildInfoFields.BUILD_NAME); }
Source:
public List<ObjectId> readMergeHeads() throws IOException { List<ObjectId> heads = null; File mergeHeadFile = new File(gitDir, Constants.MERGE_HEAD); if (mergeHeadFile.exists()) { try { FileReader r = new FileReader(mergeHeadFile); BufferedReader mh = new BufferedReader(r); String headStr; try { heads = new LinkedList<ObjectId>(); while ((headStr = mh.readLine()) != null) { heads.add(ObjectId.fromString(headStr)); } } finally { r.close(); } } catch (FileNotFoundException e) { heads = null; } } return heads; }

Target:
public List<ObjectId> readMergeHeads() throws IOException { File mergeHeadFile = new File(gitDir, Constants.MERGE_HEAD); byte[] raw; try { raw = IO.readFully(mergeHeadFile); } catch (FileNotFoundException notFound) { return new LinkedList<ObjectId>(); } if (raw.length == 0) throw new IOException("MERGE_HEAD file empty: " + mergeHeadFile); LinkedList<ObjectId> heads = new LinkedList<ObjectId>(); for (int p = 0; p < raw.length;) { heads.add(ObjectId.fromString(raw, p)); p = RawParseUtils .nextLF(raw, p + Constants.OBJECT_ID_STRING_LENGTH); } return heads; }
Source:
public Statement apply(final Statement statement, Description description) { return new Statement() { @Override public void evaluate() throws Throwable { IntegrationTestUtils.reserveMasterPorts(); mTestName = IntegrationTestUtils .getTestName(description.getTestClass().getSimpleName(), description.getMethodName()); try { try { Annotation configAnnotation; configAnnotation = description.getAnnotation(ServerConfig.class); if (configAnnotation != null) { ServerConfig config = (ServerConfig) configAnnotation; for (int i = 0; i < config.confParams().length; i += 2) { mConfiguration.put(PropertyKey.fromString(config.confParams()[i]), config.confParams()[i + 1]); } } boolean startCluster = mStartCluster; configAnnotation = description.getAnnotation(Config.class); if (configAnnotation != null) { Config config = (Config) configAnnotation; for (int i = 0; i < config.confParams().length; i += 2) { mConfiguration.put(PropertyKey.fromString(config.confParams()[i]), config.confParams()[i + 1]); } startCluster = config.startCluster(); } if (startCluster) { start(); } } catch (Exception e) { throw new RuntimeException(e); } try { statement.evaluate(); } finally { mLocalAlluxioCluster.stop(); } } finally { IntegrationTestUtils.releaseMasterPorts(); } } }; }

Target:
public Statement apply(final Statement statement, Description description) { return new Statement() { @Override public void evaluate() throws Throwable { IntegrationTestUtils.reserveMasterPorts(); mTestName = IntegrationTestUtils .getTestName(description.getTestClass().getSimpleName(), description.getMethodName()); try { try { Annotation configAnnotation; configAnnotation = description.getAnnotation(ServerConfig.class); if (configAnnotation != null) { overrideConfiguration(((ServerConfig) configAnnotation).confParams()); } boolean startCluster = mStartCluster; configAnnotation = description.getAnnotation(Config.class); if (configAnnotation != null) { Config config = (Config) configAnnotation; overrideConfiguration(config.confParams()); startCluster = config.startCluster(); } if (startCluster) { start(); } } catch (Exception e) { throw new RuntimeException(e); } try { statement.evaluate(); } finally { mLocalAlluxioCluster.stop(); } } finally { IntegrationTestUtils.releaseMasterPorts(); } } }; }
Source:
private static DataSize.Unit valueOfUnit(String unitString) { for (DataSize.Unit unit : DataSize.Unit.values()) { if (unit.getUnitString().equals(unitString)) { return unit; } } throw new PrestoException(INVALID_FUNCTION_ARGUMENT, "Unit string must be one of [B, kB, MB, GB, TB, PB]"); }

Target:
private static Unit valueOfUnit(String unitString) { for (Unit unit : Unit.values()) { if (unit.getUnitString().equals(unitString)) { return unit; } } throw new PrestoException(INVALID_FUNCTION_ARGUMENT, "Unit string must be one of [B, kB, MB, GB, TB, PB]"); }
Source:
public void onCreateTable(CreateTableEvent tableEvent) throws MetaException { Table t = tableEvent.getTable(); FileIterator fileIter = t.getTableType().equals(TableType.EXTERNAL_TABLE.toString()) ? null : new FileIterator(t.getSd().getLocation()); NotificationEvent event = new NotificationEvent(0, now(), EventType.CREATE_TABLE.toString(), msgFactory.buildCreateTableMessage(t, fileIter).toString()); event.setCatName(t.isSetCatName() ? t.getCatName() : DEFAULT_CATALOG_NAME); event.setDbName(t.getDbName()); event.setTableName(t.getTableName()); process(event, tableEvent); }

Target:
public void onCreateTable(CreateTableEvent tableEvent) throws MetaException { Table t = tableEvent.getTable(); FileIterator fileIter = MetaStoreUtils.isExternalTable(t) ? null : new FileIterator(t.getSd().getLocation()); NotificationEvent event = new NotificationEvent(0, now(), EventType.CREATE_TABLE.toString(), msgFactory.buildCreateTableMessage(t, fileIter).toString()); event.setCatName(t.isSetCatName() ? t.getCatName() : DEFAULT_CATALOG_NAME); event.setDbName(t.getDbName()); event.setTableName(t.getTableName()); process(event, tableEvent); }
Source:
private void initializeGenerationFromDisk(HostMessenger messenger, final ExportDataProcessor processor, File[] files, List<Pair<Integer, Integer>> localPartitionsToSites) { List<Integer> onDiskPartitions = new ArrayList<Integer>(); Map<String, File> dataFiles = new HashMap<>(); for (File data: files) { if (data.getName().endsWith(".pbd")) { String nonce = data.getName().substring(0, data.getName().lastIndexOf('.')); nonce = nonce.substring(0, nonce.lastIndexOf('_')); nonce = nonce.substring(0, nonce.lastIndexOf('_')); dataFiles.put(nonce, data); } } for (File ad: files) { if (ad.getName().endsWith(".ad")) { String nonce = ad.getName().substring(0, ad.getName().lastIndexOf('.')); File dataFile = dataFiles.get(nonce); if (dataFile != null) { try { addDataSource(ad, localPartitionsToSites, onDiskPartitions, processor); } catch (IOException e) { VoltDB.crashLocalVoltDB("Error intializing export datasource " + ad, true, e); } } else { ad.delete(); } } } Set<Integer> allLocalPartitions = localPartitionsToSites.stream() .map(p -> p.getFirst()) .collect(Collectors.toSet()); Set<Integer> onDIskPartitionsSet = new HashSet<Integer>(onDiskPartitions); onDIskPartitionsSet.removeAll(allLocalPartitions); if (!onDIskPartitionsSet.isEmpty()) { createAckMailboxesIfNeeded(messenger, onDIskPartitionsSet); } }

Target:
private void initializeGenerationFromDisk(HostMessenger messenger, final ExportDataProcessor processor, File[] files, List<Pair<Integer, Integer>> localPartitionsToSites) { List<Integer> onDiskPartitions = new ArrayList<Integer>(); Map<String, File> dataFiles = new HashMap<>(); for (File data: files) { if (data.getName().endsWith(".pbd")) { String nonce = data.getName().substring(0, data.getName().lastIndexOf('_')); nonce = nonce.substring(0, nonce.lastIndexOf('_')); dataFiles.put(nonce, data); } } for (File ad: files) { if (ad.getName().endsWith(".ad")) { String nonce = ad.getName().substring(0, ad.getName().lastIndexOf('.')); File dataFile = dataFiles.get(nonce); if (dataFile != null) { try { addDataSource(ad, localPartitionsToSites, onDiskPartitions, processor); } catch (IOException e) { VoltDB.crashLocalVoltDB("Error intializing export datasource " + ad, true, e); } } else { ad.delete(); } } } Set<Integer> allLocalPartitions = localPartitionsToSites.stream() .map(p -> p.getFirst()) .collect(Collectors.toSet()); Set<Integer> onDIskPartitionsSet = new HashSet<Integer>(onDiskPartitions); onDIskPartitionsSet.removeAll(allLocalPartitions); if (!onDIskPartitionsSet.isEmpty()) { createAckMailboxesIfNeeded(messenger, onDIskPartitionsSet); } }
Source:
private String[] parseSegments(String key) { return key.split("\\.", key.startsWith("attributes.") ? 2 : 0); }

Target:
private String[] parseSegments(String key) { return key.startsWith("attributes.") ? key.split("\\.", 2) : key.split("\\."); }
Source:
public int onStartCommand(Intent intent, int flags, int startId) { ArrayList<AbstractSuite> testSuites = (ArrayList<AbstractSuite>) intent.getSerializableExtra("testSuites"); if (testSuites == null || testSuites.size() == 0) return 0; Application app = ((Application)getApplication()); NotificationService.setChannel(getApplicationContext(), CHANNEL_ID, app.getString(R.string.Settings_AutomatedTesting_Label), false, false, false); Intent notificationIntent = new Intent(this, RunningActivity.class); PendingIntent pendingIntent = PendingIntent.getActivity(this, 0, notificationIntent, 0); notificationManager = NotificationManagerCompat.from(this); builder = new NotificationCompat.Builder(this, CHANNEL_ID); builder.setContentTitle(getApplication().getString(R.string.Dashboard_Running_Running)) .setContentText(getApplication().getString(R.string.Dashboard_Running_PreparingTest)) .setAutoCancel(false) .setSmallIcon(R.drawable.notification_icon) .setContentIntent(pendingIntent) .setProgress(100, 0, false) .build(); task = (TestAsyncTask) new TestAsyncTask(app, testSuites, this).execute(); Intent broadcastIntent = new Intent(); broadcastIntent.setAction(RunTestService.ACTION_INTERRUPT); PendingIntent pIntent = PendingIntent.getBroadcast(this,1, broadcastIntent,PendingIntent.FLAG_UPDATE_CURRENT); builder.addAction(0, "STOP TEST", pIntent); startForeground(NOTIFICATION_ID, builder.build()); return START_NOT_STICKY; }

Target:
public int onStartCommand(Intent intent, int flags, int startId) { ArrayList<AbstractSuite> testSuites = (ArrayList<AbstractSuite>) intent.getSerializableExtra("testSuites"); if (testSuites == null || testSuites.size() == 0) return 0; Application app = ((Application)getApplication()); NotificationService.setChannel(getApplicationContext(), CHANNEL_ID, app.getString(R.string.Settings_AutomatedTesting_Label), false, false, false); Intent notificationIntent = new Intent(this, RunningActivity.class); PendingIntent pendingIntent = PendingIntent.getActivity(this, 0, notificationIntent, 0); notificationManager = NotificationManagerCompat.from(this); builder = new NotificationCompat.Builder(this, CHANNEL_ID); builder.setContentTitle(getApplication().getString(R.string.Dashboard_Running_Running)) .setContentText(getApplication().getString(R.string.Dashboard_Running_PreparingTest)) .setAutoCancel(false) .setSmallIcon(R.drawable.notification_icon) .setContentIntent(pendingIntent) .setProgress(100, 0, false) .build(); task = (TestAsyncTask) new TestAsyncTask(app, testSuites, this).execute(); Intent broadcastIntent = new Intent(); broadcastIntent.setAction(RunTestService.ACTION_INTERRUPT); PendingIntent pIntent = PendingIntent.getBroadcast(this,1, broadcastIntent,PendingIntent.FLAG_UPDATE_CURRENT); builder.addAction(0, getApplicationContext().getString(R.string.Notification_StopTest), pIntent); startForeground(NOTIFICATION_ID, builder.build()); return START_NOT_STICKY; }
Source:
public static PutAdapter createPutAdapter(BigtableHBaseSettings settings) { Configuration config = settings.getConfiguration(); boolean setClientTimestamp = !config.getBoolean(ALLOW_NO_TIMESTAMP_RETRIES_KEY, false); return new PutAdapter(config.getInt("hbase.client.keyvalue.maxsize", -1), setClientTimestamp); }

Target:
public static PutAdapter createPutAdapter(BigtableHBaseSettings settings) { Configuration config = settings.getConfiguration(); boolean setClientTimestamp = !settings.isRetriesWithoutTimestampAllowed(); return new PutAdapter(config.getInt("hbase.client.keyvalue.maxsize", -1), setClientTimestamp); }
Source:
public String toString() { return "PacBioNotificationDto [movieDurationInSec=" + movieDurationInSec + ", getRunName()=" + getRunAlias() + ", getSequencerName()=" + getSequencerName() + ", getCompletionDate()=" + getCompletionDate() + ", getStartDate()=" + getStartDate() + ", getContainerId()=" + getContainerSerialNumber() + ", getLaneCount()=" + getLaneCount() + ", getHealthType()=" + getHealthType() + ", getSequencerFolderPath()=" + getSequencerFolderPath() + ", isPairedEndRun()=" + isPairedEndRun() + ", getSoftware()=" + getSoftware() + "]"; }

Target:
public String toString() { return "PacBioNotificationDto [movieDurationInSec=" + movieDurationInSec + ", getRunAlias()=" + getRunAlias() + ", getSequencerName()=" + getSequencerName() + ", getContainerSerialNumber()=" + getContainerSerialNumber() + ", getLaneCount()=" + getLaneCount() + ", getHealthType()=" + getHealthType() + ", getSequencerFolderPath()=" + getSequencerFolderPath() + ", isPairedEndRun()=" + isPairedEndRun() + ", getSoftware()=" + getSoftware() + ", getStartDate()=" + getStartDate() + ", getCompletionDate()=" + getCompletionDate() + "]"; }
Source:
public void testValidDockerignore() throws Exception { try (final GenericContainer container = new GenericContainer(new ImageFromDockerfile() .withFileFromPath(".", DockerfileBuildTest.RESOURCE_PATH) .withDockerfile(new File("src/test/resources/dockerfile-build-test/Dockerfile-currentdir")) .get()) .withStartupCheckStrategy(new OneShotStartupCheckStrategy()) .withCommand("ls", "/")) { container.start(); final String logs = container.getLogs(); assertTrue("Files in the container indicated the .dockerignore was not applied. Output was: " + logs, logs.contains("should_not_be_ignored.txt")); assertTrue("Files in the container indicated the .dockerignore was not applied. Output was: " + logs, !logs.contains("should_be_ignored.txt")); } }

Target:
public void testValidDockerignore() throws Exception { ImageFromDockerfile img = new ImageFromDockerfile() .withFileFromPath(".", DockerfileBuildTest.RESOURCE_PATH) .withDockerfile(DockerfileBuildTest.RESOURCE_PATH.resolve("Dockerfile-currentdir")); try( final GenericContainer<?> container = new GenericContainer<>(img.get()) .withStartupCheckStrategy(new OneShotStartupCheckStrategy()) .withCommand("ls", "/") ) { container.start(); final String logs = container.getLogs(); assertTrue("Files in the container indicated the .dockerignore was not applied. Output was: " + logs, logs.contains("should_not_be_ignored.txt")); assertTrue("Files in the container indicated the .dockerignore was not applied. Output was: " + logs, !logs.contains("should_be_ignored.txt")); } }
Source:
private void findNegotiatingProfiles(ServletRequest req) { List<String> schemes = new ArrayList<String>(); if (profiles == null) { synchronized (this) { if (profiles == null) { schemes = new ArrayList<>(); profiles = new ArrayList<AuthenticationProfile>(1); for (AuthenticationProfile profile : AuthenticationProfileRepository.getInstance().getProfiles()) { if (profile != null) { ExtMap authnContext = profile.getAuthn().getContext(); if ((authnContext.<Long> get(Authn.ContextKeys.CAPABILITIES).longValue() & caps) != caps) { profiles.add(0, profile); } schemes.addAll(authnContext.<List<String>>get(Authn.ContextKeys.HTTP_AUTHENTICATION_SCHEME, Collections.<String>emptyList())); } } } } } ((HttpServletRequest) req).setAttribute(FiltersHelper.Constants.SCHEMES_KEY, schemes); }

Target:
private void findNegotiatingProfiles(ServletRequest req) { List<String> schemes = new ArrayList<String>(); if (profiles == null) { synchronized (this) { if (profiles == null) { schemes = new ArrayList<>(); profiles = new ArrayList<AuthenticationProfile>(); for (AuthenticationProfile profile : AuthenticationProfileRepository.getInstance().getProfiles()) { if (profile != null) { ExtMap authnContext = profile.getAuthn().getContext(); if ((authnContext.<Long> get(Authn.ContextKeys.CAPABILITIES).longValue() & caps) != caps) { profiles.add(0, profile); } schemes.addAll(authnContext.<List<String>>get(Authn.ContextKeys.HTTP_AUTHENTICATION_SCHEME, Collections.<String>emptyList())); } } } } } ((HttpServletRequest) req).setAttribute(FiltersHelper.Constants.SCHEMES_KEY, schemes); }
Source:
protected AsyncFileEntry getRootFile() { return rootFile; }

Target:
AsyncFileEntry getRootFile() { return rootFile; }
Source:
public SqlStatementParameterCustomizer createForParameter(Annotation annotation, Class<?> sqlObjectType, Method method, Parameter param, int index, Type type) { Bind b = (Bind) annotation; String nameFromAnnotation = b == null ? Bind.NO_VALUE : b.value(); Optional<String> name = ParameterUtil.findParameterName(nameFromAnnotation, param); if (GenericTypes.getErasedType(type) == Consumer.class) { return (stmt, arg) -> { }; } return (stmt, arg) -> { stmt.bindByType(index, arg, type); name.ifPresent(n -> stmt.bindByType(n, arg, type)); }; }

Target:
public SqlStatementParameterCustomizer createForParameter(Annotation annotation, Class<?> sqlObjectType, Method method, Parameter param, int index, Type type) { Bind b = (Bind) annotation; String nameFromAnnotation = b == null ? Bind.NO_VALUE : b.value(); Optional<String> name = ParameterUtil.findParameterName(nameFromAnnotation, param); return (stmt, arg) -> { stmt.bindByType(index, arg, type); name.ifPresent(n -> stmt.bindByType(n, arg, type)); }; }
Source:
public Integer getExpectedClusters(String experimentAccession) { Integer expectedClusters = null; IdfParserOutput idfParserOutput = idfParser.parse(experimentAccession); if (idfParserOutput.getExpectedClusters() != 0 && getAvailableClusters(experimentAccession).contains(idfParserOutput.getExpectedClusters())) { expectedClusters = idfParserOutput.getExpectedClusters(); } else { Optional<Integer> optimalClusterFromFile = dataFileHub.getSingleCellExperimentFiles(experimentAccession).clustersTsv.get().get() .skip(1) .filter(line -> line[0].equalsIgnoreCase("false")) .map(line -> Integer.parseInt(line[1])) .findFirst(); if(optimalClusterFromFile.isPresent()) { expectedClusters = optimalClusterFromFile.get(); } } return expectedClusters; }

Target:
public Optional<Integer> getExpectedClusters(String experimentAccession) { IdfParserOutput idfParserOutput = idfParser.parse(experimentAccession); if (idfParserOutput.getExpectedClusters() != 0 && getAvailableClusters(experimentAccession).contains(idfParserOutput.getExpectedClusters())) { return Optional.of(idfParserOutput.getExpectedClusters()); } else { return dataFileHub.getSingleCellExperimentFiles(experimentAccession).clustersTsv.get().get() .skip(1) .filter(line -> line[0].equalsIgnoreCase("true")) .map(line -> Integer.parseInt(line[1])) .findFirst(); } }
Source:
public void findElementsByNamedPagedQueryFailedWithoutCountQuery() { createAndSaveSampleEntity(); createAndSaveSampleEntity(); exceptionRule.expect(IllegalArgumentException.class); exceptionRule.expectMessage("Must specify a count query to get pagination info."); Page<SampleEntityForNamedQuery> page = repository.findByPagedQueryWithoutCountQuery(SAMPLE_ENTITY_NAME, PageRequest.of(0,1)); }

Target:
public void findElementsByNamedPagedQueryFailedWithoutCountQuery() { createAndSaveSampleEntity(); createAndSaveSampleEntity(); assertThatIllegalArgumentException() .isThrownBy(() -> repository.findByPagedQueryWithoutCountQuery(SAMPLE_ENTITY_NAME, PageRequest.of(0,1))) .withMessage("Must specify a count query to get pagination info."); }
Source:
public synchronized void removeDomain( final String domainId ) { delegate.removeDomain( domainId ); purgeDomain( domainId ); removeDomainFromIDCache( domainId ); }

Target:
public void removeDomain( final String domainId ) { delegate.removeDomain( domainId ); purgeDomain( domainId ); removeDomainFromIDCache( domainId ); }
Source:
protected void executeQueryCommand() { for (Map.Entry<Guid, DiskImage> entry : getParameters().getDiskImagesMap().entrySet()) { DiskImage ancestor = getDbFacade().getDiskImageDao().getAncestor(entry.getKey()); if (ancestor != null) { entry.setValue(ancestor); } } getQueryReturnValue().setReturnValue(getParameters().getDiskImagesMap()); }

Target:
protected void executeQueryCommand() { Map<Guid, DiskImage> imagesAncestors = new HashMap<>(); for (Guid id : getParameters().getIds()) { DiskImage ancestor = getDbFacade().getDiskImageDao().getAncestor( id, getUserID(), getParameters().isFiltered()); imagesAncestors.put(id, ancestor); } getQueryReturnValue().setReturnValue(imagesAncestors); }
Source:
public CPPASTLiteralExpression(int kind, char[] value, char[] numericCompilerSuffixes) { fKind = kind; setValue(kind, value); setNumericCompilerSuffixes(numericCompilerSuffixes); }

Target:
public CPPASTLiteralExpression(int kind, char[] value, char[] numericCompilerSuffixes) { fKind = kind; setValue(kind, value); fNumericCompilerSuffixes = (numericCompilerSuffixes == null) ? CharArrayUtils.EMPTY : numericCompilerSuffixes; }
Source:
private void runManagement() { while (true) { if (Thread.interrupted()) { return; } BlockManagementTask currentTask = null; try { if (mLoadTracker.loadDetected(BlockStoreLocation.anyTier())) { LOG.info("Load detected."); Thread.sleep(mLoadDetectionCoolDownMs); continue; } final BlockManagementTask nextTask = getNextTask(); if (nextTask == null) { LOG.info("No management task pending."); Thread.sleep(mIdleSleepMs); continue; } currentTask = nextTask; mTaskExecutor.submit(() -> nextTask.run()).get(); LOG.info("Management task finished: {}", currentTask.getClass().getSimpleName()); } catch (InterruptedException e) { Thread.currentThread().interrupt(); break; } catch (ExecutionException e) { LOG.error("Management task failed: {}. Error: {}", currentTask.getClass().getSimpleName(), e); } catch (Throwable t) { LOG.error("Unexpected error during block management: {}", t); } } LOG.info("Block management coordinator exited."); }

Target:
private void runManagement() { while (true) { if (Thread.interrupted()) { LOG.debug("Coordinator interrupted."); break; } BlockManagementTask currentTask; try { if (mBackoffStrategy == BackoffStrategy.ANY && mLoadTracker.loadDetected(BlockStoreLocation.anyTier())) { LOG.debug("Load detected. Sleeping {}ms.", mLoadDetectionCoolDownMs); Thread.sleep(mLoadDetectionCoolDownMs); continue; } final BlockManagementTask nextTask = getNextTask(); if (nextTask == null) { LOG.debug("No management task pending. Sleeping {}ms.", mLoadDetectionCoolDownMs); Thread.sleep(mLoadDetectionCoolDownMs); continue; } currentTask = nextTask; LOG.debug("Running task of type:{}", currentTask.getClass().getSimpleName()); try { currentTask.run(); } catch (Exception e) { LOG.error("Management task failed: {}. Error: {}", currentTask.getClass().getSimpleName(), e); } LOG.debug("Management task finished: {}", currentTask.getClass().getSimpleName()); } catch (InterruptedException e) { Thread.currentThread().interrupt(); break; } catch (Throwable t) { LOG.error("Unexpected error during block management: {}", t); } } LOG.debug("Block management coordinator exited."); }
Source:
public EList<EObject> getCreatedObjects() { if (createdObjects == null) { InternalTransaction transaction = domain.getActiveTransaction().getRoot(); TransactionChangeDescription changeDescription = transaction.getChangeDescription(); if (changeDescription != null) { createdObjects = changeDescription.getObjectsToDetach(); } } return createdObjects; }

Target:
public Collection<EObject> getCreatedObjects() { if (createdObjects == null) { InternalTransaction transaction = domain.getActiveTransaction().getRoot(); TransactionChangeDescription changeDescription = transaction.getChangeDescription(); if (changeDescription != null) { createdObjects = changeDescription.getObjectsToDetach(); } } return Objects.firstNonNull(createdObjects, Collections.<EObject> emptySet()); }
Source:
public Docker(DockerServerEndpoint dockerHost, String dockerInstallation, String credentialsId, AbstractBuild build, Launcher launcher, TaskListener listener, boolean verbose, boolean privileged, boolean sudo, String protectedEnvironmentVariables) throws IOException, InterruptedException { this.dockerHost = dockerHost; this.dockerExecutable = DockerTool.getExecutable(dockerInstallation, Computer.currentComputer().getNode(), listener, build.getEnvironment(listener)); this.registryEndpoint = new DockerRegistryEndpoint(null, credentialsId); this.launcher = launcher; this.listener = listener; this.build = build; this.verbose = verbose | debug; this.privileged = privileged; this.sudo = sudo; this.protectedEnvironmentVariables = new HashSet<String>(); if(protectedEnvironmentVariables != null) { for (final String variable : Arrays.asList(protectedEnvironmentVariables.split(","))) { this.protectedEnvironmentVariables.add(variable.trim()); } } }

Target:
public Docker(DockerServerEndpoint dockerHost, String dockerInstallation, String credentialsId, AbstractBuild build, Launcher launcher, TaskListener listener, boolean verbose, boolean privileged, boolean sudo, String protectedEnvironmentVariables) throws IOException, InterruptedException { this.dockerHost = dockerHost; this.dockerExecutable = DockerTool.getExecutable(dockerInstallation, Computer.currentComputer().getNode(), listener, build.getEnvironment(listener)); this.registryEndpoint = new DockerRegistryEndpoint(null, credentialsId); this.launcher = launcher; this.listener = listener; this.build = build; this.verbose = verbose | debug; this.privileged = privileged; this.sudo = sudo; this.protectedEnvironmentVariables = new HashSet<String>(); if(protectedEnvironmentVariables != null) { for (final String variable : Arrays.asList(protectedEnvironmentVariables.split(","))) { final String trimmedVariable = variable.trim(); if (trimmedVariable.isEmpty()) { continue; } this.protectedEnvironmentVariables.add(trimmedVariable); } } }
Source:
protected abstract boolean isRuntimeSystemPropertyUpdateAllowed(String propertyName, String propertyValue, boolean bootTime) throws OperationFailedException; protected abstract void systemPropertyUpdated(String propertyName, String propertyValue); public abstract UUID getInstanceUuid(); protected UUID createProcessUUID(final Path filePath) throws IOException { UUID uuid = null; if (Files.exists(filePath)) { String line = Files.lines(filePath).findFirst().get(); uuid = UUID.fromString(line); } if (uuid == null) { uuid = UUID.randomUUID(); Files.createDirectories(filePath.getParent()); Files.write(filePath, Collections.singletonList(uuid.toString()), StandardOpenOption.CREATE); } return uuid; }

Target:
protected abstract boolean isRuntimeSystemPropertyUpdateAllowed(String propertyName, String propertyValue, boolean bootTime) throws OperationFailedException; protected abstract void systemPropertyUpdated(String propertyName, String propertyValue); public abstract UUID getInstanceUuid(); protected UUID obtainProcessUUID(final Path filePath) throws IOException { UUID uuid = null; if (Files.exists(filePath)) { try (Stream<String> lines = Files.lines(filePath)) { uuid = UUID.fromString(lines.findFirst().get()); } } if (uuid == null) { uuid = UUID.randomUUID(); Files.createDirectories(filePath.getParent()); Files.write(filePath, Collections.singletonList(uuid.toString()), StandardOpenOption.CREATE); } return uuid; }
Source:
beginRecognizeCustomFormsFromUrl(String fileSourceUrl, String modelId, boolean includeTextDetails, Duration pollInterval) { Objects.requireNonNull(fileSourceUrl, "'fileSourceUrl' is required and cannot be null."); Objects.requireNonNull(modelId, "'modelId' is required and cannot be null."); final Duration interval = pollInterval != null ? pollInterval : Duration.ofSeconds(5); return new PollerFlux<OperationResult, IterableStream<RecognizedForm>>( interval, analyzeFormActivationOperation(fileSourceUrl, modelId, includeTextDetails), createAnalyzeFormPollOperation(modelId), (activationResponse, context) -> Mono.error(new RuntimeException("Cancellation is not supported")), fetchAnalyzeFormResultOperation(modelId, includeTextDetails)); }

Target:
beginRecognizeCustomFormsFromUrl(String fileSourceUrl, String modelId, boolean includeTextDetails, Duration pollInterval) { final Duration interval = pollInterval != null ? pollInterval : DEFAULT_DURATION; return new PollerFlux<OperationResult, IterableStream<RecognizedForm>>( interval, analyzeFormActivationOperation(fileSourceUrl, modelId, includeTextDetails), createAnalyzeFormPollOperation(modelId), (activationResponse, context) -> Mono.error(new RuntimeException("Cancellation is not supported")), fetchAnalyzeFormResultOperation(modelId, includeTextDetails)); }
Source:
private void writeConfigFileHeader(HttpServletResponse response) throws IOException { BufferedWriter writer = new BufferedWriter(new OutputStreamWriter(response.getOutputStream())); writer.write(CONFIG_FILE_HEADER); writer.newLine(); writer.flush(); }

Target:
private void writeConfigFileHeader(HttpServletResponse response) throws IOException { PrintWriter writer = response.getWriter(); writer.println(CONFIG_FILE_HEADER); if (writer.checkError()) { throw new IOException("Error when writing to response stream"); } writer.flush(); }
Source:
public SceneElement createSceneElement(String imagePath) { EditorGameAssets assets = controller.getEditorGameAssets(); String newPath = imagePath; if (!assets.isLoaded(imagePath, Texture.class)) { if (assets.resolve(imagePath).exists()) { assets.load(imagePath, Texture.class); } else { newPath = controller.getEditorGameAssets().copyAndLoad( imagePath, Texture.class); } controller.getEditorGameAssets().finishLoading(); } Texture texture = controller.getEditorGameAssets().get(newPath, Texture.class); SceneElement sceneElement = new SceneElement(); Image renderer = new Image(); renderer.setUri(newPath); sceneElement.setRenderer(renderer); Transformation transformation = new Transformation(); transformation.setOriginX(texture.getWidth() / 2.0f); transformation.setOriginY(texture.getHeight() / 2.0f); sceneElement.setTransformation(transformation); TextureData td = texture.getTextureData(); td.prepare(); sceneElement.getCollisionPolygons().clear(); sceneElement.getCollisionPolygons().addAll( GeometryUtils.findPolygons(td.consumePixmap())); return sceneElement; }

Target:
public SceneElement createSceneElement(String imagePath) { EditorGameAssets assets = controller.getEditorGameAssets(); String newPath = imagePath; if (!assets.isLoaded(imagePath, Texture.class)) { if (assets.resolve(imagePath).exists()) { assets.load(imagePath, Texture.class); } else { newPath = controller.getEditorGameAssets().copyAndLoad( imagePath, Texture.class); } controller.getEditorGameAssets().finishLoading(); } Texture texture = controller.getEditorGameAssets().get(newPath, Texture.class); SceneElement sceneElement = new SceneElement(); Image renderer = new Image(); renderer.setUri(newPath); sceneElement.setRenderer(renderer); Transformation transformation = new Transformation(); transformation.setOriginX(texture.getWidth() / 2.0f); transformation.setOriginY(texture.getHeight() / 2.0f); sceneElement.setTransformation(transformation); TextureData td = texture.getTextureData(); td.prepare(); sceneElement.getCollisionPolygons().addAll( GeometryUtils.findPolygons(td.consumePixmap())); return sceneElement; }
Source:
int nextSpan(int distanceFromTip) { if (distanceFromTip < 0) throw new IllegalArgumentException(); if (distanceFromTip <= recentCommitCount) return recentCommitSpan; int next = Math.min(distanceFromTip - recentCommitCount, distantCommitSpan); return Math.max(next, recentCommitSpan); }

Target:
int nextSpan(int distanceFromTip) { if (distanceFromTip < 0) { throw new IllegalArgumentException(); } if (distanceFromTip <= recentCommitCount) { return recentCommitSpan; } int next = Math.min(distanceFromTip - recentCommitCount, distantCommitSpan); return Math.max(next, recentCommitSpan); }
Source:
private String getSerializationLanguage(final MediaType baseMediaType) { if(baseMediaType == null) { throw new IllegalArgumentException("Base media type can't be null"); } List<Map.Entry<MediaType, String>> mediaPairs = new ArrayList<>(); mediaPairs.add(new AbstractMap.SimpleEntry<>(OslcMediaType.TEXT_TURTLE_TYPE, RDFLanguages.strLangTurtle)); mediaPairs.add(new AbstractMap.SimpleEntry<>(OslcMediaType.APPLICATION_JSON_LD_TYPE, RDFLanguages.strLangJSONLD)); mediaPairs.add(new AbstractMap.SimpleEntry<>(OslcMediaType.TEXT_XML_TYPE, RDFLanguages.strLangRDFXML)); if (OSLC4JUtils.alwaysAbbrevXML()) { mediaPairs.add(new AbstractMap.SimpleEntry<>(OslcMediaType.APPLICATION_RDF_XML_TYPE, FileUtils.langXMLAbbrev)); } else { mediaPairs.add(new AbstractMap.SimpleEntry<>(OslcMediaType.APPLICATION_RDF_XML_TYPE, RDFLanguages.strLangRDFXML)); } mediaPairs.add(new AbstractMap.SimpleEntry<>(OslcMediaType.APPLICATION_XML_TYPE, FileUtils.langXMLAbbrev)); for (Map.Entry<MediaType, String> mediaPair : mediaPairs) { if (baseMediaType.isCompatible(mediaPair.getKey())) { log.trace("Using '{}' writer for '{}' Accept media type", mediaPair.getValue(), mediaPair.getKey()); return mediaPair.getValue(); } } throw new IllegalArgumentException("Base media type can't be matched to any writer"); }

Target:
private String getSerializationLanguage(final MediaType baseMediaType) { if(baseMediaType == null) { throw new IllegalArgumentException("Base media type can't be null"); } List<Map.Entry<MediaType, String>> mediaPairs = new ArrayList<>(); mediaPairs.add(new AbstractMap.SimpleEntry<>(OslcMediaType.TEXT_TURTLE_TYPE, RDFLanguages.strLangTurtle)); mediaPairs.add(new AbstractMap.SimpleEntry<>(OslcMediaType.APPLICATION_JSON_LD_TYPE, RDFLanguages.strLangJSONLD)); if (OSLC4JUtils.alwaysAbbrevXML()) { mediaPairs.add(new AbstractMap.SimpleEntry<>(OslcMediaType.APPLICATION_RDF_XML_TYPE, FileUtils.langXMLAbbrev)); } else { mediaPairs.add(new AbstractMap.SimpleEntry<>(OslcMediaType.APPLICATION_RDF_XML_TYPE, RDFLanguages.strLangRDFXML)); } mediaPairs.add(new AbstractMap.SimpleEntry<>(OslcMediaType.APPLICATION_XML_TYPE, FileUtils.langXMLAbbrev)); for (Map.Entry<MediaType, String> mediaPair : mediaPairs) { if (baseMediaType.isCompatible(mediaPair.getKey())) { log.trace("Using '{}' writer for '{}' Accept media type", mediaPair.getValue(), mediaPair.getKey()); return mediaPair.getValue(); } } throw new IllegalArgumentException("Base media type can't be matched to any writer"); }
Source:
public static List<CoverageBucket> getCoverageBuckets(String readGroupSetId, GenomicsFactory.OfflineAuth auth) throws IOException, GeneralSecurityException { Genomics genomics = auth.getGenomics(auth.getDefaultFactory()); ListCoverageBucketsResponse response = genomics.readgroupsets().coveragebuckets().list(readGroupSetId).execute(); if(null != response.getNextPageToken()) { throw new IllegalArgumentException("Read group set " + readGroupSetId + " has more Coverage Buckets than the default page size for the CoverageBuckets list operation."); } return response.getCoverageBuckets(); }

Target:
public static List<CoverageBucket> getCoverageBuckets(String readGroupSetId, GenomicsFactory.OfflineAuth auth) throws IOException, GeneralSecurityException { Genomics genomics = auth.getGenomics(auth.getDefaultFactory()); ListCoverageBucketsResponse response = genomics.readgroupsets().coveragebuckets().list(readGroupSetId).execute(); if (!Strings.isNullOrEmpty(response.getNextPageToken())) { throw new IllegalArgumentException("Read group set " + readGroupSetId + " has more Coverage Buckets than the default page size for the CoverageBuckets list operation."); } return response.getCoverageBuckets(); }
Source:
protected void run(Server server, User user, String commandLabel, String[] args) throws Exception { RandomTeleport randomTeleport = ess.getRandomTeleport(); if (args.length == 0 || "center".equalsIgnoreCase(args[0])) { randomTeleport.setCenter(user.getLocation()); user.sendMessage(tl("settpr", "center")); } else if (args.length > 1) { if ("minrange".equalsIgnoreCase(args[0])) { randomTeleport.setMinRange(Double.parseDouble(args[1])); } else if ("maxrange".equalsIgnoreCase(args[0])) { randomTeleport.setMaxRange(Double.parseDouble(args[1])); } user.sendMessage(tl("settprValue", args[0].toLowerCase(), args[1].toLowerCase())); } }

Target:
protected void run(Server server, User user, String commandLabel, String[] args) throws Exception { RandomTeleport randomTeleport = ess.getRandomTeleport(); randomTeleport.getCachedLocations().clear(); if (args.length == 0 || "center".equalsIgnoreCase(args[0])) { randomTeleport.setCenter(user.getLocation()); user.sendMessage(tl("settpr")); } else if (args.length > 1) { if ("minrange".equalsIgnoreCase(args[0])) { randomTeleport.setMinRange(Double.parseDouble(args[1])); } else if ("maxrange".equalsIgnoreCase(args[0])) { randomTeleport.setMaxRange(Double.parseDouble(args[1])); } user.sendMessage(tl("settprValue", args[0].toLowerCase(), args[1].toLowerCase())); } }
Source:
public User getUserByName(String username) { UserIdentificationDAO userIdentificationDAO = DAOFactory.getInstance().getUserIdentificationDAO(); InternalAuthDAO internalAuthDAO = DAOFactory.getInstance().getInternalAuthDAO(); InternalAuth internalAuth = internalAuthDAO.findByUsername(username); if (internalAuth != null) { UserIdentification userIdentification = userIdentificationDAO.findByAuthSourceAndExternalId(getName(), String.valueOf(internalAuth.getId())); if(userIdentification != null){ return userIdentification.getPerson().getDefaultUser(); } logger.warning("UserIdentification is null"); return null; } else { return null; } }

Target:
public User getUserByName(String username) { UserIdentificationDAO userIdentificationDAO = DAOFactory.getInstance().getUserIdentificationDAO(); InternalAuthDAO internalAuthDAO = DAOFactory.getInstance().getInternalAuthDAO(); InternalAuth internalAuth = internalAuthDAO.findByUsername(username); if (internalAuth != null) { UserIdentification userIdentification = userIdentificationDAO.findByAuthSourceAndExternalId(getName(), String.valueOf(internalAuth.getId())); if(userIdentification != null){ return userIdentification.getPerson().getDefaultUser(); } return null; } else { return null; } }
Source:
public PatchLink createLink(int index, PatchScreen.Type patchType, SafeHtml before, SafeHtml after) { Patch patch = patchList.get(index); Key thisKey = patch.getKey(); PatchLink link; boolean newScrren = Dispatcher.isChangeScreen2(); if (newScrren && (detail.getPatches().get(index).getPatchType() .equals(PatchType.BINARY) || Gerrit.getUserAccount() .getGeneralPreferences().getDiffView() .equals(DiffView.UNIFIED_DIFF)) || !newScrren && patchType == PatchScreen.Type.UNIFIED) { link = new PatchLink.Unified("", base, thisKey, index, detail, this); } else { link = new PatchLink.SideBySide("", base, thisKey, index, detail, this); } SafeHtmlBuilder text = new SafeHtmlBuilder(); text.append(before); text.append(getFileNameOnly(patch)); text.append(after); SafeHtml.set(link, text); return link; }

Target:
public PatchLink createLink(int index, PatchScreen.Type patchType, SafeHtml before, SafeHtml after) { Patch patch = patchList.get(index); Key thisKey = patch.getKey(); PatchLink link; boolean isNewScreen = Dispatcher.isChangeScreen2(); if (isNewScreen && (detail.getPatches().get(index).getPatchType() .equals(PatchType.BINARY) || Gerrit.getUserAccount() .getGeneralPreferences().getDiffView() .equals(DiffView.UNIFIED_DIFF)) || !isNewScreen && patchType == PatchScreen.Type.UNIFIED) { link = new PatchLink.Unified("", base, thisKey, index, detail, this); } else { link = new PatchLink.SideBySide("", base, thisKey, index, detail, this); } SafeHtmlBuilder text = new SafeHtmlBuilder(); text.append(before); text.append(getFileNameOnly(patch)); text.append(after); SafeHtml.set(link, text); return link; }
Source:
protected ICommand getSetSAPKindCommand(final Port serviceAccessPoint) { RecordingCommand command = new RecordingCommand(TransactionUtil.getEditingDomain(serviceAccessPoint)) { @Override protected void doExecute() { serviceAccessPoint.setIsService(false); serviceAccessPoint.setIsBehavior(true); RTPort stereotype = UMLUtil.getStereotypeApplication(serviceAccessPoint, RTPort.class); stereotype.setIsWired(false); stereotype.setIsPublish(false); serviceAccessPoint.setVisibility(VisibilityKind.PROTECTED_LITERAL); } }; ICommand cmd = EMFtoGMFCommandWrapper.wrap(command); return cmd; }

Target:
protected ICommand getSetSAPKindCommand(final Port serviceAccessPoint) { Command command = RTPortUtils.getChangeKindCommand(serviceAccessPoint, RTPortKindEnum.SAP); ICommand cmd = EMFtoGMFCommandWrapper.wrap(command); return cmd; }
Source:
protected WorkbenchJob doCreateRefreshJob() { WorkbenchJob job = super.doCreateRefreshJob(); return new WorkbenchJob("Refresh Filter") { @Override public IStatus runInUIThread(IProgressMonitor monitor) { if (fCheckboxTreeViewer.getTree().isDisposed()) { return Status.CANCEL_STATUS; } Object[] expandedBefore = fCheckboxTreeViewer.getExpandedElements(); job.runInUIThread(monitor); Object[] expandedAfter = fCheckboxTreeViewer.getExpandedElements(); ArrayList<Object> list = new ArrayList<>(); for (int i = 0; i < expandedBefore.length; i++) { list.add(expandedBefore[i]); } for (int i = 0; i < expandedAfter.length; i++) { if (!list.contains(expandedAfter[i])) { list.add(expandedAfter[i]); } } fCheckboxTreeViewer.setCheckedElements(getCheckedElements()); fCheckboxTreeViewer.setExpandedElements(list.toArray()); return Status.OK_STATUS; } }; }

Target:
protected WorkbenchJob doCreateRefreshJob() { WorkbenchJob job = super.doCreateRefreshJob(); return new WorkbenchJob("Refresh Filter") { @Override public IStatus runInUIThread(IProgressMonitor monitor) { if (fCheckboxTreeViewer.getTree().isDisposed()) { return Status.CANCEL_STATUS; } Set<Object> expandedElements = new HashSet<>(Arrays.asList(fCheckboxTreeViewer.getExpandedElements())); job.runInUIThread(monitor); expandedElements.addAll(Arrays.asList(fCheckboxTreeViewer.getExpandedElements())); fCheckboxTreeViewer.getTree().setRedraw(false); fCheckboxTreeViewer.expandAll(); fCheckboxTreeViewer.setCheckedElements(getCheckedElements()); fCheckboxTreeViewer.collapseAll(); fCheckboxTreeViewer.getTree().setRedraw(true); fCheckboxTreeViewer.setExpandedElements(expandedElements.toArray()); return Status.OK_STATUS; } }; }
Source:
private void createNewStepContext() { stepContext = new ClassPathXmlApplicationContext(new String[]{"classpath*:cucumber-steps.xml"}, applicationContext); }

Target:
private void createNewStepContext() { stepContext = new ClassPathXmlApplicationContext(new String[]{"classpath*:cucumber-glue.xml"}, applicationContext); }