auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public static List<FunctionCall> extractSupportedSpatialFunctions(Expression filterExpression) { ImmutableList.Builder<FunctionCall> spatialFunctions = ImmutableList.builder(); List<Expression> conjuncts = extractConjuncts(filterExpression); for (Expression expression : conjuncts) { if (expression instanceof FunctionCall) { FunctionCall function = (FunctionCall) expression; if (isSupportedSpatialFunction(function)) { spatialFunctions.add(function); } } } <START> return spatialFunctions.build(); <END> }</code><technical_language>return extractConjuncts(filterExpression).stream() .filter(FunctionCall.class::isInstance) .map(FunctionCall.class::cast) .filter(SpatialJoinUtils::isSupportedSpatialFunction) .collect(toImmutableList());</technical_language>

Target:
public static List<FunctionCall> extractSupportedSpatialFunctions(Expression filterExpression) { return extractConjuncts(filterExpression).stream() .filter(FunctionCall.class::isInstance) .map(FunctionCall.class::cast) .filter(SpatialJoinUtils::isSupportedSpatialFunction) .collect(toImmutableList()); }
Source:
<code>protected void clientInit() { CommonHelper.assertNotBlank("scope", getConfiguration().getScope()); CommonHelper.assertNotBlank("fields", getConfiguration().getFields()); configuration.setApi(LinkedInApi20.instance()); configuration.setProfileDefinition(new LinkedIn2ProfileDefinition()); configuration.setWithState(true); configuration.setHasBeenCancelledFactory(ctx -> { final Optional<String> error = ctx.getRequestParameter(OAuthCredentialsException.ERROR); final Optional<String> errorDescription = ctx.getRequestParameter(OAuthCredentialsException.ERROR_DESCRIPTION); <START> if ("access_denied".equals(error.orElse(null)) <END> && ("the+user+denied+your+request".equals(errorDescription.orElse(null)) || "the user denied your request" .equals(errorDescription))) { return true; } else { return false; } }); defaultLogoutActionBuilder((ctx, profile, targetUrl) -> Optional.of(RedirectAction.redirect("<LINK_0>")) ); super.clientInit(); }</code><technical_language>prefer map and/or flatMap nulls</technical_language>

Target:
protected void clientInit() { CommonHelper.assertNotBlank("scope", getConfiguration().getScope()); CommonHelper.assertNotBlank("fields", getConfiguration().getFields()); configuration.setApi(LinkedInApi20.instance()); configuration.setProfileDefinition(new LinkedIn2ProfileDefinition()); configuration.setWithState(true); configuration.setHasBeenCancelledFactory(ctx -> { final Optional<String> error = ctx.getRequestParameter(OAuthCredentialsException.ERROR); final Optional<String> errorDescription = ctx.getRequestParameter(OAuthCredentialsException.ERROR_DESCRIPTION); return error.map(e -> "access_denied".equals(e)).orElse(false) && errorDescription.map( e -> "the+user+denied+your+request".equals(e) || "the user denied your request".equals(e) ).orElse(false); }); defaultLogoutActionBuilder((ctx, profile, targetUrl) -> Optional.of(RedirectAction.redirect("<LINK_0>")) ); super.clientInit(); }
Source:
<code>public JSONObject toJSON() { JSONObject event = new JSONObject(); <START> event.put("user", this.user == null ? null : this.user.getName()); <END> event.put("ip", this.ip); event.put("action", this.action); event.put("extra", this.extra); event.put("entity", this.entity == null ? null : this.entity.getName()); event.put("time", this.time == null ? null : this.time.toString()); return event; }</code><technical_language>user's name a trusted put in JSON, user.getId() instead</technical_language>

Target:
public JSONObject toJSON() { JSONObject event = new JSONObject(); event.put("user", this.user == null ? null : this.user.getId()); event.put("ip", this.ip); event.put("action", this.action); event.put("extra", this.extra); event.put("entity", this.entity == null ? null : this.entity.toString()); event.put("time", this.time == null ? null : this.time.toInstant().toString()); return event; }
Source:
<code>public ImageCard(String webUrl) throws CardBuilderException { <START> this.cardType = CardType.IMAGE; <END> webUrl(webUrl); MetaTagModel metaTagModel = MetaTagExtractor.getMetaTags(this.webUrl); media(new Image(metaTagModel)); }</code><technical_language>super()</technical_language>

Target:
public ImageCard(String webUrl) throws CardBuilderException { super(webUrl); this.cardType = CardType.IMAGE; media(new Image(this.getMetaTagModel())); }
Source:
<code>private void basicCRUD(Realm realm) { showStatus("Perform basic Create/Read/Update/Delete (CRUD) operations..."); <START> RealmResults<Person> persons = realm.where(Person.class).findAll(); <END> persons.addChangeListener((people, changeSet) -> { if(changeSet == null) { return; } String insertions = changeSet.getInsertions().length == 0 ? "" : "\n - Insertions: " + Arrays.toString(changeSet.getInsertions()); String deletions = changeSet.getDeletions().length == 0 ? "" : "\n - Deletions: " + Arrays.toString(changeSet.getDeletions()); String changes = changeSet.getChanges().length == 0 ? "" : "\n - Changes: " + Arrays.toString(changeSet.getChanges()); showStatus("Person was written to: " + insertions + deletions + changes + "]"); }); realm.executeTransaction(r -> { Person person = r.createObject(Person.class, 1); person.setName("Young Person"); person.setAge(14); person.getPhoneNumbers().add("+1 123 4567"); }); final Person person = realm.where(Person.class).findFirst(); showStatus(person.getName() + ":" + person.getAge()); realm.executeTransaction(r -> { person.setName("Senior Person"); person.setAge(99); showStatus(person.getName() + " got older: " + person.getAge()); }); showStatus("Deleting all persons"); realm.executeTransaction(r -> r.delete(Person.class)); }</code><technical_language>this a field reference. I needed, reads a bit funny disclaimer proceeding it</technical_language>

