auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
private void discoverSupervisorTaskPartitions() { for (StorageLocation location : shuffleDataLocations) { final Path localtionPath = location.getPath().toPath().toAbsolutePath(); final MutableInt numDiscovered = new MutableInt(0); final File[] dirsPerSupervisorTask = location.getPath().listFiles(); if (dirsPerSupervisorTask != null) { for (File supervisorTaskDir : dirsPerSupervisorTask) { final String supervisorTaskId = supervisorTaskDir.getName(); supervisorTaskCheckTimes.computeIfAbsent( supervisorTaskId, k -> { for (File eachFile : FileUtils.listFiles(supervisorTaskDir, null, true)) { final String relativeSegmentPath = localtionPath .relativize(eachFile.toPath().toAbsolutePath()) .toString(); final File reservedFile = location.reserve( relativeSegmentPath, eachFile.getName(), eachFile.length() ); if (reservedFile == null) { log.warn("Can't add a discovered partition[%s]", eachFile.getAbsolutePath()); } } numDiscovered.increment(); return DateTimes.nowUtc().plus(intermediaryPartitionTimeout); } ); } } log.info("Discovered partitions for [%s] new supervisor tasks", numDiscovered.getValue()); } }

Target:
private void discoverSupervisorTaskPartitions() { for (StorageLocation location : shuffleDataLocations) { final Path locationPath = location.getPath().toPath().toAbsolutePath(); final MutableInt numDiscovered = new MutableInt(0); final File[] dirsPerSupervisorTask = location.getPath().listFiles(); if (dirsPerSupervisorTask != null) { for (File supervisorTaskDir : dirsPerSupervisorTask) { final String supervisorTaskId = supervisorTaskDir.getName(); supervisorTaskCheckTimes.computeIfAbsent( supervisorTaskId, k -> { for (File eachFile : FileUtils.listFiles(supervisorTaskDir, null, true)) { final String relativeSegmentPath = locationPath .relativize(eachFile.toPath().toAbsolutePath()) .toString(); final File reservedFile = location.reserve( relativeSegmentPath, eachFile.getName(), eachFile.length() ); if (reservedFile == null) { LOG.warn("Can't add a discovered partition[%s]", eachFile.getAbsolutePath()); } } numDiscovered.increment(); return DateTimes.nowUtc().plus(intermediaryPartitionTimeout); } ); } } LOG.info( "Discovered partitions for [%s] new supervisor tasks under location[%s]", numDiscovered.getValue(), location.getPath() ); } }
Source:
private static void appendStyleSheetWithBodyColorRules(StringBuilder buffer, RGB fgRGB, RGB bgRGB) { buffer.append("<style charset=\"ISO-8859-1\" type=\"text/css\">"); appendBodyColorsRule(buffer, fgRGB, bgRGB); buffer.append("</style></head>"); }

Target:
private static void appendStyleSheetWithBodyColorRules(StringBuilder buffer, RGB fgRGB, RGB bgRGB) { buffer.append("<style charset=\"ISO-8859-1\" type=\"text/css\">"); appendBodyColorsRule(buffer, fgRGB, bgRGB); buffer.append("</style>"); }
Source:
public InMoov2Arm(String n, String id) throws Exception { super(n, id); startPeers(); bicep.setPin(8); rotate.setPin(9); shoulder.setPin(10); omoplate.setPin(11); bicep.setMinMax(0.0, 180.0); rotate.setMinMax(0.0, 180.0); shoulder.setMinMax(0.0, 180.0); omoplate.setMinMax(0.0, 180.0); bicep.setMap(5.0, 90.0, 0.0, 180.0); rotate.setMap(40.0, 180.0, 0.0, 180.0); shoulder.setMap(0.0, 180.0, 0.0, 180.0); omoplate.setMap(10.0, 80.0, 0.0, 180.0); bicep.setRest(5.0); rotate.setRest(90.0); shoulder.setRest(30.0); omoplate.setRest(10.0); bicep.setPosition(5.0); shoulder.setPosition(30.0); rotate.setPosition(90.0); omoplate.setPosition(10.0); setSpeed(20.0, 20.0, 20.0, 20.0); }

Target:
public InMoov2Arm(String n, String id) throws Exception { super(n, id); startPeers(); bicep.setPin(8); rotate.setPin(9); shoulder.setPin(10); omoplate.setPin(11); bicep.map(5.0, 90.0, 5.0, 90.0); rotate.map(40.0, 180.0, 40.0, 180.0); shoulder.map(0.0, 180.0, 0.0, 180.0); omoplate.map(10.0, 80.0, 10.0, 80.0); bicep.setRest(5.0); rotate.setRest(90.0); shoulder.setRest(30.0); omoplate.setRest(10.0); bicep.setPosition(5.0); shoulder.setPosition(30.0); rotate.setPosition(90.0); omoplate.setPosition(10.0); setSpeed(20.0, 20.0, 20.0, 20.0); }
Source:
public void syncGroup(MarkersSyncGroup group) { if (!isGroupSynced(group.getId())) { return; } List<MapMarker> dbMarkers = markersDbHelper.getMarkersFromGroup(group); if (group.getType() == MarkersSyncGroup.FAVORITES_TYPE) { FavoriteGroup favGroup = ctx.getFavorites().getGroup(group.getName()); if (favGroup == null) { return; } if (!favGroup.visible) { removeActiveMarkersFromSyncGroup(group.getId()); return; } if (group.getColor() == -1) { group.setColor(favGroup.color); } for (FavouritePoint fp : favGroup.points) { addNewMarkerIfNeeded(group, dbMarkers, new LatLon(fp.getLatitude(), fp.getLongitude()), fp.getName()); } removeOldMarkersIfNeeded(dbMarkers); } else if (group.getType() == MarkersSyncGroup.GPX_TYPE) { GpxSelectionHelper gpxHelper = ctx.getSelectedGpxHelper(); File file = new File(group.getId()); if (!file.exists()) { return; } SelectedGpxFile selectedGpxFile = gpxHelper.getSelectedFileByPath(group.getId()); GPXFile gpx = selectedGpxFile == null ? null : selectedGpxFile.getGpxFile(); if (gpx == null) { removeActiveMarkersFromSyncGroup(group.getId()); return; } List<WptPt> gpxPoints = new LinkedList<>(gpx.getPoints()); for (WptPt pt : gpxPoints) { group.setColor(pt.getColor(ContextCompat.getColor(ctx, R.color.marker_red))); addNewMarkerIfNeeded(group, dbMarkers, new LatLon(pt.lat, pt.lon), pt.name); } removeOldMarkersIfNeeded(dbMarkers); } }

