auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>protected String doInBackground(NetParam... params) { start_time = System.currentTimeMillis(); try{ switch(params[0].type){ case PING: try{ String result = output(Runtime.getRuntime().exec(String.format(PING_CMD, params[0].address))); if(result.isEmpty()){ result = context.getString(R.string.network_connection_not_available); } return result; }catch (Exception eex){ try{ if(InetAddress.getByAddress(params[0].address.getBytes()).isReachable(G.logPingTimeout())){ return String.format(context.getString(R.string.reachable_timeout), finish_time()); } }catch(UnknownHostException ex){ return String.format("Currently IP(%s) is not Reachable, timeout: %d ms", params[0].address, finish_time()); } } <START> <END> case RESOLVE: try{ return InetAddress.getByName(params[0].address).getCanonicalHostName(); }catch(UnknownHostException ex){ return String.format("Currently can not resolve Host for IP(%s), timeout: %d ms", params[0].address, finish_time()); } } }catch (Exception e){ e.printStackTrace(); } return context.getString(R.string.error_or_unknown_category); }</code><technical_language>break statement is missing</technical_language>

Target:
protected String doInBackground(NetParam... params) { start_time = System.currentTimeMillis(); try{ switch(params[0].type){ case PING: try{ String shell_result = ""; String command = ""; try{ command = String.format(PING_CMD, "", G.logPingTimeout(), params[0].address); Log.d(TAG, "Execute CMD: " + command); Process process = Runtime.getRuntime().exec(command); process.waitFor(); Log.d(TAG, "CMD exit code: " + process.exitValue()); if(process.exitValue() == 0){ shell_result = parse(process); }else{ shell_result = su_busyboox_ping(params[0].address); } }catch (Exception ping_cmd_ex){ Log.e(TAG, "Exception(00): " + ping_cmd_ex.getMessage()); shell_result = su_busyboox_ping(params[0].address); } return shell_result; }catch (Exception eex){ Log.e(TAG, "Exception(01): " + eex.getMessage()); return normal_ping(params[0].address); } case RESOLVE: try{ return InetAddress.getByName(params[0].address).getCanonicalHostName(); }catch(UnknownHostException ex){ Log.e(TAG, "Exception(02): " + ex.getMessage()); return String.format("Currently can not resolve Host for IP(%s), timeout: %d ms", params[0].address, finish_time()); } } }catch (Exception e){ Log.e(TAG, "Exception(03): " + e.getMessage()); } return context.getString(R.string.error_or_unknown_category); }
Source:
<code>private void createClient() { if (ribbonEtc.containsKey("eureka")) { ribbonEtc.setProperty( clientName + ".ribbon.AppName", clientName); ribbonEtc.setProperty( clientName + ".ribbon.NIWSServerListClassName", "com.netflix.niws.loadbalancer.DiscoveryEnabledNIWSServerList"); ribbonEtc.setProperty( <START> clientName + ".ribbon.ServerListRefreshInterval", <END> "60000"); String[] host_port = addressList.get(0).split(":"); ribbonEtc.setProperty( clientName + ".ribbon.DeploymentContextBasedVipAddresses", host_port[0]); ribbonEtc.setProperty( clientName + ".ribbon.Port", host_port[1]); } else { ribbonEtc.setProperty(clientName + ".ribbon.listOfServers", Joiner.on(",").join(addressList)); } ConfigurationManager.loadProperties(ribbonEtc); client = (RestClient) ClientFactory.getNamedClient(clientName); }</code><technical_language>do need override default refresh interval? Longer interval lead staled discovery data</technical_language>

Target:
private void createClient() { if (ribbonEtc.containsKey("eureka")) { ribbonEtc.setProperty( clientName + ".ribbon.AppName", clientName); ribbonEtc.setProperty( clientName + ".ribbon.NIWSServerListClassName", "com.netflix.niws.loadbalancer.DiscoveryEnabledNIWSServerList"); String[] host_port = addressList.get(0).split(":"); ribbonEtc.setProperty( clientName + ".ribbon.DeploymentContextBasedVipAddresses", host_port[0]); ribbonEtc.setProperty( clientName + ".ribbon.Port", host_port[1]); } else { ribbonEtc.setProperty(clientName + ".ribbon.listOfServers", Joiner.on(",").join(addressList)); } ribbonEtc.setProperty( clientName + ".ribbon.EnablePrimeConnections", "true"); ConfigurationManager.loadProperties(ribbonEtc); client = (RestClient) ClientFactory.getNamedClient(clientName); }
Source:
<code>private void remove() { if (getWindow() != null) { return; } ConfirmationModel window = new ConfirmationModel(); setWindow(window); window.setTitle(ConstantsManager.getInstance().getConstants().removeVirtualMachinesTitle()); window.setHelpTag(HelpTag.remove_virtual_machine); window.setHashName("remove_virtual_machine"); vmsRemoveMap = new HashMap<>(); for (Object selectedItem : getSelectedItems()) { VM vm = (VM) selectedItem; <START> if (vm.getStatus() == VMStatus.Down) { <END> EntityModel removeDisksCheckbox = new EntityModel(true); removeDisksCheckbox.setTitle(ConstantsManager.getInstance().getConstants().removeDisksTitle()); removeDisksCheckbox.setMessage(vm.getName()); if (!Guid.Empty.equals(vm.getVmtGuid())) { updateRemoveDisksCheckBox(removeDisksCheckbox, true, false, ConstantsManager.getInstance() .getConstants() .removeVmDisksTemplateMsg()); } vmsRemoveMap.put(vm.getId(), removeDisksCheckbox); } } window.setItems(vmsRemoveMap.entrySet()); initRemoveDisksCheckboxes(vmsRemoveMap); UICommand tempVar = UICommand.createDefaultOkUiCommand("OnRemove", this); window.getCommands().add(tempVar); UICommand tempVar2 = UICommand.createCancelUiCommand("Cancel", this); window.getCommands().add(tempVar2); }</code><technical_language>I VdcActionUtils.canExecute(Arrays.asList(vm), VM.class, VdcActionType.RemoveVm)) checks guaranteed stay in sync</technical_language>

