auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>private void testExistWithNonZero(String cmd) throws Exception { final ProcessBuilder processBuilder = new ProcessBuilder(TEST_SCRIPT_PATH, cmd); processBuilder.redirectErrorStream(true); final Process process = processBuilder.start(); final int exitValue = process.waitFor(); if (exitValue != 0) { final BufferedReader stdoutReader = new BufferedReader(new InputStreamReader(process.getInputStream())); final String stdout = stdoutReader.lines().collect(StringBuilder::new, StringBuilder::append, StringBuilder::append).toString(); <START> log.error("Script exit with non-zero {}, output: {}", exitValue, stdout); <END> throw new Exception("Script exist with non-zero."); } }</code><technical_language>I suggest add exitValue stdout thrown Exception instead of logging yourself. thrown exception logged Junit</technical_language>

Target:
private void testExistWithNonZero(String cmd) throws Exception { final ProcessBuilder processBuilder = new ProcessBuilder(TEST_SCRIPT_PATH, cmd); processBuilder.redirectErrorStream(true); final Process process = processBuilder.start(); try (final BufferedReader stdoutReader = new BufferedReader(new InputStreamReader(process.getInputStream()))) { final int exitValue = process.waitFor(); if (exitValue != 0) { final String stdout = stdoutReader.lines().collect(StringBuilder::new, StringBuilder::append, StringBuilder::append).toString(); throw new Exception(String.format("Script exist with non-zero %d.\\n OUTPUT: %s", exitValue, stdout)); } } finally { process.destroyForcibly(); } }
Source:
<code>private void processRedirectedEntity(MwRevision mwRevision) { try { RedirectedEntity document = jsonDeserializer.deserializeRedirectedEntity(mwRevision.getText()); entityDocumentProcessor.processRedirectedEntity(document); } catch (JsonParseException e1) { logger.error("Failed to parse JSON for lexeme " + mwRevision.getPrefixedTitle() + ": " + e1.getMessage()); } catch (JsonMappingException e1) { <START> logger.error("Failed to map JSON for lexeme " <END> + mwRevision.getPrefixedTitle() + ": " + e1.getMessage()); e1.printStackTrace(); System.out.print(mwRevision.getText()); } catch (IOException e1) { logger.error("Failed to read revision: " + e1.getMessage()); } }</code><technical_language>lexemes (same 3 lines before)</technical_language>

Target:
private void processRedirectedEntity(MwRevision mwRevision) { try { RedirectedEntity document = jsonDeserializer.deserializeRedirectedEntity(mwRevision.getText()); entityDocumentProcessor.processRedirectedEntity(document); } catch (JsonParseException e1) { logger.error("Failed to parse JSON for redirect " + mwRevision.getPrefixedTitle() + ": " + e1.getMessage()); } catch (JsonMappingException e1) { logger.error("Failed to map JSON for redirect " + mwRevision.getPrefixedTitle() + ": " + e1.getMessage()); e1.printStackTrace(); System.out.print(mwRevision.getText()); } catch (IOException e1) { logger.error("Failed to read revision: " + e1.getMessage()); } }
Source:
<code>public void verifyErrorIsPresented() { waitForElementByElement(errorField); <START> Assertion.assertEquals(checkIfElementOnPage(errorField), true); <END> }</code><technical_language>Is this a redundancy? checkIfElementOnPage(errorField) check if errorField.getLocation() returns error</technical_language>

Target:
public void verifyErrorIsPresented() { waitForElementByElement(errorField); Assertion.assertEquals(checkIfElementOnPage(errorField), true); PageObjectLogging.log("verifyErrorIsPresented", "Error message is visible", true, driver); }
Source:
<code>private static void updateTenantsUnboundedFieldMap(GovernanceArtifactConfiguration rxtConfiguration) throws RegistryException { if (rxtConfiguration.getMediaType().matches("application/vnd.(.)+\\+xml")) { <START> RXTIndexer.updateTenantsUnboundedFieldMap(rxtConfiguration.getContentDefinition().getParent().toString()); <END> } }</code><technical_language>implement logic instead referring RXTIndexer. if logic in utils class refer in indexer. this public accept tenant Id well. WDYT</technical_language>

Target:
private static void updateTenantsUnboundedFieldMap(GovernanceArtifactConfiguration rxtConfiguration) throws RegistryException { if (rxtConfiguration.getMediaType().matches("application/vnd.(.)+\\+xml")) { updateTenantsUnboundedFieldMap(rxtConfiguration.getContentDefinition().getParent().toString()); } }
Source:
<code>public ExpressionInterceptUrlRegistry access(String attribute) { if (this.not) { attribute = "!" + attribute; } ExpressionUrlAuthorizationConfigurer.this.authorizationManagerBuilder .add(new RequestMatcherEntry<>(this.requestMatchers, <START> new WebExpressionAuthorizationManager(attribute, getExpressionHandler(getBuilder())))); <END> interceptUrl(this.requestMatchers, SecurityConfig.createList(attribute)); return ExpressionUrlAuthorizationConfigurer.this.REGISTRY; }</code><technical_language>I early call getExpressionHandler this point. reason is application call expressionHandler configuring authorization rules</technical_language>

Target:
public ExpressionInterceptUrlRegistry access(String attribute) { if (this.not) { attribute = "!" + attribute; } interceptUrl(this.requestMatchers, SecurityConfig.createList(attribute)); return ExpressionUrlAuthorizationConfigurer.this.REGISTRY; }
Source:
<code>String[] getProgramArguments() throws IOException { LOGGER.entering(); List<String> args = new LinkedList<>(Arrays.asList(super.getProgramArguments())); for (Entry<String, JsonElement> entry : defaultArgs.entrySet()) { String key = entry.getKey(); if (!args.contains(key)) { args.add(key); String val = defaultArgs.get(key).getAsString(); if (StringUtils.isNotBlank(val)) { args.add(val); } } } <START> Set<Field> fields = new HashSet<Field>(); <END> fields.addAll(Arrays.asList(ProcessLauncherConfiguration.class.getDeclaredFields())); fields.addAll(Arrays.asList(LauncherConfiguration.class.getDeclaredFields())); for (Field f : fields) { Parameter p = f.getAnnotation(Parameter.class); if (p == null) { continue; } if (!f.getType().equals(Boolean.class)) { for (String arg : args) { if (Arrays.asList(p.names()).contains(arg)) { args.set(args.indexOf(arg) + 1, ""); args.set(args.indexOf(arg), ""); } } args.removeAll(Arrays.asList("")); } else { args.removeAll(Arrays.asList(p.names())); } } LOGGER.exiting(args.toString()); return args.toArray(new String[args.size()]); }</code><technical_language>diamond operator for consistency</technical_language>