Target:
public void syncGroup(MarkersSyncGroup group) { if (!isGroupSynced(group.getId())) { return; } List<MapMarker> dbMarkers = markersDbHelper.getMarkersFromGroup(group); if (group.getType() == MarkersSyncGroup.FAVORITES_TYPE) { FavoriteGroup favGroup = ctx.getFavorites().getGroup(group.getName()); if (favGroup == null) { return; } if (!favGroup.visible) { removeActiveMarkersFromSyncGroup(group.getId()); return; } if (group.getColor() == -1) { group.setColor(favGroup.color); } for (FavouritePoint fp : favGroup.points) { addNewMarkerIfNeeded(group, dbMarkers, new LatLon(fp.getLatitude(), fp.getLongitude()), fp.getName()); } removeOldMarkersIfNeeded(dbMarkers); } else if (group.getType() == MarkersSyncGroup.GPX_TYPE) { GpxSelectionHelper gpxHelper = ctx.getSelectedGpxHelper(); File file = new File(group.getId()); if (!file.exists()) { return; } SelectedGpxFile selectedGpxFile = gpxHelper.getSelectedFileByPath(group.getId()); GPXFile gpx = selectedGpxFile == null ? null : selectedGpxFile.getGpxFile(); if (gpx == null) { removeActiveMarkersFromSyncGroup(group.getId()); return; } List<WptPt> gpxPoints = new LinkedList<>(gpx.getPoints()); int defColor = ContextCompat.getColor(ctx, R.color.marker_red); for (WptPt pt : gpxPoints) { group.setColor(pt.getColor(defColor)); addNewMarkerIfNeeded(group, dbMarkers, new LatLon(pt.lat, pt.lon), pt.name); } removeOldMarkersIfNeeded(dbMarkers); } }
Source:
private boolean containsAnnotation(ClassInfo classInfo, DotName requiredAnnotationName, Class<? extends Annotation> requiredAnnotation) { if (classInfo.annotations().containsKey(requiredAnnotationName)) { return true; } for (DotName annotation : classInfo.annotations().keySet()) { if (annotationClassAnnotationsCache.getValue(annotation).contains(requiredAnnotationName.toString())) { return true; } } final DotName superName = classInfo.superName(); if (superName != null && !OBJECT_NAME.equals(superName)) { final ClassInfo superClassInfo = index.getClassByName(superName); if (superClassInfo == null) { return Reflections.containsAnnotation(loadClass(superName.toString()), requiredAnnotation); } if (containsAnnotation(superClassInfo, requiredAnnotationName, requiredAnnotation)) { return true; } } for (DotName interfaceName : classInfo.interfaceNames()) { final ClassInfo interfaceInfo = index.getClassByName(interfaceName); if (interfaceInfo == null) { Class<?> interfaceClass = loadClass(interfaceName.toString()); for (Method method : interfaceClass.getDeclaredMethods()) { if (method.isDefault() && Reflections.containsAnnotations(method.getAnnotations(), requiredAnnotation)) { return true; } } continue; } for (MethodInfo method : interfaceInfo.methods()) { if (isDefault(method)) { if (method.hasAnnotation(requiredAnnotationName)) { return true; } for (AnnotationInstance annotation : method.annotations()) { if (annotationClassAnnotationsCache.getValue(annotation.name()).contains(requiredAnnotationName.toString())) { return true; } } } } } return false; }

Target:
private boolean containsAnnotation(ClassInfo classInfo, DotName requiredAnnotationName, Class<? extends Annotation> requiredAnnotation) { if (classInfo.annotations().containsKey(requiredAnnotationName)) { return true; } for (DotName annotation : classInfo.annotations().keySet()) { if (annotationClassAnnotationsCache.getValue(annotation).contains(requiredAnnotationName.toString())) { return true; } } final DotName superName = classInfo.superName(); if (superName != null && !OBJECT_NAME.equals(superName)) { final ClassInfo superClassInfo = index.getClassByName(superName); if (superClassInfo == null) { return Reflections.containsAnnotation(loadClass(superName.toString()), requiredAnnotation); } if (containsAnnotation(superClassInfo, requiredAnnotationName, requiredAnnotation)) { return true; } } for (DotName interfaceName : classInfo.interfaceNames()) { final ClassInfo interfaceInfo = index.getClassByName(interfaceName); if (interfaceInfo == null) { Class<?> interfaceClass = loadClass(interfaceName.toString()); for (Method method : interfaceClass.getDeclaredMethods()) { if (method.isDefault() && Reflections.containsAnnotations(method.getAnnotations(), requiredAnnotation)) { return true; } } continue; } for (MethodInfo method : interfaceInfo.methods()) { if (isNonAbstractPublicInstanceMethod(method)) { if (method.hasAnnotation(requiredAnnotationName)) { return true; } for (AnnotationInstance annotation : method.annotations()) { if (annotationClassAnnotationsCache.getValue(annotation.name()).contains(requiredAnnotationName.toString())) { return true; } } } } } return false; }
Source:
protected void attachModel() { super.attachModel(); if (m_modelListener != null) { throw new IllegalStateException("Already attached"); } m_modelListener = new P_ModelListener(); getModel().addContentEditorFieldListener(m_modelListener); }

Target:
protected void attachModel() { super.attachModel(); m_modelListener = new P_ModelListener(); getModel().addContentEditorFieldListener(m_modelListener); }
Source:
public Connector create(String catalogName, Map<String, String> config, ConnectorContext context) { requireNonNull(catalogName, "connectorId is null"); requireNonNull(config, "config is null"); try { Bootstrap app = new Bootstrap( new JsonModule(), new RedisConnectorModule(), binder -> { binder.bind(RedisConnectorId.class).toInstance(new RedisConnectorId(catalogName)); binder.bind(TypeManager.class).toInstance(context.getTypeManager()); binder.bind(NodeManager.class).toInstance(context.getNodeManager()); if (tableDescriptionSupplier.isPresent()) { binder.bind(new TypeLiteral<Supplier<Map<SchemaTableName, RedisTableDescription>>>() {}).toInstance(tableDescriptionSupplier.get()); } else { binder.bind(new TypeLiteral<Supplier<Map<SchemaTableName, RedisTableDescription>>>() {}) .to(RedisTableDescriptionSupplier.class) .in(Scopes.SINGLETON); } }); Injector injector = app.strictConfig() .doNotInitializeLogging() .setRequiredConfigurationProperties(config) .initialize(); return injector.getInstance(RedisConnector.class); } catch (Exception e) { throwIfUnchecked(e); throw new RuntimeException(e); } }