Target:
private void remove() { if (getWindow() != null) { return; } ConfirmationModel window = new ConfirmationModel(); setWindow(window); window.setTitle(ConstantsManager.getInstance().getConstants().removeVirtualMachinesTitle()); window.setHelpTag(HelpTag.remove_virtual_machine); window.setHashName("remove_virtual_machine"); vmsRemoveMap = new HashMap<>(); for (Object selectedItem : getSelectedItems()) { VM vm = (VM) selectedItem; if (VdcActionUtils.canExecute(Arrays.asList(vm), VM.class, VdcActionType.RemoveVm)) { EntityModel removeDisksCheckbox = new EntityModel(true); removeDisksCheckbox.setTitle(ConstantsManager.getInstance().getConstants().removeDisksTitle()); removeDisksCheckbox.setMessage(vm.getName()); if (!Guid.Empty.equals(vm.getVmtGuid())) { updateRemoveDisksCheckBox(removeDisksCheckbox, true, false, ConstantsManager.getInstance() .getConstants() .removeVmDisksTemplateMsg()); } vmsRemoveMap.put(vm.getId(), removeDisksCheckbox); } } window.setItems(vmsRemoveMap.entrySet()); initRemoveDisksCheckboxes(vmsRemoveMap); UICommand tempVar = UICommand.createDefaultOkUiCommand("OnRemove", this); window.getCommands().add(tempVar); UICommand tempVar2 = UICommand.createCancelUiCommand("Cancel", this); window.getCommands().add(tempVar2); }
Source:
<code>public SimpleMergedByteBuffers(boolean readOnly, ByteBuffer ...bbs) { super(readOnly); for(ByteBuffer bb: bbs) { if(bb == null) { throw new IllegalArgumentException("Can not add null buffers!"); } } if(bbs.length > 0) { bba = bbs; } else { <START> bba = new ByteBuffer[] {EMPTY_BYTEBUFFER}; <END> } }</code><technical_language>a static instance of this empty? if hitting this case naturally not</technical_language>

Target:
public SimpleMergedByteBuffers(boolean readOnly, ByteBuffer ...bbs) { super(readOnly); for(ByteBuffer bb: bbs) { if(bb == null) { throw new IllegalArgumentException("Can not add null buffers!"); } } if(bbs.length > 0) { bba = bbs; } else { bba = EMPTY_BUFFER_ARRAY; } }
Source:
<code>public static CinderDisk volumeToCinderDisk(Volume volume, Guid storageDomainId) { CinderDisk cinderDisk = new CinderDisk(); cinderDisk.setId(Guid.createGuidFromString(volume.getId())); cinderDisk.setImageId(Guid.createGuidFromString(volume.getId())); cinderDisk.setDiskAlias(volume.getName()); cinderDisk.setDescription(volume.getDescription()); cinderDisk.setSizeInGigabytes(volume.getSize()); cinderDisk.setCinderVolumeType(volume.getVolumeType()); cinderDisk.setStorageIds(new ArrayList<>(Arrays.asList(storageDomainId))); cinderDisk.setActive(true); cinderDisk.setImageStatus(ImageStatus.OK); cinderDisk.setvolumeFormat(VolumeFormat.RAW); cinderDisk.setDiskInterface(DiskInterface.VirtIO); try { <START> cinderDisk.setCreationDate(new SimpleDateFormat(DATE_FORMAT).parse(volume.getCreatedAt())); <END> } catch (ParseException e) { cinderDisk.setCreationDate(null); } return cinderDisk; }</code><technical_language>exception thrown here, is a mandatory for this API</technical_language>

Target:
public static CinderDisk volumeToCinderDisk(Volume volume, Guid storageDomainId) { CinderDisk cinderDisk = new CinderDisk(); cinderDisk.setId(Guid.createGuidFromString(volume.getId())); cinderDisk.setImageId(Guid.createGuidFromString(volume.getId())); cinderDisk.setDiskAlias(volume.getName()); cinderDisk.setDescription(volume.getDescription()); cinderDisk.setSizeInGigabytes(volume.getSize()); cinderDisk.setCinderVolumeType(volume.getVolumeType()); cinderDisk.setStorageIds(new ArrayList<>(Arrays.asList(storageDomainId))); cinderDisk.setActive(true); cinderDisk.setImageStatus(ImageStatus.OK); cinderDisk.setvolumeFormat(VolumeFormat.RAW); cinderDisk.setDiskInterface(DiskInterface.VirtIO); try { cinderDisk.setCreationDate(new SimpleDateFormat(DATE_FORMAT).parse(volume.getCreatedAt())); } catch (ParseException e) { cinderDisk.setCreationDate(null); log.error("Invalid disk creation date format", e); } return cinderDisk; }
Source:
<code>public void checkParameters(Command command, ExecutionHandlerContext executionHandlerContext) { List<byte[]> parameters = command.getProcessedCommand(); String commandType = command.getCommandType().name(); parameters.forEach(parameter -> { String parameterString = parameter.toString(); if (isNotAllowed(parameterString) && <START> !parameterString.equalsIgnoreCase(commandType)) { <END> throw new RedisParametersMismatchException(""); } }); }</code><technical_language>iterate a sublist excludes item (which is commandType). a parameter is if is equal "commandType" allow do this command: "INFO INFO INFO" care extra INFO parameters match commandType</technical_language>

Target:
public void checkParameters(Command command, ExecutionHandlerContext executionHandlerContext) { List<byte[]> parameters = command.getProcessedCommand(); String commandType = command.getCommandType().name(); parameters.forEach(parameter -> { String parameterString = new String(parameter); if (isNotAllowed(parameterString) && !parameterString.equalsIgnoreCase(commandType)) { throw new RedisParametersMismatchException(ERROR_MESSAGE); } }); }
Source:
<code>public void testID3v2Metadata() { MediaMetadataRetriever retriever = new MediaMetadataRetriever(); try { Resources resources = getContext().getResources(); AssetFileDescriptor afd = resources.openRawResourceFd( R.raw.video_480x360_mp4_h264_500kbps_25fps_aac_stereo_128kbps_44100hz); retriever.setDataSource(afd.getFileDescriptor(), afd.getStartOffset(), afd.getLength()); afd.close(); } catch (Exception e) { fail("Unable to open file"); } assertEquals("Title was other than expected", "Title", retriever.extractMetadata(MediaMetadataRetriever.METADATA_KEY_TITLE)); assertEquals("Artist was other than expected", "UTF16LE エンディアン ", retriever.extractMetadata(MediaMetadataRetriever.METADATA_KEY_ARTIST)); assertEquals("Album was other than expected", "Test album", retriever.extractMetadata(MediaMetadataRetriever.METADATA_KEY_ALBUM)); assertEquals("Track number was other than expected", "10", retriever.extractMetadata(MediaMetadataRetriever.METADATA_KEY_CD_TRACK_NUMBER)); assertEquals("Year was other than expected", "2013", retriever.extractMetadata(MediaMetadataRetriever.METADATA_KEY_YEAR)); assertNull("Writer was <START> unexpected present", <END> retriever.extractMetadata(MediaMetadataRetriever.METADATA_KEY_WRITER)); }</code><technical_language>nit: Writer unexpectedly present Writer expected present</technical_language>

