auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public void testFailParse() { onView(withId(R.id.brick_set_variable_edit_text)) .perform(click()); onFormulaEditor() .performEnterFormula("1+"); onFormulaEditor() .performCloseAndSave(); <START> onView(withText(R.string.formula_editor_parse_fail)).inRoot(withDecorView(not(baseActivityTestRule.getActivity().getWindow().getDecorView()))) <END> .check(matches(isDisplayed())); }</code><technical_language>please move a new method in UiTestUtils</technical_language>

Target:
public void testFailParse() { onBrickAtPosition(1).onChildView(withId(R.id.brick_set_variable_edit_text)) .perform(click()); onFormulaEditor() .performEnterFormula("1+"); onFormulaEditor() .performCloseAndSave(); UiTestUtils.onToast(withText(R.string.formula_editor_parse_fail)) .check(matches(isDisplayed())); }
Source:
<code><START> private Producer<String, Set<Statement>> makeProducer(final KafkaParameters params) { <END> requireNonNull(params); final Properties props = new Properties(); props.setProperty(ProducerConfig.BOOTSTRAP_SERVERS_CONFIG, params.bootstrapServers); props.setProperty(ProducerConfig.KEY_SERIALIZER_CLASS_CONFIG, StringSerializer.class.getName()); props.setProperty(ProducerConfig.VALUE_SERIALIZER_CLASS_CONFIG, StatementsSerializer.class.getName()); return new KafkaProducer<>(props); }</code><technical_language>static</technical_language>

Target:
private static Producer<String, Set<Statement>> makeProducer(final KafkaParameters params) { requireNonNull(params); final Properties props = new Properties(); props.setProperty(ProducerConfig.BOOTSTRAP_SERVERS_CONFIG, params.bootstrapServers); props.setProperty(ProducerConfig.KEY_SERIALIZER_CLASS_CONFIG, StringSerializer.class.getName()); props.setProperty(ProducerConfig.VALUE_SERIALIZER_CLASS_CONFIG, StatementsSerializer.class.getName()); return new KafkaProducer<>(props); }
Source:
<code>private Bundle metaDataToBundle(Map<String, String> meta){ <START> if(meta.size() == 0) return null; <END> Bundle bundle = new Bundle(); for(Map.Entry<String,String> entry : meta.entrySet()){ if(entry.getValue() == null){ } else if("true".equals(entry.getValue())){ bundle.putBoolean(entry.getKey(), true); } else if("false".equals(entry.getValue())){ bundle.putBoolean(entry.getKey(), false); } else { if(entry.getValue().contains(".")){ try { bundle.putFloat(entry.getKey(), Float.parseFloat(entry.getValue())); } catch (NumberFormatException ef) { } } if(!bundle.containsKey(entry.getKey()) && !entry.getValue().startsWith("#")){ try { bundle.putInt(entry.getKey(), Integer.parseInt(entry.getValue())); } catch (NumberFormatException ei) { } } if(!bundle.containsKey(entry.getKey())){ try { bundle.putInt(entry.getKey(), Color.parseColor(entry.getValue())); } catch (IllegalArgumentException e) { } } if(!bundle.containsKey(entry.getKey())){ bundle.putString(entry.getKey(), entry.getValue()); } } } return bundle; }</code><technical_language>space if</technical_language>

Target:
private Bundle metaDataToBundle(Map<String, String> meta) { if (meta.size() == 0) { return null; } Bundle bundle = new Bundle(); for (Map.Entry<String,String> entry : meta.entrySet()) { if (entry.getValue() == null) { } else if ("true".equals(entry.getValue())) { bundle.putBoolean(entry.getKey(), true); } else if ("false".equals(entry.getValue())) { bundle.putBoolean(entry.getKey(), false); } else { if (entry.getValue().contains(".")) { try { bundle.putFloat(entry.getKey(), Float.parseFloat(entry.getValue())); } catch (NumberFormatException ef) { } } if (!bundle.containsKey(entry.getKey()) && !entry.getValue().startsWith("#")) { try { bundle.putInt(entry.getKey(), Integer.parseInt(entry.getValue())); } catch (NumberFormatException ei) { } } if (!bundle.containsKey(entry.getKey())) { try { bundle.putInt(entry.getKey(), Color.parseColor(entry.getValue())); } catch (IllegalArgumentException e) { } } if (!bundle.containsKey(entry.getKey())) { bundle.putString(entry.getKey(), entry.getValue()); } } } return bundle; }
Source:
<code>public void test() throws IOException { AntJPADomainExporter exporter = new AntJPADomainExporter(); exporter.setNamePrefix("Q"); exporter.setNameSuffix(""); exporter.setTargetFolder(folder.getRoot().getAbsolutePath()); exporter.setPersistenceUnitName("h2"); exporter.execute(); File origRoot = new File("../querydsl-jpa/target/generated-test-sources/java"); Set<File> files = exporter.getGeneratedFiles(); assertFalse(files.isEmpty()); for (File file : files) { String path = file.getAbsolutePath().replace( folder.getRoot().getAbsolutePath(), origRoot.getAbsolutePath()); String reference = Files.toString(new File(path), Charsets.UTF_8); String content = Files.toString(file, Charsets.UTF_8); <START> assertEquals(file.getPath(), reference, content); <END> } }</code><technical_language>want move hamcrest</technical_language>

Target:
public void test() throws IOException { AntJPADomainExporter exporter = new AntJPADomainExporter(); exporter.setNamePrefix("Q"); exporter.setNameSuffix(""); Path outputFolder = folder.getRoot().toPath(); exporter.setTargetFolder(outputFolder.toFile().getAbsolutePath()); exporter.setPersistenceUnitName("h2"); exporter.execute(); File origRoot = new File("../querydsl-jpa/target/generated-test-sources/java"); Set<File> files = exporter.getGeneratedFiles(); assertFalse(files.isEmpty()); for (File file : files) { Path relativeFile = outputFolder.relativize(file.toPath()); Path origFile = origRoot.toPath().resolve(relativeFile); String reference = Files.toString(origFile.toFile(), Charsets.UTF_8); String content = Files.toString(file, Charsets.UTF_8); errors.checkThat("Mismatch for " + file.getPath(), content, is(equalTo(reference))); } }
Source:
<code>public Channel retrieve(VeluxBridge bridge) { <START> logger.trace("retrieve() called."); <END> logger.trace("retrieve() About to query device status."); GetDeviceStatus bcp = bridge.bridgeAPI().getDeviceStatus(); if ((bridge.bridgeCommunicate(bcp)) && (bcp.isCommunicationSuccessful())) { VeluxGwState state = bcp.getState(); this.channel.gwState = new StringType(state.toString()); this.channel.gwStateDescription = new StringType(state.toDescription()); this.channel.isRetrieved = true; logger.trace("retrieve() finished successfully with result {}.", state.toDescription()); return channel; } else { logger.trace("retrieve() finished with failure."); return null; } }</code><technical_language>Join this line trace line it</technical_language>

