auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>protected void onCreate(@Nullable Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_crop_image); task = new SaveUriToFileTask(this, (Uri) getIntent().getParcelableExtra(EXTRA_IMAGE_URI)) { @Override protected void onSuccess(final Uri imageUri) throws Exception { final CropImageView imageView = (CropImageView) findViewById(R.id.image); imageView.setImage(ImageSource.uri(imageUri)); findViewById(R.id.save).setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { <START> if (imageView != null) { <END> setResult(Activity.RESULT_OK, new Intent() .putExtra(EXTRA_CROP_RECT, imageView.getCropRect()) .putExtra(EXTRA_IMAGE_URI, imageUri) .putExtra(EXTRA_FROM_CAMERA, getIntent().getBooleanExtra(EXTRA_FROM_CAMERA, false)) ); finish(); } } }); } @Override protected void onException(Exception e) throws RuntimeException { throw new RuntimeException(e); } }; task.execute(); findViewById(R.id.cancel).setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { onBackPressed(); } }); }</code><technical_language>Huh. this null? in activity layout</technical_language>

Target:
protected void onCreate(@Nullable Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_crop_image); task = new SaveUriToFileTask(this, (Uri) getIntent().getParcelableExtra(EXTRA_IMAGE_URI)) { @Override protected void onSuccess(final Uri imageUri) throws Exception { final CropImageView imageView = (CropImageView) findViewById(R.id.image); imageView.setImage(ImageSource.uri(imageUri)); findViewById(R.id.save).setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { if (imageView.isReady()) { setResult(Activity.RESULT_OK, new Intent() .putExtra(EXTRA_CROP_RECT, imageView.getCropRect()) .putExtra(EXTRA_IMAGE_URI, imageUri) .putExtra(EXTRA_FROM_CAMERA, getIntent().getBooleanExtra(EXTRA_FROM_CAMERA, false)) ); finish(); } } }); } @Override protected void onException(Exception e) throws RuntimeException { throw new RuntimeException(e); } }; task.execute(); findViewById(R.id.cancel).setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { onBackPressed(); } }); }
Source:
<code>private void testUsingZippedInput(final String filepath, final int nVariants, final Function<File,OutputStream> outputStreamProvider) throws IOException { File tmp = new File(filepath); if( tmp.getName().endsWith(IOUtil.VCF_FILE_EXTENSION)) { tmp = File.createTempFile("tmp",IOUtil.COMPRESSED_VCF_FILE_EXTENSION); tmp.deleteOnExit(); try( FileInputStream in = new FileInputStream(filepath); OutputStream out = outputStreamProvider.apply(tmp); ) { IOUtil.copyStream(in, out); out.flush(); } catch(final IOException err) { throw err; } } final VCFIterator r = new VCFIteratorBuilder().open(tmp); assertExpectedNumberOfVariants(r, nVariants); <START> r.close(); <END> }</code><technical_language>I this close is redundant assertExpectedNumberOfVariants closes iterator, other call sites manually close it. that, I tests easier read if a try-with-resources call sites, asserted count in a finally block</technical_language>

Target:
private void testUsingZippedInput(final String filepath, final int nVariants, final Function<File,OutputStream> outputStreamProvider) throws IOException { File tmp = new File(filepath); if( tmp.getName().endsWith(IOUtil.VCF_FILE_EXTENSION)) { tmp = File.createTempFile("tmp",IOUtil.COMPRESSED_VCF_FILE_EXTENSION); tmp.deleteOnExit(); try( FileInputStream in = new FileInputStream(filepath); OutputStream out = outputStreamProvider.apply(tmp); ) { IOUtil.copyStream(in, out); out.flush(); } catch(final IOException err) { throw err; } } try (final VCFIterator r = new VCFIteratorBuilder().open(tmp) ) { assertExpectedNumberOfVariants(r, nVariants); } }
Source:
<code>public static EntropyEstimator createEstimator(String type, String base) { if(EmpiricalEntropyEstimator.EMPIRICAL_ESTIMATOR.equalsIgnoreCase(type)) { return new EmpiricalEntropyEstimator(base); } if(EmpiricalEntropyEstimator.CHAOSHEN_ESTIMATOR.equalsIgnoreCase(type)) { return new ChaoShenEntropyEstimator(base); } <START> return null; <END> }</code><technical_language>throw exception instead</technical_language>

Target:
public static EntropyEstimator createEstimator(String type, String base) throws IllegalArgumentException { if(EmpiricalEntropyEstimator.EMPIRICAL_ESTIMATOR.equalsIgnoreCase(type)) { return new EmpiricalEntropyEstimator(base); } if(EmpiricalEntropyEstimator.CHAOSHEN_ESTIMATOR.equalsIgnoreCase(type)) { return new ChaoShenEntropyEstimator(base); } throw new IllegalArgumentException("invalid input entropy estimator type. " + "Please refer to StreamingEntropy's javadoc for the supported estimator types"); }
Source:
<code>private boolean TxBegin() { <START> if (!TransactionalContext.isInTransaction()) { <END> corfuRuntime.getObjectsView() .TXBuild() .type(TransactionType.OPTIMISTIC) .build().begin(); return true; } return false; }</code><technical_language>invert if condition</technical_language>

Target:
private boolean TxBegin() { if (TransactionalContext.isInTransaction()) { return false; } corfuRuntime.getObjectsView() .TXBuild() .type(TransactionType.OPTIMISTIC) .build() .begin(); return true; }
Source:
<code>private BundleDependency getPluginBundleDependency(Plugin plugin, List<BundleDependency> mulePlugins) { <START> return mulePlugins.stream().filter(mulePlugin -> mulePlugin.getDescriptor().getArtifactId().equals(plugin.getArtifactId()) <END> && mulePlugin.getDescriptor().getGroupId().equals(plugin.getGroupId())) .findFirst() .orElseThrow(() -> new MuleRuntimeException(createStaticMessage("Declared additional dependencies for a plugin not present: " + plugin))); }</code><technical_language>Please StringUtils.equals</technical_language>