Target:
public void testID3v2Metadata() { MediaMetadataRetriever retriever = new MediaMetadataRetriever(); try { Resources resources = getContext().getResources(); AssetFileDescriptor afd = resources.openRawResourceFd( R.raw.video_480x360_mp4_h264_500kbps_25fps_aac_stereo_128kbps_44100hz); retriever.setDataSource(afd.getFileDescriptor(), afd.getStartOffset(), afd.getLength()); afd.close(); } catch (Exception e) { fail("Unable to open file"); } assertEquals("Title was other than expected", "Title", retriever.extractMetadata(MediaMetadataRetriever.METADATA_KEY_TITLE)); assertEquals("Artist was other than expected", "UTF16LE エンディアン ", retriever.extractMetadata(MediaMetadataRetriever.METADATA_KEY_ARTIST)); assertEquals("Album was other than expected", "Test album", retriever.extractMetadata(MediaMetadataRetriever.METADATA_KEY_ALBUM)); assertEquals("Track number was other than expected", "10", retriever.extractMetadata(MediaMetadataRetriever.METADATA_KEY_CD_TRACK_NUMBER)); assertEquals("Year was other than expected", "2013", retriever.extractMetadata(MediaMetadataRetriever.METADATA_KEY_YEAR)); assertNull("Writer was unexpectedly present", retriever.extractMetadata(MediaMetadataRetriever.METADATA_KEY_WRITER)); }
Source:
<code>public void testNegatedPackagesFiltering() throws Exception { Builder b = new Builder(); try { b.setIncludePackage("test.packageinfo.*"); b.setProperty("X-Not-Versioned", "${packages;ANNOTATED;!org.osgi.annotation.versioning.Version}"); b.addClasspath(new File("bin_test")); Jar jar = b.build(); Manifest m = jar.getManifest(); m.write(System.err); assertTrue(b.check()); Parameters notVersioned = Domain.domain(m) .getParameters("X-Not-Versioned"); assertThat(notVersioned).containsKeys("test.packageinfo", "test.packageinfo.both_no_version", <START> "test.packageinfo.nopackageinfo", "test.packageinfo.ref"); <END> } finally { b.close(); } }</code><technical_language>some keys tested contained? doesNotContain</technical_language>

Target:
public void testNegatedPackagesFiltering() throws Exception { Builder b = new Builder(); try { b.setIncludePackage("test.packageinfo.*"); b.setProperty("X-Not-Versioned", "${packages;ANNOTATED;!org.osgi.annotation.versioning.Version}"); b.addClasspath(new File("bin_test")); Jar jar = b.build(); Manifest m = jar.getManifest(); m.write(System.err); assertTrue(b.check()); Parameters notVersioned = Domain.domain(m) .getParameters("X-Not-Versioned"); assertThat(notVersioned) .containsKeys("test.packageinfo", "test.packageinfo.both_no_version", "test.packageinfo.nopackageinfo", "test.packageinfo.ref") .doesNotContainKeys("test.packageinfo.annotated", "test.packageinfo.notannotated"); } finally { b.close(); } }
Source:
<code>public void filterImageDisksForVM(VM vm) { List<DiskImage> filteredDisks = DisksFilter.filterImageDisks(vm.getDiskMap().values(), ONLY_ACTIVE); List<CinderDisk> filteredCinderDisks = DisksFilter.filterCinderDisks(vm.getDiskMap().values()); List<ManagedBlockStorageDisk> <START> filteredManagedBlockStorageDisks = <END> DisksFilter.filterManagedBlockStorageDisks(vm.getDiskMap().values()); filteredDisks.addAll(filteredCinderDisks); filteredDisks.addAll(filteredManagedBlockStorageDisks); @SuppressWarnings("unchecked") Collection<? extends Disk> vmDisksToRemove = CollectionUtils.subtract(vm.getDiskMap().values(), filteredDisks); vm.clearDisks(); updateDisksForVm(vm, filteredDisks); for (Disk diskToRemove : vmDisksToRemove) { vm.getManagedVmDeviceMap().remove(diskToRemove.getId()); } }</code><technical_language>this variable is redundant</technical_language>

Target:
public void filterImageDisksForVM(VM vm) { List<DiskImage> filteredDisks = DisksFilter.filterImageDisks(vm.getDiskMap().values(), ONLY_ACTIVE); List<CinderDisk> filteredCinderDisks = DisksFilter.filterCinderDisks(vm.getDiskMap().values()); filteredDisks.addAll(filteredCinderDisks); filteredDisks.addAll(DisksFilter.filterManagedBlockStorageDisks(vm.getDiskMap().values())); @SuppressWarnings("unchecked") Collection<? extends Disk> vmDisksToRemove = CollectionUtils.subtract(vm.getDiskMap().values(), filteredDisks); vm.clearDisks(); updateDisksForVm(vm, filteredDisks); for (Disk diskToRemove : vmDisksToRemove) { vm.getManagedVmDeviceMap().remove(diskToRemove.getId()); } }
Source:
<code>public Drug getDrugByMapping(String code, ConceptSource conceptSource, Collection<ConceptMapType> withAnyOfTheseTypesOrOrderOfPreference, boolean includeRetired) throws DAOException { <START> Criteria searchCriteria = sessionFactory.getCurrentSession().createCriteria(DrugReferenceMap.class); <END> searchCriteria.setProjection(Projections.property("drug")); searchCriteria.createAlias("conceptReferenceTerm", "term"); searchCriteria.add(Restrictions.eq("term.code", code)); searchCriteria.createAlias("term.conceptSource", "source"); searchCriteria.add(Restrictions.or(Restrictions.eq("source.name", conceptSource.getName()), Restrictions.eq("source.hl7Code", conceptSource.getHl7Code()))); for(ConceptMapType conceptMapType : withAnyOfTheseTypesOrOrderOfPreference) { if(conceptMapType != null) { searchCriteria.add(Restrictions.eq("conceptMapType", conceptMapType)); } } searchCriteria.createAlias("drug", "drug"); if (includeRetired == false) { searchCriteria.add(Restrictions.eq("drug.retired", false)); } return (Drug) searchCriteria.uniqueResult(); }</code><technical_language>This duplicates code in method is i suggesting DAO method</technical_language>

