auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public void addRandomElectionPolicyInUI() throws Exception { page.treeNavigation() .step(SINGLETON_POLICY) .step(SINGLETON_POLICY_RESOURCE) .step(ELECTION_POLICY) .navigateToTreeItem().clickLabel(); WizardWindowWithAdvancedSelectBoxOptions window = page.getResourceManager() .addResource(WizardWindowWithAdvancedSelectBoxOptions.class); window.pick(RANDOM) .clickContinue() .finish(); new ResourceVerifier(SINGLETON_POLICY_ADDRESS.and(ELECTION_POLICY, RANDOM), client) .verifyExists("This fails because of <LINK_0>"); }

Target:
public void addRandomElectionPolicyInUI() throws Exception { page.treeNavigation() .step(SINGLETON_POLICY) .step(SINGLETON_POLICY_RESOURCE) .step(ELECTION_POLICY) .navigateToTreeItem().clickLabel(); WizardWindowWithAdvancedSelectBoxOptions window = page.getResourceManager() .addResource(WizardWindowWithAdvancedSelectBoxOptions.class); window.pick(RANDOM) .clickContinue() .finish(); new ResourceVerifier(SINGLETON_POLICY_ADDRESS.and(ELECTION_POLICY, RANDOM), client) .verifyExists("This probably fails because of <LINK_0>"); }
Source:
private HttpURLConnection connectTo(Endpoint endpoint) throws IOException { URL url = new URL(endpoint.asString()); return (HttpURLConnection) url.openConnection(); }

Target:
private HttpURLConnection connectTo(Endpoint endpoint) throws IOException { URL url = endpoint.asURL(); return (HttpURLConnection) url.openConnection(); }
Source:
public File newFolder(String folder) throws IOException { if (folder.startsWith(File.separator)) { throw new IOException("Folder name cannot start with a file separator"); } return newFolder(folder.split(FILE_SEPARATOR_REGEX)); }

Target:
public File newFolder(String folder) throws IOException { if (new File(folder).isAbsolute()) { throw new IOException("folder name must be a relative path"); } File file = new File(getRoot(), folder); if (!file.mkdirs()) { throw new IOException( "a folder with the name \'" + folder + "\' already exists"); } return file; }
Source:
private Set<IStorage> resolveTraversal(IFile file, Set<URI> bounds) { Collection<URI> uris = dependencyProviderRegistry.getDependencies(createURIFor(file)); Set<IStorage> traversalSet = new LinkedHashSet<IStorage>(); for (URI uri : uris) { IFile toResolve = getFileAt(uri); final Iterable<URI> dependencies = getDependenciesOf(toResolve, bounds); for (URI dep : dependencies) { traversalSet.add(getFileAt(dep)); } } return traversalSet; }

Target:
private Set<IStorage> resolveTraversal(IFile file, Set<URI> bounds) { final URI baseUri = createURIFor(file); final Set<IStorage> traversalSet = new LinkedHashSet<IStorage>(); for (URI uri : getUriAndDependentUrisFromDependencyProvider(baseUri)) { final IFile toResolve = getFileAt(uri); final Iterable<URI> dependencies = getDependenciesOf(toResolve, bounds); for (URI dep : dependencies) { traversalSet.add(getFileAt(dep)); } } return traversalSet; }
Source:
public synchronized byte[] getReferenceBases(final SAMSequenceRecord record, final boolean tryNameVariants) { { final String name = record.getSequenceName(); final byte[] bases = findInCache(name); if (bases != null) return bases; } final String md5 = record.getAttribute(SAMSequenceRecord.MD5_TAG); { if (md5 != null) { byte[] bases = findInCache(md5); if (bases != null) return bases; bases = findInCache(md5.toLowerCase()); if (bases != null) return bases; bases = findInCache(md5.toUpperCase()); if (bases != null) return bases; } } byte[] bases; { bases = findBasesByName(record.getSequenceName(), tryNameVariants); if (bases != null) { SequenceUtil.upperCase(bases); cacheW.put(record.getSequenceName(), new WeakReference<byte[]>( bases)); return bases; } } if (Defaults.REF_DOWNLOAD_ENABLED) { if (md5 != null) try { bases = findBasesByMD5(md5.toLowerCase()); } catch (final Exception e) { throw new RuntimeException(e); } if (bases != null) { SequenceUtil.upperCase(bases); cacheW.put(md5, new WeakReference<byte[]>(bases)); return bases; } } return null; }

Target:
public synchronized byte[] getReferenceBases(final SAMSequenceRecord record, final boolean tryNameVariants) { { final String name = record.getSequenceName(); final byte[] bases = findInCache(name); if (bases != null) return bases; } final String md5 = record.getAttribute(SAMSequenceRecord.MD5_TAG); { if (md5 != null) { byte[] bases = findInCache(md5); if (bases != null) return bases; bases = findInCache(md5.toLowerCase()); if (bases != null) return bases; bases = findInCache(md5.toUpperCase()); if (bases != null) return bases; } } byte[] bases; { bases = findBasesByName(record.getSequenceName(), tryNameVariants); if (bases != null) { SequenceUtil.upperCase(bases); cacheW.put(record.getSequenceName(), new WeakReference<byte[]>( bases)); return bases; } } { if (Defaults.USE_CRAM_REF_DOWNLOAD) { if (md5 != null) { try { bases = findBasesByMD5(md5.toLowerCase()); } catch (final Exception e) { throw new RuntimeException(e); } } if (bases != null) { SequenceUtil.upperCase(bases); cacheW.put(md5, new WeakReference<byte[]>(bases)); return bases; } } } return null; }
Source:
public void run() { while (true) { if (Thread.interrupted()) { log.warn("Prefetch thread was interrupted."); break; } if (prefetchCounters.byteSize < maxByteSize && prefetchCounters.size < maxRecordsCount) { try { GetRecordsResult getRecordsResult = getRecordsRetrievalStrategy.getRecords(maxRecordsPerCall); ProcessRecordsInput processRecordsInput = new ProcessRecordsInput() .withRecords(getRecordsResult.getRecords()) .withMillisBehindLatest(getRecordsResult.getMillisBehindLatest()) .withCacheEntryTime(Instant.now()); getRecordsResultQueue.put(processRecordsInput); prefetchCounters.added(processRecordsInput); } catch (InterruptedException e) { log.error("Interrupted while adding records to the cache", e); } } } }