Target:
private BundleDependency getPluginBundleDependency(Plugin plugin, List<BundleDependency> mulePlugins) { return mulePlugins.stream() .filter(mulePlugin -> StringUtils.equals(mulePlugin.getDescriptor().getArtifactId(), plugin.getArtifactId()) && StringUtils.equals(mulePlugin.getDescriptor().getGroupId(), plugin.getGroupId())) .findFirst() .orElseThrow(() -> new MuleRuntimeException(createStaticMessage("Declared additional dependencies for a plugin not present: " + plugin))); }
Source:
<code>private static void validateScanStartupMode(ReadableConfig tableOptions) { tableOptions.getOptional(SCAN_STARTUP_MODE) .map(String::toLowerCase) .ifPresent(mode -> { if (!SCAN_STARTUP_MODE_ENUMS.contains(mode)) { throw new ValidationException( String.format("Invalid value for option '%s'. Supported values are %s, but was: %s", SCAN_STARTUP_MODE.key(), "[earliest-offset, latest-offset, group-offsets, specific-offsets, timestamp]", mode)); } if (mode.equals(SCAN_STARTUP_MODE_VALUE_TIMESTAMP)) { if (!tableOptions.getOptional(SCAN_STARTUP_TIMESTAMP_MILLIS).isPresent()) { throw new ValidationException(String.format("'%s' is required in '%s' startup mode" + " but missing.", SCAN_STARTUP_TIMESTAMP_MILLIS.key(), SCAN_STARTUP_MODE_VALUE_TIMESTAMP)); } } if (mode.equals(SCAN_STARTUP_MODE_VALUE_SPECIFIC_OFFSETS)) { if (!tableOptions.getOptional(SCAN_STARTUP_SPECIFIC_OFFSETS).isPresent()) { throw new ValidationException(String.format("'%s' is required in '%s' startup mode" + " but missing.", SCAN_STARTUP_SPECIFIC_OFFSETS.key(), SCAN_STARTUP_MODE_VALUE_SPECIFIC_OFFSETS)); } <START> if (!tableOptions.getOptional(TOPIC).isPresent() || tableOptions.get(TOPIC).split(",").length > 1){ <END> throw new ValidationException("Currently Kafka source only supports specific offset for single topic."); } String specificOffsets = tableOptions.get(SCAN_STARTUP_SPECIFIC_OFFSETS); parseSpecificOffsets(specificOffsets, SCAN_STARTUP_SPECIFIC_OFFSETS.key()); } }); }</code><technical_language>Add a util method boolean isSingleTopic(ReadableConfig). in sink side</technical_language>

Target:
private static void validateScanStartupMode(ReadableConfig tableOptions) { tableOptions.getOptional(SCAN_STARTUP_MODE) .map(String::toLowerCase) .ifPresent(mode -> { if (!SCAN_STARTUP_MODE_ENUMS.contains(mode)) { throw new ValidationException( String.format("Invalid value for option '%s'. Supported values are %s, but was: %s", SCAN_STARTUP_MODE.key(), "[earliest-offset, latest-offset, group-offsets, specific-offsets, timestamp]", mode)); } if (mode.equals(SCAN_STARTUP_MODE_VALUE_TIMESTAMP)) { if (!tableOptions.getOptional(SCAN_STARTUP_TIMESTAMP_MILLIS).isPresent()) { throw new ValidationException(String.format("'%s' is required in '%s' startup mode" + " but missing.", SCAN_STARTUP_TIMESTAMP_MILLIS.key(), SCAN_STARTUP_MODE_VALUE_TIMESTAMP)); } } if (mode.equals(SCAN_STARTUP_MODE_VALUE_SPECIFIC_OFFSETS)) { if (!tableOptions.getOptional(SCAN_STARTUP_SPECIFIC_OFFSETS).isPresent()) { throw new ValidationException(String.format("'%s' is required in '%s' startup mode" + " but missing.", SCAN_STARTUP_SPECIFIC_OFFSETS.key(), SCAN_STARTUP_MODE_VALUE_SPECIFIC_OFFSETS)); } if (!isSingleTopic(tableOptions)){ throw new ValidationException("Currently Kafka source only supports specific offset for single topic."); } String specificOffsets = tableOptions.get(SCAN_STARTUP_SPECIFIC_OFFSETS); parseSpecificOffsets(specificOffsets, SCAN_STARTUP_SPECIFIC_OFFSETS.key()); } }); }
Source:
<code>public void testSetTime() throws Exception { checkSetTime(0L); END> AM GMT checkSetTime(31536000000L); checkSetTime(315187200000L); checkSetTime(315705600000L); checkSetTime(ENTRY_TIME); checkSetTime(4134153600000L); }</code><technical_language>1970</technical_language>

Target:
public void testSetTime() throws Exception { checkSetTime(0L); checkSetTime(31536000000L); checkSetTime(315187200000L); checkSetTime(LocalDate.of(1980, 1, 1).atStartOfDay().minus(1, ChronoUnit.SECONDS) .atZone(ZoneId.systemDefault()).toInstant().toEpochMilli()); checkSetTime(LocalDate.of(1980, 1, 1).atStartOfDay().minus(1, ChronoUnit.SECONDS) .atZone(ZoneId.systemDefault()).toInstant().toEpochMilli()); checkSetTime(315705600000L); checkSetTime(ENTRY_TIME); checkSetTime(4134153600000L); }
Source:
<code>protected final void processAnnotationOnMethod(MethodMetadata data, Annotation annotation, Method method) { if (methodAnnotationProcessors.stream() <START> .anyMatch(processor -> processor.test(annotation))) { <END> methodAnnotationProcessors.stream() .filter(processor -> processor.test(annotation)) .forEach(processor -> processor.process(annotation, data)); } else { data.addWarning(String.format( "Method %s has an annotation %s that is not used by contract %s", method.getName(), annotation.annotationType() .getSimpleName(), getClass().getSimpleName())); } }</code><technical_language>Similar approach here, create a function do this test</technical_language>

Target:
protected final void processAnnotationOnMethod(MethodMetadata data, Annotation annotation, Method method) { List<GuardedAnnotationProcessor> processors = methodAnnotationProcessors.stream() .filter(processor -> processor.test(annotation)) .collect(Collectors.toList()); if (!processors.isEmpty()) { processors.forEach(processor -> processor.process(annotation, data)); } else { data.addWarning(String.format( "Method %s has an annotation %s that is not used by contract %s", method.getName(), annotation.annotationType() .getSimpleName(), getClass().getSimpleName())); } }
Source:
<code>public static void waitForVMtoStart(final CloudStackClient client, final String vmName) { checkNotEmpty(vmName); VirtualMachine machine = getVirtualMachineByName(client, vmName); String id = machine.getId(); long startTime = System.currentTimeMillis(); while (machine.getState() == STARTING) { try { LOG.info("Waiting for VM - id to start", machine.getName(), machine.getId()); TimeUnit.SECONDS.sleep(BETWEEN_REQUESTS_SLEEP_TIME); machine = client.getVirtualMachineClient().getVirtualMachine(id); } catch (InterruptedException e) { <START> LOG.info("Interrupted while waiting for VM's to start"); <END> } if (timeOutExceeded(startTime)) { break; } } switch (machine.getState()) { case RUNNING: LOG.info("VM is running, as expected", vmName); break; default: throw new IllegalStateException("VM " + machine + "is not in RUNNING state"); } }</code><technical_language>is this exception ignored? (except for a log message)</technical_language>

