auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public List<Map<String, Object>> getAllAvailablePortletInfoList() throws SystemException, LanguageException, DotRuntimeException, PortalException { PortletAPI portletAPI = APILocator.getPortletAPI(); UserWebAPI uWebAPI = WebAPILocator.getUserWebAPI(); WebContext ctx = WebContextFactory.get(); HttpServletRequest request = ctx.getHttpServletRequest(); List<Map<String, Object>> listOfPortletsInfo = new ArrayList<Map<String,Object>>(); Collection<Portlet> portlets = portletAPI.findAllPortlets(); <START> for(Portlet p: portlets) { <END> if(portletAPI.canAddPortletToLayout(p)) { Map<String, Object> portletMap = new HashMap<String, Object>(); String portletTitle = LanguageUtil.get(uWebAPI.getLoggedInUser(request),"com.dotcms.repackage.javax.portlet.title." + p.getPortletId()); portletMap.put("title", portletTitle); portletMap.put("id", p.getPortletId()); listOfPortletsInfo.add(portletMap); } } Collections.sort(listOfPortletsInfo, new Comparator<Map<String, Object>>() { public int compare(Map<String, Object> o1, Map<String, Object> o2) { return ((String)o1.get("title")).compareTo(((String)o2.get("title"))); } }); return listOfPortletsInfo; }</code><technical_language>set final rename portlet</technical_language>

Target:
public List<Map<String, Object>> getAllAvailablePortletInfoList() throws SystemException, LanguageException, DotRuntimeException, PortalException { PortletAPI portletAPI = APILocator.getPortletAPI(); UserWebAPI uWebAPI = WebAPILocator.getUserWebAPI(); WebContext ctx = WebContextFactory.get(); HttpServletRequest request = ctx.getHttpServletRequest(); List<Map<String, Object>> listOfPortletsInfo = new ArrayList<Map<String,Object>>(); final Collection<Portlet> portlets = portletAPI.findAllPortlets(); for(final Portlet portlet: portlets) { if(portletAPI.canAddPortletToLayout(portlet)) { Map<String, Object> portletMap = new HashMap<String, Object>(); String portletTitle = LanguageUtil.get(uWebAPI.getLoggedInUser(request),"com.dotcms.repackage.javax.portlet.title." + portlet.getPortletId()); portletMap.put("title", portletTitle); portletMap.put("id", portlet.getPortletId()); listOfPortletsInfo.add(portletMap); } } Collections.sort(listOfPortletsInfo, new Comparator<Map<String, Object>>() { public int compare(Map<String, Object> o1, Map<String, Object> o2) { return ((String)o1.get("title")).compareTo(((String)o2.get("title"))); } }); return listOfPortletsInfo; }
Source:
<code>public ValueHolder<V> get(final K key) throws StoreAccessException { Chain chain = storeProxy.get(key.hashCode()); <START> Map.Entry<Operation<K>, Chain> entry = resolver.resolve(chain, key); <END> Chain compactedChain = entry.getValue(); storeProxy.replaceAtHead(key.hashCode(), chain, compactedChain); Operation<K> resolvedOperation = entry.getKey(); V value = null; if(resolvedOperation != null && resolvedOperation instanceof KeyValueOperation) { value = ((KeyValueOperation<K, V>)resolvedOperation).getValue(); } return new ClusteredValueHolder<V>(value); }</code><technical_language>I missed this usage of Map.Entry a tuple. I pretty is a type hiding sense ... indication is right needs refactoring</technical_language>

Target:
public ValueHolder<V> get(final K key) throws StoreAccessException { Chain chain = storeProxy.get(key.hashCode()); ResolvedChain<K> resolvedChain = resolver.resolve(chain, key); Chain compactedChain = resolvedChain.getCompactedChain(); storeProxy.replaceAtHead(key.hashCode(), chain, compactedChain); Operation<K> resolvedOperation = resolvedChain.getResolvedOperation(key); V value = null; if(resolvedOperation != null && resolvedOperation instanceof KeyValueOperation) { value = ((KeyValueOperation<K, V>)resolvedOperation).getValue(); } return new ClusteredValueHolder<V>(value); }
Source:
<code>public String getBorderStyle() { JavascriptExecutor js = (JavascriptExecutor)driver; WebElement selectedComponent = component.get(0); wait.forElementVisible(selectedComponent); selectedComponent.click(); String script = "return window.getComputedStyle(" + "document.querySelector('.active'),':before').getPropertyValue('Border')"; <START> return js.executeScript(script).toString(); <END> }</code><technical_language>js.execute(script).toString()</technical_language>

Target:
public String getBorderStyle() { JavascriptExecutor js = (JavascriptExecutor)driver; WebElement selectedComponent = component.get(0); wait.forElementClickable(selectedComponent); selectedComponent.click(); String script = "return window.getComputedStyle(" + "document.querySelector('.active'),':before').getPropertyValue('Border')"; return js.executeScript(script).toString(); }
Source:
<code>public static List<String> sanitizeColumnName(List<String> columnNames) throws DDFException { Preconditions.checkArgument(columnNames.size() > 0); List<String> ret = new ArrayList<>(); for (String name : columnNames) { Preconditions.checkArgument(name.length() > 0); String dashName = name.trim().replaceAll("![0-9a-zA-Z]|\\s", "_"); int i; <START> for (i = 0; i < dashName.length(); ++i) { <END> char c = name.charAt(i); boolean isAlpha = ((c >= 'a' && c <= 'z') || (c >= 'A' && c <='Z')); if (isAlpha) { ret.add(dashName.substring(i)); break; } } if (i == dashName.length()) { throw new DDFException(String.format("Not valid column name: %s", name)); } } HashSet<String> nameSet = new HashSet<>(); for (int i = 0; i < ret.size(); ++i) { String validName = ret.get(i); String attemptName = new String(validName); int j = 0; while (true) { if (!nameSet.contains(attemptName)) { nameSet.add(attemptName); ret.set(i, attemptName); break; } else { attemptName = String.format("%s%s%s", validName, "_", String.valueOf(j)); ++j; } } } return ret; }</code><technical_language>do need this code piece replaced alpha-numeric chars _? @PangZhi</technical_language>

