auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>private static void appendStyleSheetWithBodyColorRules(StringBuilder buffer, RGB fgRGB, RGB bgRGB) { buffer.append("<style charset=\"ISO-8859-1\" type=\"text/css\">"); appendBodyColorsRule(buffer, fgRGB, bgRGB); <START> buffer.append("</style></head>"); <END> }</code><technical_language>here? close head early if called in line 463 above</technical_language>

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:
<code>public InMoov2Arm(String n, String id) throws Exception { super(n, id); startPeers(); bicep.setPin(8); rotate.setPin(9); shoulder.setPin(10); omoplate.setPin(11); <START> bicep.setMinMax(0.0, 180.0); <END> 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); }</code><technical_language>changed.. bicep min/max 5-90 ... 0 to180. change in behavior in setMinMax fixed .. changes reverted</technical_language>

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:
<code>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) { <START> group.setColor(pt.getColor(ContextCompat.getColor(ctx, R.color.marker_red))); <END> addNewMarkerIfNeeded(group, dbMarkers, new LatLon(pt.lat, pt.lon), pt.name); } removeOldMarkersIfNeeded(dbMarkers); } }</code><technical_language>ContextCompat.getColor(ctx, R.color.marker_red)) in loop</technical_language>

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:
<code>protected void attachModel() { super.attachModel(); <START> if (m_modelListener != null) { <END> throw new IllegalStateException("Already attached"); } m_modelListener = new P_ModelListener(); getModel().addContentEditorFieldListener(m_modelListener); }</code><technical_language>IllegalStateException is required (check is performed in super call)</technical_language>

Target:
protected void attachModel() { super.attachModel(); m_modelListener = new P_ModelListener(); getModel().addContentEditorFieldListener(m_modelListener); }
Source:
<code>public Connector create(String catalogName, Map<String, String> config, ConnectorContext context) { <START> requireNonNull(catalogName, "connectorId is null"); <END> 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); } }</code><technical_language>msg</technical_language>

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:
<code>public void setStashRootUrl(String stashRootUrl) { <START> this.stashRootUrl = stashRootUrl; <END> }</code><technical_language>Please correct indentation for new code. in other places spaces & tabs currently mixed up</technical_language>

Target:
public void setStashRootUrl(String stashRootUrl) { this.stashRootUrl = StringUtils.trimToNull(stashRootUrl); }
Source:
<code>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 <START> protected void handleCompleted() { <END> 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); }</code><technical_language>override handleSuccess() instead I believe</technical_language>

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:
<code>@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()) { <START> int cp = this.next().codePointAt(0); <END> 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); }</code><technical_language>safe do so, prefer called this.next() once</technical_language>

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:
<code>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( <START> String.format("%s=%s", criteria.label().name(), criteria.label().value()) <END> )); } WebTarget resource = resource().path("services"); resource = resource.queryParam("filters", urlEncodeFilters(filters)); return request(GET, SERVICE_LIST, resource, resource.request(APPLICATION_JSON_TYPE)); }</code><technical_language>docker APIs, filter labels "name=value" "name" value. Is case services</technical_language>

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:
<code>default Query getRemoveByQuery() { <START> if (isVersionedEntity()) { <END> return getQueryForVersion(); } return getByIdQuery(); }</code><technical_language>Ternary ? true : false. ;)</technical_language>

Target:
default Query getRemoveByQuery() { return isVersionedEntity() ? getQueryForVersion() : getByIdQuery(); }
Source:
<code>public Post clickNthPostWithPoll(int number) { wait.forElementClickable(postsWithPollList.get(number)); <START> postsWithPollList.get(number).click(); <END> return this; }</code><technical_language>catch index out of bound exception</technical_language>

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:
<code>public String toString() { <START> return "StatusReturnForXmlRpc [mStatus=" + mStatus + "]"; <END> }</code><technical_language>getClass().getSimpleName in other places</technical_language>

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

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:
<code>public ITmfCommonXAxisResponse fetchXY(TimeQueryFilter filter, @Nullable IProgressMonitor monitor) { <START> if (!(filter instanceof SelectedCpuQueryFilter)) { return TmfCommonXAxisResponseFactory.createFailedResponse(CommonStatusMessage.UNEXPECTED_QUERY_FILTER); } return fetchXY((SelectedCpuQueryFilter) filter, monitor); <END> }</code><technical_language>invert condition do if(A instanceof B) { (B) A }</technical_language>

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:
<code>private static boolean returnsOptional(MethodTree method) { TypeTree returnType = method.returnType(); if (returnType != null) { <START> return returnType.symbolType().is(Optional.class.getName()); <END> } return false; }</code><technical_language>Please fully qualified name java.util.Optional instead of Optional.class.getName(). Main reasons are: - want do add external dependencies (even if in case Optional is provided java8), in order guarantee compatibility - If Optional changes location in a future version of java, check is react way</technical_language>

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