Target:
private void basicCRUD(Realm realm) { showStatus("Perform basic Create/Read/Update/Delete (CRUD) operations..."); realm.executeTransaction(r -> { Person person = r.createObject(Person.class, 1); person.setName("Young Person"); person.setAge(14); person.getPhoneNumbers().add("+1 123 4567"); }); final Person person = realm.where(Person.class).findFirst(); showStatus(person.getName() + ":" + person.getAge()); realm.executeTransaction(r -> { person.setName("Senior Person"); person.setAge(99); showStatus(person.getName() + " got older: " + person.getAge()); }); showStatus("Deleting all persons"); realm.executeTransaction(r -> r.delete(Person.class)); }
Source:
<code>public final void run() { try { runInternal(); <START> } catch (NativeOutOfMemoryError e) { <END> e.printStackTrace(); } }</code><technical_language>remove this try-catch block pull runInternal code here. MultiMap support NATIVE in memory format for NativeOutOfMemoryError thrown</technical_language>

Target:
public final void run() { int size = mapEntries != null ? mapEntries.size() : 0; int currentIndex = 0; while (currentIndex < size) { Data dataKey = mapEntries.getKey(currentIndex); Data value = mapEntries.getValue(currentIndex); put(dataKey, value); currentIndex++; } }
Source:
<code>private void shrink(int delta) { Collection<Entity> removedEntities = Lists.newArrayList(); for (int i = 0; i < (delta*-1); i++) { removedEntities.add(removeNode()); } Task<List<Void>> invoke = Entities.invokeEffectorList(this, removedEntities, Startable.STOP, Collections.<String,Object>emptyMap()); try { invoke.get(); <START> } catch (InterruptedException e) { <END> Thread.currentThread().interrupt(); throw Throwables.propagate(e); } catch (ExecutionException e) { throw Throwables.propagate(e); } }</code><technical_language>a new EntitiesSafe.invokeXxxx catches propagates exceptions</technical_language>

Target:
private void shrink(int delta) { Collection<Entity> removedEntities = Lists.newArrayList(); for (int i = 0; i < (delta*-1); i++) { removedEntities.add(pickAndRemoveMember()); } Task<List<Void>> invoke = Entities.invokeEffectorList(this, removedEntities, Startable.STOP, Collections.<String,Object>emptyMap()); try { invoke.get(); } catch (Exception e) { throw Exceptions.propagate(e); } finally { for (Entity removedEntity : removedEntities) { discardNode(removedEntity); } } }
Source:
<code>public void setGlobalTargetTaskThreadPoolSize(int globalTargetTaskThreadPoolSize) throws IllegalArgumentException { <START> if (globalTargetTaskThreadPoolSize <= 0) { throw new IllegalArgumentException("globalTargetTaskThreadPoolSize must be greater than 0!"); } <END> _record .setIntField(ClusterConfig.ClusterConfigProperty.GLOBAL_TARGET_TASK_THREAD_POOL_SIZE.name(), globalTargetTaskThreadPoolSize); }</code><technical_language>Technically, I 0 is valid. process tasks. do think? I able this config a workaround "disable" task framework globally, participants process tasks - say, global is 0, participants individual configs set</technical_language>

Target:
public void setGlobalTargetTaskThreadPoolSize(int globalTargetTaskThreadPoolSize) throws IllegalArgumentException { if (globalTargetTaskThreadPoolSize < 0) { throw new IllegalArgumentException("globalTargetTaskThreadPoolSize must be non-negative!"); } _record .setIntField(ClusterConfig.ClusterConfigProperty.GLOBAL_TARGET_TASK_THREAD_POOL_SIZE.name(), globalTargetTaskThreadPoolSize); }
Source:
<code>ProposalStats() { final MetricRegistry metrics = new MetricRegistry(); <START> Reservoir reservoir = new ExponentiallyDecayingReservoir(); <END> proposalSizes = new Histogram(reservoir); metrics.register(name(CommonNames.DOMAIN, "Leader", "proposalSize"), proposalSizes); final JmxReporter jmxReporter = JmxReporter.forRegistry(metrics).registerWith(MBeanRegistry.getInstance().getPlatformMBeanServer()).build(); jmxReporter.start(); }</code><technical_language>I pretend exponentially decaying reservoirs. curious behavior is minimum maximum values. guaranteed exact for time period</technical_language>

Target:
ProposalStats() { final MetricRegistry metrics = new MetricRegistry(); long winSize = getWindowSizeInMinutes(); Reservoir reservoir = new SlidingTimeWindowArrayReservoir(winSize, TimeUnit.MINUTES); LOG.info("Initialized histogram sliding window size to minutes", winSize); proposalSizes = new Histogram(reservoir); metrics.register(name(CommonNames.DOMAIN, "Leader", "proposalSize"), proposalSizes); final JmxReporter jmxReporter = JmxReporter.forRegistry(metrics).registerWith(MBeanRegistry.getInstance().getPlatformMBeanServer()).build(); jmxReporter.start(); }
Source:
<code>private ContentType getContentType(Request request) { ContentType contentType = ContentType.DEFAULT_TEXT; for (Map.Entry<String, Collection<String>> entry : request.headers().entrySet()) if (entry.getKey().equalsIgnoreCase("Content-Type")) { Collection<String> values = entry.getValue(); if (values != null && !values.isEmpty()) { String mimeType = values.iterator().next(); try { contentType = ContentType.create(mimeType, request.charset()); } catch (IllegalArgumentException e) { <START> contentType = ContentType.parse(mimeType); <END> } break; } } return contentType; }</code><technical_language>catching.. test this :)</technical_language>

Target:
private ContentType getContentType(Request request) { ContentType contentType = ContentType.DEFAULT_TEXT; for (Map.Entry<String, Collection<String>> entry : request.headers().entrySet()) if (entry.getKey().equalsIgnoreCase("Content-Type")) { Collection<String> values = entry.getValue(); if (values != null && !values.isEmpty()) { contentType = ContentType.parse(values.iterator().next()); break; } } return contentType; }
Source:
<code>protected boolean runTest(DatabaseRegistryEntry dbre) { <START> SqlTemplate srv = getSqlTemplate(dbre); <END> boolean result = true; getTotalCould(dbre); result = computeMissingValues (dbre, totalCount); return result; }</code><technical_language>srv is</technical_language>

Target:
protected boolean runTest(DatabaseRegistryEntry dbre) { boolean result = true; result = computeMissingValues (dbre); return result; }
Source:
<code>public void queryInventoryAsync(final boolean querySkuDetails, final List<String> moreItemSkus, final List<String> moreSubsSkus, final IabHelper.QueryInventoryFinishedListener listener) { checkSetupDone("queryInventory"); <START> if(listener == null) return; <END> flagStartAsync("refresh inventory"); (new Thread(new Runnable() { public void run() { IabResult result = new IabResult(BILLING_RESPONSE_RESULT_OK, "Inventory refresh successful."); Inventory inv = null; try { inv = queryInventory(querySkuDetails, moreItemSkus, moreSubsSkus); } catch (IabException ex) { result = ex.getResult(); } flagEndAsync(); final IabResult result_f = result; final Inventory inv_f = inv; notifyHandler.post(new Runnable() { public void run() { listener.onQueryInventoryFinished(result_f, inv_f); } }); } })).start(); }</code><technical_language>listener is get results calling operation sense. throw IllegalArgument</technical_language>