Target:
public static void waitForVMtoStart(final CloudStackClient client, final String vmName) { checkNotEmpty(vmName); VirtualMachine machine = getVirtualMachineByName(client, vmName); String id = machine.getId(); long startTime = System.currentTimeMillis(); while (machine.getState() == STARTING) { try { LOG.info("Waiting for VM - id to start", machine.getName(), machine.getId()); TimeUnit.SECONDS.sleep(BETWEEN_REQUESTS_SLEEP_TIME); machine = client.getVirtualMachineClient().getVirtualMachine(id); } catch (InterruptedException e) { LOG.info("Interrupted while waiting for VM's to start"); Throwables.propagateIfPossible(e); } if (timeOutExceeded(startTime)) { break; } } switch (machine.getState()) { case RUNNING: LOG.info("VM is running, as expected", vmName); break; default: throw new IllegalStateException("VM " + machine + "is not in RUNNING state"); } }
Source:
<code>private List<DRepresentationElement> extractSelectionFromUIState(DRepresentation currentRep, List<DRepresentationElement> notifiedElements) { List<DRepresentationElement> selectedElements = null; List<DRepresentationElement> dRepElements = new ArrayList<>(); List<EObject> semanticElements = new ArrayList<>(); if <START> (currentRep == <END> null) { return null; } UIState uiState = currentRep.getUiState(); if (uiState != null && uiState.isSetElementsToSelect()) { Collection<EObject> elementsToSelectFromUIState = uiState.getElementsToSelect(); boolean hasRepElement = false; boolean hasSemanticElement = false; boolean hasRepresentation = false; for (EObject currentElement : elementsToSelectFromUIState) { if (currentElement instanceof DRepresentationElement) { hasRepElement = true; dRepElements.add((DRepresentationElement) currentElement); } else if (currentElement instanceof DRepresentation) { hasRepresentation = true; break; } else { hasSemanticElement = true; semanticElements.add(currentElement); } } if (hasSemanticElement && !hasRepresentation && !hasRepElement) { selectedElements = new ArrayList<>(); caseHasSemanticElement(selectedElements, notifiedElements, semanticElements, currentRep); } else if (hasRepElement && !hasRepresentation && !hasSemanticElement) { if (!notifiedElements.isEmpty()) { dRepElements.retainAll(notifiedElements); } selectedElements = new ArrayList<DRepresentationElement>(dRepElements); } else { selectedElements = new ArrayList<>(); } } return selectedElements; }</code><technical_language>check this in resourceSetChanged</technical_language>

Target:
private List<DRepresentationElement> extractSelectionFromUIState(DRepresentation currentRep, List<DRepresentationElement> notifiedElements) { List<DRepresentationElement> selectedElements = null; List<DRepresentationElement> dRepElements = new ArrayList<>(); List<EObject> semanticElements = new ArrayList<>(); UIState uiState = currentRep.getUiState(); if (uiState != null && uiState.isSetElementsToSelect()) { Collection<EObject> elementsToSelectFromUIState = uiState.getElementsToSelect(); boolean hasRepElement = false; boolean hasSemanticElement = false; boolean hasRepresentation = false; for (EObject currentElement : elementsToSelectFromUIState) { if (currentElement instanceof DRepresentationElement) { hasRepElement = true; dRepElements.add((DRepresentationElement) currentElement); } else if (currentElement instanceof DRepresentation) { hasRepresentation = true; break; } else { hasSemanticElement = true; semanticElements.add(currentElement); } } if (hasSemanticElement && !hasRepresentation && !hasRepElement) { selectedElements = new ArrayList<>(); caseHasSemanticElement(selectedElements, notifiedElements, semanticElements, currentRep); } else if (hasRepElement && !hasRepresentation && !hasSemanticElement) { if (!notifiedElements.isEmpty()) { dRepElements.retainAll(notifiedElements); } selectedElements = new ArrayList<DRepresentationElement>(dRepElements); } else { selectedElements = new ArrayList<>(); } } return selectedElements; }
Source:
<code>public static Observable<Boolean> observeInternetConnectivity(final int initialIntervalInMs, final int intervalInMs, final String host, final int port, final int timeoutInMs) { if (initialIntervalInMs < 0) { throw new IllegalArgumentException("initialIntervalInMs is not a non-zero number"); <START> } <END> Preconditions.checkPositive(intervalInMs, "intervalInMs is not positive number"); Preconditions.checkNotNullOrEmpty(host, "host is null or empty"); Preconditions.checkPositive(port, "port is not positive number"); Preconditions.checkPositive(timeoutInMs, "timeoutInMs is not positive number"); return Observable.interval(initialIntervalInMs, intervalInMs, TimeUnit.MILLISECONDS, Schedulers.io()) .map(new Func1<Long, Boolean>() { @Override public Boolean call(Long tick) { try { Socket socket = new Socket(); socket.connect(new InetSocketAddress(host, port), timeoutInMs); return socket.isConnected(); } catch (IOException e) { return Boolean.FALSE; } } }) .distinctUntilChanged(); }</code><technical_language>Preconditions.checkPositive(int,String) method in below. logically this conditional statement</technical_language>