Target:
String[] getProgramArguments() throws IOException { LOGGER.entering(); List<String> args = new LinkedList<>(Arrays.asList(super.getProgramArguments())); for (Entry<String, JsonElement> entry : defaultArgs.entrySet()) { String key = entry.getKey(); if (!args.contains(key)) { args.add(key); String val = defaultArgs.get(key).getAsString(); if (StringUtils.isNotBlank(val)) { args.add(val); } } } removeSeLionArgumentsAndValues(args); LOGGER.exiting(args.toString()); return args.toArray(new String[args.size()]); }
Source:
<code>public EnvInjectJobProperty newInstance(StaplerRequest req, JSONObject formData) throws FormException { Object onObject = formData.get("on"); if (onObject != null) { EnvInjectJobProperty envInjectJobProperty = new EnvInjectJobProperty(); EnvInjectJobPropertyInfo info = req.bindParameters(EnvInjectJobPropertyInfo.class, "envInjectInfoJobProperty."); envInjectJobProperty.setInfo(info); envInjectJobProperty.setOn(true); if (onObject instanceof JSONObject) { JSONObject onJSONObject = (JSONObject) onObject; envInjectJobProperty.setKeepJenkinsSystemVariables(onJSONObject.getBoolean("keepJenkinsSystemVariables")); envInjectJobProperty.setKeepBuildVariables(onJSONObject.getBoolean("keepBuildVariables")); <START> envInjectJobProperty.setKeepBuildVariables(onJSONObject.getBoolean("overrideBuildParameters")); <END> setContributors(req, envInjectJobProperty, onJSONObject); return envInjectJobProperty; } } return null; }</code><technical_language>a typo. I suppose call <code>setOverrideBuildParameters</code></technical_language>

Target:
public EnvInjectJobProperty newInstance(StaplerRequest req, JSONObject formData) throws FormException { Object onObject = formData.get("on"); if (onObject != null) { EnvInjectJobProperty envInjectJobProperty = new EnvInjectJobProperty(); EnvInjectJobPropertyInfo info = req.bindParameters(EnvInjectJobPropertyInfo.class, "envInjectInfoJobProperty."); envInjectJobProperty.setInfo(info); envInjectJobProperty.setOn(true); if (onObject instanceof JSONObject) { JSONObject onJSONObject = (JSONObject) onObject; envInjectJobProperty.setKeepJenkinsSystemVariables(onJSONObject.getBoolean("keepJenkinsSystemVariables")); envInjectJobProperty.setKeepBuildVariables(onJSONObject.getBoolean("keepBuildVariables")); envInjectJobProperty.setOverrideBuildParameters(onJSONObject.getBoolean("overrideBuildParameters")); setContributors(req, envInjectJobProperty, onJSONObject); return envInjectJobProperty; } } return null; }
Source:
<code>public void setUp() { context = InstrumentationRegistry.getTargetContext(); SharedPreferences sharedPreferences = PreferenceManager.getDefaultSharedPreferences(context); editor = sharedPreferences.edit(); editor.clear(); editor.putBoolean(SettingsActivity.SETTINGS_CLOUD_NOTIFICATIONS, true); <START> editor.commit(); <END> CloudMessaging.setIsCloudNotificationsEnabled(true); }</code><technical_language>Hmm, mock Context SharedPreferences everywhere? appstore debug/testing version share SharedPreferences (afaik)</technical_language>

Target:
public void setUp() { sharedPreferences = mock(SharedPreferences.class); context = mock(Context.class); messagingService = mock(FirebaseCloudMessaging.class); when(PreferenceManager.getDefaultSharedPreferences(context)).thenReturn(sharedPreferences); when(sharedPreferences.getBoolean(SettingsActivity.SETTINGS_CLOUD_NOTIFICATIONS, false)).thenReturn(true); CloudMessaging.setIsCloudNotificationsEnabled(true); CloudMessaging.setCloudMessagingInterface(messagingService); }
Source:
<code>List<ICommitMessageProvider> getCommitMessageProviders() <START> throws CoreException { <END> List<ICommitMessageProvider> providers = new ArrayList<>(); IExtensionRegistry registry = Platform.getExtensionRegistry(); IConfigurationElement[] configs = registry .getConfigurationElementsFor(COMMIT_MESSAGE_PROVIDER_ID); for (IConfigurationElement config : configs) { Object provider; String contributorName = "<unknown"; try { contributorName = config.getDeclaringExtension() .getContributor().getName(); provider = config.createExecutableExtension("class"); if (provider instanceof ICommitMessageProvider) { providers.add((ICommitMessageProvider) provider); } else { Activator.logError( UIText.CommitDialog_WrongTypeOfCommitMessageProvider, null); } } catch (CoreException | InvalidRegistryObjectException e) { Activator.logError( MessageFormat.format( UIText.CommitDialog_ErrorCreatingCommitMessageProvider, contributorName), e); } } return providers; }</code><technical_language>Remove, throwing CoreException. remove try-catch lines 690 713-716</technical_language>

Target:
List<ICommitMessageProvider> getCommitMessageProviders() { List<ICommitMessageProvider> providers = new ArrayList<>(); IExtensionRegistry registry = Platform.getExtensionRegistry(); IConfigurationElement[] configs = registry .getConfigurationElementsFor(COMMIT_MESSAGE_PROVIDER_ID); for (IConfigurationElement config : configs) { Object provider; String contributorName = "<unknown"; try { contributorName = config.getDeclaringExtension() .getContributor().getName(); provider = config.createExecutableExtension("class"); if (provider instanceof ICommitMessageProvider) { providers.add((ICommitMessageProvider) provider); } else { Activator.logError( UIText.CommitDialog_WrongTypeOfCommitMessageProvider, null); } } catch (CoreException | InvalidRegistryObjectException e) { Activator.logError( MessageFormat.format( UIText.CommitDialog_ErrorCreatingCommitMessageProvider, contributorName), e); } } return providers; }
Source:
<code>private void delete(PrintStream writer, String where, String[] args) { int result = mContentResolver.delete(APODContract.CONTENT_URI, where, args); <START> writer.println("removed " + String.valueOf(result) + " rows."); <END> }</code><technical_language>nit: Removed nit2: String.valueOf is unnecessary</technical_language>