Target:
public Channel retrieve(VeluxBridge bridge) { logger.trace("retrieve() called. About to query device status."); GetDeviceStatus bcp = bridge.bridgeAPI().getDeviceStatus(); if (bridge.bridgeCommunicate(bcp) && bcp.isCommunicationSuccessful()) { VeluxGwState state = bcp.getState(); this.channel.gwState = new StringType(state.toString()); this.channel.gwStateDescription = new StringType(state.toDescription()); this.channel.isRetrieved = true; logger.trace("retrieve() finished successfully with result {}.", state.toDescription()); return channel; } else { logger.trace("retrieve() finished with failure."); return null; } }
Source:
<code>public void execute(StartProcessInstanceCmd cmd) { ProcessInstance processInstance = processEngine.startProcess(cmd); <START> StartProcessInstanceResults cmdResult = new StartProcessInstanceResults(cmd.getId(), <END> processInstance.getId()); commandResults.send(MessageBuilder.withPayload(cmdResult).build()); }</code><technical_language>expecting content get calling REST end point? In this case, include process instance, id. This applies *Results</technical_language>

Target:
public void execute(StartProcessInstanceCmd cmd) { ProcessInstance processInstance = processEngine.startProcess(cmd); if(processInstance != null) { StartProcessInstanceResults cmdResult = new StartProcessInstanceResults(cmd.getId(), processInstance.getId()); commandResults.send(MessageBuilder.withPayload(cmdResult).build()); }else{ throw new IllegalStateException("Failed to start processInstance"); } }
Source:
<code>public String getText(Mode mode) { if (staticText != null && !staticText.isEmpty()) { return staticText; } StringBuilder sb = new StringBuilder(); if (mode.getTargets().isEmpty()) { <START> return ""; <END> } sb.append("target ").append(mode.getTargets().get(0).getTargetName()); sb.append(" creates "); if (amount.toString().equals("1")) { sb.append("a "); if (tapped && !attacking) { sb.append("tapped "); } sb.append(token.getDescription()); } else { sb.append(CardUtil.numberToText(amount.toString())).append(' '); if (tapped && !attacking) { sb.append("tapped "); } sb.append(token.getDescription()); if (token.getDescription().endsWith("token")) { sb.append("s "); } int tokenLocation = sb.indexOf("token "); if (tokenLocation != -1) { sb.replace(tokenLocation, tokenLocation + 6, "tokens "); } } if (attacking) { sb.append(" that are"); if (tapped) { sb.append(" tapped and"); } sb.append(" attacking"); } String message = amount.getMessage(); if (!message.isEmpty()) { if (amount.toString().equals("X")) { sb.append(", where X is "); } else { sb.append(" for each "); } } sb.append(message); return sb.toString(); }</code><technical_language>Effect return real text, empty string. add "target ", "target player " other text</technical_language>

Target:
public String getText(Mode mode) { if (staticText != null && !staticText.isEmpty()) { return staticText; } StringBuilder sb = new StringBuilder(); if (mode.getTargets().isEmpty()) { sb.append("target player"); } else { sb.append("target ").append(mode.getTargets().get(0).getTargetName()); } sb.append(" creates "); if (amount.toString().equals("1")) { sb.append("a "); if (tapped && !attacking) { sb.append("tapped "); } sb.append(token.getDescription()); } else { sb.append(CardUtil.numberToText(amount.toString())).append(' '); if (tapped && !attacking) { sb.append("tapped "); } sb.append(token.getDescription()); if (token.getDescription().endsWith("token")) { sb.append("s "); } int tokenLocation = sb.indexOf("token "); if (tokenLocation != -1) { sb.replace(tokenLocation, tokenLocation + 6, "tokens "); } } if (attacking) { sb.append(" that are"); if (tapped) { sb.append(" tapped and"); } sb.append(" attacking"); } String message = amount.getMessage(); if (!message.isEmpty()) { if (amount.toString().equals("X")) { sb.append(", where X is "); } else { sb.append(" for each "); } } sb.append(message); return sb.toString(); }
Source:
<code>private void createFormRecordScanResultDialog(Pair<Boolean, String> result, FormRecord record) { String title; if (result.first) { title = Localization.get("app.workflow.forms.scan.title.valid"); } else { title = Localization.get("app.workflow.forms.scan.title.invalid"); } int resId = result.first ? R.drawable.checkmark : R.drawable.redx; StandardAlertDialog dialog = StandardAlertDialog.getBasicAlertDialogWithIcon(this, title, result.second, resId, null); if (FormRecordFilter.Pending.containsStatus(record.getStatus())) { if (DeveloperPreferences.isManualFormQuarantineAllowed()) { dialog.setNegativeButton(Localization.get("app.workflow.forms.quarantine"), (dialog1, which) -> { manuallyQuarantineRecord(record); dismissAlertDialog(); <START> DeveloperPreferences.disableManualFormQuarantine(); <END> }); } } showAlertDialog(dialog); }</code><technical_language>Is a reason this is "spring loaded" speak lets quarantine a single form? get painful if is some strange event issues for a lot of forms in a row</technical_language>