Target:
public void run() { while (true) { if (Thread.interrupted()) { log.warn("Prefetch thread was interrupted."); break; } if (prefetchCounters.shouldGetNewRecords()) { try { GetRecordsResult getRecordsResult = getRecordsRetrievalStrategy.getRecords(maxRecordsPerCall); ProcessRecordsInput processRecordsInput = new ProcessRecordsInput() .withRecords(getRecordsResult.getRecords()) .withMillisBehindLatest(getRecordsResult.getMillisBehindLatest()) .withCacheEntryTime(Instant.now()); getRecordsResultQueue.put(processRecordsInput); prefetchCounters.added(processRecordsInput); } catch (InterruptedException e) { log.info("Thread was interrupted, indicating shutdown was called on the cache", e); } } } }
Source:
public void shouldRunQueryFromFile() throws IOException, InterruptedException { try (TempFile file = new TempFile()) { Files.write("select * from hive.default.nation;\n", file.file(), UTF_8); launchPrestoCliWithServerArgument("--file", file.file().getAbsolutePath()); assertThat(trimLines(presto.readRemainingOutputLines())).containsAll(nationTableBatchLines); presto.waitForWithTimeoutAndKill(); } }

Target:
public void shouldRunQueryFromFile() throws Exception { try (TempFile file = new TempFile()) { Files.write("select * from hive.default.nation;\n", file.file(), UTF_8); launchPrestoCliWithServerArgument("--file", file.file().getAbsolutePath()); assertThat(trimLines(presto.readRemainingOutputLines())).containsAll(nationTableBatchLines); presto.waitForWithTimeoutAndKill(); } }
Source:
protected void setUp() throws Exception { super.setUp(); mSyncthing = new SyncthingRunnable(new MockContext(null), getContext().getApplicationInfo().dataDir+"/"+SyncthingService.BINARY_NAME); mConfig = new ConfigXml(new MockContext(getContext())); mConfig.changeDefaultFolder(); mHttpsCertPath = getContext().getFilesDir()+"/"+SyncthingService.HTTPS_CERT_FILE; final CountDownLatch latch = new CountDownLatch(2); new PollWebGuiAvailableTask() { @Override protected void onPostExecute(Void aVoid) { mApi.onWebGuiAvailable(); latch.countDown(); } }.execute(mHttpsCertPath, mConfig.getWebGuiUrl()); mApi = new RestApi(getContext(), mConfig.getWebGuiUrl(), mConfig.getApiKey(), new RestApi.OnApiAvailableListener() { @Override public void onApiAvailable() { latch.countDown(); } }); latch.await(1, TimeUnit.SECONDS); }

Target:
protected void setUp() throws Exception { super.setUp(); new SyncthingRunnable(new MockContext(null), getContext().getApplicationInfo().dataDir + "/" + SyncthingService.BINARY_NAME); ConfigXml config = new ConfigXml(new MockContext(getContext())); config.changeDefaultFolder(); String httpsCertPath = getContext().getFilesDir() + "/" + SyncthingService.HTTPS_CERT_FILE; final CountDownLatch latch = new CountDownLatch(2); new PollWebGuiAvailableTask(httpsCertPath) { @Override protected void onPostExecute(Void aVoid) { mApi.onWebGuiAvailable(); latch.countDown(); } }.execute(config.getWebGuiUrl()); mApi = new RestApi(getContext(), config.getWebGuiUrl(), config.getApiKey(), new RestApi.OnApiAvailableListener() { @Override public void onApiAvailable() { latch.countDown(); } }); latch.await(1, TimeUnit.SECONDS); }
Source:
public void removeDiff(FilePatch2 diffToRemove){ FilePatch2[] temp = new FilePatch2[fDiffs.length - 1]; int counter = 0; for (FilePatch2 fDiff : fDiffs) { if (fDiff != diffToRemove) { temp[counter++] = fDiff; } } fDiffs = temp; }

Target:
public void removeDiff(FilePatch2 diffToRemove){ FilePatch2[] temp = new FilePatch2[fDiffs.length - 1]; int counter = 0; for (FilePatch2 diff : fDiffs) { if (diff != diffToRemove) { temp[counter++] = diff; } } fDiffs = temp; }
Source:
private Set<File> findLinks(List<FileSet> fileSets) { Set<File> result = new HashSet<>(); for (FileSet fs : fileSets) { DirectoryScanner ds = fs.getDirectoryScanner(getProject()); File dir = fs.getDir(getProject()); Stream.of(ds.getIncludedFiles(), ds.getIncludedDirectories()) .flatMap(Stream::of).forEach(path -> { final File f = new File(dir, path); if (Files.isSymbolicLink(f.toPath())) { result.add(f); } }); } return result; }

Target:
private Set<File> findLinks(List<FileSet> fileSets) { final Set<File> result = new HashSet<>(); for (FileSet fs : fileSets) { DirectoryScanner ds = fs.getDirectoryScanner(getProject()); File dir = fs.getDir(getProject()); Stream.of(ds.getIncludedFiles(), ds.getIncludedDirectories()) .flatMap(Stream::of).forEach(path -> { try { final File f = new File(dir, path); final File pf = f.getParentFile(); final String name = f.getName(); final File parentDirCanonicalizedFile = new File(pf.getCanonicalPath(), name); if (Files.isSymbolicLink(parentDirCanonicalizedFile.toPath())) { result.add(parentDirCanonicalizedFile); } } catch (IOException e) { handleError("IOException: " + path + " omitted"); } }); } return result; }
Source:
private TaskTracker forNewTable() throws Exception { if (isImmutableDataCopy()) { addConsolidatedPartitionDesc(); return tracker; } Iterator<AlterTableAddPartitionDesc> iterator = event.partitionDescriptions(tableDesc).iterator(); while (iterator.hasNext() && tracker.canAddMoreTasks()) { AlterTableAddPartitionDesc currentPartitionDesc = iterator.next(); addPartition(iterator.hasNext(), currentPartitionDesc, null); } return tracker; }

