auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
private void load() { Snackbar.make(scrollView, R.string.loading, Snackbar.LENGTH_SHORT).show(); new ReadFileTask(getContentResolver(), mFile, getExternalCacheDir(), isRootExplorer(), (data) -> { switch (data.error) { case ReadFileTask.NORMAL: cacheFile = data.cachedFile; mOriginal = data.fileContents; try { mInput.setText(data.fileContents); if (mFile.hybridFileParcelable != null && mFile.hybridFileParcelable.getPath().contains(getExternalCacheDir().getPath()) && cacheFile == null) { mInput.setInputType(EditorInfo.TYPE_NULL); mInput.setSingleLine(false); mInput.setImeOptions(EditorInfo.IME_FLAG_NO_ENTER_ACTION); Snackbar snackbar = Snackbar.make(mInput, getResources().getString(R.string.file_read_only), Snackbar.LENGTH_INDEFINITE); snackbar.setAction(getResources().getString(R.string.got_it).toUpperCase(), v -> snackbar.dismiss()); snackbar.show(); } if (data.fileContents.isEmpty()) { mInput.setHint(R.string.file_empty); } else { mInput.setHint(null); } } catch (OutOfMemoryError e) { Toast.makeText(getApplicationContext(), R.string.error, Toast.LENGTH_SHORT).show(); finish(); } break; case ReadFileTask.EXCEPTION_STREAM_NOT_FOUND: Toast.makeText(getApplicationContext(), R.string.error_file_not_found, Toast.LENGTH_SHORT).show(); finish(); break; case ReadFileTask.EXCEPTION_IO: Toast.makeText(getApplicationContext(), R.string.error_io, Toast.LENGTH_SHORT).show(); finish(); break; } }).execute(); }

Target:
private void load() { Snackbar.make(scrollView, R.string.loading, Snackbar.LENGTH_SHORT).show(); new ReadFileTask(getContentResolver(), mFile, getExternalCacheDir(), isRootExplorer(), (data) -> { switch (data.error) { case ReadFileTask.NORMAL: cacheFile = data.cachedFile; mOriginal = data.fileContents; try { mInput.setText(data.fileContents); if (mFile.scheme == EditableFileAbstraction.SCHEME_FILE && getExternalCacheDir() != null && mFile.hybridFileParcelable.getPath().contains(getExternalCacheDir().getPath()) && cacheFile == null) { mInput.setInputType(EditorInfo.TYPE_NULL); mInput.setSingleLine(false); mInput.setImeOptions(EditorInfo.IME_FLAG_NO_ENTER_ACTION); Snackbar snackbar = Snackbar.make(mInput, getResources().getString(R.string.file_read_only), Snackbar.LENGTH_INDEFINITE); snackbar.setAction(getResources().getString(R.string.got_it).toUpperCase(), v -> snackbar.dismiss()); snackbar.show(); } if (data.fileContents.isEmpty()) { mInput.setHint(R.string.file_empty); } else { mInput.setHint(null); } } catch (OutOfMemoryError e) { Toast.makeText(getApplicationContext(), R.string.error, Toast.LENGTH_SHORT).show(); finish(); } break; case ReadFileTask.EXCEPTION_STREAM_NOT_FOUND: Toast.makeText(getApplicationContext(), R.string.error_file_not_found, Toast.LENGTH_SHORT).show(); finish(); break; case ReadFileTask.EXCEPTION_IO: Toast.makeText(getApplicationContext(), R.string.error_io, Toast.LENGTH_SHORT).show(); finish(); break; } }).execute(); }
Source:
private void createCapitalAssetErrorDocument(String netid, String assetTag, String condition, String buildingCode, String roomNumber) { try { GlobalVariables.clear(); GlobalVariables.setUserSession(new UserSession("kp378")); BarcodeInventoryErrorDocument document = (BarcodeInventoryErrorDocument) getDocumentService().getNewDocument(BarcodeInventoryErrorDocument.class); document.getFinancialSystemDocumentHeader().setFinancialDocumentTotalAmount(KualiDecimal.ZERO); String errorDescription = "Error Scanning Asset Tag #" + assetTag; document.getDocumentHeader().setExplanation(errorDescription + ". Asset Tag Not Found"); document.getDocumentHeader().setDocumentDescription(errorDescription); document.setUploaderUniversalIdentifier(netid); List<BarcodeInventoryErrorDetail> barcodeInventoryErrorDetails = new ArrayList<>(); barcodeInventoryErrorDetails.add(getErrorDetail(netid, assetTag, condition, buildingCode, roomNumber)); document.setBarcodeInventoryErrorDetail(barcodeInventoryErrorDetails); getDocumentService().saveDocument(document); List<AdHocRouteRecipient> adHocRecipients = new ArrayList<>(); getDocumentService().routeDocument(document, "Capital Asset Inventory Error Asset Not Found", adHocRecipients); } catch (Exception ex) { LOG.error("createCapitalAssetErrorDocument", ex); } }

Target:
private void createCapitalAssetErrorDocument(String netid, String assetTag, String condition, String buildingCode, String roomNumber) { try { GlobalVariables.doInNewGlobalVariables(new UserSession(CuCamsConstants.CapAssetApi.KFS_SYSTEM_USER), () -> { try { BarcodeInventoryErrorDocument document = (BarcodeInventoryErrorDocument) getDocumentService().getNewDocument(BarcodeInventoryErrorDocument.class); String errorDescription = CuCamsConstants.CapAssetApi.ASSET_NOT_FOUND_ERROR + assetTag; document.getDocumentHeader().setExplanation(errorDescription + ". Asset Tag Not Found"); document.getDocumentHeader().setDocumentDescription(errorDescription); document.setUploaderUniversalIdentifier(netid); List<BarcodeInventoryErrorDetail> barcodeInventoryErrorDetails = new ArrayList<>(); barcodeInventoryErrorDetails.add(getErrorDetail(netid, assetTag, condition, buildingCode, roomNumber)); document.setBarcodeInventoryErrorDetail(barcodeInventoryErrorDetails); getDocumentService().saveDocument(document); getDocumentService().routeDocument(document, "Capital Asset Inventory Error Asset Not Found", new ArrayList<>()); return true; } catch (Exception ex) { LOG.error("createCapitalAssetErrorDocument", ex); } return false; } ); } catch (Exception ex) { LOG.error("createCapitalAssetErrorDocument", ex); } }
Source:
public void testTransformSourceResponseByMimeType() throws CatalogTransformerException, MimeTypeParseException { BinaryContent mockBinaryContent = mock(BinaryContent.class); QueryResponseTransformer transformer = mock(QueryResponseTransformer.class); when(transformer.transform(any(SourceResponse.class), any(Map.class))) .thenReturn(mockBinaryContent); when(transformerLocator.findQueryResponseTransformers(any(MimeType.class))) .thenReturn(Collections.singletonList(transformer)); BinaryContent binaryContent = transform.transform( mock(SourceResponse.class), new MimeType("text/xml"), Collections.emptyMap()); assertThat(binaryContent, is(mockBinaryContent)); }