Target:
private void createFormRecordScanResultDialog(Pair<Boolean, String> result, FormRecord record) { String title; if (result.first) { title = Localization.get("app.workflow.forms.scan.title.valid"); } else { title = Localization.get("app.workflow.forms.scan.title.invalid"); } int resId = result.first ? R.drawable.checkmark : R.drawable.redx; StandardAlertDialog dialog = StandardAlertDialog.getBasicAlertDialogWithIcon(this, title, result.second, resId, null); if (FormRecordFilter.Pending.containsStatus(record.getStatus())) { if (AdvancedActionsPreferences.isManualFormQuarantineAllowed()) { dialog.setNegativeButton(Localization.get("app.workflow.forms.quarantine"), (dialog1, which) -> { manuallyQuarantineRecord(record); dismissAlertDialog(); AdvancedActionsPreferences.setManualFormQuarantine(false); }); } } showAlertDialog(dialog); }
Source:
<code>public void testExpiredRequestAllocationOnAnyHost() throws Exception { MockClusterResourceManager spyManager = spy(new MockClusterResourceManager(callback, state)); spyAllocator = Mockito.spy( new ContainerAllocator(spyManager, config, state, false, Optional.empty())); spyAllocator.requestResources(new HashMap<String, String>() { { <START> put("0", "abc"); put("1", "def"); } <END> }); spyThread = new Thread(spyAllocator); spyThread.start(); Thread.sleep(20); assertEquals(state.preferredHostRequests.get(), 0); assertTrue(state.anyHostRequests.get() >= 2); assertTrue(state.expiredAnyHostRequests.get() >= 2); verify(spyAllocator, atLeastOnce()).handleExpiredRequestWithHostAffinityDisabled(eq("0"), any(SamzaResourceRequest.class)); verify(spyAllocator, atLeastOnce()).handleExpiredRequestWithHostAffinityDisabled(eq("1"), any(SamzaResourceRequest.class)); ArgumentCaptor<SamzaResourceRequest> cancelledRequestCaptor = ArgumentCaptor.forClass(SamzaResourceRequest.class); verify(spyManager, atLeast(2)).cancelResourceRequest(cancelledRequestCaptor.capture()); assertTrue(cancelledRequestCaptor.getAllValues() .stream() .map(resourceRequest -> resourceRequest.getPreferredHost()) .collect(Collectors.toSet()) .size() == 1); containerAllocator.stop(); }</code><technical_language>Please "host-0" "host-1" instead of abc def</technical_language>

Target:
public void testExpiredRequestAllocationOnAnyHost() throws Exception { MockClusterResourceManager spyManager = spy(new MockClusterResourceManager(callback, state)); spyAllocator = Mockito.spy( new ContainerAllocator(spyManager, config, state, false, Optional.empty())); spyAllocator.requestResources(new HashMap<String, String>() { { put("0", "host-0"); put("1", "host-1"); } }); spyThread = new Thread(spyAllocator); spyThread.start(); Thread.sleep(20); assertEquals(state.preferredHostRequests.get(), 0); assertTrue(state.anyHostRequests.get() >= 4); assertTrue(state.expiredAnyHostRequests.get() >= 2); verify(spyAllocator, atLeastOnce()).handleExpiredRequest(eq("0"), eq(ResourceRequestState.ANY_HOST), any(SamzaResourceRequest.class)); verify(spyAllocator, atLeastOnce()).handleExpiredRequest(eq("1"), eq(ResourceRequestState.ANY_HOST), any(SamzaResourceRequest.class)); ArgumentCaptor<SamzaResourceRequest> cancelledRequestCaptor = ArgumentCaptor.forClass(SamzaResourceRequest.class); verify(spyManager, atLeast(2)).cancelResourceRequest(cancelledRequestCaptor.capture()); assertTrue(cancelledRequestCaptor.getAllValues() .stream() .map(resourceRequest -> resourceRequest.getPreferredHost()) .collect(Collectors.toSet()) .size() == 1); containerAllocator.stop(); }
Source:
<code>public static CoordinateReferenceSystem get( CRS crs ) { <START> if ( crs == null || crs.getHref() == null ) <END> { throw new IllegalArgumentException( "Invalid CRS: " + crs ); } else { return get(crs.getHref()); } }</code><technical_language>get href is null safe crs.getHref() is mandatory anymore</technical_language>