Target:
public static Long getBranchUuidFromRemoteEvent(String remoteBranchId) { Long id = 0L; if (Strings.isNumeric(remoteBranchId)) { id = Long.valueOf(remoteBranchId); } return id; }
Source:
<code>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)) <START> .isInstanceOf(Exception.class); <END> verifyNumberOfAttemptsOnHost(hostList.get(0), cassandraClientPool, cassandraClientPool.getMaxRetriesPerHost()); for (int i = 1; i < numHosts; i++) { verifyNumberOfAttemptsOnHost(hostList.get(i), cassandraClientPool, 1); } }</code><technical_language>Worth more here</technical_language>

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:
<code>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(); <START> if (uri.getScheme().equals("file")) { <END> 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)); } } } } }</code><technical_language>Is share import flows other parts need them? duplicate code here? Cool if wanted check</technical_language>

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:
<code>private int calculateMaximumAmountToImport( InventoryAdaptor myAdaptor, IAEItemStack whatToImport, IMEMonitor<IAEItemStack> inv, FuzzyMode fzMode ) { <START> final int toSend = Math.min( this.itemToSend, 64 ); <END> 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; }</code><technical_language>wondering, 64? max is 96</technical_language>

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:
<code>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 <START> (context == null) { <END> return; } if (href.startsWith("/w/")) { href = String.format("%1$s://%2$s", getWikiSite().scheme(), getWikiSite().authority()) + href; } handleExternalLink(context, Uri.parse(href)); } } }</code><technical_language>This class is a messy. If necessary check Fragment attach state here, I need check fragment.getActivity() get current state</technical_language>

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:
<code>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) { <START> final Object sessionAttribute = this.sessionStore.get(this.context, Pac4jConstants.USER_PROFILES).get(); <END> if (sessionAttribute instanceof LinkedHashMap) { profiles.putAll((LinkedHashMap<String, U>) sessionAttribute); } if (sessionAttribute instanceof CommonProfile) { profiles.put(retrieveClientName((U) sessionAttribute), (U) sessionAttribute); } } return profiles; }</code><technical_language>get()</technical_language>

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:
<code>private void addWaitEvent() { if (currentMessageMillis - lastMessageMillis > MIN_WAIT_DUR) { WaitEvent w = new WaitEvent(); w.setWaitInterval(currentMessageMillis - lastMessageMillis); synchronized (rttEventQueue) { <START> if (rttEventQueue.getLast().type == Type.WAIT) { <END> 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; }</code><technical_language>this happen wait events</technical_language>

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:
<code>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); <START> <END> } }); }</code><technical_language>Extra line</technical_language>

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:
<code>public FixedDoubleHistogram(SliceInput input) { <START> this.bucketCount = input.readInt(); <END> 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); }</code><technical_language>Is a reason for this protected</technical_language>

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:
<code>private void setup() { <START> userCache = Factory.maybeUnwrapProxy(userCache); <END> 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); } }</code><technical_language>is a problem userCache is proxied? (If is a case, a cleaner fix is change cache implementation @ApplicationScoped @Singleton)</technical_language>

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:
<code>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 { <START> if (zuulProperties.getThreadPool().isUseSeparateThreadPools()) { <END> final String threadPoolKey = zuulProperties.getThreadPool().getThreadPoolKeyPrefix() + commandKey; commandSetter.andThreadPoolKey(HystrixThreadPoolKey.Factory.asKey(threadPoolKey)); } } return commandSetter.andCommandPropertiesDefaults(setter); }</code><technical_language>else if</technical_language>

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:
<code>public Step addStep(Step step) { <START> lastUpdateTime = new Date(); <END> step.setJobId(id); step.setStepNumber(steps.size()); if (step.getDescription() == null) { step.setDescription(step.getStepName()); } step.setCorrelationId(correlationId); steps.add(step); return step; }</code><technical_language>long System current time</technical_language>

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:
<code>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; } <START> IdentityProvider primaryIdP = getPrimaryIdP(dbConnection, tenantId, tenantDomain); <END> 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); } }</code><technical_language>conflicted</technical_language>

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:
<code><START> public Report(Configuration config, Throwable throwable) { <END> this.config = config; this.throwable = throwable; }</code><technical_language>If expectation is this get built Bugsnag.buildReport remove public this package protected. This enforce API usage easier maintain refactor in future</technical_language>