Target:
public static List<String> sanitizeColumnName(List<String> columnNames) throws DDFException { Preconditions.checkArgument(columnNames.size() > 0); List<String> ret = new ArrayList<>(); for (String name : columnNames) { Preconditions.checkArgument(name.length() > 0); String dashName = name.trim().replaceAll("![0-9a-zA-Z]|\\s", "_"); int i; for (i = 0; i < dashName.length(); ++i) { char c = name.charAt(i); boolean isAlpha = ((c >= 'a' && c <= 'z') || (c >= 'A' && c <='Z')); if (isAlpha) { ret.add(dashName.substring(i)); break; } } if (i == dashName.length()) { throw new DDFException(String.format("Not valid column name: %s", name)); } } HashSet<String> nameSet = new HashSet<>(); for (int i = 0; i < ret.size(); ++i) { String validName = ret.get(i); String attemptName = new String(validName); int j = 0; while (true) { if (!nameSet.contains(attemptName.toLowerCase())) { nameSet.add(attemptName.toLowerCase()); ret.set(i, attemptName); break; } else { attemptName = String.format("%s%s%s", validName, "_", String.valueOf(j)); ++j; } } } return ret; }
Source:
<code>public void testOutputSourceMapContainsSourcesContent() { String inputString = "[{\"src\": \"\", \"path\": \"base.js\"}," + "{\"src\": \"alert('foo');\", \"path\":\"foo.js\"}]"; args.add("--json_streams=BOTH"); args.add("--chunk=m1:1"); args.add("--chunk=m2:1:m1"); args.add("--source_map_include_content"); CommandLineRunner runner = new CommandLineRunner( args.toArray(new String[] {}), new ByteArrayInputStream(inputString.getBytes(UTF_8)), new PrintStream(outReader), new PrintStream(errReader)); lastCompiler = runner.getCompiler(); try { runner.doRun(); } catch (IOException e) { e.printStackTrace(); assertWithMessage("Unexpected exception " + e).fail(); } String output = new String(outReader.toByteArray(), UTF_8); <START> assertThat(output).contains("\\\"sourcesContent\\\":"); <END> }</code><technical_language>care is "sourcesContent"? reasonable assert exact content of output? a reader intimately familiar output *should* like, a lot for test like. I realize more prone "spurious" breakages, pretty easy fix happen</technical_language>

Target:
public void testOutputSourceMapContainsSourcesContent() { String inputString = "[{\"src\": \"\", \"path\": \"base.js\"}," + "{\"src\": \"alert('foo');\", \"path\":\"foo.js\"}]"; args.add("--json_streams=BOTH"); args.add("--chunk=m1:1"); args.add("--chunk=m2:1:m1"); args.add("--source_map_include_content"); CommandLineRunner runner = new CommandLineRunner( args.toArray(new String[] {}), new ByteArrayInputStream(inputString.getBytes(UTF_8)), new PrintStream(outReader), new PrintStream(errReader)); lastCompiler = runner.getCompiler(); try { runner.doRun(); } catch (IOException e) { e.printStackTrace(); assertWithMessage("Unexpected exception " + e).fail(); } String output = new String(outReader.toByteArray(), UTF_8); assertThat(output) .isEqualTo( "[{\"src\":\"\\n\",\"path\":\"./m1.js\",\"source_map\":\"{\\n\\\"version\\\":3," + "\\n\\\"file\\\":\\\"./m1.js\\\",\\n\\\"lineCount\\\":1,\\n\\\"mappings\\\":\\\";\\\"" + ",\\n\\\"sources\\\":[],\\n\\\"names\\\":[]\\n}\\n\"},{\"src\":\"alert(\\\"foo\\\");" + "\\n\",\"path\":\"./m2.js\",\"source_map\":\"{\\n\\\"version\\\":3,\\n\\\"file\\\":" + "\\\"./m2.js\\\",\\n\\\"lineCount\\\":1,\\n\\\"mappings\\\":\\\"AAAAA,KAAA,CAAM,KAAN;" + "\\\",\\n\\\"sources\\\":[\\\"foo.js\\\"],\\n\\\"sourcesContent\\\":[\\\"" + "alert('foo');\\\"],\\n\\\"names\\\":[\\\"alert\\\"]\\n}\\n\"}," + "{\"src\":\"\\n\",\"path\":\"./$weak$.js\",\"source_map\":\"{\\n\\\"version\\\":3,\\n" + "\\\"file\\\":\\\"./$weak$.js\\\",\\n\\\"lineCount\\\":1,\\n\\\"mappings\\\":\\\";" + "\\\",\\n\\\"sources\\\":[],\\n\\\"names\\\":[]\\n}\\n\"}]"); }
Source:
<code>public void shouldThrowExcepionBecauseObservableEmittedUnexpectedItemAfterExpectedSequence() { final Queue<String> expectedValues = new LinkedList<String>(); expectedValues.add("1"); expectedValues.add("2"); expectedValues.add("3"); final PublishSubject<String> publishSubject = PublishSubject.create(); final AbstractEmissionChecker<String> emissionChecker = new AbstractEmissionChecker<String>(expectedValues) { @NonNull @Override public Subscription subscribe() { return publishSubject .subscribe(new Action1<String>() { @Override public void call(String s) { onNextObtained(s); } }); } }; final Subscription subscription = emissionChecker.subscribe(); publishSubject.onNext("1"); publishSubject.onNext("2"); publishSubject.onNext("3"); emissionChecker.awaitNextExpectedValue(); emissionChecker.awaitNextExpectedValue(); emissionChecker.awaitNextExpectedValue(); emissionChecker.assertThatNoExpectedValuesLeft(); try { publishSubject.onNext("4"); failBecauseExceptionWasNotThrown(OnErrorNotImplementedException.class); } catch (OnErrorNotImplementedException expected) { assertThat(expected.getCause()) <START> .hasMessageStartingWith("Received emission, but no more emissions were expected: obtained "); <END> } finally { subscription.unsubscribe(); } }</code><technical_language>hasMessage(), leave for</technical_language>