Target:
public Connector create(String catalogName, Map<String, String> config, ConnectorContext context) { requireNonNull(catalogName, "catalogName is null"); requireNonNull(config, "config is null"); try { Bootstrap app = new Bootstrap( new JsonModule(), new RedisConnectorModule(), binder -> { binder.bind(RedisConnectorId.class).toInstance(new RedisConnectorId(catalogName)); binder.bind(TypeManager.class).toInstance(context.getTypeManager()); binder.bind(NodeManager.class).toInstance(context.getNodeManager()); if (tableDescriptionSupplier.isPresent()) { binder.bind(new TypeLiteral<Supplier<Map<SchemaTableName, RedisTableDescription>>>() {}).toInstance(tableDescriptionSupplier.get()); } else { binder.bind(new TypeLiteral<Supplier<Map<SchemaTableName, RedisTableDescription>>>() {}) .to(RedisTableDescriptionSupplier.class) .in(Scopes.SINGLETON); } }); Injector injector = app.strictConfig() .doNotInitializeLogging() .setRequiredConfigurationProperties(config) .initialize(); return injector.getInstance(RedisConnector.class); } catch (Exception e) { throwIfUnchecked(e); throw new RuntimeException(e); } }
Source:
public void setStashRootUrl(String stashRootUrl) { this.stashRootUrl = stashRootUrl; }

Target:
public void setStashRootUrl(String stashRootUrl) { this.stashRootUrl = StringUtils.trimToNull(stashRootUrl); }
Source:
public static IContainerDMContext[] getContainerContexts() throws InterruptedException, ExecutionException, TimeoutException { assert!fProcessesService.getExecutor().isInExecutorThread(); Query<IContainerDMContext[]> query = new Query<IContainerDMContext[]>() { @Override protected void execute(final DataRequestMonitor<IContainerDMContext[]> rm) { fProcessesService.getProcessesBeingDebugged(fGdbControl.getContext(), new ImmediateDataRequestMonitor<IDMContext[]>() { @Override protected void handleCompleted() { if (isSuccess()) { IDMContext[] contexts = getData(); rm.done((IContainerDMContext[]) contexts); } else { rm.done(getStatus()); } } }); } }; fGdbControl.getExecutor().execute(query); return query.get(TestsPlugin.massageTimeout(2000), TimeUnit.MILLISECONDS); }

Target:
public static IContainerDMContext[] getContainerContexts() throws InterruptedException, ExecutionException, TimeoutException { assert!fProcessesService.getExecutor().isInExecutorThread(); Query<IContainerDMContext[]> query = new Query<IContainerDMContext[]>() { @Override protected void execute(final DataRequestMonitor<IContainerDMContext[]> rm) { fProcessesService.getProcessesBeingDebugged(fGdbControl.getContext(), new ImmediateDataRequestMonitor<IDMContext[]>() { @Override protected void handleSuccess() { if (isSuccess()) { IDMContext[] contexts = getData(); rm.done((IContainerDMContext[]) contexts); } } }); } }; fGdbControl.getExecutor().execute(query); return query.get(TestsPlugin.massageTimeout(2000), TimeUnit.MILLISECONDS); }
Source:
@Nonnull protected Token[] tokenise() throws TokeniserException { while (this.hasNext()) { if (this.eatSeparator()) continue; if (!this.eatDirectiveName()) { throw this.createError("expecting directive-name but found " + this.next()); } if (this.eatSeparator()) continue; while (this.hasNext()) { if (!this.eatDirectiveValue()) { int cp = this.next().codePointAt(0); throw this.createError(String.format("expecting directive-value but found %s (U+%04x). Non-whitespace characters outside ASCII 0x21-0x7E must be percent-encoded", this.next(), cp)); } if (this.eatSeparator()) break; } } Token[] tokensArray = new Token[this.tokens.size()]; return this.tokens.toArray(tokensArray); }

Target:
@Nonnull protected Token[] tokenise() throws TokeniserException { while (this.hasNext()) { if (this.eatSeparator()) continue; if (!this.eatDirectiveName()) { throw this.createError("expecting directive-name but found " + this.next()); } if (this.eatSeparator()) continue; while (this.hasNext()) { if (!this.eatDirectiveValue()) { String token = this.next(); int cp = token.codePointAt(0); throw this.createError(String.format("expecting directive-value but found U+%04X (%s). Non-ASCII and non-printable characters must be percent-encoded", cp, new String(new int[]{cp}, 0, 1))); } if (this.eatSeparator()) break; } } Token[] tokensArray = new Token[this.tokens.size()]; return this.tokens.toArray(tokensArray); }
Source:
public List<Service> listServices(final Service.Criteria criteria) throws DockerException, InterruptedException { assertApiVersionIsAbove("1.24"); final Map<String, List<String>> filters = new HashMap<>(); if (criteria.serviceId() != null) { filters.put("id", Collections.singletonList(criteria.serviceId())); } if (criteria.serviceName() != null) { filters.put("name", Collections.singletonList(criteria.serviceName())); } if (criteria.label() != null) { filters.put("label", Collections.singletonList( String.format("%s=%s", criteria.label().name(), criteria.label().value()) )); } WebTarget resource = resource().path("services"); resource = resource.queryParam("filters", urlEncodeFilters(filters)); return request(GET, SERVICE_LIST, resource, resource.request(APPLICATION_JSON_TYPE)); }

Target:
public List<Service> listServices(final Service.Criteria criteria) throws DockerException, InterruptedException { assertApiVersionIsAbove("1.24"); final Map<String, List<String>> filters = new HashMap<>(); if (criteria.serviceId() != null) { filters.put("id", Collections.singletonList(criteria.serviceId())); } if (criteria.serviceName() != null) { filters.put("name", Collections.singletonList(criteria.serviceName())); } final List<String> labels = new ArrayList<>(); for (Entry<String, String> input: criteria.labels().entrySet()) { if ("".equals(input.getValue())) { labels.add(input.getKey()); } else { labels.add(String.format("%s=%s", input.getKey(), input.getValue())); } } if (!labels.isEmpty()) { filters.put("label", labels); } WebTarget resource = resource().path("services"); resource = resource.queryParam("filters", urlEncodeFilters(filters)); return request(GET, SERVICE_LIST, resource, resource.request(APPLICATION_JSON_TYPE)); }
Source:
default Query getRemoveByQuery() { if (isVersionedEntity()) { return getQueryForVersion(); } return getByIdQuery(); }

Target:
default Query getRemoveByQuery() { return isVersionedEntity() ? getQueryForVersion() : getByIdQuery(); }
Source:
public Post clickNthPostWithPoll(int number) { wait.forElementClickable(postsWithPollList.get(number)); postsWithPollList.get(number).click(); return this; }