Target:
public Drug getDrugByMapping(String code, ConceptSource conceptSource, Collection<ConceptMapType> withAnyOfTheseTypesOrOrderOfPreference, boolean includeRetired) throws DAOException { Criteria criteria = createSearchDrugByMappingCriteria(code,conceptSource,includeRetired); if(withAnyOfTheseTypesOrOrderOfPreference !=null) { for(ConceptMapType conceptMapType : withAnyOfTheseTypesOrOrderOfPreference) { criteria.add(Restrictions.eq("map.conceptMapType", conceptMapType)); if(criteria.list().size() > 1) { throw new DAOException("There are multiple matches for the highest-priority ConceptMapType"); } else if(criteria.list().size() == 1) { return (Drug)criteria.list().get(0); } } } return null; }
Source:
<code>private void deleteDir(Path dir) { try (Stream<Path> entries = Files.list(dir)) { if (dir.getFileName().toString().length() == 2 && entries.count() == 0) { <START> Files.deleteIfExists(dir); <END> } } catch (IOException e) { LOG.error(e.getMessage(), e); } }</code><technical_language>I DirectoryNotEmptyException handled differently other IOException. time content of directory is listed time directory is deleted directory is longer empty. In case, do want exception in logs, I simply ignored</technical_language>

Target:
private void deleteDir(Path dir) { try (Stream<Path> entries = Files.list(dir)) { if (dir.getFileName().toString().length() == 2 && entries.count() == 0) { Files.deleteIfExists(dir); } } catch (DirectoryNotEmptyException ignored) { } catch (IOException e) { LOG.error(e.getMessage(), e); } }
Source:
<code>public static <T extends EntityReference> T cloneReference(@NotNull EntityReference reference, @NotNull Class<T> token) { try { reference = reference.clone(); T ret; if (token != EntityReference.class) { <START> ret = token.getConstructor(EntityReference.class).newInstance(reference.clone()); <END> } else { @SuppressWarnings("unchecked") T castedReference = (T) reference; ret = castedReference; } return ret; } catch (ReflectiveOperationException | SecurityException exc) { throw new IllegalArgumentException("Unsupported entity class: " + token, exc); } }</code><technical_language>cloning reference (line 59 line 62)</technical_language>

Target:
public static <T extends EntityReference> T cloneReference(@NotNull EntityReference reference, @NotNull Class<T> token) { try { reference = reference.clone(); T ret; if (token != EntityReference.class) { ret = token.getConstructor(EntityReference.class).newInstance(reference); } else { ret = token.cast(reference); } return ret; } catch (ReflectiveOperationException | SecurityException exc) { throw new IllegalArgumentException("Unsupported entity class: " + token, exc); } }
Source:
<code>protected double getExportResolutionFactor(DiagramEditPart diagramEP, SiriusDiagramImageGenerator gen) { double factor = 1.0; if (this.autoScalingEnabled) { List<?> editParts = diagramEP.getPrimaryEditParts(); org.eclipse.swt.graphics.Rectangle imageRect = gen.calculateImageRectangle(editParts); factor = Math.floor(Math.sqrt(Double.valueOf(getMaximumTotalSize()) / ((imageRect.width) * (imageRect.height))) * 100) / 100; int levelScaling = this.autoScalingLevel; if (factor < 1.0) { if (!allowDownScaling) { factor = 1.0; } else { <START> factor = 1.0 - (1.0 - factor) * levelScaling / 100.; <END> } } else { factor = 1.0 + (factor - 1.0) * levelScaling / 100.; } } return factor; }</code><technical_language>(to test a real case factor is 1)</technical_language>

Target:
protected double getExportResolutionFactor(DiagramEditPart diagramEP, SiriusDiagramImageGenerator gen) { double factor = 1.0; if (this.autoScalingEnabled) { List<?> editParts = diagramEP.getPrimaryEditParts(); org.eclipse.swt.graphics.Rectangle imageRect = gen.calculateImageRectangle(editParts); factor = Math.floor(Math.sqrt(Double.valueOf(getMaximumTotalSize()) / ((imageRect.width) * (imageRect.height))) * 100) / 100; if (factor < 1.0 && !allowDownScaling) { factor = 1.0; } else { factor = 1.0 + (factor - 1.0) * this.autoScalingLevel / 100.; } } return factor; }
Source:
<code>public Date getOrder() { <START> return new GregorianCalendar(2017, 11, 21, 16, 0, 0).getTime(); <END> }</code><technical_language>this is 12/21, 11/21, a minor issue, change</technical_language>

Target:
public Date getOrder() { return new GregorianCalendar(2017, 10, 21, 16, 0, 0).getTime(); }
Source:
<code>public void newAnswer(@Load Question question, MarkedText description, boolean watching, List<Long> attachmentsIds) { User current = currentUser.getCurrent(); boolean canAnswer = answeredByValidator.validate(question); boolean isUserWithKarma = current.hasKarma(); AnswerInformation information = new AnswerInformation(description, currentUser, "new answer"); Answer answer = new Answer(information, question, current); if (canAnswer) { question.touchedBy(current); answers.save(answer); ReputationEvent reputationEvent = new ReputationEvent(EventType.CREATED_ANSWER, question, current); reputationEvents.save(reputationEvent); if (isUserWithKarma) { current.increaseKarma(reputationEvent.getKarmaReward()); <START> } <END> result.redirectTo(QuestionController.class).showQuestion(question, question.getSluggedTitle()); notificationManager.sendEmailsAndInactivate(new EmailAction(answer, question)); if (watching) { watchers.add(question, new Watcher(current)); } List<Attachment> attachmentsLoaded = attachments.load(attachmentsIds); answer.add(attachmentsLoaded); } else { result.include("answer", answer); answeredByValidator.onErrorRedirectTo(QuestionController.class).showQuestion(question, question.getSluggedTitle()); } }</code><technical_language>check identation settings</technical_language>