Target:
public void testTransformSourceResponseByMimeType() throws CatalogTransformerException, MimeTypeParseException { BinaryContent mockBinaryContent = mock(BinaryContent.class); QueryResponseTransformer transformer = mock(QueryResponseTransformer.class); when(transformer.transform(any(SourceResponse.class), any(Map.class))) .thenReturn(mockBinaryContent); when(transformerLocator.findQueryResponseTransformers( argThat(isMimeType(new MimeType("text/xml"))))) .thenReturn(Collections.singletonList(transformer)); BinaryContent binaryContent = transform.transform( mock(SourceResponse.class), new MimeType("text/xml"), Collections.emptyMap()); assertThat(binaryContent, is(mockBinaryContent)); }
Source:
public void testValidNonPatternName() { Assert.assertTrue(new TestablePoolNameValidation().Validate("pool-T4534f").getSuccess()); }

Target:
public void testValidNonPatternName() { assertTrue(new TestablePoolNameValidation().Validate("pool-T4534f").getSuccess()); }
Source:
private void shutDownGracefully() { if (log.isDebugEnabled()) log.debugf("Wait for on-going transactions to finish for %s.", Util.prettyPrintTime(configuration.transaction().cacheStopTimeout(), TimeUnit.MILLISECONDS)); long now = System.nanoTime(); long failTime = now + TimeUnit.MILLISECONDS.toNanos(configuration.transaction().cacheStopTimeout()); boolean txsOnGoing = areTxsOnGoing(); while (txsOnGoing && System.nanoTime() - failTime < 0) { try { Thread.sleep(30); txsOnGoing = areTxsOnGoing(); } catch (InterruptedException e) { Thread.currentThread().interrupt(); if (clustered) { log.debugf("Interrupted waiting for on-going transactions to finish. %s local transactions and %s remote transactions", localTransactions.size(), remoteTransactions.size()); } else { log.debugf("Interrupted waiting for %s on-going transactions to finish.", localTransactions.size()); } } } if (txsOnGoing) { log.unfinishedTransactionsRemain(localTransactions == null ? 0 : localTransactions.size(), remoteTransactions == null ? 0 : remoteTransactions.size()); if (trace) log.tracef("Unfinished local transactions: %s", localTransactions.values().stream().map(tx -> tx.getGlobalTransaction().toString()) .collect(Collectors.joining(", "))); if (trace) log.tracef("Unfinished remote transactions: %s", remoteTransactions.keySet()); } else { log.debug("All transactions terminated"); } }

Target:
private void shutDownGracefully() { if (log.isDebugEnabled()) log.debugf("Wait for on-going transactions to finish for %s.", Util.prettyPrintTime(configuration.transaction().cacheStopTimeout(), TimeUnit.MILLISECONDS)); long now = System.nanoTime(); long failTime = now + TimeUnit.MILLISECONDS.toNanos(configuration.transaction().cacheStopTimeout()); boolean txsOnGoing = areTxsOnGoing(); while (txsOnGoing && System.nanoTime() - failTime < 0) { try { Thread.sleep(30); txsOnGoing = areTxsOnGoing(); } catch (InterruptedException e) { Thread.currentThread().interrupt(); if (clustered) { log.debugf("Interrupted waiting for on-going transactions to finish. %s local transactions and %s remote transactions", localTransactions.size(), remoteTransactions.size()); } else { log.debugf("Interrupted waiting for %s on-going transactions to finish.", localTransactions.size()); } } } if (txsOnGoing) { log.unfinishedTransactionsRemain(localTransactions == null ? 0 : localTransactions.size(), remoteTransactions == null ? 0 : remoteTransactions.size()); if (trace) { log.tracef("Unfinished local transactions: %s", localTransactions.values().stream().map(tx -> tx.getGlobalTransaction().toString()) .collect(Collectors.joining(", ", "[", "]"))); log.tracef("Unfinished remote transactions: %s", remoteTransactions == null ? "none" : remoteTransactions.keySet()); } } else { log.debug("All transactions terminated"); } }
Source:
public void clearJsonFields() { this.newEntity = null; this.oldEntity = null; }

Target:
public void clearJsonFields() { if (!Event.Status.RECEIVED.equals(this.status)) { this.newEntity = null; this.oldEntity = null; } }
Source:
public void loginWithEmailPassword() { new LoginFlow().loginEmailPassword(); }

Target:
public void loginWithEmailPassword() { wpLogin(); }
Source:
public static OkHttpClient getHttpClient() { if (sHttpClient == null) { sHttpClient = new OkHttpClient(); sHttpClient.setConnectTimeout(30, TimeUnit.SECONDS); sHttpClient.setConnectTimeout(60, TimeUnit.SECONDS); sHttpClient.setRetryOnConnectionFailure(true); int cacheSize = 10 * 1024 * 1024; File cacheLocation = new File(PrefUtils.get(ButterApplication.getAppContext(), Prefs.STORAGE_LOCATION, StorageUtils.getIdealCacheDirectory(ButterApplication.getAppContext()).toString())); cacheLocation.mkdirs(); com.squareup.okhttp.Cache cache = null; try { cache = new com.squareup.okhttp.Cache(cacheLocation, cacheSize); } catch (Exception e) { e.printStackTrace(); } sHttpClient.setCache(cache); } return sHttpClient; }

Target:
public static OkHttpClient getHttpClient() { if (sHttpClient == null) { sHttpClient = new OkHttpClient(); sHttpClient.setConnectTimeout(30, TimeUnit.SECONDS); sHttpClient.setReadTimeout(60, TimeUnit.SECONDS); sHttpClient.setRetryOnConnectionFailure(true); int cacheSize = 10 * 1024 * 1024; File cacheLocation = new File(PrefUtils.get(ButterApplication.getAppContext(), Prefs.STORAGE_LOCATION, StorageUtils.getIdealCacheDirectory(ButterApplication.getAppContext()).toString())); cacheLocation.mkdirs(); com.squareup.okhttp.Cache cache = null; try { cache = new com.squareup.okhttp.Cache(cacheLocation, cacheSize); } catch (Exception e) { e.printStackTrace(); } sHttpClient.setCache(cache); } return sHttpClient; }
Source:
public User createUser(String email, String password) { User user = createModel(ImmutableMap.of("email", email, "password", password)); user.setRepository(this); return user; }