Target:
public static Observable<Boolean> observeInternetConnectivity(final int initialIntervalInMs, final int intervalInMs, final String host, final int port, final int timeoutInMs) { if (initialIntervalInMs < 0) { throw new IllegalArgumentException("initialIntervalInMs is not a positive number nor a positive number"); } Preconditions.checkPositive(intervalInMs, "intervalInMs is not positive number"); Preconditions.checkNotNullOrEmpty(host, "host is null or empty"); Preconditions.checkPositive(port, "port is not positive number"); Preconditions.checkPositive(timeoutInMs, "timeoutInMs is not positive number"); return Observable.interval(initialIntervalInMs, intervalInMs, TimeUnit.MILLISECONDS, Schedulers.io()) .map(new Func1<Long, Boolean>() { @Override public Boolean call(Long tick) { try { Socket socket = new Socket(); socket.connect(new InetSocketAddress(host, port), timeoutInMs); return socket.isConnected(); } catch (IOException e) { return Boolean.FALSE; } } }) .distinctUntilChanged(); }
Source:
<code>public BackupGetSendingSiteCommand() { <START> super(0); <END> }</code><technical_language>parameter needs 1 backup model node is level cache</technical_language>

Target:
public BackupGetSendingSiteCommand() { super(1); }
Source:
<code>private String buildCoordinateWhere(final Long centerLat, final Long centerLon, final Long spanLat, final Long spanLon) { StringBuilder where = new StringBuilder(); double latMin = (centerLat / 1e6) - ((spanLat / 1e6) / 2) - ((spanLat / 1e6) / 4); double latMax = (centerLat / 1e6) + ((spanLat / 1e6) / 2) + ((spanLat / 1e6) / 4); double lonMin = (centerLon / 1e6) - ((spanLon / 1e6) / 2) - ((spanLon / 1e6) / 4); double lonMax = (centerLon / 1e6) + ((spanLon / 1e6) / 2) + ((spanLon / 1e6) / 4); double llCache; if (latMin > latMax) { llCache = latMax; latMax = latMin; latMin = llCache; } if (lonMin > lonMax) { llCache = lonMax; lonMax = lonMin; lonMin = llCache; } if (where.length() > 0) { where.append(" and "); <START> } <END> where.append("(latitude >= "); where.append(String.format((Locale) null, "%.6f", latMin)); where.append(" and latitude <= "); where.append(String.format((Locale) null, "%.6f", latMax)); where.append(" and longitude >= "); where.append(String.format((Locale) null, "%.6f", lonMin)); where.append(" and longitude <= "); where.append(String.format((Locale) null, "%.6f", lonMax)); where.append(')'); return where.toString(); }</code><technical_language>This work expected. do rest of condition in here</technical_language>

Target:
private static StringBuilder buildCoordinateWhere(final Long centerLat, final Long centerLon, final Long spanLat, final Long spanLon) { StringBuilder where = new StringBuilder(); double latMin = (centerLat / 1e6) - ((spanLat / 1e6) / 2) - ((spanLat / 1e6) / 4); double latMax = (centerLat / 1e6) + ((spanLat / 1e6) / 2) + ((spanLat / 1e6) / 4); double lonMin = (centerLon / 1e6) - ((spanLon / 1e6) / 2) - ((spanLon / 1e6) / 4); double lonMax = (centerLon / 1e6) + ((spanLon / 1e6) / 2) + ((spanLon / 1e6) / 4); double llCache; if (latMin > latMax) { llCache = latMax; latMax = latMin; latMin = llCache; } if (lonMin > lonMax) { llCache = lonMax; lonMax = lonMin; lonMin = llCache; } where.append("(latitude >= "); where.append(String.format((Locale) null, "%.6f", latMin)); where.append(" and latitude <= "); where.append(String.format((Locale) null, "%.6f", latMax)); where.append(" and longitude >= "); where.append(String.format((Locale) null, "%.6f", lonMin)); where.append(" and longitude <= "); where.append(String.format((Locale) null, "%.6f", lonMax)); where.append(')'); return where; }
Source:
<code>private static IActivityListener createForwarder(final IActivityConsumer target) { return new IActivityListener() { @Override public void created(IActivity activity) { if (activity instanceof GitRequestActivity) { target.exec(rewriteGitRequestActivity((GitRequestActivity) activity)); } else if (activity instanceof GitCollectActivity) { target.exec(rewriteGitCollectActivity((GitCollectActivity) activity)); } else if (activity instanceof GitSendBundleActivity) { target.exec(rewriteGitSendBundleActivity((GitSendBundleActivity) activity)); } else { <START> return; <END> } } }; }</code><technical_language>else branch is needed</technical_language>

Target:
private static IActivityListener createForwarder(final IActivityConsumer target) { return new IActivityListener() { @Override public void created(IActivity activity) { if (activity instanceof GitRequestActivity) { target.exec(rewriteGitRequestActivity((GitRequestActivity) activity)); } else if (activity instanceof GitCollectActivity) { target.exec(rewriteGitCollectActivity((GitCollectActivity) activity)); } else if (activity instanceof GitSendBundleActivity) { target.exec(rewriteGitSendBundleActivity((GitSendBundleActivity) activity)); } } }; }
Source:
<code>private PropertyPath makePropertyPath(org.hibernate.hql.ast.origin.hql.resolve.path.PropertyPath propertyPath) { AggregationPropertyPath.Type aggregationType = propertyPath instanceof AggregationPropertyPath ? ((AggregationPropertyPath) propertyPath).getType() : null; PropertyPath.AggregationType _aggregationType = null; if (aggregationType != null) { switch (aggregationType) { case SUM: _aggregationType = PropertyPath.AggregationType.SUM; break; case AVG: _aggregationType = PropertyPath.AggregationType.AVG; break; case MIN: _aggregationType = PropertyPath.AggregationType.MIN; break; case MAX: _aggregationType = PropertyPath.AggregationType.MAX; break; case COUNT: _aggregationType = PropertyPath.AggregationType.COUNT; break; default: <START> throw new IllegalStateException("Aggregation " + aggregationType.name() + " is not supported"); <END> } } return new PropertyPath(_aggregationType, propertyPath.getNodeNamesWithoutAlias()); }</code><technical_language>Externalize log</technical_language>

Target:
private PropertyPath makePropertyPath(org.hibernate.hql.ast.origin.hql.resolve.path.PropertyPath propertyPath) { AggregationPropertyPath.Type aggregationType = propertyPath instanceof AggregationPropertyPath ? ((AggregationPropertyPath) propertyPath).getType() : null; return new PropertyPath(PropertyPath.AggregationType.from(aggregationType), propertyPath.getNodeNamesWithoutAlias()); }
Source:
<code>public void asyncReadLastEntry(ReadCallback cb, Object ctx) { asyncReadLastConfirmed(new ReadLastConfirmedCallback() { @Override public void readLastConfirmedComplete(int rc, long lastConfirmed, Object ctx) { <START> if (lastConfirmed < 0) { <END> cb.readComplete(BKException.Code.NoSuchEntryException, ReadOnlyLedgerHandle.this, null, ctx); } else { asyncReadEntriesInternal(lastConfirmed, lastConfirmed, cb, ctx); } } }, ctx); }</code><technical_language>need check rc first. if rc is OK, fail ReadCallback. do logic read actual entry</technical_language>