Target:
public void shouldThrowExcepionBecauseObservableEmittedUnexpectedItemAfterExpectedSequence() { final Queue<String> expectedValues = new LinkedList<String>(); expectedValues.add("1"); expectedValues.add("2"); expectedValues.add("3"); final PublishSubject<String> publishSubject = PublishSubject.create(); final AbstractEmissionChecker<String> emissionChecker = new AbstractEmissionChecker<String>(expectedValues) { @NonNull @Override public Subscription subscribe() { return publishSubject .subscribe(new Action1<String>() { @Override public void call(String s) { onNextObtained(s); } }); } }; final Subscription subscription = emissionChecker.subscribe(); publishSubject.onNext("1"); publishSubject.onNext("2"); publishSubject.onNext("3"); emissionChecker.awaitNextExpectedValue(); emissionChecker.awaitNextExpectedValue(); emissionChecker.awaitNextExpectedValue(); emissionChecker.assertThatNoExpectedValuesLeft(); try { publishSubject.onNext("4"); failBecauseExceptionWasNotThrown(OnErrorNotImplementedException.class); } catch (OnErrorNotImplementedException expected) { assertThat(expected.getCause()) .hasMessage("Received emission, but no more emissions were expected: obtained 4, expectedValues = [], obtainedValues = []"); } finally { subscription.unsubscribe(); } }
Source:
<code>private void verifyDirectories(URIish u) { if (directory == null && gitDir == null) { directory = new File(u.getHumanishName() + (bare ? Constants.DOT_GIT : <START> "")); <END> } directoryExistsInitially = directory != null && directory.exists(); gitDirExistsInitially = gitDir != null && gitDir.exists(); validateDirs(directory, gitDir, bare); if (isNonEmptyDirectory(directory)) { throw new JGitInternalException(MessageFormat.format( JGitText.get().cloneNonEmptyDirectory, directory.getName())); } if (isNonEmptyDirectory(gitDir)) { throw new JGitInternalException(MessageFormat.format( JGitText.get().cloneNonEmptyDirectory, gitDir.getName())); } }</code><technical_language>silence non-externalized String warning in Eclipse appending //$NON-NLS-1$ semicolon fix is needed in org.eclipse.jgit.pgm.Clone line 103</technical_language>

Target:
void verifyDirectories(URIish u) { if (directory == null && gitDir == null) { directory = new File(u.getHumanishName() + (bare ? Constants.DOT_GIT : "")); } directoryExistsInitially = directory != null && directory.exists(); gitDirExistsInitially = gitDir != null && gitDir.exists(); validateDirs(directory, gitDir, bare); if (isNonEmptyDirectory(directory)) { throw new JGitInternalException(MessageFormat.format( JGitText.get().cloneNonEmptyDirectory, directory.getName())); } if (isNonEmptyDirectory(gitDir)) { throw new JGitInternalException(MessageFormat.format( JGitText.get().cloneNonEmptyDirectory, gitDir.getName())); } }
Source:
<code>public GitHubSCMSource() { <START> pullRequestMetadataCache = new ConcurrentHashMap<>(); <END> pullRequestContributorCache = new ConcurrentHashMap<>(); this.traits = new ArrayList<>(); this.repoOwner = ""; this.repository = ""; this.repositoryUrl = null; this.apiUri = GITHUB_URL; }</code><technical_language>is this. in lines 320-321 this. in lines 322-326</technical_language>

Target:
public GitHubSCMSource() { pullRequestMetadataCache = new ConcurrentHashMap<>(); pullRequestContributorCache = new ConcurrentHashMap<>(); traits = new ArrayList<>(); repoOwner = ""; repository = ""; repositoryUrl = null; apiUri = GITHUB_URL; }
Source:
<code>private void verifyActionResult(int[][] expectedLogs, String... params) { AdminActivityLogPageAction action = getAction(params); ShowPageResult result = getShowPageResult(action); <START> AdminActivityLogPageData page = (AdminActivityLogPageData) result.data; <END> List<ActivityLogEntry> actualLogs = page.getLogs(); verifyLogs(expectedLogs, actualLogs); }</code><technical_language>page -> pageData</technical_language>

Target:
private void verifyActionResult(int[][] expectedLogs, String... params) { AdminActivityLogPageAction action = getAction(params); ShowPageResult result = getShowPageResult(action); AdminActivityLogPageData pageData = (AdminActivityLogPageData) result.data; List<ActivityLogEntry> actualLogs = pageData.getLogs(); verifyLogs(expectedLogs, actualLogs); }
Source:
<code>public void init(final Context context) { final ImmutableSet.Builder<IncrementalResultExporter> exportersBuilder = ImmutableSet.builder(); for(final IncrementalResultExporterFactory builder : factories) { try { <START> System.out.println("QueryResultObserver.init(): for each exportersBuilder=" + builder); <END> final Optional<IncrementalResultExporter> exporter = builder.build(context); if(exporter.isPresent()) { exportersBuilder.add(exporter.get()); } } catch (final IncrementalExporterFactoryException e) { log.error("Could not initialize a result exporter.", e); } } exporters = exportersBuilder.build(); }</code><technical_language>log.debug</technical_language>

Target:
public void init(final Context context) { final ImmutableSet.Builder<IncrementalResultExporter> exportersBuilder = ImmutableSet.builder(); for(final IncrementalResultExporterFactory builder : factories) { try { log.debug("QueryResultObserver.init(): for each exportersBuilder=" + builder); final Optional<IncrementalResultExporter> exporter = builder.build(context); if(exporter.isPresent()) { exportersBuilder.add(exporter.get()); } } catch (final IncrementalExporterFactoryException e) { log.error("Could not initialize a result exporter.", e); } } exporters = exportersBuilder.build(); }
Source:
<code>public FeedbackSessionResultsBundle (FeedbackSessionAttributes feedbackSession, List<FeedbackResponseAttributes> responses, Map<String, FeedbackQuestionAttributes> questions, Map<String, String> emailNameTable, Map<String, String> emailLastNameTable, Map<String, String> emailTeamNameTable, Map<String, boolean[]> visibilityTable, FeedbackSessionResponseStatus responseStatus, CourseRoster roster, Map<String, List<FeedbackResponseCommentAttributes>> responseComments, boolean isComplete) { this.feedbackSession = feedbackSession; this.questions = questions; this.responses = responses; this.emailNameTable = emailNameTable; this.emailLastNameTable = emailLastNameTable; this.emailTeamNameTable = emailTeamNameTable; this.visibilityTable = visibilityTable; this.responseStatus = responseStatus; this.roster = roster; this.responseComments = responseComments; this.actualResponses = new ArrayList<FeedbackResponseAttributes>(); for (FeedbackResponseAttributes response : responses) { if (questions.get(response.feedbackQuestionId).giverType == FeedbackParticipantType.TEAMS){ response.giverEmail += Const.TEAM_OF_EMAIL_OWNER; } FeedbackResponseAttributes fraCopy = new FeedbackResponseAttributes(response); actualResponses.add(fraCopy); } this.isComplete = isComplete; hideResponsesGiverRecipient(responses, questions, emailNameTable, emailTeamNameTable, visibilityTable); <START> this.rosterTeamNameEmailTable = getTeamNameToStudentsTableFromRoster(roster); <END> this.rosterSectionTeamNameTable = getSectionToTeamNamesFromRoster(roster); }</code><technical_language>getTeamNameToEmailTableFromRoster()</technical_language>