Target:
public User createUser(String email, String password) { Map<String, Object> map = new HashMap<String, Object>(); map.put("email", email); map.put("password", password); User user = createModel(map); return user; }
Source:
private static boolean keepChomping(String suffix, int initialSuffixLength, int localMinStemLength) { boolean isSuffix = stemmerSuffixes.contains(suffix); if (!isSuffix) { return !suffix.isEmpty(); } if (isSuffix && (initialSuffixLength - suffix.length()) < localMinStemLength) { return suffix.charAt(0) != '-'; } return false; }

Target:
private static boolean keepChomping(String suffix, int initialSuffixLength, int localMinStemLength) { boolean isSuffix = STEMMER_SUFFIXES.contains(suffix); if (!isSuffix) { return !suffix.isEmpty(); } if (initialSuffixLength - suffix.length() < localMinStemLength) { return suffix.charAt(0) != '-'; } return false; }
Source:
public User getUserByUsernameOrEmail(String usernameOrEmail) { if (StringUtils.isNotBlank(usernameOrEmail)) { User user = dao.getUserByEmail(usernameOrEmail); if (user == null) { return getUserByUsername(usernameOrEmail); } else { return user; } } throw new APIException("error.usernameOrEmail.notNullOrBlank", (Object[]) null); }

Target:
public User getUserByUsernameOrEmail(String usernameOrEmail) { if (StringUtils.isNotBlank(usernameOrEmail)) { User user = dao.getUserByEmail(usernameOrEmail); if (user == null) { return getUserByUsername(usernameOrEmail); } return user; } throw new APIException("error.usernameOrEmail.notNullOrBlank", (Object[]) null); }
Source:
public void testRewrite() { tester().assertThat(new TransformCorrelatedSingleRowSubqueryToProject()) .on(p -> p.lateral( ImmutableList.of(p.symbol("l_nationkey")), p.tableScan(new TableHandle( new ConnectorId("local"), new TpchTableHandle("nation", TINY_SCALE_FACTOR), TestingTransactionHandle.create(), Optional.of(TestingHandle.INSTANCE)), ImmutableList.of(p.symbol("l_nationkey")), ImmutableMap.of(p.symbol("l_nationkey"), new TpchColumnHandle("nationkey", BIGINT))), p.project( Assignments.of(p.symbol("l_expr2"), expression("l_nationkey + 1")), p.values( ImmutableList.of(), ImmutableList.of(ImmutableList.of()))))) .matches(project( ImmutableMap.of( ("l_expr2"), PlanMatchPattern.expression("l_nationkey + 1"), "l_nationkey", PlanMatchPattern.expression("l_nationkey")), tableScan("nation", ImmutableMap.of("l_nationkey", "nationkey")))); }

Target:
public void testRewrite() { tester().assertThat(new TransformCorrelatedSingleRowSubqueryToProject()) .on(p -> p.lateral( ImmutableList.of(p.symbol("l_nationkey")), p.tableScan(new TableHandle( new ConnectorId("local"), new TpchTableHandle("nation", TINY_SCALE_FACTOR), TestingTransactionHandle.create(), Optional.empty()), ImmutableList.of(p.symbol("l_nationkey")), ImmutableMap.of(p.symbol("l_nationkey"), new TpchColumnHandle("nationkey", BIGINT))), p.project( Assignments.of(p.symbol("l_expr2"), expression("l_nationkey + 1")), p.values( ImmutableList.of(), ImmutableList.of(ImmutableList.of()))))) .matches(project( ImmutableMap.of( ("l_expr2"), PlanMatchPattern.expression("l_nationkey + 1"), "l_nationkey", PlanMatchPattern.expression("l_nationkey")), tableScan("nation", ImmutableMap.of("l_nationkey", "nationkey")))); }
Source:
public void clientCallback(final ClientResponse response) throws Exception { byte status = response.getStatus(); if (status == ClientResponse.SUCCESS) { if (m_csvLine instanceof ImportSuccessCallback) { m_es.execute(new Runnable() { @Override public void run() { try { m_csvLine.success(response); } catch (Exception e) { m_log.error("Exception in success client callback", e); } } }); } } else { m_failedCount.incrementAndGet(); m_errHandler.handleError(m_csvLine, response, response.getStatusString()); } long currentCount = m_processedCount.incrementAndGet(); if (currentCount % m_reportEveryNRows == 0) { m_log.info("Inserted " + (currentCount - m_failedCount.get()) + " rows"); } }

Target:
public void clientCallback(final ClientResponse response) throws Exception { byte status = response.getStatus(); if (status == ClientResponse.SUCCESS) { if (m_callbackExecutor != null && m_successCallback != null) { m_callbackExecutor.execute(new Runnable() { @Override public void run() { m_successCallback.success(m_csvLine, response); } }); } } else { m_failedCount.incrementAndGet(); m_errHandler.handleError(m_csvLine, response, response.getStatusString()); } long currentCount = m_processedCount.incrementAndGet(); if (currentCount % m_reportEveryNRows == 0) { m_log.info("Inserted " + (currentCount - m_failedCount.get()) + " rows"); } }
Source:
public boolean isOutputEmpty() { if (this.rows == null || this.rows.size() <= 0) { throw new IllegalStateException("Internal memory corrupted! Could not be Null or empty!"); } return this.rows.size() <= 1 && this.rows.contains(OUTPUT_EMPTY_MARK); }

Target:
public boolean isOutputEmpty() { return rows.size() <= 0; }
Source:
public List<String> componentPathsSelector(Module module, String group, int index ){ List<String> result = new ArrayList<String>(); if (!JOB.equals(module.getType())) { return result; } if (module.getProperties().containsKey(TRIGGER)) { result.add(REGISTRAR_WITH_TRIGGER_REF); } else if (module.getProperties().containsKey("cron")) { result.add(REGISTRAR_WITH_CRON); } else { result.add(REGISTRAR); } return result; }