Target:
public void queryInventoryAsync(final boolean querySkuDetails, final List<String> moreItemSkus, final List<String> moreSubsSkus, final IabHelper.QueryInventoryFinishedListener listener) { checkSetupDone("queryInventory"); if (listener == null) { throw new IllegalArgumentException("Inventory listener must be not null"); } flagStartAsync("refresh inventory"); (new Thread(new Runnable() { public void run() { IabResult result = new IabResult(BILLING_RESPONSE_RESULT_OK, "Inventory refresh successful."); Inventory inv = null; try { inv = queryInventory(querySkuDetails, moreItemSkus, moreSubsSkus); } catch (IabException ex) { result = ex.getResult(); } flagEndAsync(); final IabResult result_f = result; final Inventory inv_f = inv; if (setupState != SETUP_DISPOSED) { notifyHandler.post(new Runnable() { public void run() { listener.onQueryInventoryFinished(result_f, inv_f); } }); } } })).start(); }
Source:
<code>Territory getRetreat( final String message, final Collection<Territory> possible, final boolean submerge) { if (SwingUtilities.isEventDispatchThread()) { throw new IllegalStateException("Should not be called from dispatch thread"); } <START> final CompletableFuture<Territory> future = new CompletableFuture<>(); <END> final String title; final Supplier<RetreatResult> supplier; if (!submerge || possible.size() > 1) { title = "Retreat?"; supplier = () -> showRetreatDialog(message, possible); } else { title = "Submerge Subs?"; supplier = () -> showSubmergeDialog(message); } final Action action = getPlayerAction(title, supplier, future); SwingUtilities.invokeLater( () -> { actionButton.setAction(action); action.actionPerformed(null); }); return awaitUserInput(future); }</code><technical_language>Nit: Move future right "final Action action =" line</technical_language>

Target:
Territory getRetreat( final String message, final Collection<Territory> possible, final boolean submerge) { if (SwingUtilities.isEventDispatchThread()) { throw new IllegalStateException("Should not be called from dispatch thread"); } final String title; final Supplier<RetreatResult> supplier; if (!submerge || possible.size() > 1) { title = "Retreat?"; supplier = () -> showRetreatDialog(message, possible); } else { title = "Submerge Subs?"; supplier = () -> showSubmergeDialog(message); } final CompletableFuture<Territory> future = new CompletableFuture<>(); final Action action = getPlayerAction(title, supplier, future); SwingUtilities.invokeLater( () -> { actionButton.setAction(action); action.actionPerformed(null); }); return awaitUserInput(future); }
Source:
<code><START> public static Class<?> getRealClassFromClass(Class<?> cls) { <END> Bus bus = getBus(null); if (checkUseDefaultClassHelper(bus)) { return CXF_HELPER.getRealClassFromClassInternal(cls); } else { return HELPER.getRealClassFromClassInternal(cls); } }</code><technical_language>I suggest add overloaded method accepts Bus bus, places provided context. do think</technical_language>

Target:
public static Class<?> getRealClassFromClass(Class<?> cls) { return getRealClassFromClass(null, cls); }
Source:
<code>public String toString() { StringBuilder builder = new StringBuilder(50); builder.append("commandId: "); builder.append(getCommandId()); builder.append(", user: "); <START> builder.append(getParametersCurrentUser().getUserName()); <END> builder.append(", commandType: "); builder.append(getCommandType()); return builder.toString(); }</code><technical_language>this NPE? is user in case of internal command</technical_language>

Target:
public String toString() { StringBuilder builder = new StringBuilder(50); builder.append("commandId: "); builder.append(getCommandId()); builder.append(", user: "); if(getParametersCurrentUser() != null) { builder.append(getParametersCurrentUser().getUserName()); } builder.append(", commandType: "); builder.append(getCommandType()); return builder.toString(); }
Source:
<code>public void findAll() throws Exception { getClient().perform(get("/api/config/submissionsections")) <START> .andExpect(status().isForbidden()); <END> String token = getAuthToken(admin.getEmail(), password); getClient(token).perform(get("/api/config/submissionsections")) .andExpect(status().isOk()) .andExpect(content().contentType(contentType)) .andExpect(jsonPath("$.page.size", is(20))) .andExpect(jsonPath("$.page.totalElements", greaterThanOrEqualTo(1))) .andExpect(jsonPath("$.page.totalPages", greaterThanOrEqualTo(1))) .andExpect(jsonPath("$.page.number", is(0))) .andExpect(jsonPath("$._links.self.href", Matchers.startsWith(REST_SERVER_URL + "config/submissionsections"))) .andExpect(jsonPath("$._embedded.submissionsections", hasSize(greaterThanOrEqualTo(1)) )) ; }</code><technical_language>isUnauthorized 401</technical_language>

Target:
public void findAll() throws Exception { getClient().perform(get("/api/config/submissionsections")) .andExpect(status().isUnauthorized()); String token = getAuthToken(admin.getEmail(), password); getClient(token).perform(get("/api/config/submissionsections")) .andExpect(status().isOk()) .andExpect(content().contentType(contentType)) .andExpect(jsonPath("$.page.size", is(20))) .andExpect(jsonPath("$.page.totalElements", greaterThanOrEqualTo(1))) .andExpect(jsonPath("$.page.totalPages", greaterThanOrEqualTo(1))) .andExpect(jsonPath("$.page.number", is(0))) .andExpect(jsonPath("$._links.self.href", Matchers.startsWith(REST_SERVER_URL + "config/submissionsections"))) .andExpect(jsonPath("$._embedded.submissionsections", hasSize(greaterThanOrEqualTo(1)) )) ; }
Source:
<code>private Answer[] attemptHypervisorMigration(StoragePool destPool, VMInstanceVO vm) { <START> boolean migrationResult = false; <END> final HypervisorGuru hvGuru = _hvGuruMgr.getGuru(vm.getHypervisorType()); List<Command> commandsToSend = hvGuru.finalizeMigrate(vm, destPool); Long hostId = vm.getHostId(); if(hostId == null) { hostId = vm.getLastHostId(); if (s_logger.isDebugEnabled()) { s_logger.debug(String.format("host id is null, using last host id %d", hostId) ); } } if(CollectionUtils.isNotEmpty(commandsToSend)) { Commands commandsContainer = new Commands(commandsToSend.get(0)); try { Answer[] answers = _agentMgr.send(hostId, commandsContainer); return answers; } catch (AgentUnavailableException | OperationTimedoutException e) { throw new CloudRuntimeException("Failed to migration: " + e.toString()); } } return null; }</code><technical_language>This break stack trace. So, throw new CloudRuntimeException(Sring.format ("Failed migrate VM: %s ", vm.getUuid()), e); instead</technical_language>