Target:
private TaskTracker forNewTable() throws Exception { if (isMetaDataOp()) { addConsolidatedPartitionDesc(); return tracker; } Iterator<AlterTableAddPartitionDesc> iterator = event.partitionDescriptions(tableDesc).iterator(); while (iterator.hasNext() && tracker.canAddMoreTasks()) { AlterTableAddPartitionDesc currentPartitionDesc = iterator.next(); addPartition(iterator.hasNext(), currentPartitionDesc, null); } return tracker; }
Source:
public static HazelcastSchema createRootSchema(List<TableResolver> tableResolvers) { Map<String, org.apache.calcite.schema.Table> rootTablesByName = new HashMap<>(); Map<String, Map<String, HazelcastTable>> tablesBySchema = new HashMap<>(); for (TableResolver tableResolver : tableResolvers) { Collection<Table> tables = tableResolver.getTables(); if (tables == null || tables.isEmpty()) { continue; } for (Table table : tables) { HazelcastTable convertedTable = new HazelcastTable( table, createTableStatistic(table) ); if (table.getSchemaName() == null || table.getSchemaName().isEmpty()) { rootTablesByName.put(table.getName(), convertedTable); } else { Map<String, HazelcastTable> schemaTableMap = tablesBySchema.computeIfAbsent(table.getSchemaName(), (k) -> new HashMap<>()); schemaTableMap.put(table.getName(), convertedTable); } } } Map<String, Schema> schemasByName = new HashMap<>(); for (Map.Entry<String, Map<String, HazelcastTable>> schemaEntry : tablesBySchema.entrySet()) { String schemaName = schemaEntry.getKey(); Map schemaTables = schemaEntry.getValue(); HazelcastSchema schema = new HazelcastSchema(emptyMap(), schemaTables); schemasByName.put(schemaName, schema); } HazelcastSchema rootSchema = new HazelcastSchema(schemasByName, rootTablesByName); return createCatalog(rootSchema); }

Target:
public static HazelcastSchema createRootSchema(List<TableResolver> tableResolvers) { Map<String, Map<String, HazelcastTable>> tableMap = new HashMap<>(); for (TableResolver tableResolver : tableResolvers) { Collection<Table> tables = tableResolver.getTables(); if (tables == null || tables.isEmpty()) { continue; } for (Table table : tables) { HazelcastTable convertedTable = new HazelcastTable( table, createTableStatistic(table) ); Map<String , HazelcastTable> schemaTableMap = tableMap.computeIfAbsent(table.getSchemaName(), (k) -> new HashMap<>()); schemaTableMap.put(table.getName(), convertedTable); } } Map<String, Schema> schemaMap = new HashMap<>(); for (Map.Entry<String, Map<String, HazelcastTable>> schemaEntry : tableMap.entrySet()) { String schemaName = schemaEntry.getKey(); Map schemaTables = schemaEntry.getValue(); HazelcastSchema schema = new HazelcastSchema(Collections.emptyMap(), schemaTables); schemaMap.put(schemaName, schema); } HazelcastSchema rootSchema = new HazelcastSchema(schemaMap, Collections.emptyMap()); return createCatalog(rootSchema); }
Source:
public void onDisable() { StaticLayer.GetConvertor().runShutdownHooks(); stopExecutionQueue(); ExtensionManager.Cleanup(); ClassDiscovery.getDefaultInstance().invalidateCaches(); ClassLoader loader = ClassDiscovery.getDefaultInstance().getDefaultClassLoader(); if (loader instanceof DynamicClassLoader) { DynamicClassLoader dcl = (DynamicClassLoader)loader; dcl.destroy(); } System.gc(); for (File f : CommandHelperFileLocations.getDefault().getExtensionCacheDirectory().listFiles()) { try { Files.delete(f.toPath()); } catch (IOException ex) { System.out.println("[CommandHelper] Could not delete loose file " + f.getAbsolutePath() + ": " + ex.getMessage()); } } ac = null; wep = null; }

Target:
public void onDisable() { StaticLayer.GetConvertor().runShutdownHooks(); stopExecutionQueue(); ExtensionManager.Cleanup(); ac = null; wep = null; }
Source:
public synchronized void init() { new Thread(new Runnable() { @Override public void run() { FrameworkInfo framework = FrameworkInfo.newBuilder() .setUser("") .setName(JenkinsScheduler.this.getMesosCloud().getFrameworkName()) .setCheckpoint(mesosCloud.isCheckpointingEnabled()).build(); LOGGER.info("Initializing the Mesos driver with options" + "\n" + "User: " + framework.getUser() + "\n" + "Framework Name: " + framework.getName() + "\n" + "Checkpointing: " + framework.getCheckpoint() ); driver = new MesosSchedulerDriver(JenkinsScheduler.this, framework, mesosCloud.getMaster()); if (driver.run() != Status.DRIVER_STOPPED) { LOGGER.severe("The mesos driver was aborted!"); } driver = null; } }).start(); }

Target:
public synchronized void init() { new Thread(new Runnable() { @Override public void run() { FrameworkInfo framework = FrameworkInfo.newBuilder() .setUser("") .setName(mesosCloud.getFrameworkName()) .setCheckpoint(mesosCloud.isCheckpoint()).build(); LOGGER.info("Initializing the Mesos driver with options" + "\n" + "User: " + framework.getUser() + "\n" + "Framework Name: " + framework.getName() + "\n" + "Checkpointing: " + framework.getCheckpoint() ); driver = new MesosSchedulerDriver(JenkinsScheduler.this, framework, mesosCloud.getMaster()); if (driver.run() != Status.DRIVER_STOPPED) { LOGGER.severe("The mesos driver was aborted!"); } driver = null; } }).start(); }
Source:
public static HadoopDruidIndexerConfig fromDistributedFileSystem(String path) { try { Path pt = new Path(path); FileSystem fs = FileSystem.get(pt.toUri(), new Configuration()); Reader reader = new InputStreamReader(fs.open(pt)); return fromMap( (Map<String, Object>) HadoopDruidIndexerConfig.jsonMapper.readValue( reader, new TypeReference<Map<String, Object>>() { } ) ); } catch (Exception e) { throw Throwables.propagate(e); } }

Target:
public static HadoopDruidIndexerConfig fromDistributedFileSystem(String path) { try { Path pt = new Path(path); FileSystem fs = pt.getFileSystem(new Configuration()); Reader reader = new InputStreamReader(fs.open(pt)); return fromMap( (Map<String, Object>) HadoopDruidIndexerConfig.jsonMapper.readValue( reader, new TypeReference<Map<String, Object>>() { } ) ); } catch (Exception e) { throw Throwables.propagate(e); } }
Source:
protected int getNumOfElementOnPage(By cssSelectorBy) { changeImplicitWait(500, TimeUnit.MILLISECONDS); int numElementOnPage = 0; try { numElementOnPage = driver.findElements(cssSelectorBy).size(); } catch (Exception ex) { numElementOnPage = 0; } finally { restoreDeaultImplicitWait(); } return numElementOnPage; }

Target:
protected int getNumOfElementOnPage(By cssSelectorBy) { changeImplicitWait(500, TimeUnit.MILLISECONDS); int numElementOnPage; try { numElementOnPage = driver.findElements(cssSelectorBy).size(); } catch (Exception ex) { numElementOnPage = 0; } finally { restoreDeaultImplicitWait(); } return numElementOnPage; }
Source:
public Bit() { super(BIT); }