Target:
public void asyncReadLastEntry(ReadCallback cb, Object ctx) { asyncReadLastConfirmed(new ReadLastConfirmedCallback() { @Override public void readLastConfirmedComplete(int rc, long lastConfirmed, Object ctx) { if (rc == BKException.Code.OK) { if (lastConfirmed < 0) { cb.readComplete(BKException.Code.NoSuchEntryException, ReadOnlyLedgerHandle.this, null, ctx); } else { asyncReadEntriesInternal(lastConfirmed, lastConfirmed, cb, ctx); } } else { LOG.error("ReadException in asyncReadLastEntry, ledgerId: {}, lac: {}, rc:{}", lastConfirmed, ledgerId, rc); cb.readComplete(rc, ReadOnlyLedgerHandle.this, null, ctx); } } }, ctx); }
Source:
<code>private OsFamily extractOsFamily(final String name) { Optional<OsFamily> family = tryFind(asList(OsFamily.values()), new Predicate<OsFamily>() { @Override public boolean apply(OsFamily input) { <START> return name.toLowerCase().startsWith(input.name().toLowerCase()); <END> } }); if (family.isPresent()) { logger.warn("could not find the operating system family for image: %s", name); } return family.or(OsFamily.UNRECOGNIZED); }</code><technical_language>Extract name.toLowerCase() a local variable</technical_language>

Target:
private OsFamily extractOsFamily(final String name) { final String lowerCaseName = name.toLowerCase(); Optional<OsFamily> family = tryFind(asList(OsFamily.values()), new Predicate<OsFamily>() { @Override public boolean apply(OsFamily input) { return lowerCaseName.startsWith(input.name().toLowerCase()); } }); if (family.isPresent()) { logger.warn("could not find the operating system family for image: %s", name); } return family.or(OsFamily.UNRECOGNIZED); }
Source:
<code>public void handleData(final ITmfEvent event) { super.handleData(event); if (event.getTrace() == trace) { count++; if (count == fGranularity) { count = 0; try { <START> ITmfStateSystemBuilder PartialSS = PartialHistoryBackend.this.fPartialSS; <END> PartialSS.incrementAttribute(event.getTimestamp().getValue(), fCheckpointQuark); } catch (StateValueTypeException | TimeRangeException | AttributeNotFoundException e) { e.printStackTrace(); } } sci.processEvent(event); } }</code><technical_language>variable names start a capital letter</technical_language>

Target:
public void handleData(final ITmfEvent event) { super.handleData(event); if (event.getTrace() == trace) { count++; if (count == getGranularity()) { count = 0; try { ITmfStateSystemBuilder PartialSS = PartialHistoryBackend.this.fPartialSS; PartialSS.incrementAttribute(event.getTimestamp().getValue(), fCheckpointQuark); } catch (StateValueTypeException | TimeRangeException | AttributeNotFoundException e) { e.printStackTrace(); } } sci.processEvent(event); } }
Source:
<code>public boolean shearEntity(ItemStack stack, World world, EntityPlayer player, Entity entity, int distance, int fortune) { if(!(entity instanceof IShearable)) { return false; } IShearable shearable = (IShearable)entity; if(shearable.isShearable(stack, world, entity.getPosition())) { List<ItemStack> drops = shearable.onSheared(stack, world, entity.getPosition(), fortune); Random rand = world.rand; <START> for(ItemStack drop : drops) { <END> net.minecraft.entity.item.EntityItem ent = entity.entityDropItem(drop, 1.0F); ent.motionY += rand.nextFloat() * 0.05F; ent.motionX += (rand.nextFloat() - rand.nextFloat()) * 0.1F; ent.motionZ += (rand.nextFloat() - rand.nextFloat()) * 0.1F; } ToolHelper.damageTool(stack, 1, player); return true; } return false; }</code><technical_language>spawn items serverside, this creates clientside entityitems</technical_language>

Target:
public boolean shearEntity(ItemStack stack, World world, EntityPlayer player, Entity entity, int distance, int fortune) { if(!(entity instanceof IShearable)) { return false; } IShearable shearable = (IShearable)entity; if(shearable.isShearable(stack, world, entity.getPosition())) { if(!world.isRemote) { List<ItemStack> drops = shearable.onSheared(stack, world, entity.getPosition(), fortune); Random rand = world.rand; for(ItemStack drop : drops) { net.minecraft.entity.item.EntityItem ent = entity.entityDropItem(drop, 1.0F); ent.motionY += rand.nextFloat() * 0.05F; ent.motionX += (rand.nextFloat() - rand.nextFloat()) * 0.1F; ent.motionZ += (rand.nextFloat() - rand.nextFloat()) * 0.1F; } } ToolHelper.damageTool(stack, 1, player); return true; } return false; }
Source:
<code>protected final Collection<T> sortItems(Collection<T> items) { if (items == null || comparator == null) { return items; } <START> initPositions(items); <END> SortedSet<T> sortedItems = new TreeSet<T>(comparator); sortedItems.addAll(items); return sortedItems; }</code><technical_language>is getItems().add(item) work in this scenario? added positions map</technical_language>