Target:
public FeedbackSessionResultsBundle (FeedbackSessionAttributes feedbackSession, List<FeedbackResponseAttributes> responses, Map<String, FeedbackQuestionAttributes> questions, Map<String, String> emailNameTable, Map<String, String> emailLastNameTable, Map<String, String> emailTeamNameTable, Map<String, boolean[]> visibilityTable, FeedbackSessionResponseStatus responseStatus, CourseRoster roster, Map<String, List<FeedbackResponseCommentAttributes>> responseComments, boolean isComplete) { this.feedbackSession = feedbackSession; this.questions = questions; this.responses = responses; this.emailNameTable = emailNameTable; this.emailLastNameTable = emailLastNameTable; this.emailTeamNameTable = emailTeamNameTable; this.visibilityTable = visibilityTable; this.responseStatus = responseStatus; this.roster = roster; this.responseComments = responseComments; this.actualResponses = new ArrayList<FeedbackResponseAttributes>(); for (FeedbackResponseAttributes response : responses) { if (questions.get(response.feedbackQuestionId).giverType == FeedbackParticipantType.TEAMS){ response.giverEmail += Const.TEAM_OF_EMAIL_OWNER; } FeedbackResponseAttributes fraCopy = new FeedbackResponseAttributes(response); actualResponses.add(fraCopy); } this.isComplete = isComplete; hideResponsesGiverRecipient(); this.rosterTeamNameMembersTable = getTeamNameToEmailsTableFromRoster(roster); this.rosterSectionTeamNameTable = getSectionToTeamNamesFromRoster(roster); }
Source:
<code>private void restoreCollectionPreferences() { try { mShowNextReviewTime = getCol().getConf().getBoolean("estTimes"); mShowRemainingCardCount = getCol().getConf().getBoolean("dueCounts"); } catch (JSONException e) { throw new RuntimeException(); } catch (NullPointerException npe) { Intent deckPicker = new IntentTop(this, DeckPicker.class); deckPicker.putExtra("collectionLoadError", true); <START> deckPicker.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_NEW_TASK); <END> startActivityWithAnimation(deckPicker, ActivityTransitionAnimation.LEFT); } }</code><technical_language>A great deal of calls a FLAG_ACTIVITY_CLEAR_TOP redundantly added now, extra CLEAR_TOPs removed? - a - a add FLAG_ACTIVITY_NEW_TASK (so I assume some decisions tasks task affinity baked in). removing redundant flags, a Intent helper extending expressing (with a good name) idea of single top + new task used</technical_language>

Target:
private void restoreCollectionPreferences() { try { mShowNextReviewTime = getCol().getConf().getBoolean("estTimes"); mShowRemainingCardCount = getCol().getConf().getBoolean("dueCounts"); } catch (JSONException e) { throw new RuntimeException(); } catch (NullPointerException npe) { Intent deckPicker = new IntentTopNewTask(this, DeckPicker.class); deckPicker.putExtra("collectionLoadError", true); startActivityWithAnimation(deckPicker, ActivityTransitionAnimation.LEFT); } }
Source:
<code>public void initialize(TransformContext context) throws Exception { super.initialize(context); outSchema = config.getOutputSchema(); validateXpathAndSchema(); <START> mapErrorProcessing.put("Ignore error and continue", 1); <END> mapErrorProcessing.put("Exit on error", 2); mapErrorProcessing.put("Write to error dataset", 3); }</code><technical_language>I String constants in this class, instead of encoded in a map this. switch statement easier understand also</technical_language>

Target:
public void initialize(TransformContext context) throws Exception { super.initialize(context); outSchema = config.getOutputSchema(); xPathMapping = getXPathMapping(); }
Source:
<code>public void close() throws IOException { baseMap.clear(); <START> byteCountingLRUMap.clear(); <END> }</code><technical_language>clear namespaceId map</technical_language>

Target:
public void close() throws IOException { baseMap.clear(); byteCountingLRUMap.clear(); namespaceId.clear(); }
Source:
<code>public void testPhiroIfBrickDelete() { <START> onScriptList().atPosition(brickPosition).onChildView(withText(R.string.brick_phiro_sensor_begin)).perform(click()); <END> onView(withText(R.string.brick_context_dialog_delete_brick)) .perform(click()); onView(withText(R.string.yes)) .perform(click()); onView(withId(R.string.brick_phiro_sensor_begin)).check(doesNotExist()); onView(withId(R.string.brick_if_else)).check(doesNotExist()); onView(withId(R.string.brick_if_end)).check(doesNotExist()); }</code><technical_language>code style. .perform .check in a new line</technical_language>

Target:
public void testPhiroIfBrickDelete() { Script currentScript = ProjectManager.getInstance().getCurrentScript(); Assert.assertEquals(currentScript.getBrickList().size(), 3); Assert.assertEquals(currentScript.containsBrickOfType(PhiroIfLogicBeginBrick.class), true); Assert.assertEquals(currentScript.containsBrickOfType(IfLogicElseBrick.class), true); Assert.assertEquals(currentScript.containsBrickOfType(IfLogicEndBrick.class), true); onScriptList().atPosition(brickPosition).onChildView(withText(R.string.brick_phiro_sensor_begin)) .perform(click()); onView(withText(R.string.brick_context_dialog_delete_brick)) .perform(click()); onView(withText(R.string.yes)) .perform(click()); currentScript = ProjectManager.getInstance().getCurrentScript(); Assert.assertEquals(currentScript.getBrickList().size(), 0); Assert.assertEquals(currentScript.containsBrickOfType(PhiroIfLogicBeginBrick.class), false); Assert.assertEquals(currentScript.containsBrickOfType(IfLogicElseBrick.class), false); Assert.assertEquals(currentScript.containsBrickOfType(IfLogicEndBrick.class), false); }
Source:
<code>public static boolean matches(String arg) { if (arg.startsWith("bigdoor@")) { return true; } <START> return valueOf(arg) != null; <END> }</code><technical_language>CoreUtilities.noDebugContext</technical_language>