Target:
Bit() { super(BIT); }
Source:
public synchronized void schedulingComplete() { if (!stateMachine.transitionToScheduled()) { return; } if (getAllTasks().stream().anyMatch(task -> getState() == StageState.RUNNING)) { stateMachine.transitionToRunning(); } if (finishedTasks.containsAll(allTasks)) { stateMachine.transitionToFinished(); } for (PlanNodeId partitionedSource : stateMachine.getFragment().getTableScanSchedulingOrder()) { schedulingComplete(partitionedSource); } }

Target:
public synchronized void schedulingComplete() { if (!stateMachine.transitionToScheduled()) { return; } if (getAllTasks().stream().anyMatch(task -> getState() == StageState.RUNNING)) { stateMachine.transitionToRunning(); } if (finishedTasks.containsAll(allTasks)) { stateMachine.transitionToFinished(); } for (PlanNodeId tableScanPlanNodeId : stateMachine.getFragment().getTableScanSchedulingOrder()) { schedulingComplete(tableScanPlanNodeId); } }
Source:
public CacheImpl(String name) { this.name = name; this.contextBuilder = this::getInvocationContextWithImplicitTransaction; this.pferContextBuilder = this::putForExternalReadContext; }

Target:
public CacheImpl(String name) { this.name = name; }
Source:
protected Object decode( Channel channel, SocketAddress remoteAddress, Object msg) throws Exception { Parser parser = new Parser(PATTERN, (String) msg); if (!parser.matches()) { return null; } Position position = new Position(); position.setProtocol(getProtocolName()); DeviceSession deviceSession = getDeviceSession(channel, remoteAddress, parser.next()); if (deviceSession == null) { return null; } position.setDeviceId(deviceSession.getDeviceId()); DateBuilder dateBuilder = new DateBuilder() .setDate(parser.nextInt(), parser.nextInt(), parser.nextInt()) .setTime(parser.nextInt(), parser.nextInt(), parser.nextInt()); position.setTime(dateBuilder.getDate()); position.setLongitude(parser.nextDouble()); position.setLatitude(parser.nextDouble()); position.setSpeed(UnitsConverter.knotsFromKph(parser.nextDouble())); position.setCourse(parser.nextDouble()); double altitude = parser.nextDouble(); int satellites = parser.nextInt(); position.setValid(satellites >= 3); position.set(Position.KEY_SATELLITES, satellites); if (satellites >= 4) { position.setAltitude(altitude); } position.set(Position.KEY_EVENT, parser.next()); position.set(Position.KEY_BATTERY, parser.next()); position.set(Position.PREFIX_TEMP + 1, parser.next()); return position; }

Target:
protected Object decode( Channel channel, SocketAddress remoteAddress, Object msg) throws Exception { Parser parser = new Parser(PATTERN, (String) msg); if (!parser.matches()) { return null; } Position position = new Position(); position.setProtocol(getProtocolName()); DeviceSession deviceSession = getDeviceSession(channel, remoteAddress, parser.next()); if (deviceSession == null) { return null; } position.setDeviceId(deviceSession.getDeviceId()); DateBuilder dateBuilder = new DateBuilder() .setDate(parser.nextInt(), parser.nextInt(), parser.nextInt()) .setTime(parser.nextInt(), parser.nextInt(), parser.nextInt()); position.setTime(dateBuilder.getDate()); position.setLongitude(parser.nextDouble()); position.setLatitude(parser.nextDouble()); position.setSpeed(UnitsConverter.knotsFromKph(parser.nextDouble())); position.setCourse(parser.nextDouble()); position.setAltitude(parser.nextDouble()); int satellites = parser.nextInt(); position.setValid(satellites >= 3); position.set(Position.KEY_SATELLITES, satellites); position.set(Position.KEY_EVENT, parser.next()); position.set(Position.KEY_BATTERY, parser.next()); position.set(Position.PREFIX_TEMP + 1, parser.next()); return position; }
Source:
public AggregateTestFixture(Class<T> aggregateType) { commandBus = new SimpleCommandBus(); eventStore = new RecordingEventStore(); resources.add(commandBus); resources.add(eventStore); this.aggregateType = aggregateType; clearGivenWhenState(); parameterResolverFactory = MultiParameterResolverFactory.ordered( new SimpleResourceParameterResolverFactory(resources), ClasspathParameterResolverFactory.forClass(aggregateType)); handlerDefinition = new ClasspathHandlerDefinition(Thread.currentThread().getContextClassLoader()); }

Target:
public AggregateTestFixture(Class<T> aggregateType) { commandBus = new SimpleCommandBus(); eventStore = new RecordingEventStore(); resources.add(commandBus); resources.add(eventStore); this.aggregateType = aggregateType; clearGivenWhenState(); parameterResolverFactory = MultiParameterResolverFactory.ordered( new SimpleResourceParameterResolverFactory(resources), ClasspathParameterResolverFactory.forClass(aggregateType)); handlerDefinition = ClasspathHandlerDefinition.forClass(aggregateType); }
Source:
public void handle(CacheRpcCommand command, Reply reply, DeliverOrder order) { if (order == DeliverOrder.TOTAL) { unexpectedDeliverMode(command, order); } try { final int commandTopologyId = extractCommandTopologyId(command); if (isCommandSentBeforeFirstTopology(commandTopologyId)) { reply.reply(CacheNotFoundResponse.INSTANCE); return; } final boolean waitTransactionalData = command.getCommandId() != StateRequestCommand.COMMAND_ID; final boolean onExecutorService = executeOnExecutorService(order, command); handleRunnable(createDefaultRunnable(command, reply, commandTopologyId, waitTransactionalData, onExecutorService), onExecutorService); } catch (Throwable throwable) { reply.reply(exceptionHandlingCommand(command, throwable)); } }

Target:
public void handle(CacheRpcCommand command, Reply reply, DeliverOrder order) { if (order == DeliverOrder.TOTAL) { unexpectedDeliverMode(command, order); } try { final int commandTopologyId = extractCommandTopologyId(command); final boolean waitTransactionalData = command.getCommandId() != StateRequestCommand.COMMAND_ID; final boolean onExecutorService = executeOnExecutorService(order, command); handleRunnable(createDefaultRunnable(command, reply, commandTopologyId, waitTransactionalData, onExecutorService), onExecutorService); } catch (Throwable throwable) { reply.reply(exceptionHandlingCommand(command, throwable)); } }
Source:
private static PushRegistrator getPushRegistrator() { if (mPushRegistrator != null) return mPushRegistrator; int deviceType = osUtils.getDeviceType(); if (deviceType == UserState.DEVICE_TYPE_FIREOS) mPushRegistrator = new PushRegistratorADM(); else if (new OSUtils().getDeviceType() == UserState.DEVICE_TYPE_ANDROID) { if (OSUtils.hasFCMLibrary()) mPushRegistrator = new PushRegistratorFCM(); else mPushRegistrator = new PushRegistratorGCM(); } else mPushRegistrator = new PushRegistratorHMS(); return mPushRegistrator; }