Target:
public Post clickNthPostWithPoll(int number) { try { wait.forElementClickable(postsWithPollList.get(number)); postsWithPollList.get(number).click(); } catch (IndexOutOfBoundsException e) { PageObjectLogging.log("Could not find and click nth post with a poll", e, false); } return this; }
Source:
public String toString() { return "StatusReturnForXmlRpc [mStatus=" + mStatus + "]"; }

Target:
public String toString() { return getClass().getSimpleName() + " [mStatus=" + mStatus + "]"; }
Source:
public void abort_txn(AbortTxnRequest rqst) throws TException { getTxnHandler().abortTxn(rqst); MetaStoreListenerNotifier.notifyEvent(transactionalListeners, EventType.ABORT_TXN, new AbortTxnEvent(rqst.getTxnid(), true, this)); }

Target:
public void abort_txn(AbortTxnRequest rqst) throws TException { getTxnHandler().abortTxn(rqst); if (listeners != null && !listeners.isEmpty()) { MetaStoreListenerNotifier.notifyEvent(listeners, EventType.ABORT_TXN, new AbortTxnEvent(rqst.getTxnid(), this)); } }
Source:
public ITmfCommonXAxisResponse fetchXY(TimeQueryFilter filter, @Nullable IProgressMonitor monitor) { if (!(filter instanceof SelectedCpuQueryFilter)) { return TmfCommonXAxisResponseFactory.createFailedResponse(CommonStatusMessage.UNEXPECTED_QUERY_FILTER); } return fetchXY((SelectedCpuQueryFilter) filter, monitor); }

Target:
public ITmfCommonXAxisResponse fetchXY(TimeQueryFilter filter, @Nullable IProgressMonitor monitor) { if (filter instanceof SelectedCpuQueryFilter) { return fetchXY((SelectedCpuQueryFilter) filter, monitor); } return TmfCommonXAxisResponseFactory.createFailedResponse(CommonStatusMessage.UNEXPECTED_QUERY_FILTER); }
Source:
private static boolean returnsOptional(MethodTree method) { TypeTree returnType = method.returnType(); if (returnType != null) { return returnType.symbolType().is(Optional.class.getName()); } return false; }

Target:
private static boolean returnsOptional(MethodTree method) { return method.returnType().symbolType().is(OPTIONAL); }
Source:
public static Long getBranchUuidFromRemoteEvent(String remoteBranchId) { Long id = 0L; if (Strings.isValid(remoteBranchId)) { id = Long.valueOf(remoteBranchId); } return id; }

Target:
public static Long getBranchUuidFromRemoteEvent(String remoteBranchId) { Long id = 0L; if (Strings.isNumeric(remoteBranchId)) { id = Long.valueOf(remoteBranchId); } return id; }
Source:
public void shouldRetryOnSameNodeToFailureAndThenRedirect() { int numHosts = 4; List<InetSocketAddress> hostList = Lists.newArrayList(); for (int i = 0; i < numHosts; i++) { hostList.add(new InetSocketAddress(i)); } CassandraClientPoolImpl cassandraClientPool = throwingClientPoolWithServersInCurrentPool( ImmutableSet.copyOf(hostList), new SocketTimeoutException()); assertThatThrownBy(() -> runNoopWithRetryOnHost(hostList.get(0), cassandraClientPool)) .isInstanceOf(Exception.class); verifyNumberOfAttemptsOnHost(hostList.get(0), cassandraClientPool, cassandraClientPool.getMaxRetriesPerHost()); for (int i = 1; i < numHosts; i++) { verifyNumberOfAttemptsOnHost(hostList.get(i), cassandraClientPool, 1); } }

Target:
public void shouldRetryOnSameNodeToFailureAndThenRedirect() { int numHosts = 4; List<InetSocketAddress> hostList = Lists.newArrayList(); for (int i = 0; i < numHosts; i++) { hostList.add(new InetSocketAddress(i)); } CassandraClientPoolImpl clientPool = throwingClientPoolWithServersInCurrentPool( ImmutableSet.copyOf(hostList), new SocketTimeoutException()); assertThatThrownBy(() -> runNoopWithRetryOnHost(hostList.get(0), clientPool)) .isInstanceOf(Exception.class); verifyNumberOfAttemptsOnHost(hostList.get(0), clientPool, CassandraClientPoolImpl.getMaxRetriesPerHost()); for (int i = 1; i < numHosts; i++) { verifyNumberOfAttemptsOnHost(hostList.get(i), clientPool, 1); } }
Source:
public void onActivityResult(int requestCode, int resultCode, @Nullable Intent data) { super.onActivityResult(requestCode, resultCode, data); if (resultCode == Activity.RESULT_OK) { if (requestCode == IMPORT_SMR_REQUEST_CODE) { if (data != null) { uri = data.getData(); if (uri.getScheme().equals("file")) { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) { int permissionReadStorage = ContextCompat.checkSelfPermission(getActivity(), Manifest.permission.READ_EXTERNAL_STORAGE); if (permissionReadStorage == PackageManager.PERMISSION_GRANTED) { navigationHandler.showDialog(ImportLocalBackupDialogFragment.newInstance(uri)); } else { requestPermissions(new String[]{Manifest.permission.READ_EXTERNAL_STORAGE}, READ_PERMISSION_REQUEST); } } } else { navigationHandler.showDialog(ImportLocalBackupDialogFragment.newInstance(uri)); } } } } }

Target:
public void onActivityResult(int requestCode, int resultCode, @Nullable Intent data) { super.onActivityResult(requestCode, resultCode, data); if (data != null) { data.setAction(Intent.ACTION_VIEW); getActivity().setIntent(data); intentImportInformationPresenter.subscribe(); } }
Source:
private int calculateMaximumAmountToImport( InventoryAdaptor myAdaptor, IAEItemStack whatToImport, IMEMonitor<IAEItemStack> inv, FuzzyMode fzMode ) { final int toSend = Math.min( this.itemToSend, 64 ); final ItemStack simResult; final IAEItemStack itemAmountNotStorable; if( this.getInstalledUpgrades( Upgrades.FUZZY ) > 0 ) { simResult = myAdaptor.simulateSimilarRemove( toSend, whatToImport == null ? null : whatToImport.getItemStack(), fzMode, this.configDestination( inv ) ); itemAmountNotStorable = this.destination.injectItems( AEItemStack.create( simResult ), Actionable.SIMULATE, this.source ); } else { simResult = myAdaptor.simulateRemove( toSend, whatToImport == null ? null : whatToImport.getItemStack(), this.configDestination( inv ) ); itemAmountNotStorable = this.destination.injectItems( AEItemStack.create( simResult ), Actionable.SIMULATE, this.source ); } if( itemAmountNotStorable != null ) { return (int) Math.min( simResult.stackSize - itemAmountNotStorable.getStackSize(), toSend ); } return toSend; }

