auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public void testUnmanagedEntityGcedOnUnmanageEvenIfEffectorInvoked() throws Exception { app = TestApplication.Factory.newManagedInstanceForTests(); BasicAttributeSensor<Object> byteArrayAttrib = new BasicAttributeSensor<Object>(Object.class, "test.byteArray", ""); for (int i = 0; i < 200; i++) { if (i<10 || i%10==0) LOG.info(JavaClassNames.niceClassAndMethod()+": iteration "+i); try { LOG.debug(JavaClassNames.niceClassAndMethod()+": iteration="+i); TestEntity entity = app.createAndManageChild(EntitySpec.create(TestEntity.class)); entity.setAttribute(byteArrayAttrib, new BigObject(10*1000*1000)); entity.invoke(TestEntity.MY_EFFECTOR, ImmutableMap.<String,Object>of()).get(); Entities.destroy(entity); forceGc(); System.gc(); System.gc(); } catch (OutOfMemoryError e) { LOG.warn(JavaClassNames.niceClassAndMethod()+": OOME at iteration="+i); ExecutionManager em = app.getManagementContext().getExecutionManager(); Collection<Task<?>> tasks = ((BasicExecutionManager)em).getAllTasks(); LOG.info("TASKS count "+tasks.size()+": "+tasks); throw e; } } }

Target:
public void testUnmanagedEntityGcedOnUnmanageEvenIfEffectorInvoked() throws Exception { app = TestApplication.Factory.newManagedInstanceForTests(); BasicAttributeSensor<Object> byteArrayAttrib = new BasicAttributeSensor<Object>(Object.class, "test.byteArray", ""); for (int i = 0; i < 1000; i++) { if (i<100 && i%10==0 || i%100==0) LOG.info(JavaClassNames.niceClassAndMethod()+": iteration "+i); try { LOG.debug(JavaClassNames.niceClassAndMethod()+": iteration="+i); TestEntity entity = app.createAndManageChild(EntitySpec.create(TestEntity.class)); entity.setAttribute(byteArrayAttrib, new BigObject(10*1000*1000)); entity.invoke(TestEntity.MY_EFFECTOR, ImmutableMap.<String,Object>of()).get(); Entities.unmanage(entity); forceGc(); } catch (OutOfMemoryError e) { LOG.warn(JavaClassNames.niceClassAndMethod()+": OOME at iteration="+i); ExecutionManager em = app.getManagementContext().getExecutionManager(); Collection<Task<?>> tasks = ((BasicExecutionManager)em).getAllTasks(); LOG.info("TASKS count "+tasks.size()+": "+tasks); throw e; } } }
Source:
public void getDb() throws Exception { String dbName = "testdb"; TestDatabase.genTable(1, 2); mException.expect(NotFoundException.class); mCatalog.getDatabase(dbName); mCatalog.attachDatabase(NoopJournalContext.INSTANCE, TestUdbFactory.TYPE, "connect_URI", TestDatabase.TEST_UDB_NAME, dbName, Collections.emptyMap()); assertEquals(dbName, mCatalog.getDatabase(dbName).getDbName()); }

Target:
public void getDb() throws Exception { String dbName = "testdb"; TestDatabase.genTable(1, 2); try { mCatalog.getDatabase(dbName); fail(); } catch (IOException e) { assertEquals("Database " + dbName + " does not exist", e.getMessage()); } mCatalog.attachDatabase(NoopJournalContext.INSTANCE, TestUdbFactory.TYPE, "connect_URI", TestDatabase.TEST_UDB_NAME, dbName, Collections.emptyMap()); assertEquals(dbName, mCatalog.getDatabase(dbName).getDbName()); }
Source:
public void onConnect(Session wssession) { logger.debug("Connected to server"); session = wssession; connected = true; if (eventHandler != null) { scheduler.submit(new Runnable() { @Override public void run() { try { eventHandler.onConnectionOpened(uri); } catch (Exception e) { logger.error("Error handling onConnectionOpened() {}", e.getMessage(), e); } } }); } }

Target:
public void onConnect(Session wssession) { logger.debug("Connected to server"); session = wssession; connected = true; if (eventHandler != null) { scheduler.submit(() -> { try { eventHandler.onConnectionOpened(uri); } catch (Exception e) { logger.error("Error handling onConnectionOpened() {}", e.getMessage(), e); } }); } }
Source:
public void addLight (PointLight point, Set<CubemapSide> sides) { PointLightProperties plProperty = new PointLightProperties(); for (int i = 0; i < 6; i++) { CubemapSide cubemapSide = Cubemap.CubemapSide.values()[i]; if (sides.contains(cubemapSide)) { PerspectiveCamera camera = new PerspectiveCamera(90, 0, 0); camera.position.set(point.position); camera.direction.set(cubemapSide.direction); camera.up.set(cubemapSide.up); camera.near = 0.1f; camera.far = 1000; LightProperties p = new LightProperties(camera); plProperty.properties.put(cubemapSide, p); } } pointCameras.put(point, plProperty); }

Target:
public void addLight (PointLight point, Set<CubemapSide> sides) { PointLightProperties plProperty = new PointLightProperties(); for (int i = 0; i < 6; i++) { CubemapSide cubemapSide = Cubemap.CubemapSide.values()[i]; if (sides.contains(cubemapSide)) { PerspectiveCamera camera = new PerspectiveCamera(90, 0, 0); camera.position.set(point.position); camera.direction.set(cubemapSide.direction); camera.up.set(cubemapSide.up); camera.near = 1; camera.far = 100; LightProperties p = new LightProperties(camera); plProperty.properties.put(cubemapSide, p); } } pointCameras.put(point, plProperty); }
Source:
public void handleFormSubmission(FormEntrySession session, HttpServletRequest submission) throws Exception{ lastSubmission = submission; String optedIn = Context.getAdministrationService().getGlobalProperty("htmlformentry.archiveHtmlForms","No"); if(Boolean.parseBoolean(optedIn)) { try { Patient patient = session.getPatient(); Encounter encounter = session.getEncounter(); SerializableFormObject formObject; if (patient != null && encounter != null) { formObject = new SerializableFormObject(session.getXmlDefinition(), submission.getParameterMap(), patient.getPatientIdentifier().getIdentifier(), patient.getUuid(), encounter.getUuid(),session.getHtmlFormId()); } else { formObject = new SerializableFormObject(session.getXmlDefinition(), submission.getParameterMap(), session.getHtmlFormId()); } if (formObject != null) { serializeFormData(formObject); } } finally { for (FormSubmissionControllerAction element : actions) { element.handleSubmission(session, submission); } } } else { for (FormSubmissionControllerAction element : actions) { element.handleSubmission(session, submission); } } }