Target:
private static PushRegistrator getPushRegistrator() { if (mPushRegistrator != null) return mPushRegistrator; if (OSUtils.isFireOSDeviceType()) mPushRegistrator = new PushRegistratorADM(); else if (OSUtils.isAndroidDeviceType()) { if (OSUtils.hasFCMLibrary()) mPushRegistrator = new PushRegistratorFCM(); else mPushRegistrator = new PushRegistratorGCM(); } else mPushRegistrator = new PushRegistratorHMS(); return mPushRegistrator; }
Source:
private void initViews() { initLangugeSpinner(); initCarModeButton(); }

Target:
private void initViews() { initLangugeSpinner(); initCardModeButton(); }
Source:
private List<VDS> getServersInCluster() { return getVdsDAO().getAllForVdsGroup(getGlusterHook().getClusterId()); }

Target:
private List<VDS> getServersInCluster() { if (serversInCluster == null) { serversInCluster = getVdsDAO().getAllForVdsGroup(getGlusterHook().getClusterId()); } return serversInCluster; }
Source:
private void setXmlOvfData() { try { xmlOvfData = new String(Files.readAllBytes(Paths.get(VM_OVF_XML_DATA))); } catch (IOException e) { e.printStackTrace(); } }

Target:
private void setXmlOvfData() throws IOException { xmlOvfData = new String(Files.readAllBytes(Paths.get(VM_OVF_XML_DATA))); }
Source:
protected void onCreate(@Nullable Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.fui_activity_register_email); setTitle(R.string.fui_sign_in_default); if (savedInstanceState != null) { if (!getSupportFragmentManager().getFragments().isEmpty()) { if (getSupportFragmentManager().getFragments().get(0) instanceof EmailLinkEmailPromptFragment) { setTitle(R.string.fui_email_link_confirm_email_header); } } return; } boolean linkingFlow = getIntent().getIntExtra(RECOVERY_TYPE_KEY, -1) == RequestCodes.EMAIL_LINK_CROSS_DEVICE_LINKING_FLOW; Fragment fragment; if (linkingFlow) { fragment = EmailLinkCrossDeviceLinkingFragment.newInstance(); } else { setTitle(R.string.fui_email_link_confirm_email_header); fragment = EmailLinkEmailPromptFragment.newInstance(); } switchFragment(fragment, R.id.fragment_register_email, EmailLinkEmailPromptFragment.TAG); }

Target:
protected void onCreate(@Nullable Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.fui_activity_register_email); if (savedInstanceState != null) { return; } boolean linkingFlow = getIntent().getIntExtra(RECOVERY_TYPE_KEY, -1) == RequestCodes.EMAIL_LINK_CROSS_DEVICE_LINKING_FLOW; Fragment fragment; if (linkingFlow) { fragment = EmailLinkCrossDeviceLinkingFragment.newInstance(); } else { fragment = EmailLinkPromptEmailFragment.newInstance(); } switchFragment(fragment, R.id.fragment_register_email, EmailLinkPromptEmailFragment.TAG); }
Source:
public Slice getSlice(int field) { checkFieldType(field, ImmutableSet.of(VARCHAR)); Object value = getFieldValue(field); ElasticsearchColumnHandle column = columnHandles.get(field); if (tupleDomain.getDomains().isPresent()) { Map<ColumnHandle, Domain> domains = tupleDomain.getDomains().get(); Domain domain = domains.get(column); if (domain != null) { for (Range range : domain.getValues().getRanges().getOrderedRanges()) { if (range.isSingleValue()) { return Slices.utf8Slice(String.valueOf(getValue(column.getColumnType(), range.getLow().getValue()))); } } } } if (value instanceof Collection) { return Slices.utf8Slice(new JSONArray((List<Map<String, Object>>) value).toString()); } else { return Slices.utf8Slice(String.valueOf(value)); } }

Target:
public Slice getSlice(int field) { checkFieldType(field, ImmutableSet.of(VARCHAR)); Object value = getFieldValue(field); if (value instanceof Collection) { return utf8Slice(VALUE_CODEC.toJson(value)); } if (value == null) { return EMPTY_SLICE; } return utf8Slice(String.valueOf(value)); }
Source:
protected List<String> getTabCompleteOptions(Server server, User user, String commandLabel, String[] args) { if (args.length == 1) { return Lists.newArrayList(SpawnMob.mobParts(args[0])); } else { return java.util.Collections.emptyList(); } }

Target:
protected List<String> getTabCompleteOptions(Server server, User user, String commandLabel, String[] args) { if (args.length == 1) { return Lists.newArrayList(SpawnMob.mobParts(args[0])); } else { return Collections.emptyList(); } }
Source:
protected void updateDocumentStructures(DocumentEvent event) { if (fDocumentPartitioners != null) { fDocumentPartitioningChangedEvent= new DocumentPartitioningChangedEvent(this); for (Entry<String, IDocumentPartitioner> entry : fDocumentPartitioners.entrySet()) { String partitioning= entry.getKey(); IDocumentPartitioner partitioner= fDocumentPartitioners.get(partitioning); if (partitioner instanceof IDocumentPartitionerExtension3) { IDocumentPartitionerExtension3 extension= (IDocumentPartitionerExtension3) partitioner; if (extension.getActiveRewriteSession() != null) continue; } if (partitioner instanceof IDocumentPartitionerExtension) { IDocumentPartitionerExtension extension= (IDocumentPartitionerExtension) partitioner; IRegion r= extension.documentChanged2(event); if (r != null) fDocumentPartitioningChangedEvent.setPartitionChange(partitioning, r.getOffset(), r.getLength()); } else { if (partitioner.documentChanged(event)) fDocumentPartitioningChangedEvent.setPartitionChange(partitioning, 0, event.getDocument().getLength()); } } } if (fPositions.size() > 0) updatePositions(event); }