Target:
public List<String> componentPathsSelector(Module module, String group, int index ){ List<String> result = new ArrayList<String>(); if (!JOB.equals(module.getType())) { return result; } if (module.getProperties().containsKey(TRIGGER)) { result.add(REGISTRAR_WITH_TRIGGER_REF); } else if (module.getProperties().containsKey(CRON)) { result.add(REGISTRAR_WITH_CRON); } else if (module.getProperties().containsKey(FIXED_DELAY)) { result.add(REGISTRAR_WITH_FIXED_DELAY); } else { result.add(REGISTRAR); } return result; }
Source:
public static Set<File> findAllViewFilesInWorkspace(SubMonitor monitor) { final SubMonitor subMonitor = SubMonitor.convert(monitor, 100); final IWorkspaceRoot root = ResourcesPlugin.getWorkspace().getRoot(); final int projects = root.getProjects().length; final int stepSize = 100 / projects; try { return collectFiles(root, new Predicate<IFile>() { @Override public boolean apply(IFile input) { return input.getFileExtension().equals("view"); } }, subMonitor, stepSize); } catch (final CoreException ex) { return new LinkedHashSet<File>(); } }

Target:
public static Set<IFile> findAllViewFilesInWorkspace(SubMonitor monitor) { final IWorkspaceRoot root = ResourcesPlugin.getWorkspace().getRoot(); final SubMonitor subMonitor = SubMonitor.convert(monitor, root.getProjects().length); try { return collectViewFiles(root, subMonitor); } catch (final CoreException ex) { return new LinkedHashSet<IFile>(); } }
Source:
public double apply(float[] itemVector) { double total = 0.0; for (double[] userFeatureVector : userFeaturesVectorsList) { total += VectorMath.dot(userFeatureVector, itemVector); } return total / userFeaturesVectorsList.size(); }

Target:
public double apply(float[] itemVector) { double total = 0.0; for (double[] userFeatureVector : userFeaturesVectors) { total += VectorMath.dot(userFeatureVector, itemVector); } return total / userFeaturesVectors.length; }
Source:
protected @Nullable Pair<ICallStackElement, AggregatedCallSite> getProfiledStackTrace(@NonNull ITmfEvent event) { Map<String, Collection<Object>> callStack = getCallStack(event); if (callStack.isEmpty()) { return null; } ICallStackElement element = getElement(event); Collection<Object> kernelCs = callStack.get(KERNEL_STACK_NAME); if (kernelCs == null) { kernelCs = Collections.emptyList(); } Collection<Object> userCs = callStack.get(USER_STACK_NAME); if (userCs == null) { userCs = Collections.emptyList(); } if (kernelCs.size() + userCs.size() == 0) { long[] stack = new long[1]; stack[0] = 0; return new Pair<>(element, getCallSite(element, stack, event.getTimestamp().getValue())); } long[] stack = new long[userCs.size() + kernelCs.size()]; int i = 0; for (Object call : userCs) { stack[i] = (long) call; i++; } for (Object call : kernelCs) { stack[i] = (long) call; i++; } return new Pair<>(element, getCallSite(element, stack, event.getTimestamp().getValue())); }

Target:
protected @Nullable Pair<ICallStackElement, AggregatedCallSite> getProfiledStackTrace(@NonNull ITmfEvent event) { Map<String, Collection<Object>> callStack = getCallStack(event); if (callStack.isEmpty()) { return null; } ICallStackElement element = getElement(event); Collection<Object> kernelCs = callStack.get(KERNEL_STACK_NAME); if (kernelCs == null) { kernelCs = Collections.emptyList(); } Collection<Object> userCs = callStack.get(USER_STACK_NAME); if (userCs == null) { userCs = Collections.emptyList(); } if (kernelCs.size() + userCs.size() == 0) { long[] stack = new long[1]; stack[0] = 0; return new Pair<>(element, getCallSite(element, stack, event.getTimestamp().getValue())); } long[] stack = new long[userCs.size() + kernelCs.size()]; int i = 0; for (Object call : userCs) { stack[i] = (call instanceof Long) ? (long) call : UNDEFINED_SYMBOL; i++; } for (Object call : kernelCs) { stack[i] = (call instanceof Long) ? (long) call : UNDEFINED_SYMBOL; i++; } return new Pair<>(element, getCallSite(element, stack, event.getTimestamp().getValue())); }
Source:
public Response activate(Action action) { HotPlugDiskToVmParameters params = new HotPlugDiskToVmParameters(((BackendDisksResource) collection).parentId, Guid.createGuidFromString(id)); return performAction(VdcActionType.HotPlugDiskToVm, params); }

Target:
public Response activate(Action action) { HotPlugDiskToVmParameters params = new HotPlugDiskToVmParameters(((BackendDisksResource) collection).parentId, guid); return performAction(VdcActionType.HotPlugDiskToVm, params); }
Source:
private List<List<ElementTag>> createSpecialSectionsForSectionRow(List<String> sectionNames, int sectionIndex) { List<List<ElementTag>> specialSections = new ArrayList<List<ElementTag>>(); for (int i = 0; i < sectionNames.size(); i += 3) { List<ElementTag> specialSectionGroup = new ArrayList<ElementTag>(); for (int j = 0; j < 3 && i + j < sectionNames.size(); j++) { String name = Const.ParamsNames.INSTRUCTOR_SECTION_GROUP + sectionIndex + Const.ParamsNames.INSTRUCTOR_SECTION + (i + j); if (isSectionSpecial()) { ElementTag checkbox = createCheckBox(sectionNames.get(i + j), name, sectionNames.get(i + j), i + j == sectionIndex); specialSectionGroup.add(checkbox); } else { ElementTag checkbox = createCheckBox(sectionNames.get(i + j), name, sectionNames.get(i + j), false); specialSectionGroup.add(checkbox); } } specialSections.add(specialSectionGroup); } return specialSections; }

Target:
private List<List<ElementTag>> createSpecialSectionsForSectionRow(List<String> sectionNames, int sectionIndex) { List<List<ElementTag>> specialSections = new ArrayList<List<ElementTag>>(); for (int i = 0; i < sectionNames.size(); i += 3) { List<ElementTag> specialSectionGroup = new ArrayList<ElementTag>(); for (int j = 0; j < 3 && i + j < sectionNames.size(); j++) { int positionOfNewSection = i + j; String name = Const.ParamsNames.INSTRUCTOR_SECTION_GROUP + sectionIndex + Const.ParamsNames.INSTRUCTOR_SECTION + positionOfNewSection; ElementTag checkbox; if (isSectionSpecial()) { boolean isPositionMatchedWithSection = positionOfNewSection == sectionIndex; checkbox = createCheckBox(sectionNames.get(positionOfNewSection), name, sectionNames.get(positionOfNewSection), isPositionMatchedWithSection); } else { checkbox = createCheckBox(sectionNames.get(positionOfNewSection), name, sectionNames.get(positionOfNewSection), false); } specialSectionGroup.add(checkbox); } specialSections.add(specialSectionGroup); } return specialSections; }
Source:
public void testNoBuildRevision() throws Exception { FreeStyleProject prj = jRule.createFreeStyleProject(); prj.setScm(new GitSCM("<LINK_0>")); prj.getPublishersList().add(new GitHubCommitNotifier()); Build b = prj.scheduleBuild2(0, new Cause.UserIdCause(), new BuildData()).get(); jRule.assertBuildStatus(Result.FAILURE, b); jRule.assertLogContains(BuildDataHelper_NoLastRevisionError(), b); }