Target:
public void handleFormSubmission(FormEntrySession session, HttpServletRequest submission) throws Exception{ lastSubmission = submission; String optedIn = Context.getAdministrationService().getGlobalProperty("htmlformentry.archiveHtmlForms","No"); if(Boolean.parseBoolean(optedIn)) { try { Patient patient = session.getPatient(); Encounter encounter = session.getEncounter(); SerializableFormObject formObject = null; if (patient != null && encounter != null) { formObject = new SerializableFormObject(session.getXmlDefinition(), submission.getParameterMap(), patient.getPatientIdentifier().getIdentifier(), patient.getUuid(), encounter.getUuid(),session.getHtmlFormId()); } else if(patient==null || encounter==null) { if(log.isDebugEnabled()) log.debug("Either patient or encounter or both are null"); formObject = new SerializableFormObject(session.getXmlDefinition(), submission.getParameterMap(), session.getHtmlFormId()); } if (formObject != null) { serializeFormData(formObject); } } finally { for (FormSubmissionControllerAction element : actions) { element.handleSubmission(session, submission); } } } else { for (FormSubmissionControllerAction element : actions) { element.handleSubmission(session, submission); } } }
Source:
private boolean filter(Position position) { StringBuilder filterType = new StringBuilder(); if (filterInvalid(position)) { filterType.append("Invalid "); } if (filterZero(position)) { filterType.append("Zero "); } if (filterDuplicate(position)) { filterType.append("Duplicate "); } if (filterFuture(position)) { filterType.append("Future "); } if (filterApproximate(position)) { filterType.append("Approximate "); } if (filterStatic(position)) { filterType.append("Static "); } if (filterDistance(position)) { filterType.append("Distance "); } if (filterType.length() > 0 && !filterLimit(position)) { StringBuilder logmsg = new StringBuilder(); logmsg.append("Position filtered by "); logmsg.append(filterType.toString()); logmsg.append("filters from device: "); logmsg.append(Context.getIdentityManager().getDeviceById(position.getDeviceId()).getUniqueId()); logmsg.append(" with id: "); logmsg.append(position.getDeviceId()); Log.info(logmsg.toString()); return true; } return false; }

Target:
private boolean filter(Position position) { StringBuilder filterType = new StringBuilder(); if (filterInvalid(position)) { filterType.append("Invalid "); } if (filterZero(position)) { filterType.append("Zero "); } if (filterDuplicate(position)) { filterType.append("Duplicate "); } if (filterFuture(position)) { filterType.append("Future "); } if (filterApproximate(position)) { filterType.append("Approximate "); } if (filterStatic(position)) { filterType.append("Static "); } if (filterDistance(position)) { filterType.append("Distance "); } if (filterType.length() > 0 && !filterLimit(position)) { StringBuilder message = new StringBuilder(); message.append("Position filtered by "); message.append(filterType.toString()); message.append("filters from device: "); message.append(Context.getIdentityManager().getDeviceById(position.getDeviceId()).getUniqueId()); message.append(" with id: "); message.append(position.getDeviceId()); Log.info(message.toString()); return true; } return false; }
Source:
public String getWebsocketEndpoint() { return protocol + "://" + getHost() + ":" + getPort() + "/ws/"; }

Target:
public URI getWebsocketEndpoint() { return uri; }
Source:
private View.OnTouchListener getConnectivityIndicatorTouchListener() { return new View.OnTouchListener() { private float initialTouchX; private float initialTouchY; private boolean isDragEvent=false; public boolean onTouch(View v,MotionEvent event) { if((event == null) || (ConnectivityIndicator.this.params == null) || (ConnectivityIndicator.this.windowManager == null)){ return false; } System.out.println(event.getAction() + " , " + event.getRawX() + " , " + event.getRawY()); switch(event.getAction()) { case MotionEvent.ACTION_DOWN: this.initialTouchX = event.getRawX(); this.initialTouchY = event.getRawY(); this.isDragEvent = false; return true; case MotionEvent.ACTION_UP: if(this.isDragEvent) { ConnectivityIndicator.this.currentX = ConnectivityIndicator.this.params.x; ConnectivityIndicator.this.currentY = ConnectivityIndicator.this.params.y; } return true; case MotionEvent.ACTION_MOVE: float diffX = event.getRawX() - this.initialTouchX; float diffY = event.getRawY() - this.initialTouchY; ConnectivityIndicator.this.params.x = (ConnectivityIndicator.this.currentX + (int)diffX); ConnectivityIndicator.this.params.y = (ConnectivityIndicator.this.currentY + (int)diffY); ConnectivityIndicator.this.windowManager.updateViewLayout(ConnectivityIndicator.this, ConnectivityIndicator.this.params); int slop = ViewConfiguration.get(v.getContext()).getScaledTouchSlop(); if((diffX > slop) || (diffY > slop)){ this.isDragEvent = true; } return true; } return false; } }; }

Target:
private View.OnTouchListener getConnectivityIndicatorTouchListener() { return new View.OnTouchListener() { private float initialTouchX; private float initialTouchY; private boolean isDragEvent=false; public boolean onTouch(View v,MotionEvent event) { if ((event == null) || (ConnectivityIndicator.this.mParams == null) || (ConnectivityIndicator.this.mWindowManager == null)) { return false; } switch(event.getAction()) { case MotionEvent.ACTION_DOWN: this.initialTouchX = event.getRawX(); this.initialTouchY = event.getRawY(); this.isDragEvent = false; return true; case MotionEvent.ACTION_UP: if(this.isDragEvent) { ConnectivityIndicator.this.mCurrentX = ConnectivityIndicator.this.mParams.x; ConnectivityIndicator.this.mCurrentY = ConnectivityIndicator.this.mParams.y; } return true; case MotionEvent.ACTION_MOVE: float diffX = event.getRawX() - this.initialTouchX; float diffY = event.getRawY() - this.initialTouchY; ConnectivityIndicator.this.mParams.x = (ConnectivityIndicator.this.mCurrentX + (int)diffX); ConnectivityIndicator.this.mParams.y = (ConnectivityIndicator.this.mCurrentY + (int)diffY); ConnectivityIndicator.this.mWindowManager.updateViewLayout(ConnectivityIndicator.this, ConnectivityIndicator.this.mParams); int slop = ViewConfiguration.get(v.getContext()).getScaledTouchSlop(); if((diffX > slop) || (diffY > slop)){ this.isDragEvent = true; } return true; } return false; } }; }
Source:
private void updateShareableDiskEnabled() { StorageDomain storageDomain = getStorageDomain().getSelectedItem(); if (StorageType.GLUSTERFS == storageDomain.getStorageType()) { getVolumeType().setSelectedItem(VolumeType.Preallocated); } if (storageDomain != null && (StorageType.GLUSTERFS == storageDomain.getStorageType() || storageDomain.getStorageType().equals(StorageType.MANAGED_BLOCK_STORAGE))) { getIsShareable().setEntity(false); getIsShareable().setIsChangeable(false, constants.shareableDiskNotSupported()); } else if (getVolumeType().getSelectedItem() == VolumeType.Sparse && storageDomain != null && storageDomain.getStorageType().isBlockDomain()) { getIsShareable().setEntity(false); getIsShareable().setIsChangeable(false, constants.shareableDiskNotSupportedByConfiguration()); } else { getIsShareable().setIsChangeable(isEditEnabled(), constants.shareableDiskNotSupportedOnRunningVM()); } }