Target:
public void newAnswer(@Load Question question, MarkedText description, boolean watching, List<Long> attachmentsIds) { User current = currentUser.getCurrent(); boolean canAnswer = answeredByValidator.validate(question); boolean isUserWithKarma = current.hasKarma(); AnswerInformation information = new AnswerInformation(description, currentUser, "new answer"); Answer answer = new Answer(information, question, current); List<Attachment> attachmentsLoaded = attachments.load(attachmentsIds); answer.add(attachmentsLoaded); if (canAnswer) { question.touchedBy(current); answers.save(answer); ReputationEvent reputationEvent = new ReputationEvent(EventType.CREATED_ANSWER, question, current); reputationEvents.save(reputationEvent); if (isUserWithKarma) { current.increaseKarma(reputationEvent.getKarmaReward()); } result.redirectTo(QuestionController.class).showQuestion(question, question.getSluggedTitle()); notificationManager.sendEmailsAndInactivate(new EmailAction(answer, question)); if (watching) { watchers.add(question, new Watcher(current)); } } else { result.include("answer", answer); answeredByValidator.onErrorRedirectTo(QuestionController.class).showQuestion(question, question.getSluggedTitle()); } }
Source:
<code>private Map<String, AttributeValue> toDynamoDBItem(final PillHeartBeat heartBeat) { <START> final Map<String, AttributeValue> key = Maps.newHashMap(); <END> key.put(PILL_ID_ATTRIBUTE_NAME, new AttributeValue().withS(heartBeat.pillId)); key.put(UTC_DATETIME_ATTRIBUTE_NAME, new AttributeValue().withS(heartBeat.createdAtUTC.toString(DATETIME_FORMAT))); final Map<String, AttributeValue> item = Maps.newHashMap(); item.put(BATTERY_LEVEL_ATTRIBUTE_NAME, new AttributeValue().withN(String.valueOf(heartBeat.batteryLevel))); item.put(UPTIME_ATTRIBUTE_NAME, new AttributeValue().withN(String.valueOf(heartBeat.uptimeInSeconds))); item.put(FIRMWARE_VERSION_ATTRIBUTE_NAME, new AttributeValue().withN(String.valueOf(heartBeat.firmwareVersion))); return item; }</code><technical_language>key</technical_language>

Target:
private Map<String, AttributeValue> toDynamoDBItem(final PillHeartBeat heartBeat) { final Map<String, AttributeValue> item = Maps.newHashMap(); item.put(PILL_ID_ATTRIBUTE_NAME, new AttributeValue().withS(heartBeat.pillId)); item.put(UTC_DATETIME_ATTRIBUTE_NAME, new AttributeValue().withS(heartBeat.createdAtUTC.toString(DATETIME_FORMAT))); item.put(BATTERY_LEVEL_ATTRIBUTE_NAME, new AttributeValue().withN(String.valueOf(heartBeat.batteryLevel))); item.put(UPTIME_ATTRIBUTE_NAME, new AttributeValue().withN(String.valueOf(heartBeat.uptimeInSeconds))); item.put(FIRMWARE_VERSION_ATTRIBUTE_NAME, new AttributeValue().withN(String.valueOf(heartBeat.firmwareVersion))); return item; }
Source:
<code>public VersionHolder updateElementRevision(StudyIdentifier studyId, AppConfigElement element) { checkNotNull(studyId); checkNotNull(element); Validate.entityThrowingException(AppConfigElementValidator.INSTANCE, element); AppConfigElement existing = getElementRevision(studyId, element.getId(), element.getRevision()); if (element.isDeleted() && existing.isDeleted()) { throw new EntityNotFoundException(AppConfigElement.class); } if (existing.isPublished()) { throw new EntityPublishedException("App config element cannot be changed, it is published."); <START> } <END> element.setKey(studyId.getIdentifier() + ":" + element.getId()); element.setStudyId(studyId.getIdentifier()); element.setModifiedOn(getDateTime().getMillis()); element.setCreatedOn(existing.getCreatedOn()); element.setPublished(existing.isPublished()); return appConfigElementDao.saveElementRevision(element); }</code><technical_language>I recommend a publish workflow for this, especially a one-way publish workflow. In practice, developers create a revision, publish immediately test with, create a new revision, resulting in a myriad of unused revisions. This is reason ended removing publish workflow schemas. allow elements mutable</technical_language>

Target:
public VersionHolder updateElementRevision(StudyIdentifier studyId, AppConfigElement element) { checkNotNull(studyId); checkNotNull(element); Validate.entityThrowingException(AppConfigElementValidator.INSTANCE, element); AppConfigElement existing = getElementRevision(studyId, element.getId(), element.getRevision()); if (element.isDeleted() && existing.isDeleted()) { throw new EntityNotFoundException(AppConfigElement.class); } element.setStudyId(studyId.getIdentifier()); element.setId(element.getId()); element.setModifiedOn(DateTime.now().getMillis()); element.setCreatedOn(existing.getCreatedOn()); return appConfigElementDao.saveElementRevision(element); }
Source:
<code>private List<Node> recursiveTraceFragment(String tenantId, Span parent) { <START> List<Span> spanChildren = getChildren(tenantId, SpanUniqueIdGenerator.toOriginal(parent)); <END> if (spanChildren == null) { return Collections.emptyList(); } List<Node> nodes = new ArrayList<>(); for (Span child: spanChildren) { InteractionNode node = spanToNode(child); nodes.add(node); if (node.getType() == NodeType.Component) { node.setNodes(recursiveTraceFragment(tenantId, child)); } } return nodes; }</code><technical_language>necessary needing change, 'toOriginal' util function is required. id is modified for client spans, requesting children for. a specific case required this</technical_language>

Target:
private List<Node> recursiveTraceFragment(String tenantId, Span parent) { List<Span> spanChildren = getChildren(tenantId, parent.getId()); if (spanChildren == null) { return Collections.emptyList(); } List<Node> nodes = new ArrayList<>(); for (Span child: spanChildren) { InteractionNode node = spanToNode(child); if (!parent.clientSpan()) { nodes.add(node); } if (!child.clientSpan()) { node.setNodes(recursiveTraceFragment(tenantId, child)); } } return nodes; }
Source:
<code><START> protected Provider<AdditionalProperties> createProvider(String name) { <END> Provider<AdditionalProperties> p = mock(Provider.class); when(p.getName()).thenReturn(name); return p; }</code><technical_language>this change is necessary</technical_language>

Target:
private Provider<AdditionalProperties> createProvider(String name) { Provider<AdditionalProperties> p = mock(Provider.class); when(p.getName()).thenReturn(name); return p; }
Source:
<code><START> public Integer getScalingFactor() { <END> return scalingFactor; }</code><technical_language>I I mentioned that: a new test validation of this attribute in ElasticsearchSchemaAttributeValidationIT. I missed it, any</technical_language>