Target:
public void testNoBuildRevision() throws Exception { FreeStyleProject prj = jRule.createFreeStyleProject(); prj.setScm(new GitSCM("<LINK_0>")); prj.getPublishersList().add(new GitHubCommitNotifier()); Build b = safelyGenerateBuild(prj); jRule.assertBuildStatus(Result.FAILURE, b); jRule.assertLogContains(BuildDataHelper_NoLastRevisionError(), b); }
Source:
public JdbcTpchDataSource(TpchTable table, List<JDBCType> columns, double scaleFactor) { checkArgument(scaleFactor > 0.0, "scaleFactor should be greater than zero"); this.table = requireNonNull(table, "table is null"); this.columnTypes = columns; this.scaleFactor = scaleFactor; }

Target:
public JdbcTpchDataSource(TpchTable table, List<JDBCType> columns, double scaleFactor) { checkArgument(scaleFactor > 0.0, "scaleFactor should be greater than zero"); this.table = requireNonNull(table, "table is null"); this.columnTypes = ImmutableList.copyOf(columns); this.scaleFactor = scaleFactor; }
Source:
public void createsPullComment() throws Exception { final String body = "test-body"; final String commit = "test-commit-id"; final String path = "test-path"; final int position = 4; final String response = pulls(body, commit, path, position).toString(); final MkContainer container = new MkGrizzlyContainer().next( new MkAnswer.Simple(HttpURLConnection.HTTP_CREATED, response) ).next(new MkAnswer.Simple(HttpURLConnection.HTTP_OK, response)) .start(); final Pull pull = createPull(); final RtPullComments pullComments = new RtPullComments( new ApacheRequest(container.home()), pull ); try { final PullComment pullComment = pullComments.post( body, commit, path, position ); MatcherAssert.assertThat( container.take().method(), Matchers.equalTo(Request.POST) ); MatcherAssert.assertThat( new PullComment.Smart(pullComment).commitId(), Matchers.equalTo(commit) ); } finally { container.stop(); } }

Target:
public void createsPullComment() throws Exception { final String body = "test-body"; final String commit = "test-commit-id"; final String path = "test-path"; final int position = 4; final String response = pulls(body, commit, path, position).toString(); final MkContainer container = new MkGrizzlyContainer().next( new MkAnswer.Simple(HttpURLConnection.HTTP_CREATED, response) ).next(new MkAnswer.Simple(HttpURLConnection.HTTP_OK, response)) .start(); final Pull pull = Mockito.mock(Pull.class); Mockito.doReturn(repo()).when(pull).repo(); final RtPullComments pullComments = new RtPullComments( new ApacheRequest(container.home()), pull ); try { final PullComment pullComment = pullComments.post( body, commit, path, position ); MatcherAssert.assertThat( container.take().method(), Matchers.equalTo(Request.POST) ); MatcherAssert.assertThat( new PullComment.Smart(pullComment).commitId(), Matchers.equalTo(commit) ); } finally { container.stop(); } }
Source:
public void listenBreakBlock(BlockEvent.BreakEvent event) { if ( ! ( event.block instanceof BlockSecurity ) ) return; BlockSecurity self = (BlockSecurity) event.block; EntityPlayer breaker = event.getPlayer(); TileSecurity te = self.getTileEntity( event.world, event.x, event.y, event.z ); String owner = te.getOwnerName(); if ( owner.equals( breaker.getCommandSenderName() ) ) return; AELog.info( "[AE2] %s broke a security terminal owned by %s at (DIM%d, %d, %d, %d)", breaker.getDisplayName(), owner, event.world.getWorldInfo().getVanillaDimension(), event.x, event.y, event.z ); }

Target:
public void listenBreakBlock(BlockEvent.BreakEvent event) { if ( ! ( event.block instanceof BlockSecurity ) ) return; BlockSecurity self = (BlockSecurity) event.block; EntityPlayer breaker = event.getPlayer(); TileSecurity te = self.getTileEntity( event.world, event.x, event.y, event.z ); String owner = getOwnerNameForLog( te.getOwner() ); if ( owner.equals( breaker.getCommandSenderName() ) ) return; AELog.info( "[AE2] %s broke a security terminal owned by %s at (DIM%d, %d, %d, %d)", breaker.getDisplayName(), owner, event.world.getWorldInfo().getVanillaDimension(), event.x, event.y, event.z ); }
Source:
private static boolean hasSiblings(DetailAST ast) { return ast.getNextSibling() != null || ast.getParent().getFirstChild() != ast; }

Target:
private static boolean hasSiblings(DetailAST ast) { return ast.getPreviousSibling() != null || ast.getNextSibling() != null; }
Source:
public static String streamToString(InputStream in) { try { Scanner s = new Scanner(in, "UTF-8"); s.useDelimiter("\\A"); String str = s.hasNext() ? s.next() : null; s.close(); return str; } finally { close(in); } }

Target:
public static String streamToString(InputStream in) { try { return IOUtils.toString(in, "UTF-8"); } catch (IOException e) { throw new RuntimeException("Error reading stream.", e); } finally { close(in); } }
Source:
public static <I> void checkIdType(I entityId) { final Class<?> idClass = entityId.getClass(); if (SUPPORTED_ID_TYPES.contains(idClass)) { return; } final boolean isMessage = entityId instanceof Message; if (!isMessage){ throw unsupportedIdType(idClass); } }

Target:
public static <I> void checkIdType(I entityId) { final Class<?> idClass = entityId.getClass(); if (supportedSimpleIdTypes.contains(idClass)) { return; } final boolean isMessage = entityId instanceof Message; if (!isMessage){ throw unsupportedIdType(idClass); } }
Source:
public Optional<QualityGateData> getQualityGate(DbSession dbSession, OrganizationDto organization, long componentId) { Optional<Long> qualityGateId = dbClient.projectQgateAssociationDao().selectQGateIdByComponentId(dbSession, componentId); if (qualityGateId.isPresent()) { return Optional.of(new QualityGateData(getById(dbSession, qualityGateId.get()), false)); } else { QualityGateDto defaultQualityGate = dbClient.qualityGateDao().selectByOrganizationAndUuid(dbSession, organization, organization.getDefaultQualityGateUuid()); if (defaultQualityGate == null) { return Optional.empty(); } return Optional.of(new QualityGateData(defaultQualityGate, true)); } }