Target:
private Answer[] attemptHypervisorMigration(StoragePool destPool, VMInstanceVO vm) { final HypervisorGuru hvGuru = _hvGuruMgr.getGuru(vm.getHypervisorType()); List<Command> commandsToSend = hvGuru.finalizeMigrate(vm, destPool); Long hostId = vm.getHostId(); if(hostId == null) { hostId = vm.getLastHostId(); if (s_logger.isDebugEnabled()) { s_logger.debug(String.format("host id is null, using last host id %d", hostId) ); } } if(CollectionUtils.isNotEmpty(commandsToSend)) { Commands commandsContainer = new Commands(Command.OnError.Stop); commandsContainer.addCommands(commandsToSend); try { return _agentMgr.send(hostId, commandsContainer); } catch (AgentUnavailableException | OperationTimedoutException e) { throw new CloudRuntimeException(String.format("Failed to migrate VM: %s", vm.getUuid()),e); } } return null; }
Source:
<code>private CompleteTransactionMessage makeCompleteTxnMsg(boolean readOnly, boolean isRollback, boolean isRestart) { CompleteTransactionMessage msg = new CompleteTransactionMessage(0l, 0l, m_mpiTxnEgo.getTxnId(), readOnly, 0, isRollback, false, isRestart, false); <START> msg.setForReplica(false); <END> return msg; }</code><technical_language>If default false, remove it</technical_language>

Target:
private CompleteTransactionMessage makeCompleteTxnMsg(boolean readOnly, boolean isRollback, boolean isRestart) { CompleteTransactionMessage msg = new CompleteTransactionMessage(0l, 0l, m_mpiTxnEgo.getTxnId(), readOnly, 0, isRollback, false, isRestart, false); return msg; }
Source:
<code>public ModelEditor(Composite composite, IEclipseContext context, IModelResource modelProvider, IProject project, final IResourcePool resourcePool) { this.resourcePool = resourcePool; this.modelProvider = modelProvider; this.project = project; this.context = context; this.context.set(ModelEditor.class, this); this.obsManager = new ObservablesManager(); if (project != null) { <START> String localString = ""; END> Object object = this.context.get(TranslationService.LOCALE); if (object instanceof String) { localString = (String) object; } else { Locale local = (Locale) object; localString = local.toString(); } ProjectOSGiTranslationProvider translationProvider = new ProjectOSGiTranslationProvider(project, localString) { @Override protected void updateResourceBundle() { super.updateResourceBundle(); if (viewer != null) { viewer.getControl().getDisplay().asyncExec(new Runnable() { @Override public void run() { viewer.refresh(); } }); } } }; context.set(ProjectOSGiTranslationProvider.class, translationProvider); } labelFeaturePaths.add(FeaturePath.fromList(UiPackageImpl.Literals.UI_ELEMENT__TO_BE_RENDERED)); labelFeaturePaths.add(FeaturePath.fromList(UiPackageImpl.Literals.UI_ELEMENT__VISIBLE)); composite.addDisposeListener(new DisposeListener() { @Override public void widgetDisposed(DisposeEvent arg0) { persistState(); } }); }</code><technical_language>is variable name localeString localString, locale local things. ;-) I type check is necessary, a null check added. Object object = this.context.get(TranslationService.LOCALE); if (object != null) localeString = object.toString() IMHO ProjectOSGiTranslationProvider needs adjusted. takes string converts a locale, simply locale instance ... setLocale() needs adjusted there. of in a case is compatible</technical_language>

Target:
public ModelEditor(Composite composite, IEclipseContext context, IModelResource modelProvider, IProject project, final IResourcePool resourcePool) { this.resourcePool = resourcePool; this.modelProvider = modelProvider; this.project = project; this.context = context; this.context.set(ModelEditor.class, this); this.obsManager = new ObservablesManager(); if (project != null) { String localeString = ""; Object object = this.context.get(TranslationService.LOCALE); if (object != null) { localeString = object.toString(); } ProjectOSGiTranslationProvider translationProvider = new ProjectOSGiTranslationProvider(project, localeString) { @Override protected void updateResourceBundle() { super.updateResourceBundle(); if (viewer != null) { viewer.getControl().getDisplay().asyncExec(new Runnable() { @Override public void run() { viewer.refresh(); } }); } } }; context.set(ProjectOSGiTranslationProvider.class, translationProvider); } labelFeaturePaths.add(FeaturePath.fromList(UiPackageImpl.Literals.UI_ELEMENT__TO_BE_RENDERED)); labelFeaturePaths.add(FeaturePath.fromList(UiPackageImpl.Literals.UI_ELEMENT__VISIBLE)); composite.addDisposeListener(new DisposeListener() { @Override public void widgetDisposed(DisposeEvent arg0) { persistState(); } }); }
Source:
<code>public Construct exec(Target t, Environment env, Construct... args) throws CancelCommandException, ConfigRuntimeException { long arg1 = Static.getInt(args[0], t); long arg2 = Static.getInt(args[1], t); if(arg2 == 0) { <START> throw new CRERangeException("Moduloing by 0!", t); <END> } return new CInt(arg1 % arg2, t); }</code><technical_language>this "Modulo 0" instead? Current phrasing awkward</technical_language>