Target:
private void updateShareableDiskEnabled() { StorageDomain storageDomain = getStorageDomain().getSelectedItem(); if (storageDomain != null && (StorageType.GLUSTERFS == storageDomain.getStorageType())) { getVolumeType().setSelectedItem(VolumeType.Preallocated); } if (storageDomain != null && (StorageType.GLUSTERFS == storageDomain.getStorageType() || storageDomain.getStorageType().equals(StorageType.MANAGED_BLOCK_STORAGE))) { getIsShareable().setEntity(false); getIsShareable().setIsChangeable(false, constants.shareableDiskNotSupported()); } else if (getVolumeType().getSelectedItem() == VolumeType.Sparse && storageDomain != null && storageDomain.getStorageType().isBlockDomain()) { getIsShareable().setEntity(false); getIsShareable().setIsChangeable(false, constants.shareableDiskNotSupportedByConfiguration()); } else { getIsShareable().setIsChangeable(isEditEnabled(), constants.shareableDiskNotSupportedOnRunningVM()); } }
Source:
private URI createURI(String query, Collection<? extends RequestParam> origParams) { Set<RequestParam> requestParamSet = new HashSet<RequestParam>(origParams); try { final URIBuilder builder = new URIBuilder(baseURL.toURI()); builder.addParameters(new ArrayList<>(convert(requestParamSet))); if (apiAccessKey != null) { builder.addParameter("key", apiAccessKey); } if (!query.isEmpty()) { builder.setPath((builder.getPath() == null? "" : builder.getPath()) + "/" + query); } return builder.build(); } catch (URISyntaxException e) { throw new RedmineInternalError(e); } }

Target:
private URI createURI(String query, Collection<? extends RequestParam> origParams) { Collection<? extends RequestParam> distinctParams = distinct(origParams); Collection<? extends NameValuePair> nameValueParams = toNameValue(distinctParams); try { final URIBuilder builder = new URIBuilder(baseURL.toURI()); builder.addParameters(new ArrayList<>(nameValueParams)); if (apiAccessKey != null) { builder.addParameter("key", apiAccessKey); } if (!query.isEmpty()) { builder.setPath((builder.getPath() == null? "" : builder.getPath()) + "/" + query); } return builder.build(); } catch (URISyntaxException e) { throw new RedmineInternalError(e); } }
Source:
int getMonth() { if (isYearDay() || isLeapDay()) { return 0; } int doy = getDayOfYearAdjusted() - 1; return 1 + (doy / InternationalFixedChronology.DAYS_IN_MONTH); }

Target:
int getMonth() { return this.month; }
Source:
public static void main(String[] args) throws Exception { String repoPath = System.getProperty("git_repo"); if (repoPath == null) { repoPath = "."; System.out.println( "System property 'git_repo' not specified, using current directory: " + new File(repoPath).getAbsolutePath()); } try (Repository db = new FileRepository(repoPath + "/.git")) { for (String cmd : args) { List<String> result = execute(cmd, db); for (String line : result) { System.out.println(line); } } } }

Target:
public static void main(String[] args) throws Exception { String workDir = System.getProperty("git_work_tree"); if (workDir == null) { workDir = "."; System.out.println( "System property 'git_work_tree' not specified, using current directory: " + new File(workDir).getAbsolutePath()); } try (Repository db = new FileRepository(workDir + "/.git")) { for (String cmd : args) { List<String> result = execute(cmd, db); for (String line : result) { System.out.println(line); } } } }
Source:
public static Bitmap decodeSampledBitmapFromResource(Resources res, int resId, int reqWidth, int reqHeight, boolean keepAspectRatio, Cache cache) { final BitmapFactory.Options options = new BitmapFactory.Options(); options.inJustDecodeBounds = true; BitmapFactory.decodeResource(res, resId, options); options.inSampleSize = calculateInSampleSize(options, reqWidth, reqHeight, keepAspectRatio); END_INCLUDE (read_bitmap_dimensions) if (Utils.hasHoneycomb()) { addInBitmapOptions(options, cache); } options.inJustDecodeBounds = false; Bitmap bitmap = null; InputStream is = null; try { final TypedValue value = new TypedValue(); is = res.openRawResource(resId, value); bitmap = BitmapFactory.decodeResourceStream(res, value, is, null, options); } catch (Exception e) { } if (bitmap == null && options != null && options.inBitmap != null) { throw new IllegalArgumentException("Problem decoding into existing bitmap"); } ExifInterface ei = getExifInterface(is); return scaleAndRotateBitmap(bitmap, ei, reqWidth, reqHeight, keepAspectRatio); }