Target:
public static CoordinateReferenceSystem get( CRS crs ) { Objects.requireNonNull( crs ); return get(crs.getHref()); }
Source:
<code>public NetworkScan requestNetworkScan(int subId, NetworkScanRequest request, Executor executor, NetworkScanCallback callback, String callingPackage) { try { ITelephony telephony = getITelephony(); if (telephony != null) { <START> int scanId; synchronized (mScanInfo) { scanId = telephony.requestNetworkScan( <END> subId, request, mMessenger, new Binder(), callingPackage); if (scanId == INVALID_SCAN_ID) { Rlog.e(TAG, "Failed to initiate network scan"); return null; } saveScanInfo(scanId, request, executor, callback); return new NetworkScan(scanId, subId); } } } catch (RemoteException ex) { Rlog.e(TAG, "requestNetworkScan RemoteException", ex); } catch (NullPointerException ex) { Rlog.e(TAG, "requestNetworkScan NPE", ex); } return null; }</code><technical_language>do int scanId = telephony.requestNetworkScan(</technical_language>

Target:
public NetworkScan requestNetworkScan(int subId, NetworkScanRequest request, Executor executor, NetworkScanCallback callback, String callingPackage) { try { ITelephony telephony = getITelephony(); if (telephony != null) { synchronized (mScanInfo) { int scanId = telephony.requestNetworkScan( subId, request, mMessenger, new Binder(), callingPackage); if (scanId == INVALID_SCAN_ID) { Rlog.e(TAG, "Failed to initiate network scan"); return null; } saveScanInfo(scanId, request, executor, callback); return new NetworkScan(scanId, subId); } } } catch (RemoteException ex) { Rlog.e(TAG, "requestNetworkScan RemoteException", ex); } catch (NullPointerException ex) { Rlog.e(TAG, "requestNetworkScan NPE", ex); } return null; }
Source:
<code>public ClusterParticipant getClusterParticipant() throws IOException { if (clusterMapConfig == null) { throw new IllegalArgumentException( "Cluster participant creation requires the factory to be initialized with a non-null ClusterMapConfig"); } <START> if (clusterParticipant == null) { <END> clusterParticipant = new ClusterParticipant() { @Override public void initialize(String hostname, int port) throws Exception { } @Override public void terminate() { } }; } return clusterParticipant; }</code><technical_language>reason do this in constructor? Is null in normal flow</technical_language>

Target:
public ClusterParticipant getClusterParticipant() throws IOException { if (clusterParticipant == null) { clusterParticipant = new ClusterParticipant() { @Override public void initialize(String hostname, int port) { } @Override public void close() { } }; } return clusterParticipant; }
Source:
<code>public void resilientToRollingRestarts() { CassandraClientPool cassandraClientPool = clientPoolWithServersInCurrentPool(ImmutableSet.of(HOST_1, HOST_2)); AtomicReference<InetSocketAddress> downHost = new AtomicReference<>(HOST_1); cassandraClientPool.getCurrentPools().values().forEach(pool -> setConditionalTimeoutFailureForHost( pool, container -> container.getHost().equals(downHost.get()))); runNoopWithRetryOnHost(HOST_1, cassandraClientPool); assertThat(blacklist.contains(HOST_1), is(true)); downHost.set(HOST_2); <START> runNoopWithRetryOnHost(HOST_1, cassandraClientPool); <END> assertThat(blacklist.contains(HOST_1), is(false)); }</code><technical_language>This run HOST_2</technical_language>

Target:
public void resilientToRollingRestarts() { CassandraClientPool cassandraClientPool = clientPoolWithServersInCurrentPool(ImmutableSet.of(HOST_1, HOST_2)); AtomicReference<InetSocketAddress> downHost = new AtomicReference<>(HOST_1); cassandraClientPool.getCurrentPools().values().forEach(pool -> setConditionalTimeoutFailureForHost( pool, container -> container.getHost().equals(downHost.get()))); runNoopWithRetryOnHost(HOST_1, cassandraClientPool); assertThat(blacklist.contains(HOST_1), is(true)); downHost.set(HOST_2); runNoopWithRetryOnHost(HOST_2, cassandraClientPool); assertThat(blacklist.contains(HOST_1), is(false)); }
Source:
<code>public AxisAlignedBB getCollisionBoundingBox(IBlockState state) { EnumRailDirection dir = TrackTools.getTrackDirectionRaw(state); if (isGateOpen()) return null; double x = tileEntity.getPos().getX(); double y = tileEntity.getPos().getY(); double z = tileEntity.getPos().getZ(); if (dir == EnumRailDirection.NORTH_SOUTH) <START> return AxisAlignedBB.fromBounds(x, y, z + 0.375F, z + 1, y + 1.5F, z + 0.625F); <END> else return AxisAlignedBB.fromBounds(x, y, z + 0.625F, z + 1, y + 1.5F, z + 0.375F); }</code><technical_language>Vanilla AABB constructors sucks</technical_language>

Target:
public AxisAlignedBB getCollisionBoundingBox(IBlockState state) { EnumRailDirection dir = TrackTools.getTrackDirectionRaw(state); if (isGateOpen()) return null; AABBFactory factory = AABBFactory.make().createBoxForTileAt(getPos()).raiseCeiling(0.5); if (dir == EnumRailDirection.NORTH_SOUTH) return factory.expandZAxis(AABB_SHRINK).build(); else return factory.expandXAxis(AABB_SHRINK).build(); }
Source:
<code>public SegmentProcessorConfig build() { Preconditions.checkNotNull(tableConfig, "Must provide table config in SegmentProcessorConfig"); Preconditions.checkNotNull(schema, "Must provide schema in SegmentProcessorConfig"); <START> if (recordTransformerConfig == null) { <END> recordTransformerConfig = new RecordTransformerConfig.Builder().build(); } if (recordFilterConfig == null) { recordFilterConfig = new RecordFilterConfig.Builder().build(); } if (partitioningConfig == null) { partitioningConfig = new PartitioningConfig.Builder().build(); } if (collectorConfig == null) { collectorConfig = new CollectorConfig.Builder().build(); } if (_segmentConfig == null) { _segmentConfig = new SegmentConfig.Builder().build(); } return new SegmentProcessorConfig(tableConfig, schema, recordTransformerConfig, recordFilterConfig, partitioningConfig, collectorConfig, _segmentConfig); }</code><technical_language>Suggest leaving null if set</technical_language>

Target:
public SegmentProcessorConfig build() { Preconditions.checkState(_tableConfig != null, "Must provide table config in SegmentProcessorConfig"); Preconditions.checkState(_schema != null, "Must provide schema in SegmentProcessorConfig"); if (_recordTransformerConfig == null) { _recordTransformerConfig = new RecordTransformerConfig.Builder().build(); } if (_recordFilterConfig == null) { _recordFilterConfig = new RecordFilterConfig.Builder().build(); } if (_partitionerConfig == null) { _partitionerConfig = new PartitionerConfig.Builder().build(); } if (_collectorConfig == null) { _collectorConfig = new CollectorConfig.Builder().build(); } if (_segmentConfig == null) { _segmentConfig = new SegmentConfig.Builder().build(); } return new SegmentProcessorConfig(_tableConfig, _schema, _recordTransformerConfig, _recordFilterConfig, _partitionerConfig, _collectorConfig, _segmentConfig); }
Source:
<code>protected void doGet(HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException { request.setAttribute(MD5Attributes.ATTR_SELECTOR_SCRIPT.getAttributeKey(), getSelectorScriptName()); request.setAttribute(MD5Attributes.ATTR_STYLES.getAttributeKey(), brandingManager.getBrandingThemes()); request.setAttribute(MD5Attributes.ATTR_MESSAGES.getAttributeKey(), getBrandingMessages()); <START> request.setAttribute(ATTR_THEME_PATH, ATTR_THEME_PATH); <END> request.setAttribute(ATTR_DEFAULT_STYLE, "default.css"); request.setAttribute(MD5Attributes.ATTR_APPLICATION_TYPE.getAttributeKey(), getApplicationType()); VdcUser loggedInUser = getLoggedInUser(request.getSession().getId()); if (loggedInUser != null) { request.setAttribute(MD5Attributes.ATTR_USER_INFO.getAttributeKey(), getUserInfoObject(loggedInUser)); } try { String md5sum = getMd5Sum(request); if (request.getHeader(IF_NONE_MATCH_HEADER) != null && request.getHeader(IF_NONE_MATCH_HEADER).equals(md5sum)) { response.setStatus(HttpServletResponse.SC_NOT_MODIFIED); } else { RequestDispatcher dispatcher = request.getRequestDispatcher(HOST_JSP); response.setContentType(UTF_CONTENT_TYPE); response.addHeader(ETAG_HEADER, md5sum); if (dispatcher != null) { dispatcher.include(request, response); } } } catch (NoSuchAlgorithmException ex) { throw new ServletException(ex); } }</code><technical_language>dangerous key, is string? :-) In other words, also: request.setAttribute(ATTR_THEME_PATH, "theme"); //$NON-NLS-1$</technical_language>

Target:
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException { request.setAttribute(MD5Attributes.ATTR_SELECTOR_SCRIPT.getKey(), getSelectorScriptName()); request.setAttribute(MD5Attributes.ATTR_STYLES.getKey(), brandingManager.getBrandingThemes()); request.setAttribute(MD5Attributes.ATTR_MESSAGES.getKey(), getBrandingMessages()); request.setAttribute(ATTR_THEME_PATH, "theme"); request.setAttribute(ATTR_DEFAULT_STYLE, "default.css"); request.setAttribute(MD5Attributes.ATTR_APPLICATION_TYPE.getKey(), getApplicationType()); VdcUser loggedInUser = getLoggedInUser(request.getSession().getId()); if (loggedInUser != null) { request.setAttribute(MD5Attributes.ATTR_USER_INFO.getKey(), getUserInfoObject(loggedInUser)); } try { String md5sum = getMd5Sum(request); if (request.getHeader(IF_NONE_MATCH_HEADER) != null && request.getHeader(IF_NONE_MATCH_HEADER).equals(md5sum)) { response.setStatus(HttpServletResponse.SC_NOT_MODIFIED); } else { RequestDispatcher dispatcher = request.getRequestDispatcher(HOST_JSP); response.setContentType(UTF_CONTENT_TYPE); response.addHeader(ETAG_HEADER, md5sum); if (dispatcher != null) { dispatcher.include(request, response); } } } catch (NoSuchAlgorithmException ex) { throw new ServletException(ex); } }
Source:
<code>public boolean isCellEditable(int rowIndex, int columnIndex) { if (element.isEditable()) { try { Type fieldType = getMetadata().getFieldType(columnIndex); Constraint c = fieldType.getConstraint(Constraint.READONLY); return (fieldType.getTypeCode() != Type.RASTER) && (c == null); <START> } catch (DriverException e) { <END> return false; } } else { return false; } }</code><technical_language>wrong happened. log in order warn user</technical_language>

Target:
public boolean isCellEditable(int rowIndex, int columnIndex) { if (element.isEditable()) { try { Type fieldType = getMetadata().getFieldType(columnIndex); Constraint c = fieldType.getConstraint(Constraint.READONLY); return (fieldType.getTypeCode() != Type.RASTER) && (c == null); } catch (DriverException e) { LOGGER.warn(e.getLocalizedMessage(), e); return false; } } else { return false; } }
Source:
<code>public CborObject toCbor() { Map<String, CborObject> cbor = new TreeMap<>(); <START> cbor.put("p", new CborObject.CborString(path)); <END> cbor.put("fp", fp.toCbor()); return CborObject.CborMap.build(cbor); }</code><technical_language>p -> path</technical_language>

Target:
public CborObject toCbor() { Map<String, CborObject> cbor = new TreeMap<>(); cbor.put("p", new CborObject.CborString(path)); cbor.put("c", cap.toCbor()); return CborObject.CborMap.build(cbor); }
Source:
<code>public void test_of_String() { CurrencyAmount test = CurrencyAmount.of("USD", A1); assertEquals(test.getCurrency(), Currency.USD); <START> assertEquals(test.getAmount(), A1, 0.0001d); <END> }</code><technical_language>tolerance</technical_language>

Target:
public void test_of_String() { CurrencyAmount test = CurrencyAmount.of("USD", AMT1); assertEquals(test.getCurrency(), Currency.USD); assertEquals(test.getAmount(), AMT1, 0); }
Source:
<code>public void loadConfiguration(IProgressMonitor monitor) { if (!fConfigured) { synchronized (this) { if (!fConfigured) { try { fMapping.clear(); <START> for (MappingFile mf : TmfTraceManager.getInstance().getCurrentTraceContext().getMappingFiles()) { <END> for (Map.Entry<String, String> entry : mf.getSymbolMapping().entrySet()) { if (!fMapping.containsKey(entry.getKey())) { fMapping.put(entry.getKey(), entry.getValue()); } } } } finally { fConfigured = true; } } } } }</code><technical_language>get context for trace getTrace. streams simpler? I asking</technical_language>

Target:
public void loadConfiguration(IProgressMonitor monitor) { if (!fConfigured) { synchronized (this) { if (!fConfigured) { try { fMapping.clear(); for (MappingFile mf : TmfTraceManager.getInstance().getTraceContext(fTrace).getMappingFiles()) { for (Map.Entry<String, String> entry : mf.getSymbolMapping().entrySet()) { if (!fMapping.containsKey(entry.getKey())) { fMapping.put(entry.getKey(), entry.getValue()); } } } } finally { fConfigured = true; } } } } }
Source:
<code>private CoverageReportAction generateCoverageReportAction( CoverageArgs args, ArgsFunc argsFunc, LocationFunc locationFunc) { ArtifactRoot root = args.directories().getBuildDataDirectory(args.workspaceName()); PathFragment coverageDir = TestRunnerAction.COVERAGE_TMP_ROOT; Artifact lcovOutput = args.factory().getDerivedArtifact( coverageDir.getRelative("_coverage_report.dat"), root, args.artifactOwner()); Artifact reportGeneratorExec = args.reportGenerator().getExecutable(); args = CoverageArgs.createCopyWithCoverageDirAndLcovOutput(args, coverageDir, lcovOutput); ImmutableList<String> actionArgs = argsFunc.apply(args); <START> NestedSetBuilder<Artifact> inputsBuilder = NestedSetBuilder.stableOrder(); <END> Iterable<Artifact> inputs = inputsBuilder .addAll(args.coverageArtifacts()) .add(reportGeneratorExec) .addTransitive( NestedSetBuilder.create(Order.STABLE_ORDER, args.reportGenerator().getRunfilesSupport().getRunfilesMiddleman())) .add(args.lcovArtifact()) .build(); return new CoverageReportAction( ACTION_OWNER, inputs, ImmutableList.of(lcovOutput), actionArgs, locationFunc.apply(args), !args.htmlReport(), args.reportGenerator().getRunfilesSupplier()); }</code><technical_language>benefits of a NestedSet instead of a list here? a artifacts, creating NestedSets unnecessary</technical_language>

Target:
private CoverageReportAction generateCoverageReportAction( CoverageArgs args, ArgsFunc argsFunc, LocationFunc locationFunc) { ArtifactRoot root = args.directories().getBuildDataDirectory(args.workspaceName()); PathFragment coverageDir = TestRunnerAction.COVERAGE_TMP_ROOT; Artifact lcovOutput = args.factory().getDerivedArtifact( coverageDir.getRelative("_coverage_report.dat"), root, args.artifactOwner()); Artifact reportGeneratorExec = args.reportGenerator().getExecutable(); RunfilesSupport runfilesSupport = args.reportGenerator().getRunfilesSupport(); args = CoverageArgs.createCopyWithCoverageDirAndLcovOutput(args, coverageDir, lcovOutput); ImmutableList<String> actionArgs = argsFunc.apply(args); ImmutableList.Builder<Artifact> inputsBuilder = ImmutableList.<Artifact>builder() .addAll(args.coverageArtifacts()) .add(reportGeneratorExec) .add(args.lcovArtifact()); if (runfilesSupport != null) { inputsBuilder.add(runfilesSupport.getRunfilesMiddleman()); } return new CoverageReportAction( ACTION_OWNER, inputsBuilder.build(), ImmutableList.of(lcovOutput), actionArgs, locationFunc.apply(args), !args.htmlReport(), args.reportGenerator().getRunfilesSupplier()); }
Source:
<code>public void fold(ColumnValueSelector selector) { <START> boolean isCurrentValNull = selector.isNull(); <END> if (!isCurrentValNull) { if (isNullResult) { isNullResult = false; } delegate.fold(selector); } }</code><technical_language>i direct logic reading easy. java boolean isNotNull = !selector.isNull(); if (isNotNull) { if (isNullResult) { isNullResult = false; } delegate.fold(selector); }</technical_language>

Target:
public void fold(ColumnValueSelector selector) { boolean isNotNull = !selector.isNull(); if (isNotNull) { if (isNullResult) { isNullResult = false; } delegate.fold(selector); } }
Source:
<code>public void generate() { genWrapperHeader(); <START> append(IOUtils.LINE_SEPARATOR); <END> append(" is").append(IOUtils.LINE_SEPARATOR); genWrapperVariables(); append(" begin").append(IOUtils.LINE_SEPARATOR); append(" "); genSpCallWithinWrapper(); append(";").append(IOUtils.LINE_SEPARATOR); assignOutputVariables(); genWrapperReturnStatement(); append(" end ").append(getWrapperName()).append(";").append(IOUtils.LINE_SEPARATOR); append(IOUtils.LINE_SEPARATOR); }</code><technical_language>this failing Windows \n? In general this is is supposed run database. database reside machine platform DbFit. In DbFit tests multiple hard-coded expected outputs (as files). I hope _git_ is changing end of line of these. I avoid platform-specific tweaking of generated database statements: database OK work fixed (e.g. unix-like) end of line</technical_language>

Target:
public void generate() { genWrapperHeader(); append("\n"); append(" is\n"); genWrapperVariables(); append(" begin\n"); append(" "); genSpCallWithinWrapper(); append(";\n"); assignOutputVariables(); genWrapperReturnStatement(); append(" end ").append(getWrapperName()).append(";\n"); append("\n"); }
Source:
<code>public Map<String, List<Location>> getLocations(List<String> locations){ HttpClient httpClient = new DefaultHttpClient(); try { URIBuilder uri = new URIBuilder(url+SEARCH_API); for(String loc: locations){ uri.addParameter(SEARCH_PARAM, loc); } HttpGet httpGet = new HttpGet(uri.build()); HttpResponse resp = httpClient.execute(httpGet); <START> String respJson = IOUtils.toString(resp.getEntity().getContent()); <END> @SuppressWarnings("serial") Type typeDef = new TypeToken<Map<String, List<Location>>>(){}.getType(); return new Gson().fromJson(respJson, typeDef); } catch (Exception e) { LOG.severe(e.getMessage()); } return null; }</code><technical_language>@smadha Awesome PR. issue. Please charset IOUtils#toString(); Otherwise, mvn install fails (forbidden api) ![fix](<LINK_0> ## EDIT: REST API content UTF8, String respJson = IOUtils.toString(resp.getEntity().getContent(), StandardCharsets.UTF_8); pass check</technical_language>

Target:
public Map<String, List<Location>> getLocations(List<String> locations){ HttpClient httpClient = new DefaultHttpClient(); try { URIBuilder uri = new URIBuilder(url+SEARCH_API); for(String loc: locations){ uri.addParameter(SEARCH_PARAM, loc); } HttpGet httpGet = new HttpGet(uri.build()); HttpResponse resp = httpClient.execute(httpGet); String respJson = IOUtils.toString(resp.getEntity().getContent(), Charsets.UTF_8); @SuppressWarnings("serial") Type typeDef = new TypeToken<Map<String, List<Location>>>(){}.getType(); return new Gson().fromJson(respJson, typeDef); } catch (Exception e) { LOG.severe(e.getMessage()); } return null; }
Source:
<code><START> public void checkPreference() { <END> if (preference==null){ SConfiguration config =EngineDriver.driver().getConfiguration(); int maxQuotedLines = config.getImportMaxQuotedColumnLines(); preference=new CsvPreference.Builder( characterDelimiter!=null && !characterDelimiter.isEmpty() ?characterDelimiter.charAt(0):DEFAULT_STRIP_STRING, columnDelimiter!=null && !columnDelimiter.isEmpty() ?columnDelimiter.charAt(0):DEFAULT_COLUMN_DELIMITTER, "\n").maxLinesPerRow(maxQuotedLines).build(); } }</code><technical_language>I this protected accessed a subclass</technical_language>

Target:
protected void checkPreference() { if (preference==null){ SConfiguration config =EngineDriver.driver().getConfiguration(); int maxQuotedLines = config.getImportMaxQuotedColumnLines(); preference=new CsvPreference.Builder( characterDelimiter!=null && !characterDelimiter.isEmpty() ?characterDelimiter.charAt(0):DEFAULT_STRIP_STRING, columnDelimiter!=null && !columnDelimiter.isEmpty() ?columnDelimiter.charAt(0):DEFAULT_COLUMN_DELIMITTER, "\n").maxLinesPerRow(maxQuotedLines).build(); } }
Source:
<code>public void setUp(){ testObjectContext = testPersistenceObjectFactory.createTestObjectContext(); enrichmentTags = testPersistenceObjectFactory.createEnrichmentTagsForJudgment(testObjectContext.getCcJudgmentId()); <START> parametersExtractor.setMinPageSize(1); <END> DumpEnrichmentTagController dumpEnrichmentTagController = new DumpEnrichmentTagController(); dumpEnrichmentTagController.setParametersExtractor(parametersExtractor); dumpEnrichmentTagController.setDatabaseSearchService(databaseSearchService); dumpEnrichmentTagController.setDumpEnrichmentTagsListSuccessRepresentationBuilder(dumpEnrichmentTagsListSuccessRepresentationBuilder); mockMvc = standaloneSetup(dumpEnrichmentTagController) .addInterceptors(new RestrictParamsHandlerInterceptor()) .build(); }</code><technical_language>changing bean - this influence other tests it</technical_language>

Target:
public void setUp(){ testObjectContext = testPersistenceObjectFactory.createTestObjectContext(); enrichmentTags = testPersistenceObjectFactory.createEnrichmentTagsForJudgment(testObjectContext.getCcJudgmentId()); DumpEnrichmentTagController dumpEnrichmentTagController = new DumpEnrichmentTagController(); dumpEnrichmentTagController.setParametersExtractor(parametersExtractor); dumpEnrichmentTagController.setDatabaseSearchService(databaseSearchService); dumpEnrichmentTagController.setDumpEnrichmentTagsListSuccessRepresentationBuilder(dumpEnrichmentTagsListSuccessRepresentationBuilder); mockMvc = standaloneSetup(dumpEnrichmentTagController) .addInterceptors(new RestrictParamsHandlerInterceptor()) .build(); }
Source:
<code>public Result getCurrentRowState(Mutation m, Collection<? extends ColumnReference> columns, boolean ignoreNewerMutations) <START> throws IOException { <END> byte[] row = m.getRow(); Result r = results.get(new ImmutableBytesPtr(row)); if (r !=null) { return r; } Scan s = IndexManagementUtil.newLocalStateScan(Collections.singletonList(columns)); s.setStartRow(row); s.setStopRow(row); if (ignoreNewerMutations) { long ts = getOldestTimestamp(m.getFamilyCellMap().values()); s.setTimeRange(0,ts); } Region region = this.env.getRegion(); try (RegionScanner scanner = region.getScanner(s)) { List<Cell> kvs = new ArrayList<Cell>(1); boolean more = scanner.next(kvs); assert !more : "Got more than one result when scanning" + " a single row in the primary table!"; r = Result.create(kvs); return r; } }</code><technical_language>nit: results.removeAll(rows) here</technical_language>

Target:
public Result getCurrentRowState(Mutation m, Collection<? extends ColumnReference> columns, boolean ignoreNewerMutations) throws IOException { byte[] row = m.getRow(); Result r; if (results != null) { if (m.getAttribute(BaseScannerRegionObserver.REPLAY_WRITES) == null) { r = results.get(new ImmutableBytesPtr(row)); if (r == null) { List<Cell> kvs = new ArrayList<Cell>(1); r = Result.create(kvs); } return r; } } Scan s = IndexManagementUtil.newLocalStateScan(Collections.singletonList(columns)); s.setStartRow(row); s.setStopRow(row); if (ignoreNewerMutations) { long ts = getOldestTimestamp(m.getFamilyCellMap().values()); s.setTimeRange(0,ts); } Region region = this.env.getRegion(); try (RegionScanner scanner = region.getScanner(s)) { List<Cell> kvs = new ArrayList<Cell>(1); boolean more = scanner.next(kvs); assert !more : "Got more than one result when scanning" + " a single row in the primary table!"; r = Result.create(kvs); return r; } }
Source:
<code>public PolymorphicScalarFunctionBuilder choice(Function<ChoiceBuilder, ChoiceBuilder> choiceSpecification) { ChoiceBuilder choiceBuilder = new ChoiceBuilder(clazz, signature); choiceSpecification.apply(choiceBuilder); PolymorphicScalarFunctionChoice choice = choiceBuilder.build(); <START> choices.add(choice); <END> return this; }</code><technical_language>choices.add(choiceBuilder.build());</technical_language>

Target:
public PolymorphicScalarFunctionBuilder choice(Function<ChoiceBuilder, ChoiceBuilder> choiceSpecification) { ChoiceBuilder choiceBuilder = new ChoiceBuilder(clazz, signature); choiceSpecification.apply(choiceBuilder); choices.add(choiceBuilder.build()); return this; }
Source:
<code>public Object execute(ExecutionEvent executionEvent) { final IWorkbenchWindow window = HandlerUtil.getActiveWorkbenchWindow(executionEvent); if (window == null) { return null; } <START> if (!((WorkbenchWindow) window).isToolbarVisible()) { <END> displayQuickAccessDialog(window, executionEvent.getCommand()); return null; } MWindow mWindow = ((WorkbenchWindow) window).getModel(); EModelService modelService = mWindow.getContext().get(EModelService.class); MToolControl searchField = (MToolControl) modelService.find("SearchField", mWindow); if (searchField == null) { displayQuickAccessDialog(window, executionEvent.getCommand()); return null; } Control control = (Control) searchField.getWidget(); if (((WorkbenchWindow) window).isToolbarVisible() && control != null) { Control previousFocusControl = control.getDisplay().getFocusControl(); control.setFocus(); SearchField field = (SearchField) searchField.getObject(); field.activate(previousFocusControl); } return null; }</code><technical_language>this check combined check in line 56? If (searchField== null && !searchField.isVisible())</technical_language>

Target:
public Object execute(ExecutionEvent executionEvent) { final IWorkbenchWindow window = HandlerUtil.getActiveWorkbenchWindow(executionEvent); if (window == null) { return null; } MWindow mWindow = ((WorkbenchWindow) window).getModel(); EModelService modelService = mWindow.getContext().get(EModelService.class); MToolControl searchField = (MToolControl) modelService.find("SearchField", mWindow); if (searchField == null || !searchField.isVisible() || !((WorkbenchWindow) window).isToolbarVisible()) { displayQuickAccessDialog(window, executionEvent.getCommand()); return null; } Control control = (Control) searchField.getWidget(); if (((WorkbenchWindow) window).isToolbarVisible() && control != null) { Control previousFocusControl = control.getDisplay().getFocusControl(); control.setFocus(); SearchField field = (SearchField) searchField.getObject(); field.activate(previousFocusControl); } return null; }
Source:
<code>public void handleRequest(HttpServerExchange serverExchange) throws Exception { String originalTenantName = getTenantName(serverExchange); if (originalTenantName == null || originalTenantName.startsWith("_")) { containerHandler.handleRequest(serverExchange); } else { String namespaceName = ""; String[] splitted = originalTenantName.split(","); for (int i=0; i<splitted.length; i++) { String namespaceID = namespaceListener.getNamespaceId(splitted[i]); if (namespaceID != null) { String tenantName; if (projectOverwrites.containsKey(namespaceID)) { tenantName = projectOverwrites.get(namespaceID); } else { tenantName = splitted[i] + ":" + namespaceID; } if (i < splitted.length - 1) { <START> tenantName += ","; <END> } namespaceName += tenantName; } else { log.error("Could not determine a namespace id for namespace " + namespaceID + ". Cannot process request. Returning an INTERNAL_SERVER_ERROR."); Utils.endExchange(serverExchange, INTERNAL_SERVER_ERROR); return; } } serverExchange.getRequestHeaders().remove(HAWKULAR_TENANT_HEADER_NAME); serverExchange.getRequestHeaders().put(new HttpString(HAWKULAR_TENANT_HEADER_NAME), namespaceName); containerHandler.handleRequest(serverExchange); } }</code><technical_language>This creates garbage I think.. in Java 8, String.join StringJoiner (simplifies code also) Combined StringBuilder is</technical_language>

Target:
public void handleRequest(HttpServerExchange serverExchange) throws Exception { String originalTenantName = getTenantName(serverExchange); if (originalTenantName == null || originalTenantName.startsWith("_")) { containerHandler.handleRequest(serverExchange); } else { StringJoiner namespaceName = new StringJoiner(","); String[] splitted = originalTenantName.split(","); for (String namespace: originalTenantName.split(",")) { String namespaceID = namespaceListener.getNamespaceId(namespace); if (namespaceID != null) { String tenantName; if (projectOverwrites.containsKey(namespaceID)) { tenantName = projectOverwrites.get(namespaceID); } else { tenantName = namespace + ":" + namespaceID; } namespaceName.add(tenantName); } else { log.info("Could not determine a namespace id for namespace " + namespaceID + ". Cannot process request. Returning an INTERNAL_SERVER_ERROR."); Utils.endExchange(serverExchange, INTERNAL_SERVER_ERROR, "Could not determine a namespace id for namespace " + namespaceID); return; } } serverExchange.getRequestHeaders().remove(HAWKULAR_TENANT_HEADER_NAME); serverExchange.getRequestHeaders().put(new HttpString(HAWKULAR_TENANT_HEADER_NAME), namespaceName.toString()); containerHandler.handleRequest(serverExchange); } }
Source:
<code>private void checkAppTarget() throws UnfullfilledRequirementsException { SharedPreferences prefs = CommCareApp.currentSandbox.getAppPreferences(); if (prefs.contains(KEY_TARGET_PACKAGE_ID)) { String targetPackage = prefs.getString(KEY_TARGET_PACKAGE_ID, ""); if (!StringUtils.isEmpty(targetPackage)) { String myAppPackage = CommCareApplication.instance().getPackageName(); if (!myAppPackage.contentEquals(targetPackage)) { throw new UnfullfilledRequirementsException( <START> "Your app doesn't match with this commcare flavour", <END> UnfullfilledRequirementsException.RequirementType.INCORRECT_TARGET_PACKAGE); } } } }</code><technical_language>This a more user-comprehensible. "This app requires [regular CommCare / CommCare LTS] installed"</technical_language>

Target:
private void checkAppTarget() throws UnfullfilledRequirementsException { SharedPreferences prefs = CommCareApp.currentSandbox.getAppPreferences(); if (prefs.contains(KEY_TARGET_PACKAGE_ID)) { String targetPackage = prefs.getString(KEY_TARGET_PACKAGE_ID, ""); if (!StringUtils.isEmpty(targetPackage)) { String myAppPackage = CommCareApplication.instance().getPackageName(); if (!myAppPackage.contentEquals(targetPackage)) { String error = "This app requires " + (targetPackage.contentEquals("org.commcare.lts") ? "Commcare LTS" : "Regular Commcare (Non LTS)") + " to be installed"; throw new UnfullfilledRequirementsException( error, UnfullfilledRequirementsException.RequirementType.INCORRECT_TARGET_PACKAGE); } } } }
Source:
<code>public static byte[] parseHex(String string) { try { <START> return Hex.decodeHex(string.toCharArray()); <END> } catch (DecoderException e) { throw new RuntimeException(e); } }</code><technical_language>do need this change</technical_language>

Target:
public static byte[] parseHex(String string) { try { return Hex.decodeHex(string); } catch (DecoderException e) { throw new RuntimeException(e); } }
Source:
<code>private TitleAreaFilterDialogWithEmptyOptions createEObjectAttributePicker(final String title) { final HashSet<String> set = new HashSet<String>(); Collection<EObject> allEObjects = getAllEObjects(); for (EObject obj : allEObjects) { for (EAttribute attribute : obj.eClass().getEAllAttributes()) { set.add(attribute.getName()); } } final ArrayList<String> sorted = new ArrayList<String>(set); Collections.sort(sorted); ILabelProvider renderer = new LabelProvider() { @Override public String getText(Object element) { return String.valueOf(element); } }; TitleAreaFilterDialogWithEmptyOptions dlg = new TitleAreaFilterDialogWithEmptyOptions(context.get(Shell.class), renderer) { @Override protected Control createContents(Composite parent) { Control ret = super.createContents(parent); setMessage("Select an attribute"); try { <START> setTitleImage(new Image(getShell().getDisplay(), new URL("platform:/plugin/org.eclipse.e4.tools.emf.ui/icons/full/wizban/attribute_wiz.gif").openStream())); <END> } catch (Exception e) { e.printStackTrace(); } setTitle(title); setElements(sorted.toArray(new String[0])); return ret; } }; return dlg; }</code><technical_language>anonymous "new Image()" is a resource leak. Please some kind of resourcepool</technical_language>

Target:
private TitleAreaFilterDialogWithEmptyOptions createEObjectAttributePicker(final String title) { final HashSet<String> set = new HashSet<String>(); Collection<EObject> allEObjects = getAllEObjects(); for (EObject obj : allEObjects) { for (EAttribute attribute : obj.eClass().getEAllAttributes()) { set.add(attribute.getName()); } } final ArrayList<String> sorted = new ArrayList<String>(set); Collections.sort(sorted); ILabelProvider renderer = new LabelProvider() { @Override public String getText(Object element) { return String.valueOf(element); } }; TitleAreaFilterDialogWithEmptyOptions dlg = new TitleAreaFilterDialogWithEmptyOptions(context.get(Shell.class), renderer) { @Override protected Control createContents(Composite parent) { Control ret = super.createContents(parent); setMessage("Select an attribute"); try { setTitleImage(imageCache.create("org.eclipse.e4.tools.emf.ui", "/icons/full/wizban/attribute_wiz.gif")); } catch (Exception e) { e.printStackTrace(); } setTitle(title); setElements(sorted.toArray(new String[0])); return ret; } }; return dlg; }