Target:
private void delete(PrintStream writer, String where, String[] args) { int result = mContentResolver.delete(APODContract.CONTENT_URI, where, args); writer.println("Removed " + result + " rows."); }
Source:
<code>public void verifyNoSlotPresent(String slotName) { if (checkIfElementOnPage("#" + slotName)) { throw new NoSuchElementException("No slot found as expected (" + slotName + ")"); } <START> PageObjectLogging.log("AdInSlot", "Slot is added to the page", true); <END> }</code><technical_language>Method verifies is slot page, passes exception report "Page this slot", otherwise. I wondering swapped messages, reason</technical_language>

Target:
public void verifyNoSlotPresent(String slotName) { if (checkIfElementOnPage("#" + slotName)) { throw new NoSuchElementException("Slot is added to the page"); } PageObjectLogging.log("AdInSlot", "No slot found as expected", true); }
Source:
<code>public Configuration getConfiguration(GraphContext context) { Configuration configuration = ConfigurationBuilder .begin() .addRule() .when(XmlFile.matchesXpath("/j2e:ejb-jar | /jee:ejb-jar | /ejb-jar").namespace("jee", "<LINK_0>").namespace("j2e", "<LINK_1>").as("ejb") .and(XmlFile.being("ejb").matchesXpath("/ejb-jar .and(XmlFile.being("ejb").matchesXpath("/ejb-jar <START> .and(XmlFile.being("ejb").matchesXpath("/ejb-jar END> .and(XmlFile.being("ejb").matchesXpath(" .and(XmlFile.being("ejb").havingDTDPublicId("Sun Microsystems, Inc. .and(XmlFile.being("ejb").havingDTDPublicId("Sun Microsystems, Inc. .perform(Classification.of("ejb").as("EJB XML") .and(Classification.of("MDB").as("EJB - MDB")) .and(Hint.in("sessionEJB").withText("EJB - Session")) .and(Hint.in("entityEJB").withText("EJB - Entity")) .and(Hint.in("ejbRelationship").withText("EJB Relationship")) .and(Classification.of("ejb1").as("EJB 1.x")) .and(Classification.of("ejb2").as("EJB 2.x"))); return configuration; }</code><technical_language>I XmlFile.being("ejb") XmlFile.from("ejb") clearer. obvious a variable here. .from() in Query syntax starting a query existing variable</technical_language>

Target:
public Configuration getConfiguration(GraphContext context) { Configuration configuration = ConfigurationBuilder .begin() .addRule() .when(XmlFile.matchesXpath("/j2e:ejb-jar | /jee:ejb-jar | /ejb-jar").namespace("jee", "<LINK_0>").namespace("j2e", "<LINK_1>").as("ejb") .and(XmlFile.from("ejb").matchesXpath("/ejb-jar .and(XmlFile.from("ejb").matchesXpath("/ejb-jar .and(XmlFile.from("ejb").matchesXpath("/ejb-jar .and(XmlFile.from("ejb").matchesXpath(" .and(XmlFile.from("ejb").withDTDPublicId("Sun Microsystems, Inc. .and(XmlFile.from("ejb").withDTDPublicId("Sun Microsystems, Inc. .perform(Classification.of("ejb").as("EJB XML") .and(Classification.of("MDB").as("EJB - MDB")) .and(Hint.in("sessionEJB").withText("EJB - Session")) .and(Hint.in("entityEJB").withText("EJB - Entity")) .and(Hint.in("ejbRelationship").withText("EJB Relationship")) .and(Classification.of("ejb1").as("EJB 1.x")) .and(Classification.of("ejb2").as("EJB 2.x"))); return configuration; }
Source:
<code>public void shutDown(@Nullable Runnable completeHandler) { stopped = true; p2PService.getPeerManager().removeListener(this); p2PService.removeDecryptedDirectMessageListener(this); stopPeriodicRefreshOffersTimer(); stopPeriodicRepublishOffersTimer(); stopRetryRepublishOffersTimer(); int size = openOffers != null ? openOffers.size() : 0; log.info("Remove open offers at shutDown. Number of open offers: {}", size); if (offerBookService.isBootstrapped() && size > 0) { openOffers.forEach(openOffer -> offerBookService.removeOfferAtShutDown(openOffer.getOffer().getOfferPayload())); LocalTime timeout = LocalTime.now().plus(Duration.ofSeconds(15)); while (!openOffers.getList().isEmpty()) { if (timeout.isBefore(LocalTime.now())) { log.error("Could not remove all offers within timeout (" + openOffers.size() + " offers remaining). Moving on."); break; } try { Thread.sleep(10); } catch (InterruptedException e) { } } if (completeHandler != null) <START> UserThread.runAfter(completeHandler, 10, TimeUnit.MILLISECONDS); <END> } else { if (completeHandler != null) completeHandler.run(); } }</code><technical_language>Is a specific reason 10 milliseconds triggering complete handler</technical_language>

Target:
public void shutDown(@Nullable Runnable completeHandler) { stopped = true; p2PService.getPeerManager().removeListener(this); p2PService.removeDecryptedDirectMessageListener(this); stopPeriodicRefreshOffersTimer(); stopPeriodicRepublishOffersTimer(); stopRetryRepublishOffersTimer(); int size = openOffers != null ? openOffers.size() : 0; log.info("Remove open offers at shutDown. Number of open offers: {}", size); if (offerBookService.isBootstrapped() && size > 0) { openOffers.forEach(openOffer -> offerBookService.removeOfferAtShutDown(openOffer.getOffer().getOfferPayload())); if (completeHandler != null) UserThread.runAfter(completeHandler, size * 200 + 500, TimeUnit.MILLISECONDS); } else { if (completeHandler != null) completeHandler.run(); } }
Source:
<code>public static Text getWakeVarianceHigh(final int wakeStdDev, final int percentile) { return new Text("Hello, irregular", String.format("Your sleep habits are a bit irregular. Your wake time variability of %d minutes is a bit high, ", wakeStdDev) + <START> String.format("it is **higher than** %d%% of all Sense users.", percentile) + <END> "\n\nTry waking up at roughly the same time every morning."); }</code><technical_language>String format is correct</technical_language>

Target:
public static Text getWakeVarianceHigh(final int wakeStdDev, final int percentile) { return new Text("Hello, irregular", String.format("The time you wake up each morning is **a little inconsistent**. It varied an average of %d minutes last week, ", wakeStdDev) + String.format("which is higher than %d%% of all Sense users. ", percentile) + "\n\nWaking up at the same time each morning is great for your internal clock, which helps you get better sleep."); }
Source:
<code>private void loginAndVerifyWith(FTPClient ftpClient) throws IOException { ftpClient.connect("localhost", FtpService.DEFAULT_PORT); ftpClient.login("anonymous", "test@example.com"); ftpClient.changeWorkingDirectory("/"); FTPFile[] files = ftpClient.listFiles(); assertNotNull(files); assertTrue("No files found on device? It is also possible that app doesn't have permission to access storage, which may occur on broken Android emulators", files.length > 0); boolean downloadFolderExists = false; for (FTPFile f : files) { if (f.getName().equalsIgnoreCase("download")) downloadFolderExists = true; } ftpClient.logout(); ftpClient.disconnect(); <START> assertTrue("Download folder not found on device. Either storage is not availableExact, or something is really wrong with FtpService. Check logcat.", <END> downloadFolderExists); }</code><technical_language>availableExact -></technical_language>

Target:
private void loginAndVerifyWith(FTPClient ftpClient) throws IOException { ftpClient.connect("localhost", FtpService.DEFAULT_PORT); ftpClient.login("anonymous", "test@example.com"); ftpClient.changeWorkingDirectory("/"); FTPFile[] files = ftpClient.listFiles(); assertNotNull(files); assertTrue("No files found on device? It is also possible that app doesn't have permission to access storage, which may occur on broken Android emulators", files.length > 0); boolean downloadFolderExists = false; for (FTPFile f : files) { if (f.getName().equalsIgnoreCase("download")) downloadFolderExists = true; } ftpClient.logout(); ftpClient.disconnect(); assertTrue("Download folder not found on device. Either storage is not available, or something is really wrong with FtpService. Check logcat.", downloadFolderExists); }
Source:
<code>public void testInsertFirstAndAdd2() throws Exception { KieSession ksession = session.getStateful(); insertNotEvent(ksession); ksession.fireAllRules(); Assertions.assertThat(firedRules.isRuleFired(RULE1)).as(RULE1).isFalse(); insertNotEvent(ksession, "different value"); insertNotEvent(ksession, "different value"); <START> insertNotEvent(ksession, "different value"); <END> ksession.fireAllRules(); Assertions.assertThat(firedRules.isRuleFired(RULE1)).as(RULE1).isTrue(); }</code><technical_language>a loop</technical_language>

Target:
public void testInsertFirstAndAdd2() throws Exception { KieSession ksession = session.getStateful(); insertNotEvent(ksession); ksession.fireAllRules(); Assertions.assertThat(firedRules.isRuleFired(RULE1)).as(RULE1).isFalse(); for (int i = 0; i < 3; i++) { insertNotEvent(ksession, "different value"); } ksession.fireAllRules(); Assertions.assertThat(firedRules.isRuleFired(RULE1)).as(RULE1).isTrue(); }
Source:
<code>public boolean equals(Object obj) { if (obj == null) { return false; } <START> Class<?> objClass = HibernateProxyHelper.getClassWithoutInitializingProxy(obj); <END> if (getClass() != objClass) { return false; } final RelationshipMetadataValue other = (RelationshipMetadataValue) obj; if (this.isUseForPlace() != other.isUseForPlace()) { return false; } return super.equals(obj); }</code><technical_language>I need it, verify</technical_language>

Target:
public boolean equals(Object obj) { if (obj == null) { return false; } if (! (obj instanceof RelationshipMetadataValue)) { return false; } final RelationshipMetadataValue other = (RelationshipMetadataValue) obj; if (this.isUseForPlace() != other.isUseForPlace()) { return false; } return super.equals(obj); }
Source:
<code><START> public UserCredential getUserCredential() throws GitException { <END> UserCredential credentials = currRequestCredentials.get(); if (credentials == null) { return null; } LOG.info("Successfully fetched credentials for remote repository"); return credentials; }</code><technical_language>This method throws GitException, I remove this 'throws'</technical_language>

Target:
public UserCredential getUserCredential() { return currRequestCredentials.get(); }
Source:
<code>public Transaction begin() throws NotSupportedException, SystemException { Transaction result = ACTIVE_TRANSACTION.get(); if (result != null) { if (logger.isTraceEnabled()) { logger.trace("Found active ModeShape transaction '{0}' ", result); } return result instanceof NestableThreadLocalTransaction ? ((NestableThreadLocalTransaction) result).begin() : result; } javax.transaction.Transaction txn = txnMgr.getTransaction(); if (txn == null) { txnMgr.begin(); result = new NestableThreadLocalTransaction(txnMgr, ACTIVE_TRANSACTION).begin(); } else { result = new ListenerTransaction(txnMgr, txn); localCache.addListener(result); } ACTIVE_TRANSACTION.set(result); if (logger.isTraceEnabled()) { logger.trace("Created & stored new ModeShape synchronized transaction '{0}' ", result); } <START> if (logger.isTraceEnabled()) { <END> if (txn == null) txn = txnMgr.getTransaction(); assert txn != null; final String id = txn.toString(); if (!ACTIVE_TRACE_SYNCHRONIZATIONS.contains(id)) { if (result instanceof ListenerTransaction) { logger.trace("Found user transaction {0}", txn); } else { logger.trace("Begin transaction {0}", id); } try { txn.registerSynchronization(new TransactionTracer(id)); } catch (RollbackException e) { return new RollbackOnlyTransaction(); } } else { logger.trace("Tracer already registered for transaction {0}", id); } } return result; }</code><technical_language>this if block? prior block</technical_language>

Target:
public Transaction begin() throws NotSupportedException, SystemException { Transaction result = ACTIVE_TRANSACTION.get(); if (result != null) { if (logger.isTraceEnabled()) { logger.trace("Found active ModeShape transaction '{0}' ", result); } return result instanceof NestableThreadLocalTransaction ? ((NestableThreadLocalTransaction) result).begin() : result; } javax.transaction.Transaction txn = txnMgr.getTransaction(); if (txn == null) { txnMgr.begin(); result = new NestableThreadLocalTransaction(txnMgr, ACTIVE_TRANSACTION).begin(); } else { result = new ListenerTransaction(txnMgr, txn); localCache.addListener(result); } ACTIVE_TRANSACTION.set(result); if (logger.isTraceEnabled()) { logger.trace("Created & stored new ModeShape synchronized transaction '{0}' ", result); if (txn == null) txn = txnMgr.getTransaction(); assert txn != null; final String id = txn.toString(); if (!ACTIVE_TRACE_SYNCHRONIZATIONS.contains(id)) { if (result instanceof ListenerTransaction) { logger.trace("Found user transaction {0}", txn); } else { logger.trace("Begin transaction {0}", id); } try { txn.registerSynchronization(new TransactionTracer(id)); } catch (RollbackException e) { return new RollbackOnlyTransaction(); } } else { logger.trace("Tracer already registered for transaction {0}", id); } } return result; }
Source:
<code>protected @C.RoleFlags int parseRoleSchemeValue(String value){ @C.RoleFlags int result = 0; switch (value) { case "main": <START> result |= C.ROLE_FLAGS_MAIN; <END> break; case "alternate": result |= C.ROLE_FLAGS_ALTERNATE; break; case "supplementary": result |= C.ROLE_FLAGS_SUPPLEMENTARY; break; case "commentary": result |= C.ROLE_FLAGS_COMMENTARY; break; case "dub": result |= C.ROLE_FLAGS_DUB; break; case "emergency": result |= C.ROLE_FLAGS_EMERGENCY; break; case "caption": result |= C.ROLE_FLAGS_CAPTION; break; case "sign": result |= C.ROLE_FLAGS_SIGN; break; case "description": result |= C.ROLE_FLAGS_DESCRIPTION; break; case "enhanced-audio-intelligibility": result |= C.ROLE_FLAGS_ENHANCED_AUDIO_INTELLIGIBILITY; break; } return result; }</code><technical_language>return C.ROLE_FLAGS_X; for case, add a default case returns 0. Ditto for parseAudioPurposeValue if a method too</technical_language>

Target:
protected @C.RoleFlags int parseRoleSchemeValue(String value) { if (value == null) { return 0; } switch (value) { case "main": return C.ROLE_FLAGS_MAIN; case "alternate": return C.ROLE_FLAGS_ALTERNATE; case "supplementary": return C.ROLE_FLAGS_SUPPLEMENTARY; case "commentary": return C.ROLE_FLAGS_COMMENTARY; case "dub": return C.ROLE_FLAGS_DUB; case "emergency": return C.ROLE_FLAGS_EMERGENCY; case "caption": return C.ROLE_FLAGS_CAPTION; case "sign": return C.ROLE_FLAGS_SIGN; case "description": return C.ROLE_FLAGS_DESCRIPTION; case "enhanced-audio-intelligibility": return C.ROLE_FLAGS_ENHANCED_AUDIO_INTELLIGIBILITY; default: return 0; } }
Source:
<code>public void testUnsetUserResolver() { MockEnabledModelResolver resolver1 = new MockEnabledModelResolver(); manager.add(resolver1, resolver1.getClass().getName() + "1", "", ""); MockEnabledModelResolver resolver2 = new MockEnabledModelResolver(); manager.add(resolver2, resolver2.getClass().getName() + "2", "", ""); MockEnabledModelResolver resolver3 = new MockEnabledModelResolver(); String resolver3Id = resolver3.getClass().getName() + "3"; manager.add(resolver3, resolver3Id, "", ""); manager.setUserSelectedResolver(manager.getDescriptor(resolver3Id)); manager.setUserSelectedResolver(null); <START> assertEquals(manager.getUserSelectedResolver(), null); <END> }</code><technical_language>Please assertNull instead</technical_language>

Target:
public void testUnsetUserResolver() { MockEnabledModelResolver resolver1 = new MockEnabledModelResolver(); manager.add(resolver1, resolver1.getClass().getName() + "1", "", ""); MockEnabledModelResolver resolver2 = new MockEnabledModelResolver(); manager.add(resolver2, resolver2.getClass().getName() + "2", "", ""); MockEnabledModelResolver resolver3 = new MockEnabledModelResolver(); String resolver3Id = resolver3.getClass().getName() + "3"; manager.add(resolver3, resolver3Id, "", ""); manager.setUserSelectedResolver(manager.getDescriptor(resolver3Id)); manager.setUserSelectedResolver(null); assertNull(manager.getUserSelectedResolver()); }
Source:
<code><START> public Collection<CaseInstance> getCaseInstances(QueryContext queryContext) { <END> Map<String, Object> params = new HashMap<String, Object>(); params.put("statuses", statuses); applyQueryContext(params, queryContext); applyDeploymentFilter(params); List<CaseInstance> processInstances = commandService.execute(new QueryNameCommand<List<CaseInstance>>("getCaseInstances", params)); return processInstances; }</code><technical_language>method reused passing default statuses, avoiding code dup</technical_language>

Target:
public Collection<CaseInstance> getCaseInstances(QueryContext queryContext) { return getCaseInstances(statuses, queryContext); }
Source:
<code><START> public void testHeaderAmountDoesNotMatch() { <END> ConcurRequestExtractFile testFile = buildConcurRequestExtractFile(); testFile.setTotalApprovedAmount(new KualiDecimal(9.87)); if (concurRequestExtractFileValidationService.fileApprovedAmountsMatchHeaderApprovedAmount(testFile)) { assertTrue("Invalid: Header amount matched row sum. They should NOT have matched.", false); } else { assertTrue("Valid: Header amount did NOT match sum of row amounts from file.", true); } }</code><technical_language>I need separate tests here, for a test case amounts match for a test case amounts match</technical_language>

Target:
public void testHeaderAmountDoesNotMatch() { List<ConcurRequestExtractFile> testFiles = ConcurRequestExtractFileFixture.BAD_REQUEST_AMOUNT_FILE.createConcurRequestExtractFiles(); assertFalse("Expected Result: Header amount should NOT match sum of row amounts from file.", concurRequestExtractFileValidationService.requestExtractHeaderRowValidatesToFileContents(testFiles)); }
Source:
<code>private FaqPair createPair() { FaqPair faqPair = new FaqPair(); <START> faqPair.setQuestion("question"); <END> faqPair.setAnswer("answer"); return faqRepository.save(faqPair); }</code><technical_language>"Answer Ultimate Question of Life, Universe, Everything"</technical_language>

Target:
private FaqPair createPair() { FaqPair faqPair = new FaqPair(); faqPair.setQuestion("What do you get if you multiply six by nine?"); faqPair.setAnswer("42"); return faqRepository.save(faqPair); }
Source:
<code>public static Source fromString(String value) { <START> if (value.equals(STATS.value)) { <END> return STATS; } else if (value.equals(NOTIFICATIONS.value)) { return NOTIFICATIONS; } else { return null; } }</code><technical_language>need null check here</technical_language>

Target:
public static Source fromString(String value) { if (STATS.value.equals(value)) { return STATS; } else if (NOTIFICATIONS.value.equals(value)) { return NOTIFICATIONS; } else { return null; } }
Source:
<code>public String digestParams(RestInvocation restInvocation) { String queryString = ""; Iterator it; if (restInvocation.getParamsMap().get(QueryParam.class) != null && !restInvocation.getParamsMap().get(QueryParam.class).isEmpty()) { queryString = String.valueOf(restInvocation.getParamsMap().get(QueryParam.class)); } else if (restInvocation.getRequestBody() != null && !restInvocation.getRequestBody().isEmpty()) { ObjectMapper mapper = new ObjectMapper(); try { Map<String, String> map = mapper.readValue(restInvocation.getRequestBody(), Map.class); it = map.keySet().iterator(); while (it.hasNext()) { String key = (String) it.next(); String value = map.get(key); queryString += "&" + key + "=" + value; } queryString = queryString.substring(1); } catch (IOException e) { <START> e.printStackTrace(); <END> } } Algorithm algorithm = null; String jwtToken = null; algorithm = Algorithm.HMAC256(secretKey); JWTCreator.Builder builder = JWT.create(); if (queryString.length() > 0) { builder .withClaim("access_key", accessKey) .withClaim("nonce", String.valueOf(new Date().getTime())) .withClaim("query", queryString); } else { builder .withClaim("access_key", accessKey) .withClaim("nonce", String.valueOf(new Date().getTime())); } jwtToken = builder.sign(algorithm); return "Bearer " + jwtToken; }</code><technical_language>wrap IOException in a IllegalStateException throw out is sense in sending a request a broken digset</technical_language>

Target:
public String digestParams(RestInvocation restInvocation) { String queryString = ""; if (restInvocation.getParamsMap().get(QueryParam.class) != null && !restInvocation.getParamsMap().get(QueryParam.class).isEmpty()) { queryString = String.valueOf(restInvocation.getParamsMap().get(QueryParam.class)); } else if (restInvocation.getRequestBody() != null && !restInvocation.getRequestBody().isEmpty()) { try { ObjectMapper mapper = new ObjectMapper(); Map<String, String> map = mapper.readValue(restInvocation.getRequestBody(), Map.class); Iterator it = map.keySet().iterator(); while (it.hasNext()) { String key = (String) it.next(); String value = map.get(key); queryString += "&" + key + "=" + value; } queryString = queryString.substring(1); } catch (IOException e) { throw new IllegalStateException(e); } } Algorithm algorithm = Algorithm.HMAC256(secretKey); JWTCreator.Builder builder = JWT.create(); builder.withClaim("access_key", accessKey).withClaim("nonce", String.valueOf(new Date().getTime())); if (queryString.length() > 0) builder.withClaim("query", queryString); String jwtToken = builder.sign(algorithm); return "Bearer " + jwtToken; }
Source:
<code>private static void checkAllProperty(SubscriptionContext ctx, AssignmentStatement assignmentStatement) { Expression assignedValue = assignmentStatement.assignedValue(); <START> if (!assignedValue.is(Tree.Kind.LIST_LITERAL) && !assignedValue.is(Tree.Kind.TUPLE)) { <END> return; } List<Tree> stringExpressions = getStringExpressions(assignedValue); FileInput fileInput = (FileInput) TreeUtils.firstAncestorOfKind(assignedValue, Tree.Kind.FILE_INPUT); if (fileInput == null) { return; } UnresolvedWildcardImportVisitor unresolvedWildcardImportVisitor = new UnresolvedWildcardImportVisitor(); fileInput.accept(unresolvedWildcardImportVisitor); if (unresolvedWildcardImportVisitor.hasUnresolvedWildcardImport) { return; } Map<String, Symbol> symbolsByName = fileInput.globalVariables().stream().collect(Collectors.toMap(Symbol::name, Function.identity())); for (Tree stringExpression : stringExpressions) { StringLiteral stringLiteral = retrieveStringLiteral(stringExpression); if (isUnknownSymbol(ctx.pythonFile(), symbolsByName, stringLiteral)) { PreciseIssue issue = ctx.addIssue(stringExpression, String.format("Change or remove this string; \"%s\" is not defined.", stringLiteral.trimmedQuotesValue())); if (stringExpression != stringLiteral) { issue.secondary(stringLiteral, null); } } } }</code><technical_language>I merged a single call: !assignedValue.is(Tree.Kind.LIST_LITERAL, Tree.Kind.TUPLE)</technical_language>

Target:
private static void checkAllProperty(SubscriptionContext ctx, AssignmentStatement assignmentStatement) { Expression assignedValue = assignmentStatement.assignedValue(); if (!assignedValue.is(Tree.Kind.LIST_LITERAL, Tree.Kind.TUPLE)) { return; } List<Tree> stringExpressions = getStringExpressions(assignedValue); FileInput fileInput = (FileInput) TreeUtils.firstAncestorOfKind(assignedValue, Tree.Kind.FILE_INPUT); if (fileInput == null) { return; } UnresolvedWildcardImportVisitor unresolvedWildcardImportVisitor = new UnresolvedWildcardImportVisitor(); fileInput.accept(unresolvedWildcardImportVisitor); if (unresolvedWildcardImportVisitor.hasUnresolvedWildcardImport) { return; } Map<String, Symbol> symbolsByName = fileInput.globalVariables().stream().collect(Collectors.toMap(Symbol::name, Function.identity())); for (Tree stringExpression : stringExpressions) { StringLiteral stringLiteral = retrieveStringLiteral(stringExpression); if (isUnknownSymbol(ctx.pythonFile(), symbolsByName, stringLiteral)) { PreciseIssue issue = ctx.addIssue(stringExpression, String.format("Change or remove this string; \"%s\" is not defined.", stringLiteral.trimmedQuotesValue())); if (stringExpression != stringLiteral) { issue.secondary(stringLiteral, null); } } } }
Source:
<code>public ElasticsearchContainer(String dockerImageName) { super(dockerImageName); logger().info("Starting an elasticsearch container using [{}]", dockerImageName); <START> withNetwork(Network.SHARED); <END> withNetworkAliases("elasticsearch-" + Base58.randomString(6)); withEnv("discovery.type", "single-node"); addExposedPorts(ELASTICSEARCH_DEFAULT_PORT, ELASTICSEARCH_DEFAULT_TCP_PORT); setWaitStrategy(new HttpWaitStrategy() .forPort(ELASTICSEARCH_DEFAULT_PORT) .forStatusCodeMatching(response -> response == HTTP_OK || response == HTTP_UNAUTHORIZED) .withStartupTimeout(Duration.ofMinutes(2))); }</code><technical_language>I remove it, sense connect multiple containers</technical_language>

Target:
public ElasticsearchContainer(String dockerImageName) { super(dockerImageName); logger().info("Starting an elasticsearch container using [{}]", dockerImageName); withNetworkAliases("elasticsearch-" + Base58.randomString(6)); withEnv("discovery.type", "single-node"); addExposedPorts(ELASTICSEARCH_DEFAULT_PORT, ELASTICSEARCH_DEFAULT_TCP_PORT); setWaitStrategy(new HttpWaitStrategy() .forPort(ELASTICSEARCH_DEFAULT_PORT) .forStatusCodeMatching(response -> response == HTTP_OK || response == HTTP_UNAUTHORIZED) .withStartupTimeout(Duration.ofMinutes(2))); }
Source:
<code>public void setUp() { try { ObjectMapper mapper = (new NakadiConfig()).jacksonObjectMapper(); datasource = new DriverManagerDataSource(postgresqlUrl, username, password); template = new JdbcTemplate(datasource); repository = new EventTypeDbRepository(template, mapper); connection = datasource.getConnection(); <START> template.execute("DELETE FROM zsr_data.event_type"); <END> } catch (SQLException e) { e.printStackTrace(); } }</code><technical_language>before</technical_language>

Target:
public void setUp() { try { ObjectMapper mapper = (new NakadiConfig()).jacksonObjectMapper(); datasource = new DriverManagerDataSource(postgresqlUrl, username, password); template = new JdbcTemplate(datasource); repository = new EventTypeDbRepository(template, mapper); connection = datasource.getConnection(); template.execute("DELETE FROM zn_data.event_type"); } catch (SQLException e) { e.printStackTrace(); } }
Source:
<code>public void init() throws ServletException { String capsParam = getServletContext().getInitParameter(CAPABILITIES_PARAMETER); if (capsParam != null) { for (String nego : capsParam.trim().split(" *\\| *")) { try { caps |= Authn.Capabilities.class.getField(nego).getLong(null); } catch (IllegalArgumentException | IllegalAccessException | NoSuchFieldException ex) { log.error("Error calculating authn capabilities while accessing constant {}", nego); } } <START> } <END> final AuthenticationProfileRepository repo = (AuthenticationProfileRepository) getServletContext().getAttribute(SSOUtils.AUTH_PROFILE_REPOSITORY); repo.addObserver( new Observer() { @Override public void update(Observable o, Object arg) { cacheNegotiatingProfiles(repo); } } ); cacheNegotiatingProfiles(repo); }</code><technical_language>hmm... capabilities of this external url interactive, well, chain of interactive interactive set caller. interactive - a user, redirect present forms such. this is mode working right now. interactive - do user, this is a sequence work on, a entry point (phase0). this set session request parameters of some sort redirect this url</technical_language>

Target:
public void init() throws ServletException { try { caps |= Authn.Capabilities.class.getField(AUTHENTICATE_NEGOTIATE_INTERACTIVE).getLong(null); } catch (IllegalArgumentException | IllegalAccessException | NoSuchFieldException ex) { log.error("Error calculating authn capabilities while accessing constant {}", AUTHENTICATE_NEGOTIATE_INTERACTIVE); } final AuthenticationProfileRepository repo = (AuthenticationProfileRepository) getServletContext().getAttribute(SSOUtils.AUTH_PROFILE_REPOSITORY); repo.addObserver( new Observer() { @Override public void update(Observable o, Object arg) { cacheNegotiatingProfiles(repo); } } ); cacheNegotiatingProfiles(repo); }
Source:
<code>void generatePassword() { newPasswordPlainText = uuidGenerator.generateUuid(); newPasswordEncrypted = encryptionService.encrypt(newPasswordPlainText); <START> newPasswordWrappedEncrypted = String.format(ENC_TEMPLATE, newPasswordEncrypted); <END> }</code><technical_language>knowledge of a string is marked encrypted a matter of public knowledge here. encryption service is therefore, this formatting done there</technical_language>

Target:
void generatePassword() { newPasswordPlainText = uuidGenerator.generateUuid(); newPasswordWrappedEncrypted = encryptionService.encryptValue(newPasswordPlainText); }
Source:
<code>private void addInitialMembers() { List<ChatRoomMember> chatRoomMembers = getCurrentChatRoomMembers(); List<ConferenceMember> confMembers = getCurrentConferenceMembers(); <START> if(chatRoomMembers == null || confMembers == null) <END> { logger.warn("Cannot add initial members to transcription" ); return; } for(ChatRoomMember chatRoomMember : chatRoomMembers) { ChatRoomMemberJabberImpl chatRoomMemberJabber; if(chatRoomMember instanceof ChatRoomMemberJabberImpl) { chatRoomMemberJabber = (ChatRoomMemberJabberImpl) chatRoomMember; } else { logger.warn("Could not cast a ChatRoomMember to " + "ChatRoomMemberJabberImpl"); continue; } String identifier = getParticipantIdentifier(chatRoomMemberJabber); if("focus".equals(identifier)) { continue; } if(chatRoomMemberJabber.getJabberID().getResourceOrNull() == null) { continue; } this.transcriber.maybeAddParticipant(identifier); this.transcriber.updateParticipant(identifier, chatRoomMember); this.transcriber.participantJoined(identifier); } for(ConferenceMember confMember : confMembers) { if("jvb".equals(confMember.getAddress())) { continue; } String identifier = getParticipantIdentifier(confMember); this.transcriber.maybeAddParticipant(identifier); this.transcriber.updateParticipant(identifier, confMember); } }</code><technical_language>do want null? code handles independently</technical_language>

Target:
private void addInitialMembers() { List<ConferenceMember> confMembers = getCurrentConferenceMembers(); if(confMembers == null) { logger.warn("Cannot add initial ConferenceMembers to " + "transcription"); } else { for(ConferenceMember confMember : confMembers) { if("jvb".equals(confMember.getAddress())) { continue; } String identifier = getParticipantIdentifier(confMember); this.transcriber.updateParticipant(identifier, confMember); } } List<ChatRoomMember> chatRoomMembers = getCurrentChatRoomMembers(); if(chatRoomMembers == null) { logger.warn("Cannot add initial ChatRoomMembers to transcription"); return; } for (ChatRoomMember chatRoomMember : chatRoomMembers) { ChatRoomMemberJabberImpl chatRoomMemberJabber; if (chatRoomMember instanceof ChatRoomMemberJabberImpl) { chatRoomMemberJabber = (ChatRoomMemberJabberImpl) chatRoomMember; } else { logger.warn("Could not cast a ChatRoomMember to " + "ChatRoomMemberJabberImpl"); continue; } String identifier = getParticipantIdentifier(chatRoomMemberJabber); if ("focus".equals(identifier)) { continue; } if (chatRoomMemberJabber.getJabberID().getResourceOrNull() == null) { continue; } this.transcriber.updateParticipant(identifier, chatRoomMember); this.transcriber.participantJoined(identifier); } }
Source:
<code><START> public static boolean isDBFalse(final String value) { <END> String x = getDBType(); if (MYSQL.equals(x)) { return value.trim().equals("0") || value.trim().equals("false"); } else if (POSTGRESQL.equals(x) || H2.equals(x)) { return value.trim().equals("f") || value.trim().equals("false"); } else if (MSSQL.equals(x)) { return value.trim().equals("0"); } else if (ORACLE.equals(x)) { return value.trim().equals("0"); } return false; }</code><technical_language>![MAJOR](<LINK_0> 'Severity: MAJOR') Reduce number of returns of this method 5, maximum allowed 3. [![rule](<LINK_1>](<LINK_2></technical_language>

Target:
public static boolean isDBFalse(final String value) { String x = getDBType(); if (MYSQL.equals(x)) { return "0".equals(value.trim()) || "false".equals(value.trim()); } else if (POSTGRESQL.equals(x) || H2.equals(x)) { return "f".equals(value.trim()) || "false".equals(value.trim()); } else if (MSSQL.equals(x)) { return "0".equals(value.trim()); } else if (ORACLE.equals(x)) { return "0".equals(value.trim()); } return false; }
Source:
<code>public void testParseXmlGetCapabilitiesNoRootLayerTrue() throws Exception { CapabilitiesXmlReader reader = new CapabilitiesXmlReader(EntityResolverProvider.RESOLVE_DISABLED_PROVIDER); String plainRequest = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>" + "<ogc:GetCapabilities xmlns:ogc=\"<LINK_1>\" " + " xmlns:gml=\"<LINK_0>\" " + " version=\"1.2.0\" updateSequence=\"1\" " <START> + " noRootLayer=\"true\" " END> + " service=\"WMS\"> " + "</ogc:GetCapabilities>"; Reader input = new StringReader(plainRequest); Object read = reader.read(null, input, null); assertTrue(read instanceof GetCapabilitiesRequest); GetCapabilitiesRequest request = (GetCapabilitiesRequest) read; assertEquals("GetCapabilities", request.getRequest()); assertEquals("1.2.0", request.getVersion()); assertEquals("1", request.getUpdateSequence()); assertTrue(request.isNoRootLayer()); }</code><technical_language>else, negations everywhere... a rootLayer attribute/flag defaulting true instead? I understand for a wide change in PR...</technical_language>

Target:
public void testParseXmlGetCapabilitiesNoRootLayerTrue() throws Exception { CapabilitiesXmlReader reader = new CapabilitiesXmlReader(EntityResolverProvider.RESOLVE_DISABLED_PROVIDER); String plainRequest = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>" + "<ogc:GetCapabilities xmlns:ogc=\"<LINK_1>\" " + " xmlns:gml=\"<LINK_0>\" " + " version=\"1.2.0\" updateSequence=\"1\" " + " rootLayer=\"true\" " + " service=\"WMS\"> " + "</ogc:GetCapabilities>"; Reader input = new StringReader(plainRequest); Object read = reader.read(null, input, null); assertTrue(read instanceof GetCapabilitiesRequest); GetCapabilitiesRequest request = (GetCapabilitiesRequest) read; assertEquals("GetCapabilities", request.getRequest()); assertEquals("1.2.0", request.getVersion()); assertEquals("1", request.getUpdateSequence()); assertTrue(request.isRootLayerEnabled()); }
Source:
<code>public void checkAttributeSyntax(PerunSessionImpl sess, User user, Attribute attribute) throws InternalErrorException, WrongAttributeValueException { <START> Utils.notNull(attribute, "attribute"); <END> if (unpermittedLogins.contains(attribute.valueAsString())) throw new WrongAttributeValueException(attribute, user, "Login '" + attribute.getValue() + "' is not permitted."); super.checkAttributeSyntax(sess, user, attribute); }</code><technical_language>Object attribute null. skip this part if of attribute is null</technical_language>

Target:
public void checkAttributeSyntax(PerunSessionImpl sess, User user, Attribute attribute) throws InternalErrorException, WrongAttributeValueException { if (unpermittedLogins.contains(attribute.valueAsString())) throw new WrongAttributeValueException(attribute, user, "Login '" + attribute.getValue() + "' is not permitted."); super.checkAttributeSyntax(sess, user, attribute); }
Source:
<code>public String getColumnText(Object element, int columnIndex) { if (element instanceof ECAction) { switch (columnIndex) { <START> case 0: if (null != ((ECAction) element).getAlgorithm()) { return ((ECAction) element).getAlgorithm().getName(); } break; case 1: if (null != ((ECAction) element).getOutput()) { return ((ECAction) element).getOutput().getName(); } break; case 2: if (null != ((ECAction) element).getAlgorithm().getComment()) { return ((ECAction) element).getAlgorithm().getComment(); } break; <END> default: break; } } return ECCContentAndLabelProvider.EMPTY_FIELD; }</code><technical_language>cases magic numbers! some predefined constants? Otherwise, please add</technical_language>

Target:
public String getColumnText(Object element, int columnIndex) { if (element instanceof ECAction) { switch (columnIndex) { case ACTION_COLUMN_ALGORITHM: if (null != ((ECAction) element).getAlgorithm()) { return ((ECAction) element).getAlgorithm().getName(); } break; case ACTION_COLUMN_EVENT: if (null != ((ECAction) element).getOutput()) { return ((ECAction) element).getOutput().getName(); } break; case ACTION_COLUMN_COMMENT: if (null != ((ECAction) element).getAlgorithm().getComment()) { return ((ECAction) element).getAlgorithm().getComment(); } break; default: break; } } return ECCContentAndLabelProvider.EMPTY_FIELD; }