Target:
protected final Collection<T> sortItems(Collection<T> items) { if (items == null || comparator == null) { return items; } insertionIndex.clear(); SortedSet<T> sortedItems = new TreeSet<T>(comparator) { private int counter = 0; @Override public boolean add(T e) { insertionIndex.put(e, counter++); return super.add(e); } @Override public boolean remove(Object o) { insertionIndex.remove(o); return super.remove(o); } }; sortedItems.addAll(items); return sortedItems; }
Source:
<code>public void handleError(HttpCommand command, HttpResponse response) { String message = parseMessage(response); Exception exception = null; try { message = message != null ? message : String.format("%s -> %s", command.getCurrentRequest().getRequestLine(), response.getStatusLine()); switch (response.getStatusCode()) { case 404: if (command.getCurrentRequest().getMethod().equals("DELETE")) { if (command.getCurrentRequest().getEndpoint().getPath().startsWith( "/" + EtcdApiMetadata.API_VERSION + "/members") && message.contains("No such member")) { <START> exception = new ResourceNotFoundException(message, <END> new HttpResponseException(command, response, message)); } } break; case 409: if (command.getCurrentRequest().getMethod().equals("POST")) { if (command.getCurrentRequest().getEndpoint().getPath().endsWith( EtcdApiMetadata.API_VERSION + "/members") && message.contains("etcdserver: ID exists")) exception = new HttpResponseException(message, command, response); } break; default: exception = new HttpResponseException(message, command, response); break; } } catch (Exception e) { exception = new HttpResponseException(command, response, e); } finally { if (exception == null) { exception = message != null ? new HttpResponseException(command, response, message) : new HttpResponseException(command, response); } closeQuietly(response.getPayload()); command.setException(exception); } }</code><technical_language>safely throw a RNFE 404, checking method path</technical_language>

Target:
public void handleError(HttpCommand command, HttpResponse response) { String message = parseMessage(response); Exception exception = null; try { message = message != null ? message : String.format("%s -> %s", command.getCurrentRequest().getRequestLine(), response.getStatusLine()); switch (response.getStatusCode()) { case 400: exception = new IllegalArgumentException(message); break; case 404: exception = new ResourceNotFoundException(message); break; case 409: exception = new ResourceAlreadyExistsException(message); break; default: exception = new HttpResponseException(message, command, response); break; } } catch (Exception e) { exception = new HttpResponseException(command, response, e); } finally { if (exception == null) { exception = message != null ? new HttpResponseException(command, response, message) : new HttpResponseException(command, response); } closeQuietly(response.getPayload()); command.setException(exception); } }
Source:
<code>public Matrix feedForward(final Matrix input) { if (scale == null || !scale.hasSameSize(input)) { <START> scale = matrixFactory.create(input.getRows(), input.getColumns()); <END> } for (int n = 0; n < input.getColumns(); ++n) { final Matrix paddedImg = matrixFactory.zeros(input.getRows() + (paddingSize * 2 * inputSize), 1); for (int i = 0; i < input.getRows(); ++i) { paddedImg.put(i + paddingSize * inputSize, input.get(i, n) * input.get(i, n)); } computeLocalSum(scale, paddedImg, n); } scale.muli(alpha / localSize).addi(k); return MatrixFunctions.pow(scale, -beta).muli(input); }</code><technical_language>Free</technical_language>

Target:
public Matrix feedForward(final Matrix input) { this.scale = matrixFactory.create(input.getRows(), input.getColumns()); for (int n = 0; n < input.getColumns(); ++n) { final Matrix paddedImg = matrixFactory.zeros(input.getRows() + (paddingSize * 2 * inputSize), 1); for (int i = 0; i < input.getRows(); ++i) { paddedImg.put(i + paddingSize * inputSize, input.get(i, n) * input.get(i, n)); } computeLocalSum(scale, paddedImg, n); } scale.muli(alpha / localSize).addi(k); return MatrixFunctions.pow(scale, -beta).muli(input); }
Source:
<code>public <T> List<T> createChildren(Object parent) { if (parent instanceof Connection) { List<T> activeProjects = new ArrayList<>(); List<IResource> projectResources = ((Connection) parent).getResources(ResourceKind.PROJECT); for (IResource projectResource: projectResources) { IProject project = (IProject)projectResource; <START> if (!"Terminating".equals(project.getStatus())) { <END> activeProjects.add((T)project); } } return activeProjects; } else if (parent instanceof IProject) { IProject project = (IProject) parent; Connection conn = ConnectionsRegistryUtil.getConnectionFor(project); Collection appSources = loadTemplates(project, conn); appSources.addAll(loadImageStreams(project, conn)); return (List<T>) new ArrayList<>(appSources); } return Collections.emptyList(); }</code><technical_language>I guess project state moved constant client lib (we currently lots of places a "Running" check for pod (and other resources) state)</technical_language>

Target:
public <T> List<T> createChildren(Object parent) { if (parent instanceof Connection) { List<T> activeProjects = new ArrayList<>(); List<IResource> projectResources = ((Connection) parent).getResources(ResourceKind.PROJECT); for (IResource projectResource: projectResources) { IProject project = (IProject)projectResource; if (!ResourceStatus.TERMINATING.equals(project.getStatus())) { activeProjects.add((T)project); } } return activeProjects; } else if (parent instanceof IProject) { IProject project = (IProject) parent; Connection conn = ConnectionsRegistryUtil.getConnectionFor(project); Collection appSources = loadTemplates(project, conn); appSources.addAll(loadImageStreams(project, conn)); return (List<T>) new ArrayList<>(appSources); } return Collections.emptyList(); }
Source:
<code>private WaiterTimeoutCallback(final Callback<T> callback) { _timeout = new SingleTimeout<>(_timeoutExecutor, _waiterTimeout, TimeUnit.MILLISECONDS, callback, (callback1) -> { synchronized (_lock) { _waiters.remove(this); _statsTracker.incrementWaiterTimedOut(); } LOG.debug("{}: failing waiter due to waiter timeout", _poolName); <START> callback1.onError( <END> new WaiterTimeoutException( "Exceeded waiter timeout of " + _waiterTimeout + "ms: in Pool: "+ _poolName)); }); }</code><technical_language>I put a number in callback variable, like: callbackIfTimeout</technical_language>