Target:
private int calculateMaximumAmountToImport( InventoryAdaptor myAdaptor, IAEItemStack whatToImport, IMEMonitor<IAEItemStack> inv, FuzzyMode fzMode ) { final int toSend = Math.min( this.itemToSend, 64 ); final ItemStack simResult; final IAEItemStack itemAmountNotStorable; final ItemStack itemStackToImport; if( whatToImport == null ) { itemStackToImport = null; } else { itemStackToImport = whatToImport.getItemStack(); } if( this.getInstalledUpgrades( Upgrades.FUZZY ) > 0 ) { simResult = myAdaptor.simulateSimilarRemove( toSend, itemStackToImport, fzMode, this.configDestination( inv ) ); itemAmountNotStorable = this.destination.injectItems( AEItemStack.create( simResult ), Actionable.SIMULATE, this.source ); } else { simResult = myAdaptor.simulateRemove( toSend, itemStackToImport, this.configDestination( inv ) ); itemAmountNotStorable = this.destination.injectItems( AEItemStack.create( simResult ), Actionable.SIMULATE, this.source ); } if( itemAmountNotStorable != null ) { return (int) Math.min( simResult.stackSize - itemAmountNotStorable.getStackSize(), toSend ); } return toSend; }
Source:
public void onUrlClick(@NonNull String href, @Nullable String titleString) { if (href.startsWith(" href = "https:" + href; } L.d("Link clicked was " + href); if (href.startsWith("/wiki/")) { PageTitle title = TextUtils.isEmpty(titleString) ? getWikiSite().titleForInternalLink(href) : PageTitle.withSeparateFragment(titleString, UriUtil.getFragment(href), getWikiSite()); onInternalLinkClicked(title); } else if (href.startsWith("#")) { onPageLinkClicked(href.substring(1)); } else if (href.startsWith("./") && fragment != null && fragment.getTitle() != null) { String parsoidFragmentLinkPrefix = "./" + fragment.getTitle().getText() + "#"; if (href.startsWith(parsoidFragmentLinkPrefix)) { onPageLinkClicked(href.substring(parsoidFragmentLinkPrefix.length())); } } else { Uri uri = Uri.parse(href); String authority = uri.getAuthority(); if (authority != null && WikiSite.supportedAuthority(authority) && uri.getPath().startsWith("/wiki/")) { WikiSite wiki = new WikiSite(authority, getWikiSite().languageCode()); PageTitle title = wiki.titleForUri(uri); onInternalLinkClicked(title); } else { if (context == null) { return; } if (href.startsWith("/w/")) { href = String.format("%1$s://%2$s", getWikiSite().scheme(), getWikiSite().authority()) + href; } handleExternalLink(context, Uri.parse(href)); } } }

Target:
public void onUrlClick(@NonNull String href, @Nullable String titleString) { if (href.startsWith(" href = "https:" + href; } L.d("Link clicked was " + href); if (href.startsWith("/wiki/")) { PageTitle title = TextUtils.isEmpty(titleString) ? getWikiSite().titleForInternalLink(href) : PageTitle.withSeparateFragment(titleString, UriUtil.getFragment(href), getWikiSite()); onInternalLinkClicked(title); } else if (href.startsWith("#")) { onPageLinkClicked(href.substring(1)); } else if (href.startsWith("./") && fragment != null && fragment.getTitle() != null) { String parsoidFragmentLinkPrefix = "./" + fragment.getTitle().getText() + "#"; if (href.startsWith(parsoidFragmentLinkPrefix)) { onPageLinkClicked(href.substring(parsoidFragmentLinkPrefix.length())); } } else { Uri uri = Uri.parse(href); String authority = uri.getAuthority(); if (authority != null && WikiSite.supportedAuthority(authority) && uri.getPath().startsWith("/wiki/")) { WikiSite wiki = new WikiSite(authority, getWikiSite().languageCode()); PageTitle title = wiki.titleForUri(uri); onInternalLinkClicked(title); } else { if (fragment.getActivity() == null) { return; } if (href.startsWith("/w/")) { href = String.format("%1$s://%2$s", getWikiSite().scheme(), getWikiSite().authority()) + href; } handleExternalLink(fragment.getActivity(), Uri.parse(href)); } } }
Source:
protected LinkedHashMap<String, U> retrieveAll(final boolean readFromSession) { final LinkedHashMap<String, U> profiles = new LinkedHashMap<>(); final Object request = this.context.getRequestAttribute(Pac4jConstants.USER_PROFILES); if (request != null) { if (request instanceof LinkedHashMap) { profiles.putAll((LinkedHashMap<String, U>) request); } if (request instanceof CommonProfile) { profiles.put(retrieveClientName((U) request), (U) request); } } if (readFromSession) { final Object sessionAttribute = this.sessionStore.get(this.context, Pac4jConstants.USER_PROFILES).get(); if (sessionAttribute instanceof LinkedHashMap) { profiles.putAll((LinkedHashMap<String, U>) sessionAttribute); } if (sessionAttribute instanceof CommonProfile) { profiles.put(retrieveClientName((U) sessionAttribute), (U) sessionAttribute); } } return profiles; }

Target:
protected LinkedHashMap<String, U> retrieveAll(final boolean readFromSession) { final LinkedHashMap<String, U> profiles = new LinkedHashMap<>(); this.context.getRequestAttribute(Pac4jConstants.USER_PROFILES) .ifPresent(request -> { if (request instanceof LinkedHashMap) { profiles.putAll((LinkedHashMap<String, U>) request); } if (request instanceof CommonProfile) { profiles.put(retrieveClientName((U) request), (U) request); } }); if (readFromSession) { this.sessionStore.get(this.context, Pac4jConstants.USER_PROFILES) .ifPresent( sessionAttribute -> { if (sessionAttribute instanceof LinkedHashMap) { profiles.putAll((LinkedHashMap<String, U>) sessionAttribute); } if (sessionAttribute instanceof CommonProfile) { profiles.put(retrieveClientName((U) sessionAttribute), (U) sessionAttribute); } } ); } return profiles; }
Source:
private void addWaitEvent() { if (currentMessageMillis - lastMessageMillis > MIN_WAIT_DUR) { WaitEvent w = new WaitEvent(); w.setWaitInterval(currentMessageMillis - lastMessageMillis); synchronized (rttEventQueue) { if (rttEventQueue.getLast().type == Type.WAIT) { WaitEvent top = (WaitEvent) rttEventQueue.getLast(); w.setWaitInterval(w.getWaitInterval() + top.getWaitInterval()); rttEventQueue.removeLast(); Log.i(Config.LOGTAG, "Wait RTT events merged"); } rttEventQueue.addLast(w); Log.i(Config.LOGTAG, "Wait RTT event with " + w.getWaitInterval() + " milliseconds"); } } lastMessageMillis = currentMessageMillis; }

Target:
private void addWaitEvent() { if (currentMessageMillis - lastMessageMillis > MIN_WAIT_DUR) { WaitEvent w = new WaitEvent(); w.setWaitInterval(currentMessageMillis - lastMessageMillis); synchronized (rttEventQueue) { rttEventQueue.addLast(w); Log.i(Config.LOGTAG, "Wait RTT event with " + w.getWaitInterval() + " milliseconds"); } } lastMessageMillis = currentMessageMillis; }
Source:
private void checkIfDiscussionsBlackedOut() { createNewPostLayout.setVisibility(View.GONE); discussionService.getCourseDiscussionInfo(courseData.getCourse().getId()) .enqueue(new ErrorHandlingCallback<CourseDiscussionInfo>( getContext(), CallTrigger.LOADING_UNCACHED) { @Override public void onFailure(@NonNull Call<CourseDiscussionInfo> call, @NonNull Throwable t) { markAsBlackedOut(false); } @Override protected void onResponse(@NonNull CourseDiscussionInfo discussionInfo) { final Date today = new Date(); final List<TimePeriod> blackoutTimesList = discussionInfo.getBlackoutList(); for (TimePeriod timePeriod : blackoutTimesList) { if (today.after(timePeriod.getStart()) && today.before(timePeriod.getEnd())) { markAsBlackedOut(true); courseData.setDiscussionBlackedOut(true); createNewPostLayout.setEnabled(false); createNewPostLayout.setVisibility(View.VISIBLE); return; } } markAsBlackedOut(false); } private void markAsBlackedOut(boolean isBlackedOut) { courseData.setDiscussionBlackedOut(isBlackedOut); createNewPostLayout.setEnabled(!isBlackedOut); createNewPostLayout.setVisibility(isBlackedOut ? View.GONE : View.VISIBLE); } }); }

Target:
private void checkIfDiscussionsBlackedOut() { createNewPostLayout.setVisibility(View.GONE); discussionService.getCourseDiscussionInfo(courseData.getCourse().getId()) .enqueue(new ErrorHandlingCallback<CourseDiscussionInfo>( getContext(), CallTrigger.LOADING_UNCACHED, null, null) { @Override public void onFailure(@NonNull Call<CourseDiscussionInfo> call, @NonNull Throwable t) { markAsBlackedOut(false); } @Override protected void onResponse(@NonNull CourseDiscussionInfo discussionInfo) { final Date today = new Date(); final List<TimePeriod> blackoutTimesList = discussionInfo.getBlackoutList(); for (TimePeriod timePeriod : blackoutTimesList) { if (today.after(timePeriod.getStart()) && today.before(timePeriod.getEnd())) { markAsBlackedOut(true); return; } } markAsBlackedOut(false); } private void markAsBlackedOut(boolean isBlackedOut) { courseData.setDiscussionBlackedOut(isBlackedOut); createNewPostLayout.setEnabled(!isBlackedOut); createNewPostLayout.setVisibility(View.VISIBLE); } }); }
Source:
public FixedDoubleHistogram(SliceInput input) { this.bucketCount = input.readInt(); this.min = input.readDouble(); this.max = input.readDouble(); Utils.verifyParams(bucketCount, min, max); this.weights = new double[bucketCount]; input.readBytes( Slices.wrappedDoubleArray(weights), bucketCount * SizeOf.SIZE_OF_DOUBLE); }

Target:
public FixedDoubleHistogram(SliceInput input) { this.bucketCount = input.readInt(); this.min = input.readDouble(); this.max = input.readDouble(); verifyParameters(bucketCount, min, max); this.weights = new double[bucketCount]; input.readBytes( Slices.wrappedDoubleArray(weights), bucketCount * SizeOf.SIZE_OF_DOUBLE); }
Source:
private void setup() { userCache = Factory.maybeUnwrapProxy(userCache); performLoginStatusChangeActions(userCache.getUser()); final User preloadedUser = userCache.getUser(); InitVotes.waitFor(SecurityContext.class); if (User.ANONYMOUS.equals(preloadedUser)) { InitVotes.registerOneTimeDependencyCallback(ClientMessageBus.class, () -> { if (((ClientMessageBusImpl) ErraiBus.get()).getState() == BusState.CONNECTED) { initializeCacheFromServer(); } else { InitVotes.voteFor(SecurityContext.class); } }); } else { InitVotes.voteFor(SecurityContext.class); } }

Target:
private void setup() { performLoginStatusChangeActions(userCache.getUser()); final User preloadedUser = userCache.getUser(); InitVotes.waitFor(SecurityContext.class); if (User.ANONYMOUS.equals(preloadedUser)) { InitVotes.registerOneTimeDependencyCallback(ClientMessageBus.class, () -> { if (((ClientMessageBusImpl) ErraiBus.get()).getState() == BusState.CONNECTED) { initializeCacheFromServer(); } else { InitVotes.voteFor(SecurityContext.class); } }); } else { InitVotes.voteFor(SecurityContext.class); } }
Source:
protected static Setter getSetter(final String commandKey, ZuulProperties zuulProperties) { Setter commandSetter = Setter.withGroupKey(HystrixCommandGroupKey.Factory.asKey("RibbonCommand")) .andCommandKey(HystrixCommandKey.Factory.asKey(commandKey)); final HystrixCommandProperties.Setter setter = HystrixCommandProperties.Setter() .withExecutionIsolationStrategy(zuulProperties.getRibbonIsolationStrategy()); if (zuulProperties.getRibbonIsolationStrategy() == ExecutionIsolationStrategy.SEMAPHORE){ final String name = ZuulConstants.ZUUL_EUREKA + commandKey + ".semaphore.maxSemaphores"; final DynamicIntProperty value = DynamicPropertyFactory.getInstance() .getIntProperty(name, zuulProperties.getSemaphore().getMaxSemaphores()); setter.withExecutionIsolationSemaphoreMaxConcurrentRequests(value.get()); } else { if (zuulProperties.getThreadPool().isUseSeparateThreadPools()) { final String threadPoolKey = zuulProperties.getThreadPool().getThreadPoolKeyPrefix() + commandKey; commandSetter.andThreadPoolKey(HystrixThreadPoolKey.Factory.asKey(threadPoolKey)); } } return commandSetter.andCommandPropertiesDefaults(setter); }

Target:
protected static Setter getSetter(final String commandKey, ZuulProperties zuulProperties) { Setter commandSetter = Setter.withGroupKey(HystrixCommandGroupKey.Factory.asKey("RibbonCommand")) .andCommandKey(HystrixCommandKey.Factory.asKey(commandKey)); final HystrixCommandProperties.Setter setter = HystrixCommandProperties.Setter() .withExecutionIsolationStrategy(zuulProperties.getRibbonIsolationStrategy()); if (zuulProperties.getRibbonIsolationStrategy() == ExecutionIsolationStrategy.SEMAPHORE){ final String name = ZuulConstants.ZUUL_EUREKA + commandKey + ".semaphore.maxSemaphores"; final DynamicIntProperty value = DynamicPropertyFactory.getInstance() .getIntProperty(name, zuulProperties.getSemaphore().getMaxSemaphores()); setter.withExecutionIsolationSemaphoreMaxConcurrentRequests(value.get()); } else if (zuulProperties.getThreadPool().isUseSeparateThreadPools()) { final String threadPoolKey = zuulProperties.getThreadPool().getThreadPoolKeyPrefix() + commandKey; commandSetter.andThreadPoolKey(HystrixThreadPoolKey.Factory.asKey(threadPoolKey)); } return commandSetter.andCommandPropertiesDefaults(setter); }
Source:
public Step addStep(Step step) { lastUpdateTime = new Date(); step.setJobId(id); step.setStepNumber(steps.size()); if (step.getDescription() == null) { step.setDescription(step.getStepName()); } step.setCorrelationId(correlationId); steps.add(step); return step; }

Target:
public Step addStep(Step step) { lastUpdateTime = new Date(); step.setJobId(id); step.setStepNumber(steps.size()); step.setCorrelationId(correlationId); steps.add(step); return step; }
Source:
public void deleteIdP(String idPName, int tenantId, String tenantDomain) throws IdentityProviderManagementException { Connection dbConnection = IdentityDatabaseUtil.getDBConnection(); try { IdentityProvider identityProvider = getIdPByName(dbConnection, idPName, tenantId, tenantDomain); if (identityProvider == null) { String msg = "Trying to delete non-existent Identity Provider for tenant " + tenantDomain; log.error(msg); return; } IdentityProvider primaryIdP = getPrimaryIdP(dbConnection, tenantId, tenantDomain); if (primaryIdP == null) { String msg = "Cannot find primary Identity Provider for tenant " + tenantDomain; log.warn(msg); } deleteIdP(dbConnection, tenantId, idPName); if (primaryIdP != null && idPName.equals(primaryIdP.getIdentityProviderName())) { doAppointPrimary(dbConnection, tenantId, tenantDomain); } dbConnection.commit(); } catch (SQLException e) { IdentityApplicationManagementUtil.rollBack(dbConnection); throw new IdentityProviderManagementException("Error occurred while deleting Identity Provider of tenant " + tenantDomain, e); } finally { IdentityApplicationManagementUtil.closeConnection(dbConnection); } }

Target:
public void deleteIdP(String idPName, int tenantId, String tenantDomain) throws IdentityProviderManagementException { Connection dbConnection = IdentityDatabaseUtil.getDBConnection(); try { IdentityProvider identityProvider = getIdPByName(dbConnection, idPName, tenantId, tenantDomain); if (identityProvider == null) { String msg = "Trying to delete non-existent Identity Provider for tenant " + tenantDomain; log.error(msg); return; } deleteIdP(dbConnection, tenantId, idPName); dbConnection.commit(); } catch (SQLException e) { IdentityApplicationManagementUtil.rollBack(dbConnection); throw new IdentityProviderManagementException("Error occurred while deleting Identity Provider of tenant " + tenantDomain, e); } finally { IdentityApplicationManagementUtil.closeConnection(dbConnection); } }
Source:
public Report(Configuration config, Throwable throwable) { this.config = config; this.throwable = throwable; }

Target:
protected Report(Configuration config, Throwable throwable) { this.config = config; this.throwable = throwable; }
Source:
public void onDestroyView() { super.onDestroyView(); ((AppCompatActivity) getActivity()) .getSupportActionBar().setTitle(R.string.categories); }

Target:
public void onDestroyView() { super.onDestroyView(); AppCompatActivity appCompatActivity = (AppCompatActivity) getActivity(); if (appCompatActivity != null && appCompatActivity.getSupportActionBar() != null) { appCompatActivity.getSupportActionBar().setTitle(R.string.categories); } }
Source:
public void createSchema(ConnectorSession session, String schemaName, Map<String, Object> properties) { if (schemas.contains(schemaName)) { throw new PrestoException(ALREADY_EXISTS, "Schemas [%s] already exists"); } schemas.add(schemaName); }

Target:
public synchronized void createSchema(ConnectorSession session, String schemaName, Map<String, Object> properties) { if (schemas.contains(schemaName)) { throw new PrestoException(ALREADY_EXISTS, format("Schema [%s] already exists", schemaName)); } schemas.add(schemaName); }
Source:
public void updated(Dictionary<String, ?> config) throws ConfigurationException { Enumeration<String> keys = config.keys(); Map<String, AirConditioner> hosts = new HashMap<String, AirConditioner>(); while (keys.hasMoreElements()) { String key = keys.nextElement(); if ("service.pid".equals(key)) { continue; } String[] parts = key.split("\\."); String hostname = parts[0]; AirConditioner host = hosts.get(hostname); if (host == null) { host = new AirConditioner(); } String value = ((String) config.get(key)).trim(); if ("host".equals(parts[1])) { host.setIpAddress(value); } if ("mac".equals(parts[1])) { host.setMacAddress(value); } if ("token".equals(parts[1])) { host.setToken(value); } hosts.put(hostname, host); setProperlyConfigured(true); } nameHostMapper = hosts; if (nameHostMapper == null || nameHostMapper.size() == 0) { setProperlyConfigured(false); Map<String, String> discovered = SsdpDiscovery.discover(); if (discovered != null && discovered.size() > 0) { logger.warn("We found an air conditioner. Please put the following in your configuration file: " + "\r\n samsungac:Livingroom.host=" + discovered.get("IP") + "\r\n samsungac:Livingroom.mac=" + discovered.get("MAC_ADDR")); } else { logger.warn("No Samsung Air Conditioner has been configured, and we could not find one either"); } } }

Target:
public void updated(Dictionary<String, ?> config) throws ConfigurationException { Enumeration<String> keys = config.keys(); Map<String, AirConditioner> hosts = new HashMap<String, AirConditioner>(); while (keys.hasMoreElements()) { String key = keys.nextElement(); if ("service.pid".equals(key)) { continue; } String[] parts = key.split("\\."); String hostname = parts[0]; AirConditioner host = hosts.get(hostname); if (host == null) { host = new AirConditioner(); } String value = ((String) config.get(key)).trim(); if ("host".equals(parts[1])) { host.setIpAddress(value); } if ("mac".equals(parts[1])) { host.setMacAddress(value); } if ("token".equals(parts[1])) { host.setToken(value); } hosts.put(hostname, host); } nameHostMapper = hosts; if (nameHostMapper == null || nameHostMapper.size() == 0) { setProperlyConfigured(false); Map<String, String> discovered = SsdpDiscovery.discover(); if (discovered != null && discovered.size() > 0) { logger.warn("We found an air conditioner. Please put the following in your configuration file: " + "\r\n samsungac:Livingroom.host=" + discovered.get("IP") + "\r\n samsungac:Livingroom.mac=" + discovered.get("MAC_ADDR")); } else { logger.warn("No Samsung Air Conditioner has been configured, and we could not find one either"); } } else { setProperlyConfigured(true); } }
Source:
public Optional<Kml> unmarshal(InputStream inputStream) { try { if (unmarshaller != null) { XMLInputFactory xmlInputFactory = XMLInputFactory.newFactory(); xmlInputFactory.setProperty(XMLInputFactory.IS_SUPPORTING_EXTERNAL_ENTITIES, false); xmlInputFactory.setProperty(XMLInputFactory.SUPPORT_DTD, false); xmlInputFactory.setProperty(XMLInputFactory.IS_REPLACING_ENTITY_REFERENCES, false); XMLStreamReader xmlStreamReader = xmlInputFactory.createXMLStreamReader(inputStream); JAXBElement<Kml> unmarshal = unmarshaller.unmarshal(xmlStreamReader, Kml.class); Kml kml = unmarshal.getValue(); return Optional.of(kml); } } catch (JAXBException | XMLStreamException e) { LOGGER.debug("Exception while unmarshalling default style resource.", e); } return Optional.empty(); }

Target:
public Optional<Kml> unmarshal(InputStream inputStream) { if (unmarshaller == null) { return Optional.empty(); } final XMLInputFactory xmlInputFactory = XMLUtils.getInstance().getSecureXmlInputFactory(); try { XMLStreamReader xmlStreamReader = xmlInputFactory.createXMLStreamReader(inputStream); JAXBElement<Kml> unmarshal = unmarshaller.unmarshal(xmlStreamReader, Kml.class); Kml kml = unmarshal.getValue(); return Optional.of(kml); } catch (JAXBException | XMLStreamException e) { LOGGER.debug("Exception while unmarshalling default style resource.", e); return Optional.empty(); } }
Source:
private <T> T load(Class<T> tClass, String key) { try { System.out.println(1111); Path path = Paths.get(logDirPath, key + EXTENSION); if (Files.notExists(path)) { return null; } byte[] bytes = Files.readAllBytes(path); ByteBuffer buf = ByteBuffer.wrap(bytes); int checksum = buf.getInt(); byte[] strBytes = Arrays.copyOfRange(bytes, 4, bytes.length); if (checksum != getChecksum(strBytes)) { throw new DataCorruptionException(); } String json = new String(strBytes); return JsonUtils.parser.fromJson(json, tClass); } catch (IOException e) { throw new RuntimeException(e); } }

Target:
private <T> T load(Class<T> tClass, String key) { try { Path path = Paths.get(logDirPath, key + EXTENSION); if (Files.notExists(path)) { return null; } byte[] bytes = Files.readAllBytes(path); ByteBuffer buf = ByteBuffer.wrap(bytes); int checksum = buf.getInt(); if (checksum != getChecksum(bytes, 4, bytes.length - 4)) { throw new DataCorruptionException(); } String json = new String(bytes, 4, bytes.length - 4); return JsonUtils.parser.fromJson(json, tClass); } catch (IOException e) { throw new RuntimeException(e); } }
Source:
protected void executeCommand() { getParameters().setEntityId(getVmTemplateId()); RemoveVMVDSCommandParameters tempVar = new RemoveVMVDSCommandParameters(getParameters().getStoragePoolId(), getVmTemplateId()); tempVar.setStorageDomainId(getParameters().getStorageDomainId()); Backend.getInstance().getResourceManager().RunVdsCommand(VDSCommandType.RemoveVM, tempVar); List<DiskImage> images = getParameters().getImages(); ArrayList<Guid> storageIds = new ArrayList<Guid>(); storageIds.add(getParameters().getStorageDomainId()); for (DiskImage image : images) { image.setstorage_ids(storageIds); image.setstorage_pool_id(getParameters().getStoragePoolId()); } RemoveAllVmImagesParameters tempVar2 = new RemoveAllVmImagesParameters(getVmId(), images); tempVar2.setParentCommand(getActionType()); tempVar2.setEntityId(getParameters().getEntityId()); tempVar2.setForceDelete(true); tempVar2.setParentParemeters(getParameters()); VdcReturnValueBase vdcRetValue = Backend.getInstance().runInternalAction(VdcActionType.RemoveAllVmImages, tempVar2, ExecutionHandler.createDefaultContexForTasks(getExecutionContext())); if (vdcRetValue.getSucceeded()) { getReturnValue().getTaskIdList().addAll(vdcRetValue.getInternalTaskIdList()); setSucceeded(true); } else { getReturnValue().setFault(vdcRetValue.getFault()); } }

Target:
protected void executeCommand() { getParameters().setEntityId(getVmTemplateId()); RemoveVMVDSCommandParameters tempVar = new RemoveVMVDSCommandParameters(getParameters().getStoragePoolId(), getVmTemplateId()); tempVar.setStorageDomainId(getParameters().getStorageDomainId()); Backend.getInstance().getResourceManager().RunVdsCommand(VDSCommandType.RemoveVM, tempVar); List<DiskImage> images = getParameters().getImages(); for (DiskImage image : images) { ArrayList<Guid> storageIds = new ArrayList<Guid>(); storageIds.add(getParameters().getStorageDomainId()); image.setstorage_ids(storageIds); image.setstorage_pool_id(getParameters().getStoragePoolId()); } RemoveAllVmImagesParameters tempVar2 = new RemoveAllVmImagesParameters(getVmId(), images); tempVar2.setParentCommand(getActionType()); tempVar2.setEntityId(getParameters().getEntityId()); tempVar2.setForceDelete(true); tempVar2.setParentParemeters(getParameters()); VdcReturnValueBase vdcRetValue = Backend.getInstance().runInternalAction(VdcActionType.RemoveAllVmImages, tempVar2, ExecutionHandler.createDefaultContexForTasks(getExecutionContext())); if (vdcRetValue.getSucceeded()) { getReturnValue().getTaskIdList().addAll(vdcRetValue.getInternalTaskIdList()); setSucceeded(true); } else { getReturnValue().setFault(vdcRetValue.getFault()); } }