Target:
public QualityGateData getQualityGate(DbSession dbSession, OrganizationDto organization, long componentId) { Optional<Long> qualityGateId = dbClient.projectQgateAssociationDao().selectQGateIdByComponentId(dbSession, componentId); if (qualityGateId.isPresent()) { QualityGateDto qualityGate = checkFound(dbClient.qualityGateDao().selectById(dbSession, qualityGateId.get()), "No quality gate has been found for id %s", qualityGateId); return new QualityGateData(qualityGate, false); } else { QualityGateDto defaultQualityGate = dbClient.qualityGateDao().selectByOrganizationAndUuid(dbSession, organization, organization.getDefaultQualityGateUuid()); checkState(defaultQualityGate != null, "Unable to find the quality gate [%s] for organization [%s]", organization.getDefaultQualityGateUuid(), organization.getUuid()); return new QualityGateData(defaultQualityGate, true); } }
Source:
protected void preValidateLaunchArguments(List<String> args) { if (args.contains("--json")) { String jsonFile = reqVal(args, "--json"); try { fileToJSON(jsonFile); } catch (ParserException ex) { errorMessage("Could not launch, syntax error in json file: " + jsonFile, CLIENT_ERROR); } catch (IOException e) { errorMessage("Could not launch, syntax error in json file: " + jsonFile, CLIENT_ERROR); } } if (args.contains("--yaml")) { String yamlFile = reqVal(args, "--yaml"); try { fileToJSON(yamlFile); } catch (ParserException ex) { errorMessage("Could not launch, syntax error in yaml file: " + yamlFile, CLIENT_ERROR); } catch (IOException e) { errorMessage("Could not launch, syntax error in yaml file: " + yamlFile, CLIENT_ERROR); } } }

Target:
protected void preValidateLaunchArguments(List<String> args) { List<String> argsCopy = new java.util.ArrayList(args); String jsonFile = optVal(argsCopy, "--json", null); String yamlFile = optVal(argsCopy, "--yaml", null); if (jsonFile != null) { try { fileToJSON(jsonFile); } catch (ParserException ex) { errorMessage("Could not launch, syntax error in json file: " + jsonFile, CLIENT_ERROR); } catch (Exception e) { LOG.error("Error prevalidating input file: " + jsonFile, e); } } if (yamlFile != null) { try { fileToJSON(yamlFile); } catch (ParserException ex) { errorMessage("Could not launch, syntax error in yaml file: " + yamlFile, CLIENT_ERROR); } catch (Exception e) { LOG.error("Error prevalidating input file: " + yamlFile, e); } } }
Source:
protected void executeQueryCommand() { VDSBrokerFrontend vdsBroker = getVdsBroker(); if (getDbFacade().getStorageDomainDao().getForStoragePool(getStorageDomainId(), getStoragePoolId()) == null) { getQueryReturnValue().setExceptionString("Storage Domain does not exist in the Data Center"); getQueryReturnValue().setSucceeded(false); return; } VDSReturnValue imagesListResult = vdsBroker.RunVdsCommand(VDSCommandType.GetImagesList, new GetImagesListVDSCommandParameters(getStorageDomainId(), getStoragePoolId())); @SuppressWarnings("unchecked") List<Guid> imagesList = (List<Guid>) imagesListResult.getReturnValue(); List<DiskImage> fromDao = getDbFacade().getDiskImageDao().getAllSnapshotsForStorageDomain(getStorageDomainId()); for (DiskImage image : fromDao) { imagesList.remove(image.getId()); } List<Disk> unregisteredDisks = new ArrayList<Disk>(); for (Guid unregisteredDiskId : imagesList) { GetUnregisteredDiskQueryParameters unregQueryParams = new GetUnregisteredDiskQueryParameters( unregisteredDiskId, getStorageDomainId(), getStoragePoolId()); VdcQueryReturnValue unregQueryReturn = getBackend().runInternalQuery(VdcQueryType.GetUnregisteredDisk, unregQueryParams); if (unregQueryReturn.getSucceeded()) { unregisteredDisks.add(unregQueryReturn.<Disk>getReturnValue()); } else { log.error("Could not get populated disk, reason: " + unregQueryReturn.getExceptionString()); } } getQueryReturnValue().setReturnValue(unregisteredDisks); }

Target:
protected void executeQueryCommand() { VDSBrokerFrontend vdsBroker = getVdsBroker(); if (getDbFacade().getStorageDomainDao().getForStoragePool(getStorageDomainId(), getStoragePoolId()) == null) { getQueryReturnValue().setExceptionString(VdcBllMessages.ACTION_TYPE_FAILED_STORAGE_DOMAIN_NOT_EXIST_IN_DATA_CENTER.toString()); getQueryReturnValue().setSucceeded(false); return; } VDSReturnValue imagesListResult = vdsBroker.RunVdsCommand(VDSCommandType.GetImagesList, new GetImagesListVDSCommandParameters(getStorageDomainId(), getStoragePoolId())); @SuppressWarnings("unchecked") List<Guid> imagesList = (List<Guid>) imagesListResult.getReturnValue(); List<DiskImage> fromDao = getDbFacade().getDiskImageDao().getAllSnapshotsForStorageDomain(getStorageDomainId()); for (DiskImage image : fromDao) { imagesList.remove(image.getId()); } List<Disk> unregisteredDisks = new ArrayList<Disk>(); for (Guid unregisteredDiskId : imagesList) { GetUnregisteredDiskQueryParameters unregQueryParams = new GetUnregisteredDiskQueryParameters( unregisteredDiskId, getStorageDomainId(), getStoragePoolId()); VdcQueryReturnValue unregQueryReturn = getBackend().runInternalQuery(VdcQueryType.GetUnregisteredDisk, unregQueryParams); if (unregQueryReturn.getSucceeded()) { unregisteredDisks.add(unregQueryReturn.<Disk>getReturnValue()); } else { log.error("Could not get populated disk, reason: " + unregQueryReturn.getExceptionString()); } } getQueryReturnValue().setReturnValue(unregisteredDisks); }
Source:
public void evaluate_shouldReturnAllPatientsTakingSpecifiedDrugBeforeDate() throws Exception { List drugSetList = new ArrayList<Concept>(); drugSetList.add(new Concept(88)); cohortDefinition.setDrugSets(drugSetList); cohortDefinition.setActivatedOnOrBefore(DateUtil.getDateTime(2008, 8, 2)); Cohort cohort = Context.getService(CohortDefinitionService.class).evaluate(cohortDefinition, null); System.out.println("Taking Particular Drug in Date Range" + cohort.getMemberIds() + " " + cohortDefinition); Assert.assertTrue(cohort.contains(2)); }