Target:
protected Report(Configuration config, Throwable throwable) { this.config = config; this.throwable = throwable; }
Source:
<code>public void onDestroyView() { super.onDestroyView(); <START> ((AppCompatActivity) getActivity()) <END> .getSupportActionBar().setTitle(R.string.categories); }</code><technical_language>Please a null-ptr check</technical_language>

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

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:
<code>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); <START> setProperlyConfigured(true); <END> } 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"); } } }</code><technical_language>called once. Please move loop</technical_language>

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:
<code>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); <START> JAXBElement<Kml> unmarshal = unmarshaller.unmarshal(xmlStreamReader, Kml.class); <END> Kml kml = unmarshal.getValue(); return Optional.of(kml); } } catch (JAXBException | XMLStreamException e) { LOGGER.debug("Exception while unmarshalling default style resource.", e); } return Optional.empty(); }</code><technical_language>I limit try/catch lines throw exception</technical_language>

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:
<code>private <T> T load(Class<T> tClass, String key) { try { <START> System.out.println(1111); <END> 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); } }</code><technical_language>This is failing build</technical_language>

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:
<code>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>(); <START> storageIds.add(getParameters().getStorageDomainId()); <END> 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()); } }</code><technical_language>extra precautions this, sharing instance images</technical_language>

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()); } }
Source:
<code>public static BigDecimal calculateExpression(ArrayDeque<Tokenizer.Token> expression) throws ArithmeticException { ArrayDeque<BigDecimal> stack = new ArrayDeque<>(); Iterator<Tokenizer.Token> iterator = expression.descendingIterator(); while (iterator.hasNext()) { Tokenizer.Token token = iterator.next(); BigDecimal operand2 = null; BigDecimal operand1 = null; switch (token.type) { case Tokenizer.Token.NUMBER_TOKEN: stack.push(token.number); break; case Tokenizer.Token.UNARY_PLUS_TOKEN: break; case Tokenizer.Token.UNARY_MINUS_TOKEN: stack.push(stack.pop().negate()); break; case Tokenizer.Token.SUM_TOKEN: operand2 = stack.pop(); operand1 = stack.pop(); stack.push(operand1.add(operand2)); break; case Tokenizer.Token.SUBTRACT_TOKEN: operand2 = stack.pop(); operand1 = stack.pop(); stack.push(operand1.subtract(operand2)); break; case Tokenizer.Token.MULTIPLY_TOKEN: operand2 = stack.pop(); operand1 = stack.pop(); stack.push(operand1.multiply(operand2)); break; case Tokenizer.Token.DIVIDE_TOKEN: operand2 = stack.pop(); operand1 = stack.pop(); stack.push(operand1.divide(operand2)); break; case Tokenizer.Token.EXP_TOKEN: operand2 = stack.pop(); operand1 = stack.pop(); <START> stack.push(operand1.pow(operand2.intValueExact())); <END> break; } } return stack.pop(); }</code><technical_language>if operand is int</technical_language>

Target:
public static Result<BigDecimal> calculateExpression(ArrayDeque<Tokenizer.Token> expression) { try { return calculateExpressionThrowing(expression); } catch (ArithmeticException e) { return Result.arithmeticalError(); } }