auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public void autoAllocateArmor() { for (int loc = 0; loc < getJumpship().locations() - 1; loc++) { getJumpship().initializeArmor(0, loc); } <START> int bonusPerFacing = (int) Math.floor(UnitUtil.getSIBonusArmorPoints(getJumpship()) / 6.0); <END> int points = UnitUtil.getArmorPoints(getJumpship(), getJumpship().getLabArmorTonnage()) - bonusPerFacing * 6; int nose = (int)Math.floor(points * 0.22); int foresides = (int)Math.floor(points * 0.18); int aftsides = (int) Math.floor(points * 0.16); int aft = (int)Math.floor(points * 0.10); int remainder = points - nose - foresides * 2 - aftsides * 2 - aft; switch(remainder % 6) { case 1: nose++; break; case 2: foresides++; break; case 3: nose++; foresides++; break; case 4: nose += 2; foresides++; break; case 5: nose += 3; foresides++; break; } getJumpship().initializeArmor(nose + bonusPerFacing, Jumpship.LOC_NOSE); getJumpship().initializeArmor(foresides + bonusPerFacing, Jumpship.LOC_FRS); getJumpship().initializeArmor(foresides + bonusPerFacing, Jumpship.LOC_FLS); getJumpship().initializeArmor(aftsides + bonusPerFacing, Jumpship.LOC_ARS); getJumpship().initializeArmor(aftsides + bonusPerFacing, Jumpship.LOC_ALS); getJumpship().initializeArmor(aft + bonusPerFacing, Jumpship.LOC_AFT); getJumpship().autoSetThresh(); panArmorAllocation.setFromEntity(getJumpship()); refresh.refreshPreview(); refresh.refreshSummary(); refresh.refreshStatus(); }</code><technical_language>Is 6 a constant/value get instead of hardcode here</technical_language>