Target:
protected void updateDocumentStructures(DocumentEvent event) { if (fDocumentPartitioners != null) { fDocumentPartitioningChangedEvent= new DocumentPartitioningChangedEvent(this); for (Entry<String, IDocumentPartitioner> entry : fDocumentPartitioners.entrySet()) { String partitioning= entry.getKey(); IDocumentPartitioner partitioner= entry.getValue(); if (partitioner instanceof IDocumentPartitionerExtension3) { IDocumentPartitionerExtension3 extension= (IDocumentPartitionerExtension3) partitioner; if (extension.getActiveRewriteSession() != null) continue; } if (partitioner instanceof IDocumentPartitionerExtension) { IDocumentPartitionerExtension extension= (IDocumentPartitionerExtension) partitioner; IRegion r= extension.documentChanged2(event); if (r != null) fDocumentPartitioningChangedEvent.setPartitionChange(partitioning, r.getOffset(), r.getLength()); } else { if (partitioner.documentChanged(event)) fDocumentPartitioningChangedEvent.setPartitionChange(partitioning, 0, event.getDocument().getLength()); } } } if (fPositions.size() > 0) updatePositions(event); }
Source:
public static @Nullable Set<Integer> getActiveThreadsForRange(KernelAnalysisModule module, long rangeStart, long rangeEnd) { ITmfStateSystem ss = module.getStateSystem(); if (ss == null) { return null; } List<ITmfStateInterval> query; List<Integer> threadQuarks; try { query = ss.queryFullState(rangeStart); int threadsQuark = ss.getQuarkAbsolute(Attributes.THREADS); threadQuarks = ss.getSubAttributes(threadsQuark, false); } catch (AttributeNotFoundException | StateSystemDisposedException | TimeRangeException e) { return null; } return threadQuarks.stream() .filter(threadQuark -> { int activeStateQuark = ss.optQuarkRelative(threadQuark, Attributes.ACTIVE_STATE); if (activeStateQuark == ITmfStateSystem.INVALID_ATTRIBUTE) { return false; } ITmfStateInterval activeInterval = query.get(activeStateQuark); if (activeInterval.getStateValue().equals(StateValues.PROCESS_ACTIVE_STATE_ACTIVE)) { return true; } if (activeInterval.getEndTime() < rangeEnd) { return true; } return false; }) .map(ss::getAttributeName) .filter(attribName -> !attribName.startsWith(Attributes.THREAD_0_PREFIX)) .map(Integer::parseInt) .collect(Collectors.toSet()); }

Target:
public static @Nullable Set<Integer> getActiveThreadsForRange(KernelAnalysisModule module, long rangeStart, long rangeEnd) { ITmfStateSystem ss = module.getStateSystem(); if (ss == null) { return null; } List<ITmfStateInterval> query; List<Integer> threadQuarks; try { query = ss.queryFullState(rangeStart); int threadsQuark = ss.getQuarkAbsolute(Attributes.THREADS); threadQuarks = ss.getSubAttributes(threadsQuark, false); } catch (AttributeNotFoundException | StateSystemDisposedException e) { return null; } return threadQuarks.stream() .filter(threadQuark -> { int activeStateQuark = ss.optQuarkRelative(threadQuark, Attributes.ACTIVE_STATE); if (activeStateQuark == ITmfStateSystem.INVALID_ATTRIBUTE) { return false; } ITmfStateInterval activeInterval = query.get(activeStateQuark); if (activeInterval.getStateValue().equals(StateValues.PROCESS_ACTIVE_STATE_ACTIVE)) { return true; } if (activeInterval.getEndTime() < rangeEnd) { return true; } return false; }) .map(ss::getAttributeName) .filter(attribName -> !attribName.startsWith(Attributes.THREAD_0_PREFIX)) .map(Integer::parseInt) .collect(Collectors.toSet()); }
Source:
public ClientStats getClientStats() { final ChannelManager channelManager = requestSender.getChannelManager(); final long activeConnectionCount = channelManager.getOpenChannels().stream().filter(channel -> !channel.isOpen()).count(); final long idleConnectionCount = channelManager.getOpenChannels().stream().filter(Channel::isOpen).count(); return new ClientStats(activeConnectionCount, idleConnectionCount); }

Target:
public ClientStats getClientStats() { return channelManager.getClientStats(); }
Source:
protected boolean canDoAction() { if (!super.canDoAction()) { return false; } storage_domains dom = getStorageDomain(); if (dom == null) { addCanDoActionMessage(VdcBllMessages.CANNOT_REMOVE_STORAGE_DOMAIN_INVALID_STORAGE_DOMAIN_ID); return false; } VDS vds = getVds(); boolean format = getParameters().getDoFormat(); boolean localFs = isLocalFs(dom); addCanDoActionMessage(VdcBllMessages.VAR__ACTION__REMOVE); if (!CheckStorageDomain() || !checkStorageDomainSharedStatusNotLocked(dom)) { return false; } if (!localFs && !CheckStorageDomainNotInPool()) { return false; } if (localFs && isDomainAttached(dom) && !canDetachDomain(getParameters().getDestroyingPool(), false, true)) { return false; } if (vds == null) { if (localFs) { if (!InitializeVds()) { return false; } } else { addCanDoActionMessage(VdcBllMessages.CANNOT_REMOVE_STORAGE_DOMAIN_INVALID_HOST_ID); return false; } } if (isDataDomain(dom) && !format) { addCanDoActionMessage(VdcBllMessages.ERROR_CANNOT_REMOVE_STORAGE_DOMAIN_DO_FORMAT); return false; } return true; }

Target:
protected boolean canDoAction() { if (!super.canDoAction()) { return false; } storage_domains dom = getStorageDomain(); if (dom == null) { addCanDoActionMessage(VdcBllMessages.ACTION_TYPE_FAILED_STORAGE_DOMAIN_NOT_EXIST); return false; } VDS vds = getVds(); boolean format = getParameters().getDoFormat(); boolean localFs = isLocalFs(dom); addCanDoActionMessage(VdcBllMessages.VAR__ACTION__REMOVE); if (!CheckStorageDomain() || !checkStorageDomainSharedStatusNotLocked(dom)) { return false; } if (!localFs && !CheckStorageDomainNotInPool()) { return false; } if (localFs && isDomainAttached(dom) && !canDetachDomain(getParameters().getDestroyingPool(), false, true)) { return false; } if (vds == null) { if (localFs) { if (!InitializeVds()) { return false; } } else { addCanDoActionMessage(VdcBllMessages.CANNOT_REMOVE_STORAGE_DOMAIN_INVALID_HOST_ID); return false; } } if (isDataDomain(dom) && !format) { addCanDoActionMessage(VdcBllMessages.ERROR_CANNOT_REMOVE_STORAGE_DOMAIN_DO_FORMAT); return false; } return true; }
Source:
public DataSet<ExecRow> getDataSet(DataSetProcessor dsp) throws StandardException { if (!isOpen) throw new IllegalStateException("Operation is not open"); OperationContext operationContext = dsp.createOperationContext(this); operationContext.pushScope(); SConfiguration configuration= EngineDriver.driver().getConfiguration(); int MAX_LOOP = configuration.getRecursiveQueryIterationLimit(); Pair<Pair<DataSet, DataSet>, Integer> right = leftResultSet.getDataSet(dsp).persistIt2(); DataSet resultDS = right.getFirst().getFirst(); rightDS = right.getFirst().getSecond(); right = rightResultSet.getDataSet(dsp).persistIt2(); int loop = 0; while (right.getSecond() > 0 && loop < MAX_LOOP) { loop ++; Pair<DataSet, Integer> result = resultDS.union(right.getFirst().getFirst(), operationContext).persistIt(); resultDS.unpersistIt(); rightDS = right.getFirst().getSecond(); resultDS = result.getFirst(); right = rightResultSet.getDataSet(dsp).persistIt2(); rightDS.unpersistIt(); } operationContext.popScope(); return resultDS; }