Target:
public Construct exec(Target t, Environment env, Construct... args) throws CancelCommandException, ConfigRuntimeException { long arg1 = Static.getInt(args[0], t); long arg2 = Static.getInt(args[1], t); if(arg2 == 0) { throw new CRERangeException("Modulo by 0!", t); } return new CInt(arg1 % arg2, t); }
Source:
<code>public void addProfileDataToNic(Map<String, Object> struct, VM vm, VmDevice vmDevice, VmNic nic) { VnicProfile vnicProfile = null; Network network = null; String networkName = ""; List<VnicProfileProperties> unsupportedFeatures = new ArrayList<>(); if (nic.getVnicProfileId() != null) { vnicProfile = vnicProfileDao.get(nic.getVnicProfileId()); if (vnicProfile != null) { network = networkDao.get(vnicProfile.getNetworkId()); networkName = network.getVdsmName(); <START> log.debug("VNIC '{}' is using profile '{}' on network '{}'", <END> nic.getName(), vnicProfile, networkName); addQosForDevice(struct, vnicProfile); } } struct.put(VdsProperties.NETWORK, networkName); addPortMirroringToVmInterface(struct, vnicProfile, network); addCustomPropertiesForDevice(struct, vm, vmDevice, getVnicCustomProperties(vnicProfile)); reportUnsupportedVnicProfileFeatures(vm, nic, vnicProfile, unsupportedFeatures); }</code><technical_language>Please update debug log regular networkName vdsmName</technical_language>

Target:
public void addProfileDataToNic(Map<String, Object> struct, VM vm, VmDevice vmDevice, VmNic nic) { VnicProfile vnicProfile = null; Network network = null; String networkName = ""; String vdsmName = ""; List<VnicProfileProperties> unsupportedFeatures = new ArrayList<>(); if (nic.getVnicProfileId() != null) { vnicProfile = vnicProfileDao.get(nic.getVnicProfileId()); if (vnicProfile != null) { network = networkDao.get(vnicProfile.getNetworkId()); networkName = network.getName(); vdsmName = network.getVdsmName(); log.debug("VNIC '{}' is using profile '{}' on network '{}' with vdsmName '{}'", nic.getName(), vnicProfile, networkName, vdsmName); addQosForDevice(struct, vnicProfile); } } struct.put(VdsProperties.NETWORK, vdsmName); addPortMirroringToVmInterface(struct, vnicProfile, network); addCustomPropertiesForDevice(struct, vm, vmDevice, getVnicCustomProperties(vnicProfile)); reportUnsupportedVnicProfileFeatures(vm, nic, vnicProfile, unsupportedFeatures); }
Source:
<code>public Long saveOrUpdate(PositionDTO position) { Assert.notNull(position); Assert.notNull(position.getName()); PositionEntity positionEntity = this.positionRepository.findByName(position.getName()); if (positionEntity == null) { positionEntity = this.converterService.convert(position, PositionEntity.class); } else if (positionEntity.isDeleted() != null && positionEntity.isDeleted()) { positionEntity.setDeleted(false); } else { throw new DuplicatePositionException(position.getName()); } try { return this.positionRepository.saveAndFlush(positionEntity).getId(); } catch (NullPointerException e) { <START> return -1L; <END> } }</code><technical_language>For a black magic. this method return -1 if null pointer exception is occurred? In opinion is more readable if throw illegal argument exception if a validation fails return null if savedEntity is null, I prefer option. more question: please describe a situation savedEntity null</technical_language>

Target:
public Long saveOrUpdate(PositionDTO position) { Assert.notNull(position); Assert.notNull(position.getName()); PositionEntity positionEntity = this.positionRepository.findByName(position.getName()); if (positionEntity == null) { positionEntity = this.converterService.convert(position, PositionEntity.class); } else if (positionEntity.isDeleted() != null && positionEntity.isDeleted()) { positionEntity.setDeleted(false); } else { throw new DuplicatePositionException(position.getName()); } this.positionRepository.saveAndFlush(positionEntity); return positionEntity.getId(); }
Source:
<code><START> public boolean addTag(final String tag) { <END> checkNotNull(tag); if (this.tags.size() >= 1024) { return false; } return this.tags.add(tag); }</code><technical_language>I this @Intrinsic calling original method interfere other vanilla calls. @Intrinsic public boolean entity$addTag(final String tag) { Objects.requireNonNull(tag, "tag"); return this.shadow$addTag(tag); } difference this method is return result of Set#add, vanilla returns true - is a problem if addTag reports entry is in set, if reports true, regardless</technical_language>

Target:
public boolean entity$addTag(final String tag) { return this.shadow$addTag(tag); }
Source:
<code>public Database() { mDatabaseDrivers = new ArrayList<>(); mChromePeerManager = new ChromePeerManager(); <START> mChromePeerManager.setListener(new PeerRegistrationListener() { <END> @Override public void onPeerRegistered(JsonRpcPeer peer) { for (DatabaseDriver databaseDriver : mDatabaseDrivers) { databaseDriver.onRegistered(peer); } } @Override public void onPeerUnregistered(JsonRpcPeer peer) { for (DatabaseDriver databaseDriver : mDatabaseDrivers) { databaseDriver.onUnregistered(peer); } } }); mObjectMapper = new ObjectMapper(); }</code><technical_language>nit, prefer this in a named subclass a member variable for improved fluency: mChromePeerManager.setListener(mPeerListener);</technical_language>

Target:
public Database() { mDatabaseDrivers = new ArrayList<>(); mChromePeerManager = new ChromePeerManager(); mPeerListener = new DatabasePeerRegistrationListener(mDatabaseDrivers); mChromePeerManager.setListener(mPeerListener); mObjectMapper = new ObjectMapper(); }
Source:
<code>void noNameIfNotWater() { when(battleSite.isWater()).thenReturn(false); final BattleState battleState = givenBattleStateBuilder().battleSite(battleSite).build(); final RemoveUnprotectedUnits removeUnprotectedUnits = new RemoveUnprotectedUnits(battleState, battleActions); <START> assertThat(removeUnprotectedUnits.getNames(), hasSize(0)); <END> }</code><technical_language>nit, favor IsEmptyCollection matcher instead of checking size == 0 for collections</technical_language>

Target:
void noNameIfNotWater() { when(battleSite.isWater()).thenReturn(false); final BattleState battleState = givenBattleStateBuilder().battleSite(battleSite).build(); final RemoveUnprotectedUnits removeUnprotectedUnits = new RemoveUnprotectedUnits(battleState, battleActions); assertThat(removeUnprotectedUnits.getNames(), is(empty())); }
Source:
<code>synchronized void requestPage() { AtomicBoolean receivedPages = new AtomicBoolean(false); pageRetriever.get(continuationState.getLastContinuationToken(), defaultPageSize) .map(page -> { receivedPages.set(true); addPage(page); continuationState.setLastContinuationToken(page.getContinuationToken()); this.done = continuationState.isDone(); return page; }) <START> .then() <END> .block(); this.done = done || (!receivedPages.get() && !isNextAvailable()); }</code><technical_language>Is then() required a block() this</technical_language>