Target:
public static Bitmap decodeSampledBitmapFromResource(Resources res, int resId, int reqWidth, int reqHeight, boolean keepAspectRatio, Cache cache) { final BitmapFactory.Options options = new BitmapFactory.Options(); options.inJustDecodeBounds = true; BitmapFactory.decodeResource(res, resId, options); options.inSampleSize = calculateInSampleSize(options.outWidth, options.outHeight, reqWidth, reqHeight); END_INCLUDE (read_bitmap_dimensions) if (Utils.hasHoneycomb()) { addInBitmapOptions(options, cache); } options.inJustDecodeBounds = false; Bitmap bitmap = null; InputStream is = null; try { final TypedValue value = new TypedValue(); is = res.openRawResource(resId, value); bitmap = BitmapFactory.decodeResourceStream(res, value, is, null, options); } catch (Exception e) { } if (bitmap == null && options != null && options.inBitmap != null) { throw new IllegalArgumentException("Problem decoding into existing bitmap"); } ExifInterface ei = getExifInterface(is); return scaleAndRotateBitmap(bitmap, ei, reqWidth, reqHeight, keepAspectRatio); }
Source:
public void analyzeBranch( Project project, List<FilePattern> filePatterns, List<SourceCodeFileAnalyzerPlugin> sourceCodeFileAnalyzerPlugins, String branchName) { long projectId = project.getId(); List<Commit> commits = getCommitsInProjectPort.getNonAnalyzedSortedByTimestampAscWithNoParents( projectId, filePatterns, branchName); if (commits.isEmpty() || sourceCodeFileAnalyzerPlugins.isEmpty()) { return; } List<Long> commitIds = new ArrayList<>(); Map<Long, List<MetricValue>> fileMetrics = saveMetricPort.getMetricsForFiles(projectId, branchName); for (int i = 0; i < commits.size() && activeAnalysis.get(projectId); i++) { List<MetricValue> metrics = analyzeCommitUseCase.analyzeCommit( commits.get(i), project, sourceCodeFileAnalyzerPlugins); zeroOutMissingMetrics(commits.get(i), metrics, fileMetrics); if (!metrics.isEmpty()) { saveMetricPort.saveMetricValues(metrics); saveCommitPort.setCommitsWithIDsAsAnalyzed(commitIds); commitIds.clear(); } commitIds.add(commits.get(i).getId()); log(commits.get(i)); } if (!getAvailableMetricsInProjectPort.get(projectId).isEmpty()) { saveCommitPort.setCommitsWithIDsAsAnalyzed(commitIds); } }

Target:
private void analyzeBranch( Project project, List<FilePattern> filePatterns, List<SourceCodeFileAnalyzerPlugin> sourceCodeFileAnalyzerPlugins, String branchName) { long projectId = project.getId(); List<Commit> commits = getCommitsInProjectPort.getNonAnalyzedSortedByTimestampAscWithNoParents( projectId, filePatterns, branchName); if (commits.isEmpty() || sourceCodeFileAnalyzerPlugins.isEmpty()) { return; } List<Long> commitIds = new ArrayList<>(); Map<Long, List<MetricValue>> fileMetrics = saveMetricPort.getMetricsForFiles(projectId, branchName); for (int i = 0; i < commits.size() && activeAnalysis.get(projectId); i++) { List<MetricValue> metrics = analyzeCommitUseCase.analyzeCommit( commits.get(i), project, sourceCodeFileAnalyzerPlugins); zeroOutMissingMetrics(commits.get(i), metrics, fileMetrics); if (!metrics.isEmpty()) { saveMetricPort.saveMetricValues(metrics); saveCommitPort.setCommitsWithIDsAsAnalyzed(commitIds); commitIds.clear(); } commitIds.add(commits.get(i).getId()); log(commits.get(i)); } if (!getAvailableMetricsInProjectPort.get(projectId).isEmpty()) { saveCommitPort.setCommitsWithIDsAsAnalyzed(commitIds); } }
Source:
private void verifyLogs(int[][] expectedLogs, List<ActivityLogEntry> actualLogs) { List<String> expectedMsgs = generateExpectedMsgFrom(expectedLogs); assertEquals(expectedMsgs.size(), actualLogs.size()); for (int i = 0; i < expectedMsgs.size(); i++) { String actualMsg = actualLogs.get(i).generateLogMessage(); assertTrue("expecte: " + expectedMsgs.get(i) + "to contain:" + actualMsg, expectedMsgs.get(i).contains(actualMsg)); } }

Target:
private void verifyLogs(int[][] expectedLogs, List<ActivityLogEntry> actualLogs) { List<String> expectedMsgs = generateExpectedMsgFrom(expectedLogs); assertEquals(expectedMsgs.size(), actualLogs.size()); for (int i = 0; i < expectedMsgs.size(); i++) { String actualMsg = actualLogs.get(i).generateLogMessage(); assertTrue("expect: " + expectedMsgs.get(i) + "to contain:" + actualMsg, expectedMsgs.get(i).contains(actualMsg)); } }
Source:
private boolean propertiesRequiringVmUpdateDeviceWereUpdated() { return (!StringUtils.equals(oldIface.getNetworkName(), getNetworkName())) || oldIface.isLinked() != getInterface().isLinked() || !StringUtils.equals(oldIface.getCustomProperties(), getInterface().getCustomProperties()); }

Target:
private boolean propertiesRequiringVmUpdateDeviceWereUpdated() { return (!StringUtils.equals(oldIface.getNetworkName(), getNetworkName())) || oldIface.isLinked() != getInterface().isLinked() || !ObjectUtils.objectsEqual(oldIface.getCustomProperties(), getInterface().getCustomProperties()); }
Source:
private static HeldLocksToken acquireLock(LockService lockService, LockRequest lockRequest) { int failureCount = 0; while (true) { HeldLocksToken response; try { response = lockService.lockAndGetHeldLocks(LockClient.ANONYMOUS.getClientId(), lockRequest); } catch (InterruptedException e) { Thread.currentThread().interrupt(); throw new RuntimeException(e); } if (response == null) { RuntimeException ex = new LockAcquisitionException( "Failed to lock using the provided lock request: " + lockRequest); switch (lockRequest.getBlockingMode()) { case DO_NOT_BLOCK: log.debug("Could not lock successfully", ex); break; case BLOCK_UNTIL_TIMEOUT: case BLOCK_INDEFINITELY: case BLOCK_INDEFINITELY_THEN_RELEASE: log.warn("Could not lock successfully", ex); break; } ++failureCount; if (failureCount >= NUM_RETRIES) { log.warn("Failing after tries", failureCount, ex); throw ex; } } else { return response; } } }