Target:
private WaiterTimeoutCallback(final Callback<T> callback) { _timeout = new SingleTimeout<>(_timeoutExecutor, _waiterTimeout, TimeUnit.MILLISECONDS, callback, (callbackIfTimeout) -> { synchronized (_lock) { _waiters.remove(this); _statsTracker.incrementWaiterTimedOut(); } LOG.debug("{}: failing waiter due to waiter timeout", _poolName); callbackIfTimeout.onError( new WaiterTimeoutException( "Exceeded waiter timeout of " + _waiterTimeout + "ms: in Pool: "+ _poolName)); }); }
Source:
<code>private boolean binaryFilterApplies(CallExpression binExpr, Row row) { List<Expression> children = binExpr.getChildren(); Preconditions.checkArgument(children.size() == 2); Object lhsValue = getValue(children.get(0), row); Object rhsValue = getValue(children.get(1), row); <START> if (!isComparable(lhsValue, binExpr) || !isComparable(rhsValue, binExpr)) { <END> return false; } FunctionDefinition functionDefinition = binExpr.getFunctionDefinition(); if (BuiltInFunctionDefinitions.GREATER_THAN.equals(functionDefinition)) { return ((Comparable) lhsValue).compareTo(rhsValue) > 0; } else if (BuiltInFunctionDefinitions.LESS_THAN.equals(functionDefinition)) { return ((Comparable) lhsValue).compareTo(rhsValue) < 0; } else if (BuiltInFunctionDefinitions.GREATER_THAN_OR_EQUAL.equals(functionDefinition)) { return ((Comparable) lhsValue).compareTo(rhsValue) >= 0; } else if (BuiltInFunctionDefinitions.LESS_THAN_OR_EQUAL.equals(functionDefinition)) { return ((Comparable) lhsValue).compareTo(rhsValue) <= 0; } else if (BuiltInFunctionDefinitions.EQUALS.equals(functionDefinition)) { return ((Comparable) lhsValue).compareTo(rhsValue) == 0; } else if (BuiltInFunctionDefinitions.NOT_EQUALS.equals(functionDefinition)) { return ((Comparable) lhsValue).compareTo(rhsValue) != 0; } else { return false; } }</code><technical_language>check type of a field is comparable in shouldPushDownUnaryExpression method ? logic of binaryFilterApplies need change</technical_language>

Target:
private boolean binaryFilterApplies(CallExpression binExpr, Row row) { List<Expression> children = binExpr.getChildren(); Preconditions.checkArgument(children.size() == 2); Comparable lhsValue = getValue(children.get(0), row); Comparable rhsValue = getValue(children.get(1), row); FunctionDefinition functionDefinition = binExpr.getFunctionDefinition(); if (BuiltInFunctionDefinitions.GREATER_THAN.equals(functionDefinition)) { return lhsValue.compareTo(rhsValue) > 0; } else if (BuiltInFunctionDefinitions.LESS_THAN.equals(functionDefinition)) { return lhsValue.compareTo(rhsValue) < 0; } else if (BuiltInFunctionDefinitions.GREATER_THAN_OR_EQUAL.equals(functionDefinition)) { return lhsValue.compareTo(rhsValue) >= 0; } else if (BuiltInFunctionDefinitions.LESS_THAN_OR_EQUAL.equals(functionDefinition)) { return lhsValue.compareTo(rhsValue) <= 0; } else if (BuiltInFunctionDefinitions.EQUALS.equals(functionDefinition)) { return lhsValue.compareTo(rhsValue) == 0; } else if (BuiltInFunctionDefinitions.NOT_EQUALS.equals(functionDefinition)) { return lhsValue.compareTo(rhsValue) != 0; } else { return false; } }
Source:
<code>static List<JavaFileScannerContext.Location> secondaryLocations(List<Tree> methodInvocationTrees) { return methodInvocationTrees.stream() <START> .map(expr -> new JavaFileScannerContext.Location("This call can throw an expected exception", expr)) <END> .collect(Collectors.toList()); }</code><technical_language>I this message in fact... "expected" sense. I prefer "This call throw exception" instead, ideally, name of exception</technical_language>

Target:
static List<JavaFileScannerContext.Location> secondaryLocations(List<Tree> methodInvocationTrees) { return methodInvocationTrees.stream() .map(expr -> new JavaFileScannerContext.Location("Throws an exception", expr)) .collect(Collectors.toList()); }
Source:
<code>public void handleDelivery(String consumerTag, Envelope envelope, AMQP.BasicProperties properties, byte[] body) throws IOException { long deliveryTag = envelope.getDeliveryTag(); <START> if (cancelled()) { <END> if (logger.isDebugEnabled()) { logger.debug("Rejecting delivery '" + deliveryTag + "' for " + BlockingQueueConsumer.this); } BlockingQueueConsumer.this.channel.basicReject(deliveryTag, true); } else { if (logger.isDebugEnabled()) { logger.debug("Storing delivery '" + deliveryTag + "' for " + BlockingQueueConsumer.this); } try { BlockingQueueConsumer.this.queue.put(new Delivery(consumerTag, envelope, properties, body)); } catch (InterruptedException e) { Thread.currentThread().interrupt(); } } }</code><technical_language>I this is necessary - get a delivery a cancel cancelOk, I suppose hurt, for (small) overhead</technical_language>

Target:
public void handleDelivery(String consumerTag, Envelope envelope, AMQP.BasicProperties properties, byte[] body) throws IOException { if (logger.isDebugEnabled()) { logger.debug("Storing delivery for " + BlockingQueueConsumer.this); } try { BlockingQueueConsumer.this.queue.put(new Delivery(consumerTag, envelope, properties, body)); } catch (InterruptedException e) { Thread.currentThread().interrupt(); } }
Source:
<code>public void setGameData(final GameData data) { this.data = data; battleTreeCalculator.setGameData(this.data); <START> hardAiCalculator.setGameData(this.data); <END> }</code><technical_language>Method calculate 9 arguments (exceeds 4 allowed). Consider refactoring</technical_language>

Target:
public void setGameData(final GameData data) { battleTreeCalculator.setGameData(data); hardAiCalculator.setGameData(data); }
Source:
<code>public void createTopicWithInsufficientPollSubject_ShouldFail() throws Exception { User user = User.admin(); <START> Users.signIn(user); <END> Topic topic = new Topic("subject", "message"); topic.withTopicStarter(user); Poll poll = new Poll("ab", new String[]{"option1", "option2", "option3"}); topic.setPoll(poll); Topics.createTopic(topic); }</code><technical_language>2 lines factored 1: User user = Users.signIn(User.admin()). BTW, do need admin</technical_language>

Target:
public void createTopicWithInsufficientPollSubject_ShouldFail() throws Exception { Users.signUpAndSignIn(); Topic topic = new Topic(); Poll poll = new Poll("ab"); topic.setPoll(poll); Topics.createTopic(topic); }
Source:
<code>public boolean put(String lookupName, final LookupExtractorFactory lookupExtractorFactory) { <START> try { <END> startStopLock.readLock().lockInterruptibly(); } catch (InterruptedException e) { e.printStackTrace(); } try { assertStarted(); if (lookupMap.containsKey(lookupName)) { LOGGER.warn("lookup [%s] is not add, another lookup with the same name already exist", lookupName); return false; } if (!lookupExtractorFactory.start()) { throw new ISE("start method returned false for lookup [%s]", lookupName); } final boolean noPrior = null == lookupMap.putIfAbsent(lookupName, lookupExtractorFactory); if (noPrior) { if (lookupSnapshotTaker != null) { lookupSnapshotTaker.takeSnapshot(getAllAsList()); } } else { if (!lookupExtractorFactory.close()) { throw new ISE("Error closing [%s] on race condition", lookupName); } } return noPrior; } finally { startStopLock.readLock().unlock(); } }</code><technical_language>this sense, a write locking read</technical_language>