Target:
synchronized void requestPage() { if (isNextAvailable() || done) { return; } AtomicBoolean receivedPages = new AtomicBoolean(false); pageRetriever.get(continuationState.getLastContinuationToken(), defaultPageSize) .map(page -> { receivedPages.set(true); addPage(page); continuationState.setLastContinuationToken(page.getContinuationToken()); this.done = continuationState.isDone(); return page; }).blockLast(); this.done = done || (!receivedPages.get() && !isNextAvailable()); }
Source:
<code>private void guessParameters() throws Exception { int count = fParametersNames.length; fPositions = new Position[count]; fChoices = new ICompletionProposal[count][]; ParameterGuesser guesser = new ParameterGuesser(); for (int i = 0; i < count; i++) { String paramName = new String(fParametersNames[i]); Position position = new Position(0, 0); boolean isLastParameter = i == count - 1; ArrayList<ICompletionProposal> allProposals = new <START> ArrayList<ICompletionProposal>(); <END> ICompletionProposal[] argumentProposals = guesser.parameterProposals(fParametersTypes[i], paramName, position, fAssignableElements, isLastParameter); allProposals.addAll(Arrays.asList(argumentProposals)); fPositions[i] = position; fChoices[i] = argumentProposals; } updateProposalsPossitions(); }</code><technical_language><> is sufficient</technical_language>

Target:
private void guessParameters() throws Exception { int count = fParametersNames.length; fPositions = new Position[count]; fChoices = new ICompletionProposal[count][]; ParameterGuesser guesser = new ParameterGuesser(); for (int i = 0; i < count; i++) { String paramName = new String(fParametersNames[i]); Position position = new Position(0, 0); boolean isLastParameter = i == count - 1; ArrayList<ICompletionProposal> allProposals = new ArrayList<>(); ICompletionProposal[] argumentProposals = guesser.parameterProposals(fParametersTypes[i], paramName, position, fAssignableElements, isLastParameter); allProposals.addAll(Arrays.asList(argumentProposals)); fPositions[i] = position; fChoices[i] = argumentProposals; } updateProposalsPossitions(); }
Source:
<code>public void tryPush(int maxAttempts) throws IOException { int numConnectAttempts = 0; do { try { Socket pushSocket = new Socket(m_server, m_port); OutputStream socketStream = pushSocket.getOutputStream(); System.out.printf("Connected to VoltDB socket importer at: %s.\n", m_server + ":" + m_port); String s = String.valueOf(m_counter) + m_separator + System.currentTimeMillis() + "\n"; socketStream.write(s.getBytes()); pushSocket.close(); return; } catch (IOException e) { numConnectAttempts++; <START> if (numConnectAttempts < maxAttempts) { <END> throw e; } try { Thread.sleep((int) (Math.random() * 1000) + 500); } catch (InterruptedException ignore) { } } } while (true); }</code><technical_language>"if (numConnectAttempts >= maxAttempts) { ... }"</technical_language>

Target:
public void tryPush(int maxAttempts) throws IOException { int numConnectAttempts = 0; do { try { Socket pushSocket = new Socket(m_server, m_port); OutputStream socketStream = pushSocket.getOutputStream(); System.out.printf("Connected to VoltDB socket importer at: %s.\n", m_server + ":" + m_port); String s = String.valueOf(m_counter) + m_separator + System.currentTimeMillis() + "\n"; socketStream.write(s.getBytes()); pushSocket.close(); m_counter++; return; } catch (IOException e) { numConnectAttempts++; if (numConnectAttempts >= maxAttempts) { throw e; } try { Thread.sleep((int) (Math.random() * 1000) + 500); } catch (InterruptedException ignore) { } } } while (true); }
Source:
<code>public void run() { try { Thread.sleep(McUtils.SECOND * 10); } catch (InterruptedException ex) { _logger.error("Exception, ", ex); } while (!isTerminate()) { try { _logger.debug("Getting hue lights...on user request : ", onRequestUpdate); <START> final ClientResponse<Map<String, LightState>> listAll = philipsHueClient.lights().listAll(); <END> if (listAll.isSuccess()) { Map<String, LightState> clientResponse = listAll.getEntity(); _logger.debug("Client response: ", clientResponse, onRequestUpdate); if (clientResponse != null && !clientResponse.isEmpty()) { updateRecords(clientResponse); } else { _logger.warn("Error no light found ", philipsHueClient); } } else { _logger.debug("Error while getting hue lights: - ", listAll.getStatusCode(), listAll.getErrorMsg()); waitOnError(); } long pollFrequency = gateway.getPollFrequency() * McUtils.MINUTE; while (pollFrequency > 0 && !isTerminate() && !onRequestUpdate) { Thread.sleep(100); pollFrequency -= 100; } onRequestUpdate = false; } catch (Exception ex) { _logger.error("Exception, ", ex); waitOnError(); } } _logger.debug("PhilipsHueGatewayPoller Terminated..."); this.terminated = true; }</code><technical_language>@Fraid listAll once, call listNew. If call listAll time, update forcefully existing status shows a timestamp</technical_language>