Target:
private static HeldLocksToken acquireLock(LockService lockService, LockRequest lockRequest) { int failureCount = 0; while (true) { HeldLocksToken response; try { response = lockService.lockAndGetHeldLocks(LockClient.ANONYMOUS.getClientId(), lockRequest); } catch (InterruptedException e) { Thread.currentThread().interrupt(); throw new RuntimeException(e); } if (response == null) { RuntimeException ex = new LockAcquisitionException( "Failed to lock using the provided lock request: " + lockRequest); switch (lockRequest.getBlockingMode()) { case DO_NOT_BLOCK: log.debug("Could not lock successfully", ex); throw ex; case BLOCK_UNTIL_TIMEOUT: case BLOCK_INDEFINITELY: case BLOCK_INDEFINITELY_THEN_RELEASE: log.warn("Could not lock successfully", ex); ++failureCount; if (failureCount >= NUM_RETRIES) { log.warn("Failing after tries", failureCount, ex); throw ex; } break; } } else { return response; } } }
Source:
private void checkFeaturesOnNode(int nodeIdx) throws InterruptedException { Ignite ignite = ignite(nodeIdx); ClusterGroup locCluster = ignite.cluster().forNodeIds(Collections.singletonList(ignite.cluster().localNode().id())); IgniteCompute compute = ignite.compute(locCluster); CountDownLatch runLatch = new CountDownLatch(1); compute.broadcast(runLatch::countDown); runLatch.await(); IgniteServices services = ignite.services(locCluster); String svcName = "service-" + nodeIdx; assertNull("Service unexpectedly present before deployment", services.service(svcName)); services.deployClusterSingleton(svcName, new DummyService()); assertNotNull("Service unexpectedly not present", services.service(svcName)); services.cancel(svcName); assertNull("Service unexpectedly present after cancellation", services.service(svcName)); String queueName = "queue-" + nodeIdx; try (IgniteQueue<String> queue = ignite.queue(queueName, 3, new CollectionConfiguration())) { assertTrue("Queue is unexpectedly not empty after creation", queue.isEmpty()); queue.put("1"); queue.put("2"); queue.put("3"); assertEquals("Unexpected queue element", "1", queue.poll()); assertEquals("Unexpected queue element", "2", queue.poll()); assertEquals("Unexpected queue element", "3", queue.poll()); assertTrue("Queue is unexpectedly not empty after polling", queue.isEmpty()); } }

Target:
private void checkFeaturesOnNode(int nodeIdx) throws InterruptedException { checkComputeOnNode(nodeIdx); checkServicesOnNode(nodeIdx); checkDataStructuresOnNode(nodeIdx); }
Source:
static public junit.framework.Test suite() throws Exception { LocalCluster config; Map<String, String> additionalEnv = new HashMap<>(); String bundleLocation = System.getProperty("user.dir") + "/bundles"; System.out.println("Bundle location is: " + bundleLocation); additionalEnv.put("voltdbbundlelocation", bundleLocation); final MultiConfigSuiteBuilder builder = new MultiConfigSuiteBuilder(TestImportSuite.class); VoltProjectBuilder project = generateVoltProject(true, false); config = new LocalCluster("import-ddl-cluster-rep.jar", 4, 1, 0, BackendTarget.NATIVE_EE_JNI, LocalCluster.FailureState.ALL_RUNNING, true, false, additionalEnv); config.setHasLocalServer(false); boolean compile = config.compile(project); assertTrue(compile); builder.addServerConfig(config, false); return builder; }

Target:
static public junit.framework.Test suite() throws Exception { LocalCluster config; Map<String, String> additionalEnv = new HashMap<>(); String bundleLocation = System.getProperty("user.dir") + "/bundles"; System.out.println("Bundle location is: " + bundleLocation); additionalEnv.put(CatalogUtil.VOLTDB_BUNDLE_LOCATION_PROPERTY_NAME, bundleLocation); final MultiConfigSuiteBuilder builder = new MultiConfigSuiteBuilder(TestImportSuite.class); VoltProjectBuilder project = generateVoltProject(true, false); config = new LocalCluster("import-ddl-cluster-rep.jar", 4, 1, 0, BackendTarget.NATIVE_EE_JNI, LocalCluster.FailureState.ALL_RUNNING, true, false, additionalEnv); config.setHasLocalServer(false); boolean compile = config.compile(project); assertTrue(compile); builder.addServerConfig(config, false); return builder; }
Source:
public String toString() { return String.format("AxisRange[%d, %d]", getLower(), getUpper()); }

Target:
public String toString() { return String.format("AxisRange[%f, %f]", getLower(), getUpper()); }
Source:
private void scheduleFilter(CallFilter filter) { CallFilteringResult result = new CallFilteringResult.Builder() .setShouldAllowCall(true) .setShouldReject(false) .setShouldSilence(false) .setShouldAddToCallLog(true) .setShouldShowNotification(true) .build(); for (CallFilter dependencyFilter : filter.getDependencies()) { result = result.combine(dependencyFilter.getResult()); } mCurrentResult = result; final CallFilteringResult input = result; CompletableFuture<CallFilteringResult> startFuture = CompletableFuture.completedFuture(input); PostFilterTask postFilterTask = new PostFilterTask(filter); startFuture.thenComposeAsync(filter::startFilterLookup, mExecutor) .whenCompleteAsync((x, e) -> postFilterTask.whenDone(x), mExecutor); }

Target:
private void scheduleFilter(CallFilter filter) { CallFilteringResult result = new CallFilteringResult.Builder() .setShouldAllowCall(true) .setShouldReject(false) .setShouldSilence(false) .setShouldAddToCallLog(true) .setShouldShowNotification(true) .build(); for (CallFilter dependencyFilter : filter.getDependencies()) { result = result.combine(dependencyFilter.getResult()); } mCurrentResult = result; final CallFilteringResult input = result; CompletableFuture<CallFilteringResult> startFuture = CompletableFuture.completedFuture(input); PostFilterTask postFilterTask = new PostFilterTask(filter); startFuture.thenComposeAsync(filter::startFilterLookup, mExecutor) .thenApplyAsync(postFilterTask::whenDone, mExecutor); }
Source:
private static @NonNull Set<@NonNull Entry<String, Set<String>>> getSsNames(SWTBotView bot) { SWTBotTimeGraph timeGraph = new SWTBotTimeGraph(bot.bot()); SWTBotTimeGraphEntry[] traceEntries = timeGraph.getEntries(); SWTBotTimeGraphEntry trace = timeGraph.getEntry("synthetic-trace"); assertEquals("State system explorer should have a single trace entry: " + Arrays.toString(traceEntries), 1, traceEntries.length); SWTBotTimeGraphEntry[] modules = trace.getEntries(); Map<String, Set<String>> modulesToStateSystems = new HashMap<>(); for (SWTBotTimeGraphEntry module : modules) { Set<String> stateSystems = new HashSet<>(); for (SWTBotTimeGraphEntry stateSystem : module.getEntries()) { stateSystems.add(stateSystem.getText()); } modulesToStateSystems.put(module.getText(), stateSystems); } return modulesToStateSystems.entrySet(); }