Target:
public DataSet<ExecRow> getDataSet(DataSetProcessor dsp) throws StandardException { if (!isOpen) throw new IllegalStateException("Operation is not open"); OperationContext operationContext = dsp.createOperationContext(this); operationContext.pushScope(); Pair<DataSet, Integer> right = leftResultSet.getDataSet(dsp).persistIt(); DataSet resultDS = right.getFirst(); rightDS = right.getFirst().getClone(); right = rightResultSet.getDataSet(dsp).persistIt(); int loop = 0; while (right.getSecond() > 0 && loop < iterationLimit) { loop ++; Pair<DataSet, Integer> result = resultDS.union(right.getFirst(), operationContext).persistIt(); resultDS.unpersistIt(); rightDS = right.getFirst().getClone(); resultDS = result.getFirst(); right = rightResultSet.getDataSet(dsp).persistIt(); rightDS.unpersistIt(); } if (loop == iterationLimit) { throw new RuntimeException("Recursive query execution iteration limit of " + iterationLimit + " reached!"); } operationContext.popScope(); return resultDS; }
Source:
public Response add(GlusterVolume volume) { validateParameters(volume, "name", "volumeType", "bricks"); if (volume.isSetVolumeType()) { validateEnum(GlusterVolumeType.class, volume.getVolumeType().toUpperCase()); } if (volume.isSetTransportTypes()) { for (String transportType : volume.getTransportTypes().getTransportTypes()) { validateEnum(TransportType.class, transportType.toUpperCase()); } } if (volume.isSetAccessProtocols()) { for (String accessProtocol : volume.getAccessProtocols().getAccessProtocols()) { validateEnum(AccessProtocol.class, accessProtocol.toUpperCase()); } } GlusterVolumeEntity volumeEntity = getMapper(GlusterVolume.class, GlusterVolumeEntity.class).map(volume, null); volumeEntity.setClusterId(asGuid(parent.get().getId())); mapBricks(volume, volumeEntity); return performCreation(VdcActionType.CreateGlusterVolume, new CreateGlusterVolumeParameters(volumeEntity), new QueryIdResolver(VdcQueryType.GetGlusterVolumeById, IdQueryParameters.class), true); }

Target:
public Response add(GlusterVolume volume) { validateParameters(volume, "name", "volumeType", "bricks"); validateEnumParameters(volume); GlusterVolumeEntity volumeEntity = getMapper(GlusterVolume.class, GlusterVolumeEntity.class).map(volume, null); volumeEntity.setClusterId(asGuid(parent.get().getId())); mapBricks(volume, volumeEntity); return performCreation(VdcActionType.CreateGlusterVolume, new CreateGlusterVolumeParameters(volumeEntity), new QueryIdResolver(VdcQueryType.GetGlusterVolumeById, IdQueryParameters.class), true); }
Source:
public void run() { if (dialectEditor != null && editingSession.getEditors().contains(dialectEditor)) { if (dialectEditor.getSite() != null && dialectEditor.getSite().getShell() != null) { dialectEditor.getDialogFactory().editorWillBeClosedInformationDialog(dialectEditor.getSite().getShell()); } DialectUIManager.INSTANCE.closeEditor(dialectEditor, false); editingSession.detachEditor(dialectEditor); } }

Target:
public void run() { if (dialectEditor != null && editingSession.getEditors().contains(dialectEditor)) { if (dialectEditor.getSite() != null && dialectEditor.getSite().getShell() != null) { dialectEditor.getDialogFactory().editorWillBeClosedInformationDialog(dialectEditor.getSite().getShell()); } editingSession.closeEditors(false, dialectEditor); } }
Source:
public Date getTimestamp(MavenSession session, MavenProject project, MojoExecution execution) throws MojoExecutionException { FileRepositoryBuilder builder = new FileRepositoryBuilder() .readEnvironment() .findGitDir(project.getBasedir()) .setMustExist(true); try { Repository repository = builder.build(); RevWalk walk = new RevWalk(repository); String relPath = getRelPath(repository, project); if (relPath != null && relPath.length() > 0) { walk.setTreeFilter(AndTreeFilter.create(new PathFilter(relPath, getIgnoreFilter(execution)), TreeFilter.ANY_DIFF)); } ObjectId headId = repository.resolve(Constants.HEAD); walk.markStart(walk.lookupCommit(headId)); RevCommit commit = walk.iterator().next(); return new Date(commit.getCommitTime() * 1000L); } catch (IOException e) { throw new MojoExecutionException("Could not determine git commit timestamp", e); } }

Target:
public Date getTimestamp(MavenSession session, MavenProject project, MojoExecution execution) throws MojoExecutionException { FileRepositoryBuilder builder = new FileRepositoryBuilder() .readEnvironment() .findGitDir(project.getBasedir()) .setMustExist(true); try { Repository repository = builder.build(); try { RevWalk walk = new RevWalk(repository); try { String relPath = getRelPath(repository, project); if (relPath != null && relPath.length() > 0) { walk.setTreeFilter(AndTreeFilter.create(new PathFilter(relPath, getIgnoreFilter(execution)), TreeFilter.ANY_DIFF)); } ObjectId headId = repository.resolve(Constants.HEAD); walk.markStart(walk.parseCommit(headId)); RevCommit commit = walk.next(); return new Date(commit.getCommitTime() * 1000L); } finally { walk.release(); } } finally { repository.close(); } } catch (IOException e) { throw new MojoExecutionException("Could not determine git commit timestamp", e); } }
Source:
protected String putMultipartBlob(String container, Blob blob, PutOptions overrides) { MultipartUpload mpu = initiateMultipartUpload(container, blob.getMetadata()); List<MultipartPart> parts = Lists.newArrayList(); long contentLength = blob.getMetadata().getContentMetadata().getContentLength(); long partSize = getMaximumMultipartPartSize(); int partNumber = 1; for (Payload payload : slicer.slice(blob.getPayload(), partSize)) { MultipartPart part = uploadMultipartPart(mpu, partNumber, payload); parts.add(part); ++partNumber; } return completeMultipartUpload(mpu, parts); }