Target:
public void evaluate_shouldReturnAllPatientsTakingSpecifiedDrugBeforeDate() throws Exception { List drugSetList = new ArrayList<Concept>(); drugSetList.add(new Concept(88)); cohortDefinition.setDrugSets(drugSetList); cohortDefinition.setActivatedOnOrBefore(DateUtil.getDateTime(2008, 8, 2)); Cohort cohort = Context.getService(CohortDefinitionService.class).evaluate(cohortDefinition, null); Assert.assertTrue(cohort.contains(2)); }
Source:
protected DDMStructure(Parcel in, ClassLoader classLoader) { Parcelable[] array = in.readParcelableArray(Field.class.getClassLoader()); fields = new ArrayList(Arrays.asList(array)); locale = (Locale) in.readSerializable(); name = in.readString(); description = in.readString(); }

Target:
protected DDMStructure(Parcel in, ClassLoader classLoader) { Parcelable[] fieldsArray = in.readParcelableArray(Field.class.getClassLoader()); fields = new ArrayList(Arrays.asList(fieldsArray)); locale = (Locale) in.readSerializable(); name = in.readString(); description = in.readString(); Parcelable[] pagesArray = in.readParcelableArray(FormPage.class.getClassLoader()); pages = new ArrayList(Arrays.asList(pagesArray)); successPage = in.readParcelable(SuccessPage.class.getClassLoader()); }
Source:
public DirectDebitPaymentLinksBuilder withEvents(URI events) { this.events = new Link(events.toString(), GET);; return this; }

Target:
public DirectDebitPaymentLinksBuilder withEvents(URI events) { this.events = new Link(events.toString(), GET); return this; }
Source:
protected void removeHtmlClass(final String className) { if (!(this.htmlClassList == null || Util.empty(className))) { this.htmlClassList.remove(className); } }

Target:
protected void removeHtmlClass(final String className) { if (this.htmlClasses != null && !Util.empty(className)) { this.htmlClasses.remove(className); } }
Source:
protected CloseableIterator<GenericRecord> intermediateRowIterator() throws IOException { final Closer closer = Closer.create(); final byte[] buffer = new byte[InputEntity.DEFAULT_FETCH_BUFFER_SIZE]; final InputEntity.CleanableFile file = closer.register(source.fetch(temporaryDirectory, buffer)); final Schema writerSchema = dataFileSchema(file.file()); if (readerSchema == null) { readerSchema = writerSchema; } final GenericDatumReader<GenericRecord> datumReader = new GenericDatumReader<>(writerSchema, readerSchema); final DataFileReader<GenericRecord> dataFileReader = new DataFileReader<>(file.file(), datumReader); return new CloseableIterator<GenericRecord>() { @Override public boolean hasNext() { return dataFileReader.hasNext(); } @Override public GenericRecord next() { return dataFileReader.next(); } @Override public void close() throws IOException { closer.close(); } }; }

Target:
protected CloseableIterator<GenericRecord> intermediateRowIterator() throws IOException { final Closer closer = Closer.create(); final byte[] buffer = new byte[InputEntity.DEFAULT_FETCH_BUFFER_SIZE]; try { final InputEntity.CleanableFile file = closer.register(source.fetch(temporaryDirectory, buffer)); final GenericDatumReader<GenericRecord> datumReader = new GenericDatumReader<>(); final DataFileReader<GenericRecord> dataFileReader = new DataFileReader<>(file.file(), datumReader); final Schema writerSchema = dataFileReader.getSchema(); if (readerSchema == null) { readerSchema = writerSchema; } datumReader.setSchema(writerSchema); datumReader.setExpected(readerSchema); closer.register(dataFileReader); return new CloseableIterator<GenericRecord>() { @Override public boolean hasNext() { return dataFileReader.hasNext(); } @Override public GenericRecord next() { return dataFileReader.next(); } @Override public void close() throws IOException { closer.close(); } }; } catch (Exception e) { closer.close(); throw new RuntimeException(e); } }
Source:
public void addExistingModelElements2() { final EClass foo = (EClass) testPackage.getEClassifier("Foo"); final EStructuralFeature state = foo.getEStructuralFeature("state"); final EClassifier intType = typesPackage.getEClassifier("int"); final EObjectSelectionStrategy canary = mock(EObjectSelectionStrategy.class); when(canary.collectExistingObjects(any(EObject.class), any(EReference.class), anyCollectionOf(EObject.class))) .then(new Answer<Collection<EObject>>() { @SuppressWarnings("unchecked") @Override public Collection<EObject> answer(InvocationOnMock invocation) throws Throwable { return (Collection<EObject>) invocation.getArguments()[2]; } }); factory.addEObjectSelectionStrategyProvider(provider(canary)); final boolean[] doIt = { true }; Display.getDefault().asyncExec(selectFirstElementInDialog(doIt)); fixture.addExistingModelElements(state, EcorePackage.Literals.ETYPED_ELEMENT__ETYPE); doIt[0] = false; verify(canary).collectExistingObjects(eq(state), eq(EcorePackage.Literals.ETYPED_ELEMENT__ETYPE), anyCollectionOf(EObject.class)); assertThat(state.getEType(), is(intType)); assertThat(state.getLowerBound(), is(1)); verifyNoMoreInteractions(openStrategy); }

Target:
public void addExistingModelElements2() { final EClass foo = (EClass) testPackage.getEClassifier("Foo"); final EStructuralFeature state = foo.getEStructuralFeature("state"); final EClassifier intType = typesPackage.getEClassifier("int"); final EObjectSelectionStrategy canary = mock(EObjectSelectionStrategy.class); when(canary.collectExistingObjects(any(EObject.class), any(EReference.class), anyCollectionOf(EObject.class))) .then(new Answer<Collection<EObject>>() { @SuppressWarnings("unchecked") @Override public Collection<EObject> answer(InvocationOnMock invocation) throws Throwable { return (Collection<EObject>) invocation.getArguments()[2]; } }); register(vendor(canary)); final boolean[] doIt = { true }; Display.getDefault().asyncExec(selectFirstElementInDialog(doIt)); fixture.addExistingModelElements(state, EcorePackage.Literals.ETYPED_ELEMENT__ETYPE); doIt[0] = false; verify(canary).collectExistingObjects(eq(state), eq(EcorePackage.Literals.ETYPED_ELEMENT__ETYPE), anyCollectionOf(EObject.class)); assertThat(state.getEType(), is(intType)); assertThat(state.getLowerBound(), is(1)); verifyNoMoreInteractions(openStrategy); }
Source:
public static IStatus removeXmlFile(File toDelete) { boolean valid = xmlFileIsActive(toDelete); if(valid) { xmlFiles.remove(toDelete); File folder = getXmlFilesPath().toFile(); File[] files = folder.listFiles(); for(int i = 0; i < files.length; i++) { if(files[i].getName().equals(toDelete.getName())) { files[i].delete(); } } return Status.OK_STATUS; } return new Status(IStatus.ERROR, Activator.PLUGIN_ID, "The XML file is not an active XML Analysis"); }