Target:
private static @NonNull Set<@NonNull Entry<String, Set<String>>> getSsNames(SWTBotView bot) { SWTBotTimeGraph timeGraph = new SWTBotTimeGraph(bot.bot()); SWTBotTimeGraphEntry trace = timeGraph.getEntry("synthetic-trace"); SWTBotTimeGraphEntry[] traceEntries = timeGraph.getEntries(); assertEquals("State system explorer should have a single trace entry: " + Arrays.toString(traceEntries), 1, traceEntries.length); SWTBotTimeGraphEntry[] modules = trace.getEntries(); Map<String, Set<String>> modulesToStateSystems = new HashMap<>(); for (SWTBotTimeGraphEntry module : modules) { Set<String> stateSystems = new HashSet<>(); for (SWTBotTimeGraphEntry stateSystem : module.getEntries()) { stateSystems.add(stateSystem.getText()); } modulesToStateSystems.put(module.getText(), stateSystems); } return modulesToStateSystems.entrySet(); }
Source:
private void startPlayback() { if (player != null) { switch (player.getPlaybackState()) { case Player.STATE_IDLE: case Player.STATE_ENDED: initializePlayer(); break; case Player.STATE_BUFFERING: case Player.STATE_READY: if (!player.getPlayWhenReady()) { setPlayWhenReady(true); } break; default: break; } } else { initializePlayer(); } if (!disableFocus) { setKeepScreenOn(true && preventsDisplaySleepDuringVideoPlayback); } }

Target:
private void startPlayback() { if (player != null) { switch (player.getPlaybackState()) { case Player.STATE_IDLE: case Player.STATE_ENDED: initializePlayer(); break; case Player.STATE_BUFFERING: case Player.STATE_READY: if (!player.getPlayWhenReady()) { setPlayWhenReady(true); } break; default: break; } } else { initializePlayer(); } if (!disableFocus) { setKeepScreenOn(preventsDisplaySleepDuringVideoPlayback); } }
Source:
public void registerMessageGroupExpiryCallback(MessageGroupCallback callback) { if (callback instanceof UniqueExpiryCallback) { boolean uniqueExpiryCallbackPresent = this.expiryCallbacks.stream() .anyMatch(UniqueExpiryCallback.class::isInstance); Assert.isTrue(!uniqueExpiryCallbackPresent, "Only one instance of 'UniqueExpiryCallback' can be registered in the 'MessageGroupStore'." + " Use separate 'MessageGroupStore' for each aggregator/resequencer."); } this.expiryCallbacks.add(callback); }

Target:
public void registerMessageGroupExpiryCallback(MessageGroupCallback callback) { if (callback instanceof UniqueExpiryCallback) { boolean uniqueExpiryCallbackPresent = this.expiryCallbacks.stream() .anyMatch(UniqueExpiryCallback.class::isInstance); if (!uniqueExpiryCallbackPresent && this.logger.isErrorEnabled()) { this.logger.error("Only one instance of 'UniqueExpiryCallback' can be registered in the " + "'MessageGroupStore'. Use a separate 'MessageGroupStore' for each aggregator/resequencer."); } } this.expiryCallbacks.add(callback); }
Source:
public boolean equals(Object obj) { return obj instanceof TypeInInputLibraryLocation && ((TypeInInputLibraryLocation) obj).inputLibLoc.equals(inputLibLoc) && ((TypeInInputLibraryLocation) obj).typeName.equals(typeName); }

Target:
public final boolean equals(Object obj) { return obj instanceof TypeInInputLibraryLocation && ((TypeInInputLibraryLocation) obj).inputLibLoc.equals(inputLibLoc) && ((TypeInInputLibraryLocation) obj).typeName.equals(typeName); }
Source:
public CompilationUnitDeclaration dietParse(ICompilationUnit sourceUnit, CompilationResult compilationResult) { CompilationUnitDeclaration parsedUnit; boolean old = this.diet; try { this.dietInt = 0; this.diet = true; parsedUnit = parse(sourceUnit, compilationResult); } finally { this.diet = old; } return parsedUnit; }

Target:
public CompilationUnitDeclaration dietParse(ICompilationUnit sourceUnit, CompilationResult compilationResult) { CompilationUnitDeclaration parsedUnit; boolean old = this.diet; int oldInt = this.dietInt; try { this.dietInt = 0; this.diet = true; parsedUnit = parse(sourceUnit, compilationResult); } finally { this.diet = old; this.dietInt = oldInt; } return parsedUnit; }
Source:
public void testPrepareResponse() { try { reservationReportPdfStamperView.prepareResponse(request, response); assertThat(response.getCharacterEncoding(), is( StandardCharsets.UTF_8.name())); } catch (Exception e) { e.printStackTrace(); fail(); } }

Target:
public void testPrepareResponse() { HttpServletRequest request = new MockHttpServletRequest(); HttpServletResponse response = new MockHttpServletResponse(); reservationReportPdfStamperView.prepareResponse(request, response); assertThat(response.getHeader("Pragma"), is("private")); assertThat(response.getHeader("Cache-Control"), is( "private, must-revalidate")); assertThat(response.getCharacterEncoding(), is(StandardCharsets.UTF_8 .name())); }
Source:
public int hashCode() { return ((int) this.intermediateDataSetID.getLowerPart()) ^ ((int) (this.intermediateDataSetID.getLowerPart() >>> 32)) ^ ((int) this.intermediateDataSetID.getUpperPart()) ^ ((int) (this.intermediateDataSetID.getUpperPart() >>> 32)) ^ (this.partitionNum); }

Target:
public int hashCode() { return this.intermediateDataSetID.hashCode() ^ this.partitionNum; }
Source:
public void execute(Task task, TaskActionInformation actionInformation, TaskContext taskContext) throws TaskHandlerException { LOGGER.info("Executing the action with name: from the task with name: {}", actionInformation.getName(), task.getName()); this.keyEvaluator = new KeyEvaluator(taskContext); ActionEvent action = getActionEvent(actionInformation); Map<String, Object> parameters = createParameters(actionInformation, action); if (action.hasService() && bundleContext != null) { if (callActionServiceMethod(action, parameters)) { LOGGER.info("The action with name: from the task with name: was executed", actionInformation.getName(), task.getName()); return; } activityService.addWarning(task, "task.warning.serviceUnavailable", action.getServiceInterface()); } if (!action.hasSubject()) { throw new TaskHandlerException(ACTION, "task.error.cantExecuteAction"); } else { eventRelay.sendEventMessage(new MotechEvent(action.getSubject(), parameters)); } }