Target:
public void autoAllocateArmor() { final int ARMOR_FACINGS = getJumpship() instanceof Warship ? getJumpship().locations() - 3 : getJumpship().locations() - 1; for (int loc = 0; loc < ARMOR_FACINGS; loc++) { getJumpship().initializeArmor(0, loc); } int bonusPerFacing = (int) Math.floor(UnitUtil.getSIBonusArmorPoints(getJumpship()) / ARMOR_FACINGS); int points = UnitUtil.getArmorPoints(getJumpship(), getJumpship().getLabArmorTonnage()) - bonusPerFacing * 6; int nose = (int)Math.floor(points * 0.22); int foresides = (int)Math.floor(points * 0.18); int aftsides = (int) Math.floor(points * 0.16); int aft = (int)Math.floor(points * 0.10); int remainder = points - nose - foresides * 2 - aftsides * 2 - aft; switch(remainder % 6) { case 1: nose++; break; case 2: foresides++; break; case 3: nose++; foresides++; break; case 4: nose += 2; foresides++; break; case 5: nose += 3; foresides++; break; } getJumpship().initializeArmor(nose + bonusPerFacing, Jumpship.LOC_NOSE); getJumpship().initializeArmor(foresides + bonusPerFacing, Jumpship.LOC_FRS); getJumpship().initializeArmor(foresides + bonusPerFacing, Jumpship.LOC_FLS); getJumpship().initializeArmor(aftsides + bonusPerFacing, Jumpship.LOC_ARS); getJumpship().initializeArmor(aftsides + bonusPerFacing, Jumpship.LOC_ALS); getJumpship().initializeArmor(aft + bonusPerFacing, Jumpship.LOC_AFT); getJumpship().autoSetThresh(); panArmorAllocation.setFromEntity(getJumpship()); refresh.refreshPreview(); refresh.refreshSummary(); refresh.refreshStatus(); }
Source:
<code>private ValidationResult validateSlaveHasNoNetworks(String slaveName) { for (NetworkAttachment attachment : getAttachmentsToConfigure()) { if (Objects.equals(attachment.getNicName(), slaveName)) { if (attachment.getId() == null) { EngineMessage engineMessage = EngineMessage.NETWORK_INTERFACE_ADDED_TO_BOND_AND_NETWORK_IS_ATTACHED_TO_IT_AT_THE_SAME_TIME; return new ValidationResult(engineMessage, ReplacementUtils.getVariableAssignmentString(engineMessage, slaveName), ReplacementUtils.createSetVariableString(VAR_NETWORK_NAME, attachment.getNetworkName())); } else { EngineMessage engineMessage = EngineMessage.NETWORK_INTERFACE_ATTACHED_TO_NETWORK_CANNOT_BE_SLAVE; return new ValidationResult(engineMessage, ReplacementUtils.getVariableAssignmentString(engineMessage, slaveName), ReplacementUtils.createSetVariableString(VAR_NETWORK_NAME, attachment.getNetworkName())); } } <START> VdsNetworkInterface slaveInterface = existingInterfacesMap.get(slaveName); <END> if ( slaveInterface != null && slaveInterface.getNetworkImplementationDetails() != null && !slaveInterface.getNetworkImplementationDetails().isManaged()) { return new ValidationResult(EngineMessage.NETWORK_INTERFACE_WITH_UNMANAGED_NETWORK_CANNOT_BE_SLAVE, ReplacementUtils.createSetVariableString(VAR_NETWORK_NAME, slaveInterface.getNetworkName()), ReplacementUtils.createSetVariableString(VAR_NIC_NAME, slaveName)); } } return ValidationResult.VALID; }</code><technical_language>if unmanaged network is attached a vlan device base nic is slave. for (VdsNetworkInterface iface : existingInterfaces) { if (slaveName.equals((NetworkUtils.stripVlan(iface))) { // Check if iface isManaged. } }</technical_language>

Target:
private ValidationResult validateSlaveHasNoNetworks(String slaveName) { for (NetworkAttachment attachment : getAttachmentsToConfigure()) { if (Objects.equals(attachment.getNicName(), slaveName)) { if (attachment.getId() == null) { EngineMessage engineMessage = EngineMessage.NETWORK_INTERFACE_ADDED_TO_BOND_AND_NETWORK_IS_ATTACHED_TO_IT_AT_THE_SAME_TIME; return new ValidationResult(engineMessage, ReplacementUtils.getVariableAssignmentString(engineMessage, slaveName), ReplacementUtils.createSetVariableString(VAR_NETWORK_NAME, attachment.getNetworkName())); } else { EngineMessage engineMessage = EngineMessage.NETWORK_INTERFACE_ATTACHED_TO_NETWORK_CANNOT_BE_SLAVE; return new ValidationResult(engineMessage, ReplacementUtils.getVariableAssignmentString(engineMessage, slaveName), ReplacementUtils.createSetVariableString(VAR_NETWORK_NAME, attachment.getNetworkName())); } } } for (VdsNetworkInterface iface : existingInterfaces) { if (slaveName.equals(NetworkUtils.stripVlan(iface))) { if (iface.getNetworkImplementationDetails() != null && !iface.getNetworkImplementationDetails().isManaged()) { return new ValidationResult(EngineMessage.NETWORK_INTERFACE_WITH_UNMANAGED_NETWORK_CANNOT_BE_SLAVE, ReplacementUtils.createSetVariableString(VAR_NETWORK_NAME, iface.getNetworkName()), ReplacementUtils.createSetVariableString(VAR_NIC_NAME, slaveName)); } } } return ValidationResult.VALID; }
Source:
<code><START> public synchronized void unregister(PathMatcher path, HttpHandler handler) { <END> mPathMatchers.remove(path); mHttpHandlers.remove(handler); }</code><technical_language>Prefer a PathMatcher, finding index, removing entries index ArrayLists. is, if like: path0: handler0 path1: handler1 path2: handler0 called: unregister(path2, handler0) end with: path0: handler1 path1: handler0</technical_language>

Target:
public synchronized boolean unregister(PathMatcher path, HttpHandler handler) { int index = mPathMatchers.indexOf(path); if (index >= 0) { if (handler == mHttpHandlers.get(index)) { mPathMatchers.remove(index); mHttpHandlers.remove(index); return true; } } return false; }
Source:
<code>public static boolean openTask(TaskRepository repository, String taskId, TaskOpenListener listener) { Assert.isNotNull(repository); Assert.isNotNull(taskId); AbstractTask task = (AbstractTask) TasksUiInternal.getTaskList().getTask(repository.getRepositoryUrl(), taskId); if (task == null) { task = TasksUiPlugin.getTaskList().getTaskByKey(repository.getRepositoryUrl(), taskId); } if (task != null) { TaskOpenEvent event = TasksUiInternal.openTask(task, taskId); if (listener != null && event != null) { listener.taskOpened(event); } return event != null; } else { AbstractRepositoryConnectorUi connectorUi = TasksUiPlugin.getConnectorUi(repository.getConnectorKind()); if (connectorUi != null) { try { return openRepositoryTaskForId(connectorUi.getConnectorKind(), repository.getRepositoryUrl(), <START> taskId, listener) || openRepositoryTaskForKey(repository, taskId, listener); <END> } catch (Exception e) { StatusHandler.log(new Status(IStatus.ERROR, TasksUiPlugin.ID_PLUGIN, "Internal error while opening repository task", e)); } } } return false; }</code><technical_language>This problem this method takes a task id a parameter treats a key. need a new method for search key search page call method in org.eclipse.mylyn.internal.tasks.ui.TaskSearchPage.performAction(). add a openTaskByKey method put logic in page deicde search key id,, add a openTaskByKeyOrId method OpenRepositoryTaskJob try key fall id in patch set 4. option cleaner allow support opening id for connectors support search key. leaning second</technical_language>

Target:
public static boolean openTask(TaskRepository repository, String taskId, TaskOpenListener listener) { AbstractTask task = openTaskFromTaskList(repository, taskId, listener); if (task != null) { return openKnownTaskInEditor(task, taskId, listener); } else { AbstractRepositoryConnectorUi connectorUi = TasksUiPlugin.getConnectorUi(repository.getConnectorKind()); if (connectorUi != null) { try { return openRepositoryTask(connectorUi.getConnectorKind(), repository.getRepositoryUrl(), taskId, listener); } catch (Exception e) { StatusHandler.log(new Status(IStatus.ERROR, TasksUiPlugin.ID_PLUGIN, "Internal error while opening repository task", e)); } } } return false; }
Source:
<code>protected Optional<Boolean> resolveFromString(@Nonnull Value input) { <START> if (nullable && !("true".equalsIgnoreCase(input.asString()) || "false".equalsIgnoreCase(input.asString()))) { <END> return Optional.empty(); } return Optional.of(input.asBoolean()); }</code><technical_language>this match parsing of input.asBoolean is parameter is required, $NLS.yes is considerd true (and $NLS.no false) -> if parameter is required i get true for "yes" if parameter is nullable i get null for "yes"</technical_language>

Target:
protected Optional<Boolean> resolveFromString(@Nonnull Value input) { if (nullable && !input.isFilled()) { return Optional.empty(); } return Optional.of(input.asBoolean()); }
Source:
<code>public void loadTrace(ITmfTrace trace) { <START> cancelUpdate(); <END> super.loadTrace(trace); initializeDataProvider(); }</code><technical_language>cancelUpdate() beginning of updateContent(). UpdateThread get cancelled TmfXYChartViewer.windowRangeUpdated() TmfCommonXAxisChartViewer.setNbPoints()</technical_language>

Target:
public void loadTrace(ITmfTrace trace) { super.loadTrace(trace); initializeDataProvider(); }
Source:
<code>private static AuditSourceIdentificationType createAuditSourceIdentification(String communityId, String communityName) { AuditSourceIdentificationType auditSrcId = new AuditSourceIdentificationType(); if (communityId != null) { <START> if (communityId.startsWith(AuditTransformsConstants.HOME_COMMUNITY_ID_PREFIX)) { <END> auditSrcId.setAuditSourceID(communityId); } else { auditSrcId.setAuditSourceID(AuditTransformsConstants.HOME_COMMUNITY_ID_PREFIX + communityId); } } if (communityName != null) { auditSrcId.setAuditEnterpriseSiteID(communityName); } return auditSrcId; }</code><technical_language>HomeCommunityMap.getHomeCommunityIdWithPrefix(String communityId) function for HCID prefix</technical_language>

Target:
private static AuditSourceIdentificationType createAuditSourceIdentification(String communityId, String communityName) { AuditSourceIdentificationType auditSrcId = new AuditSourceIdentificationType(); if (communityId != null) { auditSrcId.setAuditSourceID(HomeCommunityMap.getHomeCommunityIdWithPrefix(communityId)); } if (communityName != null) { auditSrcId.setAuditEnterpriseSiteID(communityName); } return auditSrcId; }
Source:
<code>public void step(int step, Closure closure) { if (compareEqual(step, 0)) { if (compareNotEqual(from, to)) { <START> throw new GroovyRuntimeException("Infinite loop detected due to step size of 0"); <END> } return; } final Iterator<Comparable> iter = new StepIterator(this, step); while (iter.hasNext()) { closure.call(iter.next()); } }</code><technical_language>this error instead of no-op</technical_language>

Target:
public void step(int step, Closure closure) { if (step == 0 && compareEqual(from, to)) { return; } for (Iterator<Comparable> iter = new LazySteppingIterator(this, step); iter.hasNext(); ) { closure.call(iter.next()); } }
Source:
<code>public void init(String username, String password, String email) { User user = new User(); user.setUsername(username); user.setEmail(email); user.setPassword(this.passwordEncoder.encode(password)); user.setEnabled(true); this.userRepository.save(user); if(Arrays.asList(this.environment.getActiveProfiles()).contains("development")) { this.initDevelopmentDatabase(); <START> this.initCoduno(); <END> } }</code><technical_language>more initUsersAndOrganizations instead of Coduno</technical_language>

Target:
public void init(String username, String password, String email) { User user = new User(); user.setUsername(username); user.setEmail(email); user.setPassword(this.passwordEncoder.encode(password)); user.setEnabled(true); this.userRepository.save(user); if(Arrays.asList(this.environment.getActiveProfiles()).contains("development")) { this.initDevelopmentDatabase(); this.initOrganizationsAndUsers(); } }
Source:
<code>public String getUsage(ICommandSender sender) { <START> return new TextComponentTranslation("commands.bloodmagic.network." + getName() + ".usage").getFormattedText() + "\n" + help; <END> }</code><technical_language>getUsage(...) expects a localization key</technical_language>

Target:
public String getUsage(ICommandSender sender) { return "commands.bloodmagic.network." + getName() + ".usage"; }
Source:
<code>private void warnIfProblematicConsistency(NodeContext nodeContext) { FailoverPriority failover = nodeContext.getCluster().getFailoverPriority(); <START> if (failover != null && failover.getType().equals(CONSISTENCY)) { <END> int voters = failover.getVoters(); List<Stripe> evenNodeStripes = nodeContext.getCluster().getStripes() .stream().filter(s -> (s.getNodeCount() + voters) % 2 == 0).collect(Collectors.toList()); if (evenNodeStripes.size() > 0) { StringBuilder warn = new StringBuilder(lineSeparator()); warn.append("===================================================================================================================" + lineSeparator()); warn.append("When a cluster is configured with failover-priority=consistency, stripes with an even number" + lineSeparator()); warn.append("of nodes plus voters are more likely to experience split brain situations." + lineSeparator()); warn.append("The following stripe(s) have an even number of nodes plus voters:" + lineSeparator()); for (Stripe s : evenNodeStripes) { warn.append(" Stripe: '" + s.getName() + "' has " + s.getNodeCount() + " nodes and " + voters + " voters." + lineSeparator()); } warn.append("===================================================================================================================" + lineSeparator()); LOGGER.warn(warn.toString()); } } }</code><technical_language>failover - == compare enums</technical_language>

Target:
private void warnIfProblematicConsistency(NodeContext nodeContext) { FailoverPriority failover = nodeContext.getCluster().getFailoverPriority(); if (failover.getType() == CONSISTENCY) { int voters = failover.getVoters(); List<Stripe> evenNodeStripes = nodeContext.getCluster().getStripes() .stream().filter(s -> (s.getNodeCount() + voters) % 2 == 0).collect(Collectors.toList()); if (evenNodeStripes.size() > 0) { StringBuilder warn = new StringBuilder(lineSeparator()); warn.append("===================================================================================================================" + lineSeparator()); warn.append("When a cluster is configured with failover-priority=consistency, stripes with an even number" + lineSeparator()); warn.append("of nodes plus voters are more likely to experience split brain situations." + lineSeparator()); warn.append("The following stripe(s) have an even number of nodes plus voters:" + lineSeparator()); for (Stripe s : evenNodeStripes) { warn.append(" Stripe: '" + s.getName() + "' has " + s.getNodeCount() + " nodes and " + voters + " voters." + lineSeparator()); } warn.append("===================================================================================================================" + lineSeparator()); LOGGER.warn(warn.toString()); } } }
Source:
<code>private Connection getConnection() { <START> if(WildFlySecurityManager.isChecking()) { <END> return RemotingContext.getConnection(); } else { return WildFlySecurityManager.doUnchecked(new PrivilegedAction<Connection>() { @Override public Connection run() { return RemotingContext.getConnection(); } }); } }</code><technical_language>Is tired eyes is this backwards</technical_language>

Target:
private Connection getConnection() { if(WildFlySecurityManager.isChecking()) { return WildFlySecurityManager.doUnchecked(new PrivilegedAction<Connection>() { @Override public Connection run() { return RemotingContext.getConnection(); } }); } else { return RemotingContext.getConnection(); } }
Source:
<code>public void processResponseEntity(HttpEntity responseEntity, LocalDocument doc) throws ProcessException { try { InputStream inputStream = responseEntity.getContent(); String content; if (responseEntity.getContentEncoding() != null) { Charset encoding = Charset.forName(responseEntity.getContentEncoding().getValue()); content = IOUtils.toString(inputStream, encoding); } else { <START> content = IOUtils.toString(inputStream); <END> } doc.putContentField(outputField, content); } catch (IOException e) { throw new ProcessException("Failed to read HTTP entity body", e); } catch (UnsupportedCharsetException e) { throw new ProcessException("Response used unsupported encoding", e); } }</code><technical_language>assuming default encoding here? that, I prefer assuming UTF-8</technical_language>

Target:
public void processResponseEntity(HttpEntity responseEntity, LocalDocument doc) throws ProcessException { try { InputStream inputStream = responseEntity.getContent(); String content; if (responseEntity.getContentEncoding() != null) { Charset encoding = Charset.forName(responseEntity.getContentEncoding().getValue()); content = IOUtils.toString(inputStream, encoding); } else { content = IOUtils.toString(inputStream, fallbackEncoding); } doc.putContentField(outputField, content); } catch (IOException e) { throw new ProcessException("Failed to read HTTP entity body", e); } catch (UnsupportedCharsetException e) { throw new ProcessException("Response used unsupported encoding", e); } }
Source:
<code>public EmailBuilder htmlFooter() { htmlFooter = String.format("<p>" + "If there are any questions about this process, please visit the " + "<a href=\"%s\">" + "ONC-ACB & ONC-ATL Portal</a> to submit a ticket." + "</p>" + "<p>Thank you!</p>" + "ONC CHPL Team", <START> env.getProperty("splitDeveloper.help.url")); <END> return this; }</code><technical_language>this property moved out of splitDeveloper namespace</technical_language>

Target:
public EmailBuilder htmlFooter() { htmlFooter = String.format("<p>" + "If there are any questions about this process, please visit the " + "<a href=\"%s\">" + "ONC-ACB & ONC-ATL Portal</a> to submit a ticket." + "</p>" + "<p>Thank you!</p>" + "ONC CHPL Team", env.getProperty("footer.url")); return this; }
Source:
<code>public HttpResponse doSubmit(StaplerRequest req) throws IOException { StringBuilder whitelist = new StringBuilder(Util.fixNull(req.getParameter("whitelist"))); <START> if (!whitelist.toString().endsWith("\n")) <END> whitelist.append("\n"); Enumeration e = req.getParameterNames(); while (e.hasMoreElements()) { String name = (String) e.nextElement(); if (name.startsWith("class:")) { whitelist.append(name.substring(6)).append("\n"); } } whitelisted.set(whitelist.toString()); String newRules = Util.fixNull(req.getParameter("filePathRules")); filePathRules.parseTest(newRules); filePathRules.set(newRules); return HttpResponses.redirectToDot(); }</code><technical_language>able avoid constructing string temporarily whitelist.lastIndexOf("\n") == (whitelist.length() - 1) similar</technical_language>

Target:
public HttpResponse doSubmit(StaplerRequest req) throws IOException { StringBuilder whitelist = new StringBuilder(Util.fixNull(req.getParameter("whitelist"))); if (whitelist.charAt(whitelist.length() - 1) != '\n') whitelist.append("\n"); Enumeration e = req.getParameterNames(); while (e.hasMoreElements()) { String name = (String) e.nextElement(); if (name.startsWith("class:")) { whitelist.append(name.substring(6)).append("\n"); } } whitelisted.set(whitelist.toString()); String newRules = Util.fixNull(req.getParameter("filePathRules")); filePathRules.parseTest(newRules); filePathRules.set(newRules); return HttpResponses.redirectToDot(); }
Source:
<code>public IStatus run(IProgressMonitor monitor) { if (session != null) { IEditingSession uiSession = SessionUIManager.INSTANCE.getUISession(session); Collection<DialectEditor> editors = <START> uiSession.getEditors(); <END> if (editors.isEmpty()) { session.save(monitor); } else { IWorkbenchWindow activeWorkbenchWindow = PlatformUI.getWorkbench().getActiveWorkbenchWindow(); if (activeWorkbenchWindow != null) { IEditorPart activeEditor = activeWorkbenchWindow.getActivePage().getActiveEditor(); if (editors.contains(activeEditor)) { activeEditor.doSave(monitor); } else session.save(monitor); } else { editors.iterator().next().doSave(monitor); } } } return Status.OK_STATUS; }</code><technical_language>getSiriusEditors</technical_language>

Target:
public IStatus run(IProgressMonitor monitor) { if (session != null) { Optional<IEditingSession> uiSession = Optional.ofNullable(SessionUIManager.INSTANCE.getUISession(session)); Collection<ISiriusEditor> attachedEditors = uiSession.map(IEditingSession::getSiriusEditors).orElse(Collections.emptyList()); IEditorPart activeEditor = EclipseUIUtil.getActiveEditor(); if (attachedEditors.contains(activeEditor)) { activeEditor.doSave(monitor); } else if (!attachedEditors.isEmpty()) { attachedEditors.iterator().next().doSave(monitor); } else { session.save(monitor); } } return Status.OK_STATUS; }
Source:
<code>public void startElement( String namespaceURI, String localName, String rawName, Attributes atts) throws SAXException { if (localName.equals("GetCapabilities")) { LOGGER.finer("found capabilities start."); for (int i = 0, n = atts.getLength(); i < n; i++) { if (atts.getLocalName(i).equals("version")) { String version = atts.getValue(i); request.setVersion(version); } else if (atts.getLocalName(i).equals("updateSequence")) { request.setUpdateSequence(atts.getValue(i)); <START> } else if (atts.getLocalName(i).equals("noRootLayer")) { <END> request.setNoRootLayer(Boolean.valueOf(atts.getValue(i))); } } } }</code><technical_language>This brings POST request out of spec, provide example in docs</technical_language>

Target:
public void startElement( String namespaceURI, String localName, String rawName, Attributes atts) throws SAXException { if (localName.equals("GetCapabilities")) { LOGGER.finer("found capabilities start."); for (int i = 0, n = atts.getLength(); i < n; i++) { if (atts.getLocalName(i).equals("version")) { String version = atts.getValue(i); request.setVersion(version); } else if (atts.getLocalName(i).equals("updateSequence")) { request.setUpdateSequence(atts.getValue(i)); } else if (atts.getLocalName(i).equals("rootLayer")) { request.setRootLayerEnabled(Boolean.valueOf(atts.getValue(i))); } } } }
Source:
<code>protected JComponent getParameterPanel() { postContentTabbedPane = new ValidationTabbedPane(); argsPanel = new HTTPArgumentsPanel(); postContentTabbedPane.add(JMeterUtils.getResString("post_as_parameters"), argsPanel); int indx = TAB_PARAMETERS; if(showRawBodyPane) { tabRawBodyIndex = ++indx; postBodyContent = JSyntaxTextArea.getInstance(30, 50); postContentTabbedPane.add(JMeterUtils.getResString("post_body"), JTextScrollPane.getInstance(postBodyContent)); } if(showFileUploadPane) { tabFileUploadIndex = ++indx; filesPanel = new HTTPFileArgsPanel(); postContentTabbedPane.add(JMeterUtils.getResString("post_files_upload"), filesPanel); } <START> JPanel wrapper = new JPanel(new BorderLayout()); wrapper.setBorder(BorderFactory.createTitledBorder("")); wrapper.add(postContentTabbedPane, BorderLayout.CENTER); <END> return wrapper; }</code><technical_language>This adds extra border in Metal LaF :-/</technical_language>

Target:
protected JTabbedPane getParameterPanel() { postContentTabbedPane = new ValidationTabbedPane(); argsPanel = new HTTPArgumentsPanel(); postContentTabbedPane.add(JMeterUtils.getResString("post_as_parameters"), argsPanel); int indx = TAB_PARAMETERS; if(showRawBodyPane) { tabRawBodyIndex = ++indx; postBodyContent = JSyntaxTextArea.getInstance(30, 50); postContentTabbedPane.add(JMeterUtils.getResString("post_body"), JTextScrollPane.getInstance(postBodyContent)); } if(showFileUploadPane) { tabFileUploadIndex = ++indx; filesPanel = new HTTPFileArgsPanel(); postContentTabbedPane.add(JMeterUtils.getResString("post_files_upload"), filesPanel); } return postContentTabbedPane; }
Source:
<code>protected String resolveRegisteredFunctionName(String functionName) { <START> return getIgnoreCase(getRegisteredFunctions(), functionName); <END> }</code><technical_language>Do a map lookup in registered functions STATIC_EMF_INTEGRATOR.getRegisteredFunctions(emf).get(functionName.toLowerCase()) instead</technical_language>

Target:
protected String resolveRegisteredFunctionName(String functionName) { return getIgnoreCase(STATIC_EMF_INTEGRATOR.getRegisteredFunctions(emf).keySet(), functionName); }
Source:
<code><START> static boolean isUnresolvedSchema(final Schema schema) { <END> return (schema.getType() == Schema.Type.RECORD && schema.getProp(UR_SCHEMA_ATTR) != null); }</code><technical_language>need for final parameters</technical_language>

Target:
static boolean isUnresolvedSchema(final Schema schema) { return (schema.getType() == Schema.Type.RECORD && schema.getProp(UR_SCHEMA_ATTR) != null && UR_SCHEMA_NAME.equals(schema.getName()) && UR_SCHEMA_NS.equals(schema.getNamespace())); }
Source:
<code>public void stopping(Connection c) { m_isUp = false; if (!m_closing) { <START> if (isPrimary()) { <END> if (!m_hostMessenger.isShuttingDown()) { VoltDB.dropStackTrace("Received remote hangup from foreign host " + hostnameAndIPAndPort()); hostLog.warn("Received remote hangup from foreign host " + hostnameAndIPAndPort()); } m_hostMessenger.reportForeignHostFailed(m_hostId); } } }</code><technical_language>Remove wrap of IF by: if (!m_closing && isPrimary())</technical_language>

Target:
public void stopping(Connection c) { m_isUp = false; if (!m_closing && isPrimary()) { if (!m_hostMessenger.isShuttingDown()) { VoltDB.dropStackTrace("Received remote hangup from foreign host " + hostnameAndIPAndPort()); hostLog.warn("Received remote hangup from foreign host " + hostnameAndIPAndPort()); } m_hostMessenger.reportForeignHostFailed(m_hostId); } }
Source:
<code>void startTestCase(final TestCase testCase) { if (!testCase.getUri().equals(currentUri)) { currentUri = testCase.getUri(); currentFeatureName = testSources.getFeatureName(currentUri); } ensureUniqueTestName(testCase); <START> currentTestCaseName = getUniqueTestName(testCase); <END> resetSeverestResult(); final Bundle testStart = createBundle(currentFeatureName, currentTestCaseName); instrumentation.sendStatus(StatusCodes.START, testStart); }</code><technical_language>want do is calculate unique name for current test case, divide this methods dependent need called in order i s IMHO right solution (if this is driven "command query separation", I do is right place for it). I getUniqueTestName (maybe renamed calculateUniqueTestName is a getter) do work return result</technical_language>

Target:
void startTestCase(final TestCase testCase) { if (!testCase.getUri().equals(currentUri)) { currentUri = testCase.getUri(); currentFeatureName = testSources.getFeatureName(currentUri); } currentTestCaseName = calculateUniqueTestName(testCase); resetSeverestResult(); final Bundle testStart = createBundle(currentFeatureName, currentTestCaseName); instrumentation.sendStatus(StatusCodes.START, testStart); }
Source:
<code>public void afterSLAViolated(SLAViolatedEvent event) { CaseFileInstance caseFile = getCaseFile((KieSession) event.getKieRuntime()); if (caseFile != null) { String caseId = ((WorkflowProcessInstanceImpl) event.getProcessInstance()).getCorrelationKey(); if (caseFile.getCaseId().equals(caseId)) { logger.debug("Case instance has SLA violation, escalating starting new process instance for {}", caseId, processId); CaseService caseService = (CaseService) ServiceRegistry.get().service(ServiceRegistry.CASE_SERVICE); Long slaViolationProcessInstanceId = caseService.addDynamicSubprocess(caseId, processId, null); <START> logger.debug("Process instance with id was created to handler SLA violation for case {}", slaViolationProcessInstanceId, caseId); <END> } } }</code><technical_language>"was created handle* SLA violation"</technical_language>

Target:
public void afterSLAViolated(SLAViolatedEvent event) { CaseFileInstance caseFile = getCaseFile((KieSession) event.getKieRuntime()); if (caseFile != null) { String caseId = ((WorkflowProcessInstanceImpl) event.getProcessInstance()).getCorrelationKey(); if (caseFile.getCaseId().equals(caseId)) { logger.debug("Case instance has SLA violation, escalating starting new process instance for {}", caseId, processId); CaseService caseService = (CaseService) ServiceRegistry.get().service(ServiceRegistry.CASE_SERVICE); Long slaViolationProcessInstanceId = caseService.addDynamicSubprocess(caseId, processId, null); logger.debug("Process instance with id was created to handle SLA violation for case {}", slaViolationProcessInstanceId, caseId); } } }
Source:
<code>public static Cipher getInstance(CipherTransformation transformation) throws GeneralSecurityException { <START> return getInstance(null, transformation); <END> }</code><technical_language>put CipherTransformation parameter for getInstance(transformation, props) Utils.getCripherTransformation, is typo in Utils Cripher -> Cipher</technical_language>

Target:
public static Cipher getInstance(CipherTransformation transformation) throws GeneralSecurityException { return getInstance(transformation, null); }
Source:
<code>public void visitNode(Tree tree) { ListTree<TypeTree> thrownList = ((MethodTree) tree).throwsClauses(); Set<String> reported = new HashSet<>(); for (TypeTree typeTree : thrownList) { Type symbolType = typeTree.symbolType(); String fullyQualifiedName = symbolType.fullyQualifiedName(); if (!reported.contains(fullyQualifiedName)) { <START> String isSubtypeOfAny = isSubclassOfAny(symbolType, thrownList); <END> if (isSubtypeOfAny != null) { addIssue(typeTree, "Remove the declaration of thrown exception '" + fullyQualifiedName + "' which is a subclass of '" + isSubtypeOfAny + "'."); } else if (symbolType.isSubtypeOf("java.lang.RuntimeException")) { addIssue(typeTree, "Remove the declaration of thrown exception '" + fullyQualifiedName + "' which is a runtime exception."); } else if (declaredMoreThanOnce(fullyQualifiedName, thrownList)) { addIssue(typeTree, "Remove the redundant '" + fullyQualifiedName + "' thrown exception declaration(s)."); } reported.add(fullyQualifiedName); } } }</code><technical_language>poorly named variable: I rename superTypeName</technical_language>

Target:
public void visitNode(Tree tree) { ListTree<TypeTree> thrownList = ((MethodTree) tree).throwsClauses(); Set<String> reported = new HashSet<>(); for (TypeTree typeTree : thrownList) { Type symbolType = typeTree.symbolType(); String fullyQualifiedName = symbolType.fullyQualifiedName(); if (!reported.contains(fullyQualifiedName)) { String superTypeName = isSubclassOfAny(symbolType, thrownList); if (superTypeName != null) { addIssue(typeTree, "Remove the declaration of thrown exception '" + fullyQualifiedName + "' which is a subclass of '" + superTypeName + "'."); } else if (symbolType.isSubtypeOf("java.lang.RuntimeException")) { addIssue(typeTree, "Remove the declaration of thrown exception '" + fullyQualifiedName + "' which is a runtime exception."); } else if (declaredMoreThanOnce(fullyQualifiedName, thrownList)) { addIssue(typeTree, "Remove the redundant '" + fullyQualifiedName + "' thrown exception declaration(s)."); } reported.add(fullyQualifiedName); } } }
Source:
<code>public void read_events_by_time_and_type() { final Duration delta = Durations2.seconds(111); final Timestamp present = getCurrentTime(); final Timestamp past = subtract(present, delta); final Timestamp future = add(present, delta); final Event eventInPast = taskAdded(past); final Event eventInPresent = projectCreated(present); final Event eventInFuture = taskAdded(future); eventStore.append(eventInPast); eventStore.append(eventInPresent); eventStore.append(eventInFuture); final EventFilter taskAddedType = EventFilter.newBuilder() .setEventType(of(TaskAdded.class).value()) .build(); final EventStreamQuery query = EventStreamQuery.newBuilder() .setAfter(past) .addFilter(taskAddedType) .build(); final AtomicBoolean done = new AtomicBoolean(false); <START> final Collection<Event> resultEvents = Collections.synchronizedSet(new HashSet<Event>()); <END> eventStore.read(query, new ResponseObserver(resultEvents, done)); if (!done.get()) { fail("Please use the MoreExecutors.directExecutor in EventStore for tests."); } assertSize(1, resultEvents); final Event event = resultEvents.iterator() .next(); assertEquals(eventInFuture, event); }</code><technical_language>Please try [this](<LINK_0> instead. below</technical_language>

Target:
public void read_events_by_time_and_type() { final Duration delta = Durations2.seconds(111); final Timestamp present = getCurrentTime(); final Timestamp past = subtract(present, delta); final Timestamp future = add(present, delta); final Event eventInPast = taskAdded(past); final Event eventInPresent = projectCreated(present); final Event eventInFuture = taskAdded(future); eventStore.append(eventInPast); eventStore.append(eventInPresent); eventStore.append(eventInFuture); final EventFilter taskAddedType = EventFilter.newBuilder() .setEventType(of(TaskAdded.class).value()) .build(); final EventStreamQuery query = EventStreamQuery.newBuilder() .setAfter(past) .addFilter(taskAddedType) .build(); final AtomicBoolean done = new AtomicBoolean(false); final Collection<Event> resultEvents = newConcurrentHashSet(); eventStore.read(query, new ResponseObserver(resultEvents, done)); if (!done.get()) { fail("Please use the MoreExecutors.directExecutor in EventStore for tests."); } assertSize(1, resultEvents); final Event event = resultEvents.iterator() .next(); assertEquals(eventInFuture, event); }
Source:
<code>private void updateBranch() throws MergeException { if (mergeTip != null && (branchTip == null || branchTip != mergeTip)) { branchUpdate.setForceUpdate(false); branchUpdate.setNewObjectId(mergeTip); branchUpdate.setRefLogMessage("merged", true); try { switch (branchUpdate.update(rw)) { case NEW: case FAST_FORWARD: <START> final Project.NameKey projectName = projectCache.get(destBranch.getParentKey()).getProject().getNameKey(); <END> replication.scheduleUpdate(projectName, branchUpdate .getName()); break; default: throw new IOException(branchUpdate.getResult().name()); } } catch (IOException e) { throw new MergeException("Cannot update " + branchUpdate.getName(), e); } } }</code><technical_language>Style-nit: This line is 100 characters. tend target closer 80</technical_language>

Target:
private void updateBranch() throws MergeException { if (mergeTip != null && (branchTip == null || branchTip != mergeTip)) { branchUpdate.setForceUpdate(false); branchUpdate.setNewObjectId(mergeTip); branchUpdate.setRefLogMessage("merged", true); try { switch (branchUpdate.update(rw)) { case NEW: case FAST_FORWARD: final ProjectState ps = projectCache.get(destBranch.getParentKey()); final Project.NameKey projectName = ps.getProject().getNameKey(); replication.scheduleUpdate(projectName, branchUpdate .getName()); break; default: throw new IOException(branchUpdate.getResult().name()); } } catch (IOException e) { throw new MergeException("Cannot update " + branchUpdate.getName(), e); } } }
Source:
<code>public void addExporter() { CreateModifyExporterDialogView dialog = new CreateModifyExporterDialogView(null, dialogService, preferences <START> ); <END> Optional<ExporterViewModel> exporter = dialogService.showCustomDialogAndWait(dialog); if ((exporter != null) && exporter.isPresent()) { exporters.add(exporter.get()); } }</code><technical_language>Accidental line break</technical_language>

Target:
public void addExporter() { CreateModifyExporterDialogView dialog = new CreateModifyExporterDialogView(null); Optional<ExporterViewModel> exporter = dialogService.showCustomDialogAndWait(dialog); if ((exporter != null) && exporter.isPresent()) { exporters.add(exporter.get()); } }
Source:
<code>private void partitionIndexSegments(Map<Offset, IndexSegment> toRemove, Set<Offset> toRetain) { int i = 0; for (Map.Entry<Offset, IndexSegment> indexSegmentEntry : state.index.getIndexSegments().entrySet()) { <START> if (indexSegmentEntry.equals(state.index.getIndexSegments().lastEntry()) || i % 3 != 0) { <END> toRetain.add(indexSegmentEntry.getKey()); } else { toRemove.put(indexSegmentEntry.getKey(), indexSegmentEntry.getValue()); } i++; } }</code><technical_language>do i++ remove line 1886</technical_language>

Target:
private void partitionIndexSegments(Map<Offset, IndexSegment> toRemove, Set<Offset> toRetain) { int i = 0; for (Map.Entry<Offset, IndexSegment> indexSegmentEntry : state.index.getIndexSegments().entrySet()) { if (indexSegmentEntry.getValue().getEndOffset().compareTo(state.index.journal.getFirstOffset()) >= 0 || i % 3 != 0) { toRetain.add(indexSegmentEntry.getKey()); } else { toRemove.put(indexSegmentEntry.getKey(), indexSegmentEntry.getValue()); } i++; } }
Source:
<code>public void testBlockingOnStoreAvailabilityChange() { Cache<Object, Object> cache = createManagerAndGetCache(false, 1); PollingPersistenceManager pm = new PollingPersistenceManager(); TestingUtil.replaceComponent(cache, PersistenceManager.class, pm, true); AdvancedAsyncCacheWriter asyncWriter = TestingUtil.getFirstWriter(cache); DummyInMemoryStore store = (DummyInMemoryStore) TestingUtil.extractField(AdvancedAsyncCacheWriter.class, asyncWriter, "actual"); store.setAvailable(true); cache.put(1, 1); eventually(() -> store.load(1) != null); assertEquals(1, store.size()); store.setAvailable(false); assertFalse(store.isAvailable()); int pollCount = pm.pollCount.get(); assertTrue(asyncWriter.isAvailable()); assertFalse(TestingUtil.extractField(asyncWriter, "delegateAvailable")); eventually(() -> pm.pollCount.get() > pollCount); assertTrue(pm.isAvailable()); cache.putAll(intMap(0, 10)); assertEquals(1, store.size()); assertFalse(asyncWriter.isAvailable()); <START> eventually(() -> !pm.isAvailable()); <END> Exceptions.expectException(StoreUnavailableException.class, () -> cache.putAll(intMap(10, 20))); assertEquals(1, store.size()); store.setAvailable(true); assertTrue(store.isAvailable()); assertTrue(asyncWriter.isAvailable()); eventually(pm::isAvailable); eventually(() -> 10 == store.size()); assertFalse(store.contains(10)); }</code><technical_language>Sorry, I this is right: IMO new eventually calls sleepThread calls</technical_language>

Target:
public void testBlockingOnStoreAvailabilityChange() { Cache<Object, Object> cache = createManagerAndGetCache(false, 1); PollingPersistenceManager pm = new PollingPersistenceManager(); TestingUtil.replaceComponent(cache, PersistenceManager.class, pm, true); AdvancedAsyncCacheWriter asyncWriter = TestingUtil.getFirstWriter(cache); DummyInMemoryStore store = (DummyInMemoryStore) TestingUtil.extractField(AdvancedAsyncCacheWriter.class, asyncWriter, "actual"); store.setAvailable(true); cache.put(1, 1); eventually(() -> store.load(1) != null); assertEquals(1, store.size()); store.setAvailable(false); assertFalse(store.isAvailable()); int pollCount = pm.pollCount.get(); eventually(() -> pm.pollCount.get() > pollCount); assertTrue(asyncWriter.isAvailable()); assertFalse(TestingUtil.extractField(asyncWriter, "delegateAvailable")); assertTrue(pm.isAvailable()); cache.putAll(intMap(0, 10)); assertEquals(1, store.size()); eventually(() -> !pm.isAvailable()); assertFalse(asyncWriter.isAvailable()); Exceptions.expectException(StoreUnavailableException.class, () -> cache.putAll(intMap(10, 20))); assertEquals(1, store.size()); store.setAvailable(true); assertTrue(store.isAvailable()); assertTrue(asyncWriter.isAvailable()); eventually(pm::isAvailable); eventually(() -> 10 == store.size()); assertFalse(store.contains(10)); }
Source:
<code>protected RaftPartitionServer createServer(PartitionManagementService managementService) { final RaftPartitionServer raftPartitionServer = new RaftPartitionServer( this, config, managementService.getMembershipService().getLocalMember().id(), managementService.getMembershipService(), managementService.getMessagingService(), managementService.getPrimitiveTypes(), threadContextFactory); if (!deferredRoleChangeListeners.isEmpty()) { <START> deferredRoleChangeListeners.forEach(raftPartitionServer::addRoleChangeListener); <END> deferredRoleChangeListeners.clear(); } return raftPartitionServer; }</code><technical_language>@Zelldon more thought I safer if this operation moved server variable is assigned a value</technical_language>

Target:
protected RaftPartitionServer createServer(PartitionManagementService managementService) { return new RaftPartitionServer( this, config, managementService.getMembershipService().getLocalMember().id(), managementService.getMembershipService(), managementService.getMessagingService(), managementService.getPrimitiveTypes(), threadContextFactory); }
Source:
<code>void check() throws Exception { root = task.getContext().getNextPush(); task.execute(); IInterpreter interpreter = iRegistry.getInterpreter(root); assertNotNull("The <START> $" + <END> variableName + " should be available to reference the created instance", interpreter.evaluateEObject(root, "aql:" + variableName)); }</code><technical_language>query legacy variable prefix removed assertion message</technical_language>

Target:
void check() throws Exception { root = task.getContext().getNextPush(); task.execute(); IInterpreter interpreter = iRegistry.getInterpreter(root); assertNotNull("The " + variableName + " variable should be available to reference the created instance", interpreter.evaluateEObject(root, "aql:" + variableName)); }
Source:
<code><START> private Account getAccount(String id) { <END> try { return restTemplate.getForObject(Account.URI, Account.class, id); } catch (GoodDataRestException e) { if (HttpStatus.NOT_FOUND.value() == e.getStatusCode()) { throw new AccountNotFoundException(Account.TEMPLATE.expand(id).toString(), e); } else { throw e; } } catch (RestClientException e) { throw new GoodDataException("Unable to get account", e); } }</code><technical_language>public</technical_language>

Target:
public Account getAccount(String id) { try { return restTemplate.getForObject(Account.URI, Account.class, id); } catch (GoodDataRestException e) { if (HttpStatus.NOT_FOUND.value() == e.getStatusCode()) { throw new AccountNotFoundException(Account.TEMPLATE.expand(id).toString(), e); } else { throw e; } } catch (RestClientException e) { throw new GoodDataException("Unable to get account", e); } }
Source:
<code>public void proxyConfiguration() throws Exception { server.await(); String mockProxyUser = "alpha"; String mockProxyPass = "alphaPass"; CloudantClient client = new CloudantClient("<LINK_0>", new ConnectOptions() .setProxyURL(new URL(server.getUrl())) .setProxyUser(mockProxyUser) .setProxyPassword(mockProxyPass)); client.executeRequest(Http.GET(client.getBaseUri())); boolean foundProxyAuthHeader = false; for (String line : server.getLastInputRequestLines()) { if (line.contains("Proxy-Authorization")) { foundProxyAuthHeader = true; Matcher m = Pattern.compile("Proxy-Authorization: Basic (.*)", Pattern .CASE_INSENSITIVE).matcher(line); assertTrue("The Proxy-Authorization header should match the pattern", m.matches()); <START> assertEquals("There should be 1 group for the value", 1, m.groupCount()); <END> final String encodedCreds = new ProxyAuthInterceptor(mockProxyUser, mockProxyPass) { String getEncodedCreds() { return encodedAuth; } }.getEncodedCreds(); assertEquals("The encoded credentials should match the expected value", encodedCreds, m.group(1)); } } assertTrue(foundProxyAuthHeader); }</code><technical_language>group count change? I thought group for matching string another for bracketed subgroup, original 2 - is wrong</technical_language>

Target:
public void proxyConfiguration() throws Exception { server.await(); String mockProxyUser = "alpha"; String mockProxyPass = "alphaPass"; CloudantClient client = new CloudantClient("<LINK_1>", new ConnectOptions() .setProxyURL(new URL(server.getUrl())) .setProxyUser(mockProxyUser) .setProxyPassword(mockProxyPass)); client.executeRequest(Http.GET(client.getBaseUri())); boolean foundProxyAuthHeader = false; for (String line : server.getLastInputRequestLines()) { if (line.contains("Proxy-Authorization")) { foundProxyAuthHeader = true; Matcher m = Pattern.compile("Proxy-Authorization: Basic (.*)", Pattern .CASE_INSENSITIVE).matcher(line); assertTrue("The Proxy-Authorization header should match the pattern", m.matches()); assertEquals("There should be 1 group for the value", 1, m.groupCount()); final String encodedCreds = new ProxyAuthInterceptor(mockProxyUser, mockProxyPass) { String getEncodedCreds() { return encodedAuth; } }.getEncodedCreds(); assertEquals("The encoded credentials should match the expected value", encodedCreds, m.group(1)); } } assertTrue(foundProxyAuthHeader); }
Source:
<code>public void generatePage_WithSpecifiedQualifier_generatesStatsTableBody() { String testQualifier = "testQualifier"; configuration.setQualifier(FilenameUtils.removeExtension(SAMPLE_JSON), testQualifier); setUpWithJson(SAMPLE_JSON); configuration.addPresentationModes(PresentationMode.PARALLEL_TESTING); page = new FeaturesOverviewPage(reportResult, configuration); page.generatePage(); DocumentAssertion document = documentFrom(page.getWebPage()); TableRowAssertion[] bodyRows = document.getReport().getTableStats().getBodyRows(); assertThat(bodyRows).hasSize(2); TableRowAssertion firstRow = bodyRows[0]; firstRow.hasExactValues("1st feature", testQualifier, "10", "0", "0", "0", "0", "10", "1", "0", "1", "1:39.263", "Passed"); <START> firstRow.hasExactCSSClasses("tagname", "", "passed", "", "", "", "", "total", "passed", "", "total", "duration", "passed"); <END> firstRow.hasExactDataValues("", "", "", "", "", "", "", "", "", "", "", "99263122889", ""); firstRow.getReportLink().hasLabelAndAddress("1st feature", "report-feature_1920820787.html"); TableRowAssertion secondRow = bodyRows[1]; secondRow.hasExactValues("Second feature", testQualifier, "5", "1", "2", "1", "3", "12", "1", "2", "3", "0.092", "Failed"); secondRow.hasExactCSSClasses("tagname", "", "passed", "failed", "skipped", "pending", "undefined", "total", "passed", "failed", "total", "duration", "failed"); secondRow.hasExactDataValues("", "", "", "", "", "", "", "", "", "", "", "92610000", ""); secondRow.getReportLink().hasLabelAndAddress("Second feature", "report-feature_1_1515379431.html"); }</code><technical_language>remove this line end of section for feature - this allows focus is tested</technical_language>

Target:
public void generatePage_WithSpecifiedQualifier_generatesStatsTableBody() { String testQualifier = "testQualifier"; configuration.setQualifier(FilenameUtils.removeExtension(SAMPLE_JSON), testQualifier); setUpWithJson(SAMPLE_JSON); configuration.addPresentationModes(PresentationMode.PARALLEL_TESTING); page = new FeaturesOverviewPage(reportResult, configuration); page.generatePage(); DocumentAssertion document = documentFrom(page.getWebPage()); TableRowAssertion[] bodyRows = document.getReport().getTableStats().getBodyRows(); assertThat(bodyRows).hasSize(2); TableRowAssertion firstRow = bodyRows[0]; firstRow.hasExactValues("1st feature", testQualifier, "10", "0", "0", "0", "0", "10", "1", "0", "1", "1:39.263", "Passed"); }