Target:
public static IStatus removeXmlFile(File toDelete) { if(!xmlFileIsActive(toDelete)) { return new Status(IStatus.ERROR, Activator.PLUGIN_ID, "The XML file is not an active XML Analysis"); } toDelete.delete(); return Status.OK_STATUS; }
Source:
public void open() throws TTransportException { throw new RuntimeException("Not implemented"); }

Target:
public void open() throws TTransportException { throw new UnsupportedOperationException(); }
Source:
public static Map<String, String> getFilteredExecutionInfo(Object executionRequirementsUnchecked, Rule rule) throws EvalException { Map<String, String> executionInfo = Maps.newLinkedHashMap(); executionInfo.putAll(getExecutionInfoFromTags(rule)); if (executionRequirementsUnchecked != Runtime.NONE) { executionInfo.putAll(TargetUtils.filter( SkylarkDict.castSkylarkDictOrNoneToDict( executionRequirementsUnchecked, String.class, String.class, "execution_requirements"))); } return executionInfo; }

Target:
public static ImmutableMap<String, String> getFilteredExecutionInfo(Object executionRequirementsUnchecked, Rule rule) throws EvalException { Map<String, String> executionInfoBuilder = new HashMap<>(); executionInfoBuilder.putAll(TargetUtils.filter( SkylarkDict.castSkylarkDictOrNoneToDict( executionRequirementsUnchecked, String.class, String.class, "execution_requirements"))); getExecutionInfo(rule).forEach(executionInfoBuilder::putIfAbsent); return ImmutableMap.copyOf(executionInfoBuilder); }
Source:
public void testGetRequestParameterListNoResponseType() throws IOException { final Ds3DocSpecParser docSpecParser = new Ds3DocSpecParserImpl(new NameMapper()); final Ds3DocSpec docSpec = docSpecParser.getDocSpec(CCodeGenerator_Test.class.getResourceAsStream("/input/testCommandDocumentation.json")); final ImmutableList<Parameter> paramList = RequestConverter.getParamList("", docSpec); assertEquals(paramList.size(), 2); assertEquals(RequestHelper.paramListToString(paramList), "const ds3_client* client, const ds3_request* request"); }

Target:
public void testGetRequestParameterListNoResponseType() throws IOException { final ImmutableList<Parameter> paramList = RequestConverter.getParamList("", new Ds3DocSpecEmptyImpl()); assertEquals(paramList.size(), 2); assertEquals(RequestHelper.paramListToString(paramList), "const ds3_client* client, const ds3_request* request"); }
Source:
public long count(String name, String namePattern, HivePrincipal principal) { final CriteriaBuilder cb = criteriaBuilder(); final CriteriaQuery<Network> criteria = cb.createQuery(Network.class); final Root<Network> from = criteria.from(Network.class); final Predicate[] nameAndPrincipalPredicates = CriteriaHelper.networkListPredicates(cb, from, ofNullable(name), ofNullable(namePattern), ofNullable(principal)); criteria.where(nameAndPrincipalPredicates); final TypedQuery<Network> query = createQuery(criteria); return query.getResultList().size(); }

Target:
public long count(String name, String namePattern, HivePrincipal principal) { final CriteriaBuilder cb = criteriaBuilder(); final CriteriaQuery<Long> criteria = cb.createQuery(Long.class); final Root<Network> from = criteria.from(Network.class); final Predicate[] nameAndPrincipalPredicates = CriteriaHelper.networkListPredicates(cb, from, ofNullable(name), ofNullable(namePattern), ofNullable(principal)); criteria.where(nameAndPrincipalPredicates); criteria.select(cb.count(from)); return count(criteria); }
Source:
protected void performProfilesActions(final Guid networkGuid) { List<VnicProfileModel> profileModels = (List<VnicProfileModel>) getProfiles().getItems(); List<VnicProfileModel> profileModelsToRemove = new ArrayList<VnicProfileModel>(profileModels); profileModelsToRemove.removeAll(profileModels); final List<VnicProfileModel> profileModelsToAdd = new ArrayList<VnicProfileModel>(); for (VnicProfileModel profileModel : profileModels) { if (profileModel instanceof NewVnicProfileModel) { profileModelsToAdd.add(profileModel); } } startProgress(null); performVnicProfileAction(VdcActionType.RemoveVnicProfile, profileModelsToRemove, new IFrontendMultipleActionAsyncCallback() { @Override public void executed(FrontendMultipleActionAsyncResult result) { performVnicProfileAction(VdcActionType.AddVnicProfile, profileModelsToAdd, new IFrontendMultipleActionAsyncCallback() { @Override public void executed(FrontendMultipleActionAsyncResult result) { stopProgress(); cancel(); } }, networkGuid); } }, networkGuid); }

Target:
protected void performProfilesActions(final Guid networkGuid) { List<VnicProfileModel> profileModels = (List<VnicProfileModel>) getProfiles().getItems(); List<VnicProfileModel> profileModelsToRemove = new ArrayList<VnicProfileModel>(originalProfileModels); profileModelsToRemove.removeAll(profileModels); final List<VnicProfileModel> profileModelsToAdd = new ArrayList<VnicProfileModel>(); for (VnicProfileModel profileModel : profileModels) { if (profileModel instanceof NewVnicProfileModel) { profileModelsToAdd.add(profileModel); } } startProgress(null); performVnicProfileAction(VdcActionType.RemoveVnicProfile, profileModelsToRemove, new IFrontendMultipleActionAsyncCallback() { @Override public void executed(FrontendMultipleActionAsyncResult result) { performVnicProfileAction(VdcActionType.AddVnicProfile, profileModelsToAdd, new IFrontendMultipleActionAsyncCallback() { @Override public void executed(FrontendMultipleActionAsyncResult result) { stopProgress(); cancel(); } }, networkGuid); } }, networkGuid); }