Target:
public void execute(Task task, TaskActionInformation actionInformation, TaskContext taskContext) throws TaskHandlerException { LOGGER.info("Executing task action: from task: {}", actionInformation.getName(), task.getName()); this.keyEvaluator = new KeyEvaluator(taskContext); ActionEvent action = getActionEvent(actionInformation); Map<String, Object> parameters = createParameters(actionInformation, action); LOGGER.debug("Parameters created: for task action: {}", parameters.toString(), action.getName()); if (action.hasService() && bundleContext != null) { if (callActionServiceMethod(action, parameters)) { LOGGER.info("Action: from task: was executed through an OSGi service call", actionInformation.getName(), task.getName()); return; } LOGGER.info("There is no service: {}", action.getServiceInterface()); activityService.addWarning(task, "task.warning.serviceUnavailable", action.getServiceInterface()); } if (!action.hasSubject()) { throw new TaskHandlerException(ACTION, "task.error.cantExecuteAction"); } else { LOGGER.info("Event: was sent", action.getSubject()); eventRelay.sendEventMessage(new MotechEvent(action.getSubject(), parameters)); } }
Source:
public KeyAsyncClient buildAsyncClient() { Configuration buildConfiguration = (configuration == null) ? ConfigurationManager.getConfiguration().clone() : configuration; URL buildEndpoint = getBuildEndpoint(buildConfiguration); if (buildEndpoint == null) { throw new IllegalStateException(KeyVaultErrorCodeStrings.getErrorString(KeyVaultErrorCodeStrings.VAULT_END_POINT_REQUIRED)); } if (pipeline != null) { return new KeyAsyncClient(endpoint, pipeline); } if (credential == null) { throw new IllegalStateException(KeyVaultErrorCodeStrings.getErrorString(KeyVaultErrorCodeStrings.CREDENTIAL_REQUIRED)); } final List<HttpPipelinePolicy> policies = new ArrayList<>(); policies.add(new UserAgentPolicy(AzureKeyVaultConfiguration.SDK_NAME, AzureKeyVaultConfiguration.SDK_VERSION, buildConfiguration)); policies.add(retryPolicy); policies.add(new BearerTokenAuthenticationPolicy(credential, KeyAsyncClient.KEY_VAULT_SCOPE)); policies.addAll(this.policies); HttpPolicyProviders.addAfterRetryPolicies(policies); policies.add(new HttpLoggingPolicy(httpLogDetailLevel)); HttpPipeline pipeline = HttpPipeline.builder() .policies(policies.toArray(new HttpPipelinePolicy[0])) .httpClient(httpClient) .build(); return new KeyAsyncClient(endpoint, pipeline); }

Target:
public KeyAsyncClient buildAsyncClient() { Configuration buildConfiguration = (configuration == null) ? ConfigurationManager.getConfiguration().clone() : configuration; URL buildEndpoint = getBuildEndpoint(buildConfiguration); if (buildEndpoint == null) { throw new IllegalStateException(KeyVaultErrorCodeStrings.getErrorString(KeyVaultErrorCodeStrings.VAULT_END_POINT_REQUIRED)); } if (pipeline != null) { return new KeyAsyncClient(endpoint, pipeline); } if (credential == null) { throw new IllegalStateException(KeyVaultErrorCodeStrings.getErrorString(KeyVaultErrorCodeStrings.CREDENTIAL_REQUIRED)); } final List<HttpPipelinePolicy> policies = new ArrayList<>(); policies.add(new UserAgentPolicy(AzureKeyVaultConfiguration.SDK_NAME, AzureKeyVaultConfiguration.SDK_VERSION, buildConfiguration)); HttpPolicyProviders.addBeforeRetryPolicies(policies); policies.add(retryPolicy); policies.add(new BearerTokenAuthenticationPolicy(credential, KeyAsyncClient.KEY_VAULT_SCOPE)); policies.addAll(this.policies); HttpPolicyProviders.addAfterRetryPolicies(policies); policies.add(new HttpLoggingPolicy(httpLogDetailLevel)); HttpPipeline pipeline = new HttpPipelineBuilder() .policies(policies.toArray(new HttpPipelinePolicy[0])) .httpClient(httpClient) .build(); return new KeyAsyncClient(endpoint, pipeline); }
Source:
public Page<WorkflowItemRest> findBySubmitter(@Parameter(value = "uuid") UUID submitterID, Pageable pageable) { List<XmlWorkflowItem> witems = null; try { Context context = obtainContext(); EPerson ep = epersonService.find(context, submitterID); witems = wis.findBySubmitter(context, ep); } catch (SQLException e) { throw new RuntimeException(e.getMessage(), e); } Page<WorkflowItemRest> page = utils.getPage(witems, pageable).map(converter); return page; }

Target:
public Page<WorkflowItemRest> findBySubmitter(@Parameter(value = "uuid") UUID submitterID, Pageable pageable) { List<XmlWorkflowItem> witems = null; int total = 0; try { Context context = obtainContext(); EPerson ep = epersonService.find(context, submitterID); witems = wis.findBySubmitter(context, ep, pageable.getPageNumber(), pageable.getPageSize()); total = wis.countBySubmitter(context, ep); } catch (SQLException e) { throw new RuntimeException(e.getMessage(), e); } Page<WorkflowItemRest> page = new PageImpl<XmlWorkflowItem>(witems, pageable, total).map(converter); return page; }
Source:
public Version getVersion() { return version; }

Target:
public String getVersion() { return version; }
Source:
private static void setBloomFilter(Statistics stats, org.apache.parquet.column.statistics.Statistics statistics) { if (!(statistics instanceof BloomFilterStatistics)) { return; } BloomFilterStatistics bfStatistics = (BloomFilterStatistics) statistics; if (!bfStatistics.isBloomFilterEnabled()) { return; } else { stats.setBloom_filter_enabled(true); } BloomFilterStats bfStats = stats.getBloom_filter_stats(); if (bfStats == null) { bfStats = new BloomFilterStats(bfStatistics.getBitSet(), bfStatistics.getBloomFilter().getNumBits(), bfStatistics.getBloomFilter().getNumHashFunctions()); stats.setBloom_filter_stats(bfStats); return; } if (bfStats.getNumBits() != bfStatistics.getBloomFilter().getBitSize() || bfStats.getNumHashFunctions() != bfStatistics.getBloomFilter().getNumHashFunctions()) { throw new RuntimeException("Inconsistent configuration for bloom filter"); } bfStats.setBitSet(bfStatistics.getBitSet()); }