Target:
public Double getScalingFactor() { return scalingFactor; }
Source:
<code>protected Set<JWSAlgorithm> getSignatureAlgorithms(JWKSource<SecurityContext> jwkSource) { Set<SignatureAlgorithm> jwkAlgorithms = getDefaultAlgorithms(); try { <START> jwkAlgorithms.addAll(fetchSignatureVerificationAlgorithms(jwkSource)); <END> } catch (Exception ex) { log.error("Error fetching Signature Verification algorithms"); } return convertToJwsAlgorithms(jwkAlgorithms); }</code><technical_language>Spring Security builders typically additive - instead replace. This allows Spring Security gracefully backoff application wants manually configure a value. means is if application configured algorithms, auto-fetch get run</technical_language>

Target:
protected Set<JWSAlgorithm> getSignatureAlgorithms(JWKSource<SecurityContext> jwkSource) { Set<SignatureAlgorithm> jwkAlgorithms = getDefaultAlgorithms(); try { if (signatureAlgorithms.isEmpty()) { jwkAlgorithms.addAll(fetchSignatureVerificationAlgorithms(jwkSource)); } } catch (Exception ex) { log.error("Error fetching Signature Verification algorithms"); } return convertToJwsAlgorithms(jwkAlgorithms); }
Source:
<code>private Mono<CosmosContainerResponse> createContainerInternal( CosmosContainerProperties containerProperties, CosmosContainerRequestOptions options, Context context) { String spanName = "createContainer." + containerProperties.getId(); Mono<CosmosContainerResponse> responseMono = createContainerInternal(containerProperties, options); return this.client.getTracerProvider().traceEnabledCosmosResponsePublisher(responseMono, context, <START> spanName, <END> getId(), getClient().getServiceEndpoint()); }</code><technical_language>Readability is concern here, lets is</technical_language>

Target:
private Mono<CosmosContainerResponse> createContainerInternal( CosmosContainerProperties containerProperties, CosmosContainerRequestOptions options, Context context) { String spanName = "createContainer." + containerProperties.getId(); Mono<CosmosContainerResponse> responseMono = getDocClientWrapper() .createCollection(this.getLink(), ModelBridgeInternal.getV2Collection(containerProperties), ModelBridgeInternal.toRequestOptions(options)) .map(response -> ModelBridgeInternal.createCosmosContainerResponse(response)).single(); return this.client.getTracerProvider().traceEnabledCosmosResponsePublisher(responseMono, context, spanName, getId(), getClient().getServiceEndpoint()); }
Source:
<code>public static String getErrorMessage(String filename){ String errorMessage = ""; String noWhitespace = "[\\S]+"; String firstCharacterLetter = "[A-Za-z].*"; String temp = filename.replaceAll("( )+", " ").replace(" ","_"); <START> if(temp.length() > 0){ <END> if(!temp.matches("[A-Za-z][A-Za-z0-9_]*")) { if (!temp.matches(firstCharacterLetter)) { return MESSAGES.firstCharProjectNameError(); } else { return MESSAGES.invalidCharProjectNameError(); } } if (!filename.matches("[A-Za-z][A-Za-z0-9_]*")) { return MESSAGES.whitespaceProjectNameError().concat(". \n '").concat(temp).concat("' will be used if continued."); } else return ""; } return ""; }</code><technical_language>follow Google Java style guide w.r.t. spacing characters indentation</technical_language>

Target:
public static String getErrorMessage(String filename){ String errorMessage = ""; String noWhitespace = "[\\S]+"; String firstCharacterLetter = "[A-Za-z].*"; String temp = filename.trim().replaceAll("( )+", " ").replace(" ","_"); if (temp.length() > 0) { if (!temp.matches("[A-Za-z][A-Za-z0-9_]*")) { if (!temp.matches(firstCharacterLetter)) { errorMessage = MESSAGES.firstCharProjectNameError(); } else { errorMessage = MESSAGES.invalidCharProjectNameError(); } } } return errorMessage; }
Source:
<code>public String showInDoubtTransactions() { Set<RecoveryManager.InDoubtTxInfo> info = getRecoveryInfoFromCluster(); if (trace) { log.tracef("Found in doubt transactions: %s", info.size()); } StringBuilder result = new StringBuilder(); for (RecoveryManager.InDoubtTxInfo i : info) { result.append("xid = [").append(i.getXid()).append("], ").append(SEPARATOR) .append("internalId = ").append(i.getInternalId()).append(SEPARATOR); result.append("status = [ "); <START> int status = i.getTxStatus(); <END> if (status == Status.STATUS_PREPARED) { result.append("_PREPARED_"); } else if (status == Status.STATUS_COMMITTED) { result.append("_COMMITTED_"); } else if (status == Status.STATUS_ROLLEDBACK) { result.append("_ROLLEDBACK_"); } result.append(" ]"); result.append('\n'); } return result.toString(); }</code><technical_language>nitpick: org.infinispan.commons.tx.Util.transactionStatusToString() get status string. if status != -1 :)</technical_language>

Target:
public String showInDoubtTransactions() { Set<RecoveryManager.InDoubtTxInfo> info = getRecoveryInfoFromCluster(); if (trace) { log.tracef("Found in doubt transactions: %s", info.size()); } StringBuilder result = new StringBuilder(); for (RecoveryManager.InDoubtTxInfo i : info) { result.append("xid = [").append(i.getXid()).append("], ").append(SEPARATOR) .append("internalId = ").append(i.getInternalId()).append(SEPARATOR); result.append("status = [ "); int status = i.getStatus(); if (status != -1) result.append(Util.transactionStatusToString(status)); result.append(" ]"); result.append('\n'); } return result.toString(); }
Source:
<code>public HttpResponse openAsHttpResponse(String url, HttpEntity entity, HttpMethod method) throws ClientProtocolException, IOException { this.currentURI = url; HttpResponse response; String[] headerKeys = (String[]) this.headers.keySet().toArray(new String[headers.size()]); String[] headerVals = (String[]) this.headers.values().toArray(new String[headers.size()]); ResponseHandler<String> responseHandler = new BasicResponseHandler(); HttpUriRequest request; switch (method) { case GET: request = new HttpGet(url); break; case POST: request = new HttpPost(url); ((HttpPost) request).setEntity(entity); break; case PUT: request = new HttpPut(url); ((HttpPut) request).setEntity(entity); break; default: request = new HttpGet(url); } if (userAgent != null) { request.addHeader("User-Agent", userAgent); } for (int i = 0; i < headerKeys.length; i++) { request.addHeader(headerKeys[i], headerVals[i]); } HttpRequestRetryHandler retryHandler = new HttpRequestRetryHandler() { public boolean retryRequest(IOException exception, int executionCount, HttpContext context) { <START> if(executionCount >= 5){ <END> return false; } if(exception instanceof NoHttpResponseException){ return true; } else if (exception instanceof ClientProtocolException){ return true; } return false; } }; httpclient.setHttpRequestRetryHandler(retryHandler); response = httpclient.execute(request, mHttpContext); this.currentURI = request.getURI().toString(); return response; }</code><technical_language>do moving integer a constant e.g. MAX_RETRY_ATTEMPTS</technical_language>