Target:
public void run() { waitFor(McUtils.SECOND * 10); while (!isTerminate()) { try { _logger.debug("Getting hue lights...on user request : ", onRequestUpdate); final ClientResponse<Map<String, LightState>> clientResponse = philipsHueClient.lights().listAll(); if (clientResponse.isSuccess()) { Map<String, LightState> lights = clientResponse.getEntity(); _logger.debug("Client response: ", clientResponse, onRequestUpdate); if (clientResponse != null && !lights.isEmpty()) { updateRecords(lights); } else { _logger.warn("Error no light found ", philipsHueClient); } } else { _logger.debug("Error while getting hue lights: {}", clientResponse); _logger.debug("On error retrying..."); waitFor(2000); } long pollFrequency = gateway.getPollFrequency() * McUtils.MINUTE; while (pollFrequency > 0 && !isTerminate() && !onRequestUpdate) { Thread.sleep(100); pollFrequency -= 100; } onRequestUpdate = false; } catch (Exception ex) { _logger.error("Exception, ", ex); _logger.debug("On error retrying..."); waitFor(2000); } } _logger.debug("PhilipsHueGatewayPoller Terminated..."); this.terminated = true; }
Source:
<code>public static List<WorkItemDefinition> parse(String widStr) { if (empty(widStr)) { return Collections.emptyList(); } <START> widStr = widStr.replace("\r\n", "\n"); <END> List<WorkItemDefinition> widList = new ArrayList<>(); String[] lines = widStr.split("\n"); Queue<String> linesQueue = new LinkedList<>(Arrays.asList(lines)); while (!linesQueue.isEmpty()) { String line = linesQueue.peek().trim(); if (!(empty(line) || isStartingObject(line) || isEndingObject(line))) { WorkItemDefinition wid = parseWorkItemDefinitionObject(linesQueue); widList.add(wid); } linesQueue.poll(); } return widList; }</code><technical_language>Stunnet codebase if facing this issue in some other place, for Strings in sources, I place, safe fixing this</technical_language>

Target:
public static List<WorkItemDefinition> parse(String widStr) { if (empty(widStr)) { return Collections.emptyList(); } List<WorkItemDefinition> widList = new ArrayList<>(); String[] lines = widStr.split("\r\n|\r|\n"); Queue<String> linesQueue = new LinkedList<>(Arrays.asList(lines)); while (!linesQueue.isEmpty()) { String line = linesQueue.peek().trim(); if (!(empty(line) || isStartingObject(line) || isEndingObject(line))) { WorkItemDefinition wid = parseWorkItemDefinitionObject(linesQueue); widList.add(wid); } linesQueue.poll(); } return widList; }
Source:
<code>private void testEditResponse() throws Exception { ______TS("edit responses"); FeedbackQuestionAttributes fq = BackDoor.getFeedbackQuestion("IESFPTCourse", "First feedback session", 1); FeedbackResponseAttributes fr = BackDoor.getFeedbackResponse(fq.getId(), "student1InIESFPTCourse@gmail.tmt", "student1InIESFPTCourse@gmail.tmt"); assertEquals("Student 1 self feedback.", fr.getResponseDetails().getAnswerString()); submitPage = loginToInstructorEditStudentFeedbackPage("IESFPTCourseinstr", "student1InIESFPTCourse@gmail.tmt", "session1InIESFPTCourse"); submitPage.verifyHtmlMainContent("/instructorEditStudentFeedbackPageOpen.html"); submitPage.fillResponseRichTextEditor(1, 0, "Good design"); submitPage.clickSubmitButton(); submitPage.verifyStatus(Const.StatusMessages.FEEDBACK_RESPONSES_SAVED); fq = BackDoor.getFeedbackQuestion("IESFPTCourse", "First feedback session", 1); fr = BackDoor.getFeedbackResponse(fq.getId(), "student1InIESFPTCourse@gmail.tmt", "student1InIESFPTCourse@gmail.tmt"); assertEquals("<p>Good design</p>", fr.getResponseDetails().getAnswerString()); <START> submitPage.waitForAndDismissAlertModal(); <END> }</code><technical_language>Move this line line 71</technical_language>

Target:
private void testEditResponse() throws Exception { ______TS("edit responses"); FeedbackQuestionAttributes fq = BackDoor.getFeedbackQuestion("IESFPTCourse", "First feedback session", 1); FeedbackResponseAttributes fr = BackDoor.getFeedbackResponse(fq.getId(), "student1InIESFPTCourse@gmail.tmt", "student1InIESFPTCourse@gmail.tmt"); assertEquals("Student 1 self feedback.", fr.getResponseDetails().getAnswerString()); submitPage = loginToInstructorEditStudentFeedbackPage("IESFPTCourseinstr", "student1InIESFPTCourse@gmail.tmt", "session1InIESFPTCourse"); submitPage.verifyHtmlMainContent("/instructorEditStudentFeedbackPageOpen.html"); submitPage.fillResponseRichTextEditor(1, 0, "Good design"); submitPage.clickSubmitButton(); submitPage.verifyStatus(Const.StatusMessages.FEEDBACK_RESPONSES_SAVED); submitPage.verifyAndCloseSuccessfulSubmissionModal(); fq = BackDoor.getFeedbackQuestion("IESFPTCourse", "First feedback session", 1); fr = BackDoor.getFeedbackResponse(fq.getId(), "student1InIESFPTCourse@gmail.tmt", "student1InIESFPTCourse@gmail.tmt"); assertEquals("<p>Good design</p>", fr.getResponseDetails().getAnswerString()); }
Source:
<code>public static String m(String key, Object... args) { String result = messages.getProperty(key); if (result == null) { Gdx.app.log("I18N", "No message for key " + key + ", lang " + lang); result = key; } int end = result.indexOf(argMarker); if (end == -1) { if (args.length != 0) { Gdx.app.log("I18N", "Extra args passed to " + key + ": " + Arrays.toString(args) + " but none expected in '" + result + "'"); } return result; } else if (args.length == 0) { Gdx.app.log("I18N", "No args passed to " + key + ": but expected at least 1 in '" + result + "'"); return result; } StringBuilder replaced = new StringBuilder(result.length()); int currentArg = 0; int start = 0; int substitutions = 0; do { if (currentArg == args.length) { Gdx.app.log("I18N", "Substitution requested in key " + key + " " + " but not enough args " + Arrays.toString(args) + " provided for message '" + result + "'; recycling args"); <START> if (args.length == 0) { <END> return result; } else { currentArg %= args.length; } } replaced.append(result.substring(start, end)).append( args[currentArg]); currentArg++; substitutions++; start = end + "{}".length(); end = result.indexOf("{}", start); } while (end != -1); if (currentArg != args.length) { Gdx.app.log("I18N", "Bad number of args (" + args.length + ") passed to " + key + ": expected " + substitutions + " args for '" + result + "'"); } replaced.append(result.substring(start)); return replaced.toString(); }</code><technical_language>This condition is false. if true, if in 191, return result</technical_language>