Target:
private static void setBloomFilter( Statistics stats, org.apache.parquet.column.statistics.Statistics statistics) { if (!(statistics instanceof BloomFilterStatistics) || !((BloomFilterStatistics) statistics) .isBloomFilterEnabled()) { stats.setBloom_filter(null); } else { BloomFilterStatistics bfStatistics = (BloomFilterStatistics) statistics; BloomFilter bfStats = new BloomFilter(serializeLongArray(bfStatistics.getBloomFilter().getBitSet()), bfStatistics.getBloomFilter().getNumBits(), bfStatistics.getBloomFilter().getNumHashFunctions(), BloomFilterStrategy.MURMUR128_32); stats.setBloom_filter(bfStats); } }
Source:
protected LinkedHashSet<Class<? extends BaseTypeChecker>> getImmediateSubcheckerClasses() { LinkedHashSet<Class<? extends BaseTypeChecker>> checkers = super.getImmediateSubcheckerClasses(); AliasAnalysis[] aliasAnalyses = createAliasAnalyses(); for (AliasAnalysis aliasAnalysis : aliasAnalyses) { switch (aliasAnalysis) { case RETURNS_RECEIVER: checkers.add(ReturnsReceiverChecker.class); break; } } return checkers; }

Target:
protected LinkedHashSet<Class<? extends BaseTypeChecker>> getImmediateSubcheckerClasses() { LinkedHashSet<Class<? extends BaseTypeChecker>> checkers = super.getImmediateSubcheckerClasses(); if (isEnabled(AliasAnalysis.RETURNS_RECEIVER)) { checkers.add(ReturnsReceiverChecker.class); } return checkers; }
Source:
public void testObservableRemoved() throws CacheException { InfinispanPropertyCache cache = createCache(); CountingObserver observer = new CountingObserver(); cache.addObserver(null, "id1", observer); cache.store(null, new Property<>("id1", 2)); Assert.assertEquals(0, observer.removedCounter.intValue()); cache.store(null, new Property<>("id1", 2)); Assert.assertEquals(0, observer.removedCounter.intValue()); cache.store(null, new Property<>("id1", 111)); Assert.assertEquals(0, observer.removedCounter.intValue()); cache.remove(null, "id1"); Assert.assertEquals(1, observer.removedCounter.intValue()); cache.remove(null, "id1"); Assert.assertEquals(1, observer.removedCounter.intValue()); cache.store(null, new Property<>("id1", 222)); cache.remove(null, "id1"); Assert.assertEquals(1, observer.removedCounter.intValue()); }

Target:
public void testObservableRemoved() throws CacheException { CountingObserver observer = new CountingObserver(); propertyCache.addObserver(null, "id1", observer); propertyCache.store(null, new Property<>("id1", 2)); Assert.assertEquals(0, observer.removedCounter.intValue()); propertyCache.store(null, new Property<>("id1", 111)); Assert.assertEquals(0, observer.removedCounter.intValue()); propertyCache.remove(null, "id1"); Assert.assertEquals(1, observer.removedCounter.intValue()); propertyCache.remove(null, "id1"); Assert.assertEquals(1, observer.removedCounter.intValue()); propertyCache.store(null, new Property<>("id1", 222)); propertyCache.remove(null, "id1"); Assert.assertEquals(2, observer.removedCounter.intValue()); }
Source:
private void populateStatus(final List<GlusterGeoRepSessionDetails> details) { if(getConfirmWindow() != null) { closeConfirmWindow(); } if(getWindow() != null) { closeWindow(); } final VolumeGeoRepSessionDetailsModel windowModel = new VolumeGeoRepSessionDetailsModel(); final UIConstants constants = ConstantsManager.getInstance().getConstants(); windowModel.setTitle(constants.geoReplicationSessionDetailsTitle()); UICommand okCommand = new UICommand("closeWindow", this); okCommand.setIsCancel(true); okCommand.setTitle(constants.ok()); windowModel.getCommands().add(okCommand); final List<EntityModel<GeoRepSessionDetailsSummaryTableRow>> detailRows = new ArrayList<>(); for(final GlusterGeoRepSessionDetails detail : details) { AsyncDataProvider.getInstance().getGlusterVolumeBrickById(new AsyncQuery(new INewAsyncCallback() { @Override public void onSuccess(Object model, Object returnValue) { GlusterBrickEntity brick = (GlusterBrickEntity) returnValue; if(brick == null) { brick = new GlusterBrickEntity(); brick.setServerName(constants.notAvailableLabel()); } detailRows.add(new EntityModel<VolumeGeoRepSessionDetailsModel.GeoRepSessionDetailsSummaryTableRow>(new GeoRepSessionDetailsSummaryTableRow(brick.getServerName(), detail))); if(detailRows.size() == details.size()) { windowModel.getGeoRepSessionSummary().setItems(detailRows, detailRows.get(0)); setWindow(windowModel); } } }), detail.getMasterBrickId()); } }

Target:
private void populateStatus(final List<GlusterGeoRepSessionDetails> details) { if(getConfirmWindow() != null) { closeConfirmWindow(); } if(getWindow() != null) { closeWindow(); } final VolumeGeoRepSessionDetailsModel windowModel = new VolumeGeoRepSessionDetailsModel(); final UIConstants constants = ConstantsManager.getInstance().getConstants(); windowModel.setTitle(constants.geoReplicationSessionDetailsTitle()); UICommand okCommand = new UICommand("closeWindow", this); okCommand.setIsCancel(true); okCommand.setTitle(constants.ok()); windowModel.getCommands().add(okCommand); List<VdcQueryParametersBase> queryParamsList = new ArrayList<VdcQueryParametersBase>(); for(GlusterGeoRepSessionDetails detail : details) { queryParamsList.add(new IdQueryParameters(detail.getMasterBrickId())); } final List<EntityModel<GeoRepSessionDetailsSummaryTableRow>> detailRows = new ArrayList<>(); Frontend.getInstance().runMultipleQueries(Collections.singletonList(VdcQueryType.GetGlusterBrickById), queryParamsList , new IFrontendMultipleQueryAsyncCallback() { @Override public void executed(FrontendMultipleQueryAsyncResult result) { for (VdcQueryReturnValue returnValue : result.getReturnValues()) { for (GlusterGeoRepSessionDetails sessionDetail : details) { GlusterBrickEntity currentBrick = (GlusterBrickEntity) returnValue.getReturnValue(); if (sessionDetail.getMasterBrickId().equals(currentBrick.getId())) { detailRows.add(new EntityModel<VolumeGeoRepSessionDetailsModel.GeoRepSessionDetailsSummaryTableRow>(new GeoRepSessionDetailsSummaryTableRow(currentBrick.getServerName(), sessionDetail))); } } } if(detailRows.size() == details.size()) { windowModel.getGeoRepSessionSummary().setItems(detailRows, detailRows.get(0)); setWindow(windowModel); } } }); }