Target:
public HttpResponse openAsHttpResponse(String url, HttpEntity entity, HttpMethod method) throws ClientProtocolException, IOException { this.currentURI = url; HttpResponse response; String[] headerKeys = (String[]) this.headers.keySet().toArray(new String[headers.size()]); String[] headerVals = (String[]) this.headers.values().toArray(new String[headers.size()]); ResponseHandler<String> responseHandler = new BasicResponseHandler(); HttpUriRequest request; switch (method) { case GET: request = new HttpGet(url); break; case POST: request = new HttpPost(url); ((HttpPost) request).setEntity(entity); break; case PUT: request = new HttpPut(url); ((HttpPut) request).setEntity(entity); break; default: request = new HttpGet(url); } if (userAgent != null) { request.addHeader("User-Agent", userAgent); } for (int i = 0; i < headerKeys.length; i++) { request.addHeader(headerKeys[i], headerVals[i]); } HttpRequestRetryHandler retryHandler = new HttpRequestRetryHandler() { public boolean retryRequest(IOException exception, int executionCount, HttpContext context) { if (executionCount >= MAX_RETRIES) { return false; } if (exception instanceof NoHttpResponseException) { return true; } else if (exception instanceof ClientProtocolException) { return true; } return false; } }; httpclient.setHttpRequestRetryHandler(retryHandler); response = httpclient.execute(request, mHttpContext); this.currentURI = request.getURI().toString(); return response; }
Source:
<code>private void configureBottomCard() { <START> BasicKvStore flag = new BasicKvStore(this, "prevTitleDesc"); <END> int flagVal = flag.getInt("flag"); if(flagVal == 0){ prevTitleDecs.setVisibility(View.INVISIBLE); } else { prevTitleDecs.setVisibility(View.VISIBLE); } bottomCardExpandButton.setOnClickListener(v -> presenter.toggleBottomCardState()); bottomCard.setOnClickListener(v -> presenter.toggleBottomCardState()); bottomCardAddDescription.setOnClickListener(v -> addNewDescription()); }</code><technical_language>defaultKvStore instead of creating new storage</technical_language>

Target:
private void configureBottomCard() { boolean flagVal = directKvStore.getBoolean("flagForSubmit"); if(flagVal){ prevTitleDecs.setVisibility(View.VISIBLE); } else { prevTitleDecs.setVisibility(View.INVISIBLE); } bottomCardExpandButton.setOnClickListener(v -> presenter.toggleBottomCardState()); bottomCard.setOnClickListener(v -> presenter.toggleBottomCardState()); bottomCardAddDescription.setOnClickListener(v -> addNewDescription()); }
Source:
<code>private void performDiscardChanges() { ArrayList<IResource> allFiles = new ArrayList<IResource>(); for (IResource res : getSelectedResources()) { allFiles.addAll(getAllMembers(res)); } for (IResource res : allFiles) { try { discardChange(res); } catch (IOException e1) { MessageDialog.openError(getShell(), UIText.DiscardChangesAction_checkoutErrorTitle, UIText.DiscardChangesAction_checkoutErrorMessage); } catch (CoreException e) { MessageDialog.openError(getShell(), <START> UIText.DiscardChangesAction_refreshErrorTitle, <END> UIText.DiscardChangesAction_refreshErrorMessage); } } }</code><technical_language>Do this is a refresh different. opposed IOException,</technical_language>

Target:
private void performDiscardChanges() { ArrayList<IResource> allFiles = new ArrayList<IResource>(); for (IResource res : getSelectedResources()) { allFiles.addAll(getAllMembers(res)); } for (IResource res : allFiles) { try { discardChange(res); } catch (IOException e1) { MessageDialog.openError(getShell(), UIText.DiscardChangesAction_unexpectedErrorTitle, UIText.DiscardChangesAction_unexpectedErrorMessage); }catch (RuntimeException e2) { MessageDialog.openError(getShell(), UIText.DiscardChangesAction_unexpectedErrorTitle, UIText.DiscardChangesAction_unexpectedIndexErrorMessage); } } }
Source:
<code>public void start() throws CacheLoaderException { try { if(!config.autoCreateKeyspace) config.poolProperties.setKeySpace(config.keySpace); dataSource = new DataSource(config.getPoolProperties()); readConsistencyLevel = ConsistencyLevel.valueOf(config.readConsistencyLevel); writeConsistencyLevel = ConsistencyLevel.valueOf(config.writeConsistencyLevel); entryColumnPath = new ColumnPath(config.entryColumnFamily).setColumn(ENTRY_COLUMN_NAME.getBytes(UTF8Charset)); entryColumnParent = new ColumnParent(config.entryColumnFamily); entryKeyPrefix = ENTRY_KEY_PREFIX + (config.isSharedKeyspace() ? cacheName + "_" : ""); expirationColumnParent = new ColumnParent(config.expirationColumnFamily); expirationKey = ByteBufferUtil.bytes(EXPIRATION_KEY + (config.isSharedKeyspace() ? "_" + cacheName : "")); keyMapper = (TwoWayKey2StringMapper) Util.getInstance(config.getKeyMapper()); } catch (Exception e) { throw new ConfigurationException(e); } if(config.autoCreateKeyspace) { log.debug("automatically create keyspace"); createKeySpace(); <START> dataSource.close(); END> dataSource.setKeySpace(config.keySpace); } log.debug("cleaning up expired entries..."); purgeInternal(); log.debug("started"); super.start(); }</code><technical_language>wanna wrap createKeySpace try/finally put dataSource.close() call in finally? closed</technical_language>