Target:
protected String putMultipartBlob(String container, Blob blob, PutOptions overrides) { MultipartUpload mpu = initiateMultipartUpload(container, blob.getMetadata()); List<MultipartPart> parts = Lists.newArrayList(); long contentLength = blob.getMetadata().getContentMetadata().getContentLength(); MultipartUploadSlicingAlgorithm algorithm = new MultipartUploadSlicingAlgorithm( getMinimumMultipartPartSize(), getMaximumMultipartPartSize(), getMaximumNumberOfParts()); long partSize = algorithm.calculateChunkSize(contentLength); int partNumber = 1; for (Payload payload : slicer.slice(blob.getPayload(), partSize)) { MultipartPart part = uploadMultipartPart(mpu, partNumber, payload); parts.add(part); ++partNumber; } return completeMultipartUpload(mpu, parts); }
Source:
public DuplicatedEventTypeNameException(Exception e, String name) { this.exception = e; this.name = name; }

Target:
public DuplicatedEventTypeNameException(Exception e, String name) { super(); this.exception = e; this.name = name; }
Source:
public static boolean isAllowedForServerAdapter(IResource resource) { return SERVER_ADDAPTER_ALLOWED_RESOURCE_TYPESS.stream().anyMatch(kind -> kind.equals(resource.getKind())); }

Target:
public static boolean isAllowedForServerAdapter(IResource resource) { return SERVER_ADAPTER_ALLOWED_RESOURCE_TYPES.contains(resource.getKind()); }
Source:
public synchronized Tuple next() throws SQLException { initScanner(); try { lastTuple = scanIterator.next(); if (lastTuple != null) { ImmutableBytesWritable ptr = new ImmutableBytesWritable(); lastTuple.getKey(ptr); } } catch (SQLException e) { try { throw ServerUtil.parseServerException(e); } catch(StaleRegionBoundaryCacheException e1) { if(scan.getAttribute(NON_AGGREGATE_QUERY)!=null) { Scan newScan = ScanUtil.newScan(scan); if(lastTuple != null) { lastTuple.getKey(ptr); byte[] startRowSuffix = ByteUtil.copyKeyBytesIfNecessary(ptr); if(ScanUtil.isLocalIndex(newScan)) { newScan.setAttribute(SCAN_START_ROW_SUFFIX, ByteUtil.nextKey(startRowSuffix)); } else { newScan.setStartRow(ByteUtil.nextKey(startRowSuffix)); } } plan.getContext().getConnection().getQueryServices().clearTableRegionCache(htable.getTableName()); this.scanIterator = plan.iterator(DefaultParallelScanGrouper.getInstance(), newScan); lastTuple = scanIterator.next(); } else { throw e; } } } return lastTuple; }

Target:
public synchronized Tuple next() throws SQLException { initScanner(); try { lastTuple = scanIterator.next(); if (lastTuple != null) { ImmutableBytesWritable ptr = new ImmutableBytesWritable(); lastTuple.getKey(ptr); } } catch (SQLException e) { try { throw ServerUtil.parseServerException(e); } catch(StaleRegionBoundaryCacheException e1) { if(ScanUtil.isNonAggregateScan(scan)) { Scan newScan = ScanUtil.newScan(scan); if(lastTuple != null) { lastTuple.getKey(ptr); byte[] startRowSuffix = ByteUtil.copyKeyBytesIfNecessary(ptr); if(ScanUtil.isLocalIndex(newScan)) { newScan.setAttribute(SCAN_START_ROW_SUFFIX, ByteUtil.nextKey(startRowSuffix)); } else { newScan.setStartRow(ByteUtil.nextKey(startRowSuffix)); } } plan.getContext().getConnection().getQueryServices().clearTableRegionCache(htable.getTableName()); this.scanIterator = plan.iterator(scanGrouper, newScan); lastTuple = scanIterator.next(); } else { throw e; } } } return lastTuple; }
Source:
protected PageableResult doSearch(RequestContext context) throws ResponseException { String identifierType = context.getRequest().getParameter("identifierType"); if(identifierType != null){ PatientIdentifierType requestedPatientIdentifierType = Context.getPatientService().getPatientIdentifierTypeByUuid(identifierType); if(requestedPatientIdentifierType == null) return new EmptySearchResult(); List<IdentifierSource> requestedIdentifierSources = new ArrayList(); for(IdentifierSource source: Context.getService(IdentifierSourceService.class).getAllIdentifierSources(false)){ if(source.getIdentifierType() == requestedPatientIdentifierType){ requestedIdentifierSources.add(source); } } return new NeedsPaging<IdentifierSource>(requestedIdentifierSources, context); } return new NeedsPaging<IdentifierSource>(Context.getService(IdentifierSourceService.class).getAllIdentifierSources(false), context); }

Target:
protected PageableResult doSearch(RequestContext context) throws ResponseException { String identifierType = context.getRequest().getParameter("identifierType"); if(identifierType != null){ PatientIdentifierType requestedPatientIdentifierType = Context.getPatientService().getPatientIdentifierTypeByUuid(identifierType); if(requestedPatientIdentifierType == null){ return new EmptySearchResult(); } List<IdentifierSource> requestedIdentifierSources = Context.getService(IdentifierSourceService.class) .getIdentifierSourcesByType(requestedPatientIdentifierType); return new NeedsPaging<IdentifierSource>(requestedIdentifierSources, context); } return new NeedsPaging<IdentifierSource>(Context.getService(IdentifierSourceService.class).getAllIdentifierSources(false), context); }
Source:
public static ListValue concat( ListValue... lists ) { int totalSize = 0; for ( ListValue list : lists ) { totalSize += list.size(); } AnyValue[] anyValues = new AnyValue[totalSize]; int startPoint = 0; for ( ListValue list : lists ) { System.arraycopy( list.asArray(), 0, anyValues, startPoint, list.size() ); startPoint += list.size(); } return VirtualValues.list( anyValues ); }

Target:
public static ListValue concat( ListValue... lists ) { return new ListValue.ConcatList( lists ); }