Target:
public static boolean matches(String arg) { if (arg.startsWith("bigdoor@")) { return true; } return valueOf(arg, CoreUtilities.noDebugContext) != null; }
Source:
<code>public void filter(ContainerRequestContext context) throws IOException { String path = ui.getPath(); if (path.endsWith("books/checkN")) { URI requestURI = URI.create(path.replace("N", "2")); context.setRequestUri(requestURI); String body = IOUtils.readStringFromStream(context.getEntityStream()); if (!"s".equals(body)) { throw new RuntimeException(); } replaceStream(context); } else if (path.endsWith("books/check2")) { replaceStream(context); } else if (path.endsWith("books/checkNQuery")) { <START> URI requestURI = URI.create(path.replace("NQuery", "2")); <END> context.setRequestUri(requestURI); replaceStream(context); } }</code><technical_language>Hmm... I fully understand. I test broken start effectively setting RequestUri /bookstore/books/check2?a=b?a=b - previous behavior (prior #697) simply ignore query string test passed URI invalid. #697 test failed checking query string. I test case fine, try illustrate happening change after, for simplicity I include URI method arguments. before: containerRequestContext.setRequestUri("/bookstore/books/check2?a=b") m.get(Message.REQUEST_URI) -> /bookstore/books/check2 m.get(Message.QUERY_STRING) -> a=b change: containerRequestContext.setRequestUri("/bookstore/books/check2?a=b") m.get(Message.REQUEST_URI) -> /bookstore/books/check2?a=b m.get(Message.QUERY_STRING) -> a=b see, Message.REQUEST_URI raw path before, - full URI. causing issues. I places raw URI is find matching methods invoke fe</technical_language>

Target:
public void filter(ContainerRequestContext context) throws IOException { String path = ui.getPath(); if (path.endsWith("books/checkN")) { URI requestURI = URI.create(path.replace("N", "2")); context.setRequestUri(requestURI); String body = IOUtils.readStringFromStream(context.getEntityStream()); if (!"s".equals(body)) { throw new RuntimeException(); } replaceStream(context); } else if (path.endsWith("books/check2")) { replaceStream(context); } else if (path.endsWith("books/checkNQuery")) { URI requestURI = URI.create(path.replace("NQuery", "2?a=b")); context.setRequestUri(requestURI); replaceStream(context); } }
Source:
<code>public Map<Long, LogData> FetchGarbageEntries(Iterable<Long> addresses) { <START> Map<Long, LogData> result = new HashMap<>(); <END> Iterable<List<Long>> batches = Iterables.partition(addresses, runtime.getParameters().getBulkReadSize()); for (List<Long> batch : batches) { Map<Long, LogData> batchResult = layoutHelper(e -> FetchGarbageEntryBatch(batch, e)); result.putAll(batchResult); } return result; }</code><technical_language>TreeMap order</technical_language>

Target:
public Map<Long, LogData> FetchGarbageEntries(Iterable<Long> addresses) { Iterable<List<Long>> batches = Iterables.partition(addresses, runtime.getParameters().getBulkReadSize()); return layoutHelper(e -> { Map<Long, LogData> garbageEntries = new TreeMap<>(); for (List<Long> batch : batches) { Map<Long, LogData> batchResult = FetchGarbageEntryBatch(batch, e); garbageEntries.putAll(batchResult); } return garbageEntries; }); }
Source:
<code>public void updated(Dictionary<String, ?> config) throws ConfigurationException { logger.debug("HEATMISER updated() method is called!"); if (config != null) { String refreshIntervalString = (String) config.get("refresh"); if (StringUtils.isNotBlank(refreshIntervalString)) { refreshInterval = Long.parseLong(refreshIntervalString); } String localAddress = (String) config.get("address"); if (StringUtils.isNotBlank(localAddress)) { ipAddress = localAddress; } String portConfig = (String) config.get("port"); if (StringUtils.isNotBlank(portConfig)) { ipPort = Integer.parseInt(portConfig); } else { <START> ipPort = 1024; <END> } listen(); setProperlyConfigured(true); } }</code><technical_language>please refactor number a constant member field</technical_language>

Target:
public void updated(Dictionary<String, ?> config) throws ConfigurationException { logger.debug("HEATMISER updated() method is called!"); if (config != null) { String refreshIntervalString = (String) config.get("refresh"); if (StringUtils.isNotBlank(refreshIntervalString)) { refreshInterval = Long.parseLong(refreshIntervalString); } String localAddress = (String) config.get("address"); if (StringUtils.isNotBlank(localAddress)) { ipAddress = localAddress; } String portConfig = (String) config.get("port"); if (StringUtils.isNotBlank(portConfig)) { ipPort = Integer.parseInt(portConfig); } else { ipPort = DefaultPort; } listen(); setProperlyConfigured(true); } }
Source:
<code>private void setSupportedResolution(Camera camera) { Camera.Parameters parameters = camera.getParameters(); List<Camera.Size> <START> previewSizes = <END> parameters.getSupportedVideoSizes(); for (Camera.Size size : previewSizes) { if (size.width == VIDEO_WIDTH && size.height == VIDEO_HEIGHT) { mVideoWidth = VIDEO_WIDTH; mVideoHeight = VIDEO_HEIGHT; return; } } mVideoWidth = previewSizes.get(0).width; mVideoHeight = previewSizes.get(0).height; }</code><technical_language>want rename videoSizes</technical_language>

Target:
private void setSupportedResolution(Camera camera) { Camera.Parameters parameters = camera.getParameters(); List<Camera.Size> videoSizes = parameters.getSupportedVideoSizes(); for (Camera.Size size : videoSizes) { if (size.width == VIDEO_WIDTH && size.height == VIDEO_HEIGHT) { mVideoWidth = VIDEO_WIDTH; mVideoHeight = VIDEO_HEIGHT; return; } } mVideoWidth = videoSizes.get(0).width; mVideoHeight = videoSizes.get(0).height; }
Source:
<code>public static Optional<FileType> getFileType(String descriptorType) { <START> for (DescriptorLanguage lang : values()) { <END> if ((StringUtils.containsIgnoreCase(descriptorType, lang.toString()))) { return Optional.of(lang.getFileType()); } } return Optional.empty(); }</code><technical_language>alternatively write this line 114 method a stream findFirst(). though, making a conscious effort way</technical_language>

Target:
public static Optional<FileType> getFileType(String descriptorType) { return Arrays.stream(DescriptorLanguage.values()) .filter(lang -> StringUtils.containsIgnoreCase(descriptorType, lang.toString())).findFirst().map(DescriptorLanguage::getFileType); }
Source:
<code>public Ds3ResponseCode toDs3ResponseCode() { <START> Ds3ResponseCode ds3ResponseCode = new Ds3ResponseCode(code, toDs3ResponseTypes()); <END> return ds3ResponseCode; }</code><technical_language>Missing final</technical_language>

Target:
public Ds3ResponseCode toDs3ResponseCode() { final Ds3ResponseCode ds3ResponseCode = new Ds3ResponseCode(code, toDs3ResponseTypes()); return ds3ResponseCode; }
Source:
<code>public static com.azure.search.documents.indexes.implementation.models.StopwordsTokenFilter map(StopwordsTokenFilter obj) { if (obj == null) { return null; } com.azure.search.documents.indexes.implementation.models.StopwordsTokenFilter stopwordsTokenFilter = new com.azure.search.documents.indexes.implementation.models.StopwordsTokenFilter(); String name = obj.getName(); stopwordsTokenFilter.setName(name); <START> Boolean removeTrailingStopWords = obj.isTrailingStopWordsRemoved(); <END> stopwordsTokenFilter.setRemoveTrailingStopWords(removeTrailingStopWords); Boolean ignoreCase = obj.isCaseIgnored(); stopwordsTokenFilter.setIgnoreCase(ignoreCase); if (obj.getStopwords() != null) { List<String> stopwords = new ArrayList<>(obj.getStopwords()); stopwordsTokenFilter.setStopwords(stopwords); } if (obj.getStopwordsList() != null) { com.azure.search.documents.indexes.implementation.models.StopwordsList stopwordsList = StopwordsListConverter.map(obj.getStopwordsList()); stopwordsTokenFilter.setStopwordsList(stopwordsList); } return stopwordsTokenFilter; }</code><technical_language>areTrailingStopwordsRemoved</technical_language>

Target:
public static com.azure.search.documents.indexes.implementation.models.StopwordsTokenFilter map(StopwordsTokenFilter obj) { if (obj == null) { return null; } com.azure.search.documents.indexes.implementation.models.StopwordsTokenFilter stopwordsTokenFilter = new com.azure.search.documents.indexes.implementation.models.StopwordsTokenFilter(); String name = obj.getName(); stopwordsTokenFilter.setName(name); Boolean removeTrailingStopWords = obj.areTrailingStopWordsRemoved(); stopwordsTokenFilter.setRemoveTrailingStopWords(removeTrailingStopWords); Boolean ignoreCase = obj.isCaseIgnored(); stopwordsTokenFilter.setIgnoreCase(ignoreCase); if (obj.getStopwords() != null) { List<String> stopwords = new ArrayList<>(obj.getStopwords()); stopwordsTokenFilter.setStopwords(stopwords); } if (obj.getStopwordsList() != null) { com.azure.search.documents.indexes.implementation.models.StopwordsList stopwordsList = StopwordsListConverter.map(obj.getStopwordsList()); stopwordsTokenFilter.setStopwordsList(stopwordsList); } return stopwordsTokenFilter; }
Source:
<code>public void processAdminDistribution(EDXLDistribution body, AssertionType assertion) { <START> GenericDBUtils.logInfoServiceProcess(this.getClass()); <END> sendToAdapter(body, assertion, adminUtils, adapterFactory); }</code><technical_language>is point of logs here? "Flag service processing debug: PassthroughInboundAdminDistribution" outputted</technical_language>

Target:
public void processAdminDistribution(EDXLDistribution body, AssertionType assertion) { logInfoServiceProcess(this.getClass()); sendToAdapter(body, assertion, adminUtils, adapterFactory); }
Source:
<code>public void testCreateSSLContext_validCustomSSLContextClass() throws X509Exception.SSLContextException { ZKConfig zkConfig = new ZKConfig(); ClientX509Util clientX509Util = new ClientX509Util(); zkConfig.setProperty(clientX509Util.getSslContextSupplierClassProperty(), X509UtilTest.class.getCanonicalName() + "$" + SslContextSupplier.class.getSimpleName()); final SSLContext sslContext = clientX509Util.createSSLContext(zkConfig); <START> assertNotNull(sslContext); <END> }</code><technical_language>nit: I this assertEquals(SSLContext.getDefault(), sslContext)</technical_language>

Target:
public void testCreateSSLContext_validCustomSSLContextClass() throws Exception { ZKConfig zkConfig = new ZKConfig(); ClientX509Util clientX509Util = new ClientX509Util(); zkConfig.setProperty(clientX509Util.getSslContextSupplierClassProperty(), SslContextSupplier.class.getName()); final SSLContext sslContext = clientX509Util.createSSLContext(zkConfig); Assert.assertEquals(SSLContext.getDefault(), sslContext); }
Source:
<code>public void testGetTrackInfo() throws InterruptedException { prepareLooper(); final CountDownLatch latch = new CountDownLatch(1); final List<SessionPlayer.TrackInfo> testTracks = TestUtils.createTrackInfoList(); final ControllerCallback callback = new ControllerCallback() { @Override public void onTrackInfoChanged(MediaController controller, List<SessionPlayer.TrackInfo> trackInfos) { for (int i = 0; i < testTracks.size(); i++) { SessionPlayer.TrackInfo track = testTracks.get(i); SessionPlayer.TrackInfo trackFromController = trackInfos.get(i); assertEquals(track, trackFromController); <START> assertEquals(track.getId(), trackFromController.getId()); <END> assertEquals(track.getLanguage(), trackFromController.getLanguage()); assertEquals(track.getTrackType(), trackFromController.getTrackType()); } } }; MediaController controller = createController(mSession.getToken(), true, null, callback); mPlayer.notifyTrackInfoChanged(testTracks); assertTrue(latch.await(TIMEOUT_MS, TimeUnit.MILLISECONDS)); }</code><technical_language>Is sufficient compare getId() TrackInfo#equals considers mId? (ditto for others)</technical_language>

Target:
public void testGetTrackInfo() throws InterruptedException { prepareLooper(); final CountDownLatch latch = new CountDownLatch(1); final List<SessionPlayer.TrackInfo> testTracks = TestUtils.createTrackInfoList(); final ControllerCallback callback = new ControllerCallback() { @Override public void onTrackInfoChanged(MediaController controller, List<SessionPlayer.TrackInfo> trackInfos) { assertEquals(testTracks.size(), trackInfos.size()); for (int i = 0; i < testTracks.size(); i++) { SessionPlayer.TrackInfo track = testTracks.get(i); SessionPlayer.TrackInfo trackFromController = trackInfos.get(i); assertEquals(track, trackFromController); assertEquals(track.getLanguage(), trackFromController.getLanguage()); assertEquals(track.getTrackType(), trackFromController.getTrackType()); } latch.countDown(); } }; MediaController controller = createController(mSession.getToken(), true, null, callback); mPlayer.notifyTrackInfoChanged(testTracks); assertTrue(latch.await(TIMEOUT_MS, TimeUnit.MILLISECONDS)); }
Source:
<code>private StoreFileInfo(final Configuration conf, final FileSystem fs, final FileStatus fileStatus, final Path initialPath, final boolean primaryReplica) throws IOException { assert fs != null; assert initialPath != null; assert conf != null; this.fs = fs; this.conf = conf; this.initialPath = initialPath; this.primaryReplica = primaryReplica; this.noReadahead = this.conf.getBoolean(STORE_FILE_READER_NO_READAHEAD, DEFAULT_STORE_FILE_READER_NO_READAHEAD); Path p = initialPath; if (HFileLink.isHFileLink(p)) { this.reference = null; this.link = HFileLink.buildFromHFileLinkPattern(conf, p); LOG.trace("{} is a link", p); } else if (isReference(p)) { this.reference = Reference.read(fs, p); Path referencePath = getReferredToFile(p); if (HFileLink.isHFileLink(referencePath)) { this.link = HFileLink.buildFromHFileLinkPattern(conf, referencePath); } else { this.link = null; } LOG.trace("{} is a reference to {}", p, reference.getFileRegion(), referencePath); } else if (isHFile(p) || isMobFile(p) || isMobRefFile(p)) { if (fileStatus != null) { this.localStatus = fileStatus; <START> }else{ <END> this.localStatus = loadAndCacheFileStatus(fs); } this.createdTimestamp = localStatus.getModificationTime(); this.size = localStatus.getLen(); this.reference = null; this.link = null; } else { throw new IOException("path=" + p + " doesn't look like a valid StoreFile"); } if(this.localStatus == null ){ this.localStatus = loadAndCacheFileStatus(fs); } }</code><technical_language>Please style of surrounding file; i.e. space '}' 'else' after</technical_language>

Target:
private StoreFileInfo(final Configuration conf, final FileSystem fs, final FileStatus fileStatus, final Path initialPath, final boolean primaryReplica) throws IOException { assert fs != null; assert initialPath != null; assert conf != null; this.fs = fs; this.conf = conf; this.initialPath = initialPath; this.primaryReplica = primaryReplica; this.noReadahead = this.conf.getBoolean(STORE_FILE_READER_NO_READAHEAD, DEFAULT_STORE_FILE_READER_NO_READAHEAD); Path p = initialPath; if (HFileLink.isHFileLink(p)) { this.reference = null; this.link = HFileLink.buildFromHFileLinkPattern(conf, p); LOG.trace("{} is a link", p); } else if (isReference(p)) { this.reference = Reference.read(fs, p); Path referencePath = getReferredToFile(p); if (HFileLink.isHFileLink(referencePath)) { this.link = HFileLink.buildFromHFileLinkPattern(conf, referencePath); } else { this.link = null; } LOG.trace("{} is a reference to {}", p, reference.getFileRegion(), referencePath); } else if (isHFile(p) || isMobFile(p) || isMobRefFile(p)) { if (fileStatus != null) { this.localStatus = fileStatus; } else { this.localStatus = loadAndCacheFileStatus(fs); } this.createdTimestamp = localStatus.getModificationTime(); this.size = localStatus.getLen(); this.reference = null; this.link = null; } else { throw new IOException("path=" + p + " doesn't look like a valid StoreFile"); } }
Source:
<code>public static void submitHadoopFSJob( String projectId, String region, String clusterName, String hadoopFSQuery) throws IOException, InterruptedException { String myEndpoint = String.format("%s-dataproc.googleapis.com:443", region); JobControllerSettings jobControllerSettings = JobControllerSettings.newBuilder().setEndpoint(myEndpoint).build(); try (JobControllerClient jobControllerClient = JobControllerClient.create(jobControllerSettings)) { JobPlacement jobPlacement = JobPlacement.newBuilder().setClusterName(clusterName).build(); HadoopJob hadoopJob = HadoopJob.newBuilder() .setMainClass("org.apache.hadoop.fs.FsShell") .addAllArgs(stringToList(hadoopFSQuery)) .build(); Job job = Job.newBuilder().setPlacement(jobPlacement).setHadoopJob(hadoopJob).build(); OperationFuture<Job, JobMetadata> submitJobAsOperationAsyncRequest = jobControllerClient.submitJobAsOperationAsync(projectId, region, job); <START> Job response = submitJobAsOperationAsyncRequest.get(); <END> Matcher matches = Pattern.compile("gs://(.*?)/(.*)").matcher(response.getDriverOutputResourceUri()); matches.matches(); Storage storage = StorageOptions.getDefaultInstance().getService(); Blob blob = storage.get(matches.group(1), String.format("%s.000000000", matches.group(2))); System.out.println(String.format("Job \"%s\" finished: %s", response.getReference().getJobId(), new String(blob.getContent()))); } catch (ExecutionException e) { System.err.println(String.format("submitHadoopFSJob: %s ", e.getMessage())); } }</code><technical_language>this Job fail throw exceptions caught handled</technical_language>

Target:
public static void submitHadoopFSJob( String projectId, String region, String clusterName, String hadoopFSQuery) throws IOException, InterruptedException { String myEndpoint = String.format("%s-dataproc.googleapis.com:443", region); JobControllerSettings jobControllerSettings = JobControllerSettings.newBuilder().setEndpoint(myEndpoint).build(); try (JobControllerClient jobControllerClient = JobControllerClient.create(jobControllerSettings)) { JobPlacement jobPlacement = JobPlacement.newBuilder().setClusterName(clusterName).build(); HadoopJob hadoopJob = HadoopJob.newBuilder() .setMainClass("org.apache.hadoop.fs.FsShell") .addAllArgs(stringToList(hadoopFSQuery)) .build(); Job job = Job.newBuilder().setPlacement(jobPlacement).setHadoopJob(hadoopJob).build(); OperationFuture<Job, JobMetadata> submitJobAsOperationAsyncRequest = jobControllerClient.submitJobAsOperationAsync(projectId, region, job); Job response = submitJobAsOperationAsyncRequest.get(); Matcher matches = Pattern.compile("gs://(.*?)/(.*)").matcher(response.getDriverOutputResourceUri()); matches.matches(); Storage storage = StorageOptions.getDefaultInstance().getService(); Blob blob = storage.get(matches.group(1), String.format("%s.000000000", matches.group(2))); System.out.println( String.format("Job finished successfully: %s", new String(blob.getContent()))); } catch (ExecutionException e) { System.err.println(String.format("submitHadoopFSJob: %s ", e.getMessage())); } }
Source:
<code>public void addIncludedGroup(final AccountGroup.Id groupId, final String groupName, final AsyncCallback<GroupDetail> callback) { run(callback, new Action<GroupDetail>() { public GroupDetail run(ReviewDb db) throws OrmException, Failure, NoSuchGroupException { final GroupControl control = groupControlFactory.validateFor(groupId); if (control.getAccountGroup().getType() != AccountGroup.Type.INTERNAL) { throw new Failure(new NameAlreadyUsedException()); } final AccountGroup a = findGroup(groupName); if (!control.canAddGroup(a.getId())) { throw new Failure(new NoSuchEntityException()); } final AccountGroupIncludedGroup.Key key = new AccountGroupIncludedGroup.Key(groupId, a.getId()); <START> AccountGroupIncludedGroup m = db.accountGroupIncludedGroups().get(key); <END> if (m == null) { m = new AccountGroupIncludedGroup(key); db.accountGroupIncludedGroupsAudit().insert( Collections.singleton(new AccountGroupIncludedGroupAudit(m, getAccountId()))); db.accountGroupIncludedGroups().insert(Collections.singleton(m)); includedGroupCache.evictGroup(groupId); includedGroupCache.evictIncludedGroup(a.getId()); } return groupDetailFactory.create(groupId).call(); } }); }</code><technical_language>I indentation is messed here, this level left</technical_language>

Target:
public void addIncludedGroup(final AccountGroup.Id groupId, final String groupName, final AsyncCallback<GroupDetail> callback) { run(callback, new Action<GroupDetail>() { public GroupDetail run(ReviewDb db) throws OrmException, Failure, NoSuchGroupException { final GroupControl control = groupControlFactory.validateFor(groupId); if (control.getAccountGroup().getType() != AccountGroup.Type.INTERNAL) { throw new Failure(new NameAlreadyUsedException()); } final AccountGroup a = findGroup(groupName); if (!control.canAddGroup(a.getId())) { throw new Failure(new NoSuchEntityException()); } final AccountGroupIncludedGroup.Key key = new AccountGroupIncludedGroup.Key(groupId, a.getId()); AccountGroupIncludedGroup m = db.accountGroupIncludedGroups().get(key); if (m == null) { m = new AccountGroupIncludedGroup(key); db.accountGroupIncludedGroupsAudit().insert( Collections.singleton(new AccountGroupIncludedGroupAudit(m, getAccountId()))); db.accountGroupIncludedGroups().insert(Collections.singleton(m)); includedGroupCache.evictIncludedGroup(a.getId()); } return groupDetailFactory.create(groupId).call(); } }); }
Source:
<code>default StreamPriority getStreamPriority() { <START> return StreamPriority.DEFAULT; <END> }</code><technical_language>return null instead is priority</technical_language>

Target:
default StreamPriority getStreamPriority() { return null; }
Source:
<code>public Menu generatePanelMenu() { Menu panelMenu = new Menu("Panels"); Menu autoCreatePanelMenu = new Menu("Auto-create"); List<MenuItem> items = new ArrayList<>(); List<MenuItem> autoCreateItems = new ArrayList<>(); items.add(createLeftPanelMenuItem()); items.add(createRightPanelMenuItem()); items.add(closePanelMenuItem()); for (Map.Entry<String, String> entry : <START> generateCustomizedPanelDetails(prefs.getLastLoginUsername()).entrySet()) { <END> autoCreateItems.add(createCustomizedPanelMenuItem(entry.getKey(), entry.getValue())); } autoCreatePanelMenu.getItems().addAll(autoCreateItems); panelMenu.getItems().addAll(items); panelMenu.getItems().add(autoCreatePanelMenu); return panelMenu; }</code><technical_language>This part verbose. Method names shortened (customPanelDetails?). If needed, give names intermediate values</technical_language>

Target:
public Menu generatePanelMenu() { Menu panelMenu = new Menu("Panels"); Menu autoCreatePanelMenu = new Menu("Auto-create"); List<MenuItem> items = new ArrayList<>(); List<MenuItem> autoCreateItems = new ArrayList<>(); items.add(createLeftPanelMenuItem()); items.add(createRightPanelMenuItem()); items.add(closePanelMenuItem()); for (Entry<String, String> entry : generatePanelDetails(currentUsername).entrySet()) { autoCreateItems.add(createPanelMenuItem(entry.getKey(), entry.getValue())); } autoCreatePanelMenu.getItems().addAll(autoCreateItems); panelMenu.getItems().addAll(items); panelMenu.getItems().add(autoCreatePanelMenu); return panelMenu; }
Source:
<code>private void createButton(Composite parent) { artifactSelectButton = new Button(parent, SWT.PUSH); <START> artifactSelectButton.setText(String.format("Select " + itemName)); <END> artifactSelectButton.addListener(SWT.Selection, new Listener() { @Override public void handleEvent(Event event) { handleSelectedArtifact(event); notifyListener(event); } }); artifactSelectButton.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_FILL)); }</code><technical_language>is here, String.format takes arguments? "Select" is picked actual class treated a string for some reason</technical_language>

Target:
private void createButton(Composite parent) { artifactSelectButton = new Button(parent, SWT.PUSH); artifactSelectButton.setText("Select " + itemName); artifactSelectButton.addListener(SWT.Selection, new Listener() { @Override public void handleEvent(Event event) { handleSelectedArtifact(event); notifyListener(event); } }); artifactSelectButton.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_FILL)); }