Target:
public void start() throws CacheLoaderException { try { if (!config.autoCreateKeyspace) config.poolProperties.setKeySpace(config.keySpace); dataSource = new DataSource(config.getPoolProperties()); readConsistencyLevel = ConsistencyLevel.valueOf(config.readConsistencyLevel); writeConsistencyLevel = ConsistencyLevel.valueOf(config.writeConsistencyLevel); entryColumnPath = new ColumnPath(config.entryColumnFamily).setColumn(ENTRY_COLUMN_NAME .getBytes(UTF8Charset)); entryColumnParent = new ColumnParent(config.entryColumnFamily); entryKeyPrefix = ENTRY_KEY_PREFIX + (config.isSharedKeyspace() ? cacheName + "_" : ""); expirationColumnParent = new ColumnParent(config.expirationColumnFamily); expirationKey = ByteBufferUtil.bytes(EXPIRATION_KEY + (config.isSharedKeyspace() ? "_" + cacheName : "")); keyMapper = (TwoWayKey2StringMapper) Util.getInstance(config.getKeyMapper()); } catch (Exception e) { throw new ConfigurationException(e); } if (config.autoCreateKeyspace) { log.debug("automatically create keyspace"); try { createKeySpace(); } finally { dataSource.close(); } dataSource.setKeySpace(config.keySpace); } log.debug("cleaning up expired entries..."); purgeInternal(); log.debug("started"); super.start(); }
Source:
<code><START> private static BkBasicTest.MkSocket createMockSocket() throws IOException { <END> return new BkBasicTest.MkSocket(); }</code><technical_language>@essobedo inline this method</technical_language>

Target:
private static MkSocket createMockSocket() throws IOException { return new MkSocket( new ByteArrayInputStream( Joiner.on(BkBasicTest.CRLF).join( "GET / HTTP/1.1", "Host:localhost", "Content-Length: 2", "", "hi" ).getBytes() ) ); }
Source:
<code>public PropertyConstraintMappingContext field(String property) { Contracts.assertNotNull( property, "The property name must not be null." ); <START> Contracts.assertNotEmpty( property, MESSAGES.propertyNameMustNotBeEmpty() ); <END> JavaBeanField javaBeanField = getFieldProperty( beanClass, property ); if ( javaBeanField == null || javaBeanField.getDeclaringClass() != beanClass ) { throw LOG.getUnableToFindPropertyWithAccessException( beanClass, property, ElementType.FIELD ); } if ( configuredMembers.contains( javaBeanField ) ) { throw LOG.getPropertyHasAlreadyBeConfiguredViaProgrammaticApiException( beanClass, property ); } PropertyConstraintMappingContextImpl context = new FieldPropertyConstraintMappingContextImpl( this, javaBeanField ); configuredMembers.add( javaBeanField ); propertyContexts.add( context ); return context; }</code><technical_language>I I instead change Contracts.assertNotEmpty() StringHelper.isNullOrEmptyString()</technical_language>

Target:
public PropertyConstraintMappingContext field(String property) { Contracts.assertNotEmpty( property, MESSAGES.propertyNameMustNotBeEmpty() ); JavaBeanField javaBeanField = getFieldProperty( beanClass, property ); if ( javaBeanField == null || javaBeanField.getDeclaringClass() != beanClass ) { throw LOG.getUnableToFindPropertyWithAccessException( beanClass, property, ElementType.FIELD ); } if ( configuredMembers.contains( javaBeanField ) ) { throw LOG.getPropertyHasAlreadyBeConfiguredViaProgrammaticApiException( beanClass, property ); } FieldConstraintMappingContextImpl context = new FieldConstraintMappingContextImpl( this, javaBeanField ); configuredMembers.add( javaBeanField ); propertyContexts.add( context ); return context; }
Source:
<code>void operationRetried(String text, Exception ex, int retries, boolean idempotent) { <START> LOG.info("{}: Retried {}: {}", retries, text, ex.toString()); <END> LOG.debug("Stack", ex); owner.operationRetried(text, ex, retries, idempotent); }</code><technical_language>order of parameter is wrong</technical_language>

Target:
void operationRetried(String text, Exception ex, int retries, boolean idempotent) { LOG.info("{}: Retried {}: {}", text, retries, ex.toString()); LOG.debug("Stack", ex); owner.operationRetried(text, ex, retries, idempotent); }
Source:
<code>public void testSameSizes() throws Exception { int min = 3, max = 8, maxAlloc = 1 << max; BuddyAllocator a = new BuddyAllocator(isDirect, isMapped, 1 << min, maxAlloc, maxAlloc, maxAlloc, 0, tmpDir, new DummyMemoryManager(), <START> LlapDaemonCacheMetrics.create("test", "1"), null, true, 1024 * 1024 * 128); <END> for (int i = max; i >= min; --i) { allocSameSize(a, 1 << (max - i), i); } }</code><technical_language>this 128MB multiple times in this suite. Maybe, want move this a const</technical_language>

Target:
public void testSameSizes() throws Exception { int min = 3, max = 8, maxAlloc = 1 << max; BuddyAllocator a = new BuddyAllocator(isDirect, isMapped, 1 << min, maxAlloc, maxAlloc, maxAlloc, 0, tmpDir, new DummyMemoryManager(), LlapDaemonCacheMetrics.create("test", "1"), null, true); for (int i = max; i >= min; --i) { allocSameSize(a, 1 << (max - i), i); } }
Source:
<code>public boolean isFreeFormContainerChildrenPresentation() { boolean isFreeForm = true; EObject <START> editPartContainer = <END> part.resolveSemanticElement().eContainer(); if (editPartContainer instanceof DNodeList) { isFreeForm = false; } else if (editPartContainer instanceof DNodeContainer) { DNodeContainer container = (DNodeContainer) editPartContainer; ContainerLayout childrenPresentation = container.getChildrenPresentation(); if (!childrenPresentation.equals(ContainerLayout.FREE_FORM)) { isFreeForm = false; } } return isFreeForm; }</code><technical_language>This is container of editPart container of semantic element (graphical element, DDiagramElement, in case) editPart. name of variable is adapted</technical_language>

Target:
public boolean isFreeFormContainerChildrenPresentation() { boolean isFreeForm = true; EObject eContainer = part.resolveSemanticElement().eContainer(); if (eContainer instanceof DNodeList) { isFreeForm = false; } else if (eContainer instanceof DNodeContainer) { DNodeContainer container = (DNodeContainer) eContainer; ContainerLayout childrenPresentation = container.getChildrenPresentation(); if (!childrenPresentation.equals(ContainerLayout.FREE_FORM)) { isFreeForm = false; } } return isFreeForm; }