Target:
public static String m(String key, Object... args) { String result = messages.getProperty(key); if (result == null) { Gdx.app.log("I18N", "No message for key " + key + ", lang " + lang); result = key; } int end = result.indexOf(argMarker); if (end == -1) { if (args.length != 0) { Gdx.app.log("I18N", "Extra args passed to " + key + ": " + Arrays.toString(args) + " but none expected in '" + result + "'"); } return result; } else if (args.length == 0) { Gdx.app.log("I18N", "No args passed to " + key + ": but expected at least 1 in '" + result + "'"); return result; } StringBuilder replaced = new StringBuilder(result.length()); int currentArg = 0; int start = 0; int substitutions = 0; do { if (currentArg == args.length) { Gdx.app.log("I18N", "Substitution requested in key " + key + " " + " but not enough args " + Arrays.toString(args) + " provided for message '" + result + "'; recycling args"); currentArg = 0; } replaced.append(result.substring(start, end)).append( args[currentArg]); currentArg++; substitutions++; start = end + "{}".length(); end = result.indexOf("{}", start); } while (end != -1); if (currentArg != args.length) { Gdx.app.log("I18N", "Bad number of args (" + args.length + ") passed to " + key + ": expected " + substitutions + " args for '" + result + "'"); } replaced.append(result.substring(start)); return replaced.toString(); }
Source:
<code>private List<DeepLinkAnnotatedElement> getElements() { TypeElement element1 = mock(TypeElement.class); Name name1 = mock(Name.class); when(elements.getDocComment(element1)).thenReturn("Sample doc \n @param empty \n @return nothing"); when(element1.getSimpleName()).thenReturn(name1); when(name1.toString()).thenReturn("DocClass"); TypeElement element2 = mock(TypeElement.class); TypeElement element2Enclosed = mock(TypeElement.class); Name name2 = mock(Name.class); Name name2Enclosed = mock(Name.class); when(element2.getSimpleName()).thenReturn(name2); when(name2.toString()).thenReturn("DocMethod"); when(element2.getEnclosingElement()).thenReturn(element2Enclosed); when(element2Enclosed.getSimpleName()).thenReturn(name2Enclosed); when(name2Enclosed.toString()).thenReturn("DocClass"); try { DeepLinkAnnotatedElement deepLinkElement1 = new DeepLinkAnnotatedElement("airbnb://example.com/{foo}/bar", element1, DeepLinkEntry.Type.CLASS); DeepLinkAnnotatedElement deepLinkElement2 = new DeepLinkAnnotatedElement("airbnb://example.com/{foo}/bar", element2, DeepLinkEntry.Type.METHOD); return ImmutableList.of(deepLinkElement1, deepLinkElement2); <START> } catch (MalformedURLException e) { <END> } return null; }</code><technical_language>add MalformedURLException method throws need this empty catch block</technical_language>

Target:
private List<DeepLinkAnnotatedElement> getElements() throws MalformedURLException { TypeElement element1 = mock(TypeElement.class); Name name1 = mock(Name.class); when(elements.getDocComment(element1)) .thenReturn("Sample doc \n @param empty \n @return nothing"); when(element1.getSimpleName()).thenReturn(name1); when(name1.toString()).thenReturn("DocClass"); TypeElement element2 = mock(TypeElement.class); TypeElement element2Enclosed = mock(TypeElement.class); Name name2 = mock(Name.class); Name name2Enclosed = mock(Name.class); when(element2.getSimpleName()).thenReturn(name2); when(name2.toString()).thenReturn("DocMethod"); when(element2.getEnclosingElement()).thenReturn(element2Enclosed); when(element2Enclosed.getSimpleName()).thenReturn(name2Enclosed); when(name2Enclosed.toString()).thenReturn("DocClass"); DeepLinkAnnotatedElement deepLinkElement1 = new DeepLinkAnnotatedElement("airbnb://example.com/{foo}/bar", element1, DeepLinkEntry.Type.CLASS); DeepLinkAnnotatedElement deepLinkElement2 = new DeepLinkAnnotatedElement("airbnb://example.com/{foo}/bar", element2, DeepLinkEntry.Type.METHOD); return ImmutableList.of(deepLinkElement1, deepLinkElement2); }
Source:
<code>protected boolean applyUpdateToRuntime(final OperationContext context, final ModelNode operation, final String attributeName, final ModelNode resolvedValue, final ModelNode currentValue, final HandbackHolder<Void> handbackHolder) throws OperationFailedException { int timeout = resolvedValue.asInt(); TxControl.setDefaultTimeout(timeout); if (timeout == 0) { <START> timeout = TransactionSubsystemRootResourceDefinition.maximum_timeout; <END> TransactionLogger.ROOT_LOGGER.timeoutValueIsSetToMaximum(timeout); } ContextTransactionManager.setGlobalDefaultTransactionTimeout(timeout); return false; }</code><technical_language>this static field, read resolve model. MAXIMUM_TIMEOUT.resolveModelAttribute(context, context.readResource(operation.currentAddress())</technical_language>

Target:
protected boolean applyUpdateToRuntime(final OperationContext context, final ModelNode operation, final String attributeName, final ModelNode resolvedValue, final ModelNode currentValue, final HandbackHolder<Void> handbackHolder) throws OperationFailedException { int timeout = resolvedValue.asInt(); TxControl.setDefaultTimeout(timeout); if (timeout == 0) { ModelNode model = context.readResource(PathAddress.EMPTY_ADDRESS).getModel(); timeout = MAXIMUM_TIMEOUT.resolveModelAttribute(context, model).asInt(); TransactionLogger.ROOT_LOGGER.timeoutValueIsSetToMaximum(timeout); } ContextTransactionManager.setGlobalDefaultTransactionTimeout(timeout); return false; }
Source:
<code>private void refactorAttribute(TaskData taskData, TaskAttribute attribute) { if (taskData != null) { TaskAttribute original = taskData.getRoot().getMappedAttribute(attribute.getPath()); <START> if (original != null) { <END> TaskAttribute parent = original.getParentAttribute(); parent.removeAttribute(original.getId()); parent.deepAddCopy(attribute); } } }</code><technical_language>if original is missing add new copy</technical_language>

Target:
private void refactorAttribute(TaskData taskData, TaskAttribute attribute) throws CoreException { if (taskData != null) { String[] path = attribute.getPath(); if (path.length == 0) { throw new CoreException( new Status(IStatus.ERROR, ITasksCoreConstants.ID_PLUGIN, Messages.TaskDataState_RefactorRoot)); } String[] shortenedPath = Arrays.copyOfRange(path, 0, path.length - 1); TaskAttribute parent = taskData.getRoot().getMappedAttribute(shortenedPath); if (parent != null) { parent.removeAttribute(attribute.getId()); parent.deepAddCopy(attribute); } } }