Target:
public boolean put(String lookupName, final LookupExtractorFactory lookupExtractorFactory) { try { startStopLock.readLock().lockInterruptibly(); } catch (InterruptedException e) { throw Throwables.propagate(e); } try { assertStarted(); if (lookupMap.containsKey(lookupName)) { LOGGER.warn("lookup [%s] is not add, another lookup with the same name already exist", lookupName); return false; } if (!lookupExtractorFactory.start()) { throw new ISE("start method returned false for lookup [%s]", lookupName); } final boolean noPrior = null == lookupMap.putIfAbsent(lookupName, lookupExtractorFactory); if (noPrior) { if (lookupSnapshotTaker != null) { lookupSnapshotTaker.takeSnapshot(getAllAsList()); } } else { if (!lookupExtractorFactory.close()) { throw new ISE("Error closing [%s] on race condition", lookupName); } } return noPrior; } finally { startStopLock.readLock().unlock(); } }
Source:
<code>public List<PermissionSubject> getPermissionCheckSubjects() { List<PermissionSubject> permissionList = new ArrayList<PermissionSubject>(); permissionList.add(new PermissionSubject(getVdsGroupId(), VdcObjectType.VdsGroups, getActionType().getActionGroup())); permissionList.add(new PermissionSubject(getVmTemplateId(), VdcObjectType.VmTemplate, getActionType().getActionGroup())); if (getVmTemplate() != null && !getVmTemplate().getDiskList().isEmpty()) { for (DiskImage disk : getParameters().getDiskInfoDestinationMap().values()) { if (disk.getStorageIds() != null && !disk.getStorageIds().isEmpty()) { <START> permissionList.add(new PermissionSubject(GuidUtils.getGuidValue(getStoragePoolId()), <END> VdcObjectType.Storage, ActionGroup.CREATE_DISK)); } } } addPermissionSubjectForAdminLevelProperties(permissionList); return permissionList; }</code><technical_language>* check storage domain. * change in Ie50e7dd9 is longer relevant</technical_language>

Target:
public List<PermissionSubject> getPermissionCheckSubjects() { List<PermissionSubject> permissionList = new ArrayList<PermissionSubject>(); permissionList.add(new PermissionSubject(getVdsGroupId(), VdcObjectType.VdsGroups, getActionType().getActionGroup())); permissionList.add(new PermissionSubject(getVmTemplateId(), VdcObjectType.VmTemplate, getActionType().getActionGroup())); if (getVmTemplate() != null && !getVmTemplate().getDiskList().isEmpty()) { for (DiskImage disk : getParameters().getDiskInfoDestinationMap().values()) { if (disk.getStorageIds() != null && !disk.getStorageIds().isEmpty()) { permissionList.add(new PermissionSubject(GuidUtils.getGuidValue(getStorageDomainId()), VdcObjectType.Storage, ActionGroup.CREATE_DISK)); } } } addPermissionSubjectForAdminLevelProperties(permissionList); return permissionList; }
Source:
<code>public FSDataInputStream open(Path f, int bufferSize) throws IOException { ChannelSftp channel = connect(); Path workDir; try { workDir = new Path(channel.pwd()); } catch (SftpException e) { throw new IOException(e); } Path absolute = makeAbsolute(workDir, f); FileStatus fileStat = getFileStatus(channel, absolute); if (fileStat.isDirectory()) { disconnect(channel); throw new IOException(String.format(E_PATH_DIR, f)); } try { absolute = new Path("/", channel.realpath(absolute.toUri().getPath())); } catch (SftpException e) { throw new IOException(e); } return new FSDataInputStream( new SFTPInputStream(channel, absolute, statistics)){ @Override public void close() throws IOException { <START> super.close(); <END> disconnect(channel); } }; }</code><technical_language>wrap super.close() a try/finally channel is diconnected</technical_language>

Target:
public FSDataInputStream open(Path f, int bufferSize) throws IOException { ChannelSftp channel = connect(); Path workDir; try { workDir = new Path(channel.pwd()); } catch (SftpException e) { throw new IOException(e); } Path absolute = makeAbsolute(workDir, f); FileStatus fileStat = getFileStatus(channel, absolute); if (fileStat.isDirectory()) { disconnect(channel); throw new IOException(String.format(E_PATH_DIR, f)); } try { absolute = new Path("/", channel.realpath(absolute.toUri().getPath())); } catch (SftpException e) { throw new IOException(e); } return new FSDataInputStream( new SFTPInputStream(channel, absolute, statistics)){ @Override public void close() throws IOException { try { super.close(); } finally { disconnect(channel); } } }; }
Source:
<code>private void onRemove() { <START> if (getProgress() != null) <END> { return; } ArrayList<VdcActionParametersBase> list = new ArrayList<VdcActionParametersBase>(); for (ExternalSubnet subnet : getSubnets()) { VdcActionParametersBase parameters = new ExternalSubnetParameters(subnet); list.add(parameters); } startProgress(null); Frontend.getInstance().runMultipleAction(VdcActionType.RemoveSubnetFromProvider, list, false, new IFrontendMultipleActionAsyncCallback() { @Override public void executed(FrontendMultipleActionAsyncResult result) { stopProgress(); cancel(); } }, null); }</code><technical_language>I this check true, required</technical_language>

Target:
private void onRemove() { ArrayList<VdcActionParametersBase> list = new ArrayList<VdcActionParametersBase>(); for (ExternalSubnet subnet : getSubnets()) { VdcActionParametersBase parameters = new ExternalSubnetParameters(subnet); list.add(parameters); } startProgress(null); Frontend.getInstance().runMultipleAction(VdcActionType.RemoveSubnetFromProvider, list, false, new IFrontendMultipleActionAsyncCallback() { @Override public void executed(FrontendMultipleActionAsyncResult result) { stopProgress(); sourceListModel.getSearchCommand().execute(); cancel(); } }, null); }