auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public void query_explain_multipleIndexes_missingIndexName() { StubMappingScope scope = indexManager.createScope( otherIndexManager ); LuceneSearchQuery<DocumentReference> query = scope.query().extension( LuceneExtension.get() ) .where( f -> f.id().matching( FIRST_ID ) ) .toQuery(); Assertions.assertThatThrownBy( () -> query.explain( FIRST_ID ) ) .isInstanceOf( SearchException.class ) .hasMessageContaining( "explain(String id) cannot be used when the query targets multiple mapped types" ) .hasMessageContaining( TYPE_NAME ) <START> .hasMessageContaining( OTHER_TYPE_NAME ); <END> }</code><technical_language>I get longer checking string contains "pass of [" + INDEX_NAME + ", " + OTHER_INDEX_NAME + "]"</technical_language>

Target:
public void query_explain_multipleIndexes_missingIndexName() { StubMappingScope scope = indexManager.createScope( otherIndexManager ); LuceneSearchQuery<DocumentReference> query = scope.query().extension( LuceneExtension.get() ) .where( f -> f.id().matching( FIRST_ID ) ) .toQuery(); Assertions.assertThatThrownBy( () -> query.explain( FIRST_ID ) ) .isInstanceOf( SearchException.class ) .hasMessageContaining( "explain(String id) cannot be used when the query targets multiple mapped types" ) .hasMessageContaining( "pass one of [" + TYPE_NAME + ", " + OTHER_TYPE_NAME + "]" ); }
Source:
<code>private <P extends VdsIdVDSCommandParametersBase> FutureVDSCommand createFutureCommand(FutureVDSCommandType commandType, P parameters) { try { Class<FutureVDSCommand> type = (Class<FutureVDSCommand>) Class.forName(commandType.getFullyQualifiedClassName()); Constructor<FutureVDSCommand> constructor = ReflectionUtils.findConstructor(type, parameters.getClass()); if (constructor != null) { return constructor.newInstance(new Object[] { parameters }); } } catch (Exception e) { if (e.getCause() != null) { <START> log.error("CreateCommand failed", e.getCause()); <END> throw new RuntimeException(e.getCause().getMessage(), e.getCause()); } log.error("CreateCommand failed", e); } return null; }</code><technical_language>this line is changed, i a proper message is: "createFutureCommand failed"</technical_language>

Target:
private <P extends VdsIdVDSCommandParametersBase> FutureVDSCommand createFutureCommand(FutureVDSCommandType commandType, P parameters) { try { Class<FutureVDSCommand> type = (Class<FutureVDSCommand>) Class.forName(commandType.getFullyQualifiedClassName()); Constructor<FutureVDSCommand> constructor = ReflectionUtils.findConstructor(type, parameters.getClass()); if (constructor != null) { return constructor.newInstance(new Object[] { parameters }); } } catch (Exception e) { if (e.getCause() != null) { log.error("CreateFutureCommand failed", e.getCause()); throw new RuntimeException(e.getCause().getMessage(), e.getCause()); } log.error("CreateFutureCommand failed", e); } return null; }
Source:
<code>public void facet_on_created_at() { SearchOptions searchOptions = fixtureForCreatedAtFacet(); <START> <END> Map<String, Long> createdAt = index.search(newQueryBuilder() .createdBefore(DateUtils.parseDateTime("2016-01-01T00:00:00+0100")).build(), searchOptions).getFacets().get("createdAt"); assertThat(createdAt).containsOnly( entry("2011-01-01T00:00:00+0000", 10L), entry("2012-01-01T00:00:00+0000", 0L), entry("2013-01-01T00:00:00+0000", 0L), entry("2014-01-01T00:00:00+0000", 50L), entry("2015-01-01T00:00:00+0000", 10L)); }</code><technical_language>![MAJOR](<LINK_0> 'Severity: MAJOR') Fix remove this skipped unit test [![rule](<LINK_1>](<LINK_2></technical_language>

Target:
public void facet_on_created_at() { SearchOptions searchOptions = fixtureForCreatedAtFacet(); Builder query = newQueryBuilder().createdBefore(DateUtils.parseDateTime("2016-01-01T00:00:00+0100")); Map<String, Long> createdAt = new Facets(underTest.search(query.build(), searchOptions)).get("createdAt"); assertThat(createdAt).containsOnly( entry("2011-01-01T00:00:00+0000", 10L), entry("2012-01-01T00:00:00+0000", 0L), entry("2013-01-01T00:00:00+0000", 0L), entry("2014-01-01T00:00:00+0000", 50L), entry("2015-01-01T00:00:00+0000", 10L)); }
Source:
<code>public String duplicateProject(Integer itemId) { this.itemId = 0; try { this.myProjekt = serviceManager.getProjectService().duplicateProject(itemId); return redirectToEdit("?faces-redirect=true"); } catch (DAOException e) { logger.error(e.getMessage()); FacesContext facesContext = FacesContext.getCurrentInstance(); <START> FacesMessage facesMessage = new FacesMessage("ERROR: Unable to duplicate selected project!"); <END> facesContext.addMessage(null, facesMessage); return null; } }</code><technical_language>Output message is translatable</technical_language>

Target:
public String duplicateProject(Integer itemId) { setLocked(false); this.itemId = 0; try { this.myProjekt = serviceManager.getProjectService().duplicateProject(itemId); return redirectToEdit("?faces-redirect=true"); } catch (DAOException e) { logger.error(e.getMessage()); FacesContext facesContext = FacesContext.getCurrentInstance(); FacesMessage facesMessage = new FacesMessage(Helper.getTranslation("unableToDuplicateProject")); facesContext.addMessage(null, facesMessage); return null; } }
Source:
<code>void hierarchicalPropagateImprovement(VolcanoPlanner planner, RelMetadataQuery mq, RelSubset subset, RelNode rel, Set<RelSubset> activeSet) { <START> Stack<Pair<RelNode, RelSubset>> propagateStack = new Stack<>(); <END> subset.push(rel, propagateStack); while (!propagateStack.empty()) { Pair<RelNode, RelSubset> one = propagateStack.remove(0); one.getValue() .propagateCostImprovements0(planner, mq, one.getKey(), activeSet, propagateStack); } }</code><technical_language>Stack class is legacy, extends Vector, some util class</technical_language>

Target:
void hierarchicalPropagateImprovement(VolcanoPlanner planner, RelMetadataQuery mq, RelSubset subset, RelNode rel, Set<RelSubset> activeSet) { ArrayDeque<Pair<RelNode, RelSubset>> propagateQueue = new ArrayDeque<>(); subset.push(rel, propagateQueue); while (!propagateQueue.isEmpty()) { Pair<RelNode, RelSubset> first = propagateQueue.remove(); first.getValue() .propagateCostImprovements0(planner, mq, first.getKey(), activeSet, propagateQueue); } }
Source:
<code>private AggregationNode computeCounts(UnionNode sourceNode, List<Symbol> originalColumns, List<Symbol> markers, List<Symbol> aggregationOutputs) { ImmutableMap.Builder<Symbol, Aggregation> aggregations = ImmutableMap.builder(); for (int i = 0; i < markers.size(); i++) { Symbol output = aggregationOutputs.get(i); aggregations.put(output, new Aggregation( new FunctionCall(QualifiedName.of("count"), ImmutableList.of(markers.get(i).toSymbolReference())), COUNT_AGGREGATION, Optional.empty())); } return new AggregationNode(idAllocator.getNextId(), sourceNode, aggregations.build(), <START> AggregationNode.singleGroupingSet(originalColumns), <END> ImmutableList.of(), Step.SINGLE, Optional.empty(), Optional.empty()); }</code><technical_language>Static import match other callsites</technical_language>

Target:
private AggregationNode computeCounts(UnionNode sourceNode, List<Symbol> originalColumns, List<Symbol> markers, List<Symbol> aggregationOutputs) { ImmutableMap.Builder<Symbol, Aggregation> aggregations = ImmutableMap.builder(); for (int i = 0; i < markers.size(); i++) { Symbol output = aggregationOutputs.get(i); aggregations.put(output, new Aggregation( new FunctionCall(QualifiedName.of("count"), ImmutableList.of(markers.get(i).toSymbolReference())), COUNT_AGGREGATION, Optional.empty())); } return new AggregationNode(idAllocator.getNextId(), sourceNode, aggregations.build(), singleGroupingSet(originalColumns), ImmutableList.of(), Step.SINGLE, Optional.empty(), Optional.empty()); }
Source:
<code>public void stopStatisticCollector() { if (collectingStats.compareAndSet(true, false)) { task.cancel(false); <START> task = null; <END> } }</code><technical_language>This is racy... accidentally cancel, null out incoming task reference (unless is synchronization this somewhere). potentially switch AtomicReference avoid this issue</technical_language>

Target:
public synchronized void stopStatisticCollector() { if (task != null) { task.cancel(false); task = null; } }
Source:
<code>public void init() { model = editorFixture.getModel(); assertNotNull("The model cannot be null", model); profile = model.getAppliedProfile(PROFILE_NAME); assertEquals("Profile is not the one Expected", PROFILE_NAME, profile.getName()); simpleClass = model.getMember(SIMPLE_CLASS_NAME); assertTrue("The element is a Class", simpleClass instanceof Class); assertEquals("Element is not the one expected", SIMPLE_CLASS_NAME, simpleClass.getName()); stereotypedClass = model.getMember(STEREOTYPED_CLASS_NAME); <START> assertTrue("The element is a Class", simpleClass instanceof Class); END> assertEquals("Element is not the one expected", STEREOTYPED_CLASS_NAME, stereotypedClass.getName()); for (Iterator<Comment> iterator = model.getOwnedComments().iterator(); iterator.hasNext();) { Comment comment = iterator.next(); if (comment.getBody() == null) { emptyCommment = comment; } else { commment = comment; } } templateSignature = model.getOwnedTemplateSignature(); assertNotNull("The template signature must exist", templateSignature); templateParameter = templateSignature.getParameters().get(0); assertNotNull("The template parameters must exist", templateParameter); }</code><technical_language>test L 209 error</technical_language>

Target:
public void init() { model = editorFixture.getModel(); assertNotNull("The model cannot be null", model); profile = model.getAppliedProfile(PROFILE_NAME); assertEquals("Profile is not the one Expected", PROFILE_NAME, profile.getName()); simpleClass = model.getMember(SIMPLE_CLASS_NAME); assertTrue("The element is not a Class", simpleClass instanceof Class); assertEquals("Element is not the one expected", SIMPLE_CLASS_NAME, simpleClass.getName()); stereotypedClass = model.getMember(STEREOTYPED_CLASS_NAME); assertTrue("The element is not a Class", stereotypedClass instanceof Class); assertEquals("Element is not the one expected", STEREOTYPED_CLASS_NAME, stereotypedClass.getName()); for (Iterator<Comment> iterator = model.getOwnedComments().iterator(); iterator.hasNext();) { Comment comment = iterator.next(); if (comment.getBody() == null) { emptyCommment = comment; } else { commment = comment; } } templateSignature = model.getOwnedTemplateSignature(); assertNotNull("The template signature must exist", templateSignature); templateParameter = templateSignature.getParameters().get(0); assertNotNull("The template parameters must exist", templateParameter); }
Source:
<code>public void propertyChange(PropertyChangeEvent event) { Repository repo = historyPage.getCurrentRepo(); if (repo == null) { if (UIPreferences.RESOURCEHISTORY_SHOW_FIRST_PARENT_ONLY_DEFAULT .equals(event.getProperty())) { applyNewState(historyPage.store.getBoolean( UIPreferences.RESOURCEHISTORY_SHOW_FIRST_PARENT_ONLY_DEFAULT)); } return; } String <START> repoSepcificKey <END> = getRepositorySpecificFirstParentPreferenceKey( repo); if (UIPreferences.RESOURCEHISTORY_SHOW_FIRST_PARENT_ONLY_DEFAULT .equals(event.getProperty())) { if (!historyPage.store.contains(repoSepcificKey)) { applyNewState(historyPage.store.getBoolean( UIPreferences.RESOURCEHISTORY_SHOW_FIRST_PARENT_ONLY_DEFAULT)); } } if (P_REPOSITORY.equals(event.getProperty())) { applyNewState(historyPage.isShowFirstParentOnly()); } }</code><technical_language>Spe</technical_language>

Target:
public void propertyChange(PropertyChangeEvent event) { Repository repo = historyPage.getCurrentRepo(); final String prefKey = UIPreferences.RESOURCEHISTORY_SHOW_FIRST_PARENT_ONLY_DEFAULT; if (repo == null) { if (prefKey.equals(event.getProperty())) { applyNewState(historyPage.store.getBoolean(prefKey)); } return; } String repoSpecificKey = getRepoSpecificKey(repo, prefKey); if (prefKey.equals(event.getProperty())) { if (!historyPage.store.contains(repoSpecificKey)) { applyNewState(historyPage.store.getBoolean(prefKey)); } } if (P_REPOSITORY.equals(event.getProperty())) { applyNewState(historyPage.isShowFirstParentOnly()); } }
Source:
<code>public Object execute(ExecutionEvent event) throws ExecutionException { IWorkbenchWindow window = PlatformUI.getWorkbench().getActiveWorkbenchWindow(); if (window == null) { return null; } IWorkbenchPage page = window.getActivePage(); IWorkbenchPart part = page.getActivePart(); if (!(part instanceof FilterView)) { return null; } FilterView v = (FilterView) part; ITmfFilterTreeNode sel = v.getSelection(); if (sel == null) { sel = v.getFilterRoot(); } <START> ITmfFilterTreeNode objectToPaste = FilterEditUtils.getTransferedTreeNode(); <END> objectToPaste = objectToPaste.clone(); sel.addChild(objectToPaste); v.refresh(); v.setSelection(objectToPaste); return null; }</code><technical_language>Interesting bug: LocalSelectionTransfer instance for Copy&Paste Drag&Drop, if do a Drag&Drop a Copy, subsequent Paste work dragFinished() clear selection. solved a Clipboard instance? If easy solution, leave for later</technical_language>

Target:
public Object execute(ExecutionEvent event) throws ExecutionException { IWorkbenchWindow window = PlatformUI.getWorkbench().getActiveWorkbenchWindow(); if (window == null) { return null; } IWorkbenchPage page = window.getActivePage(); IWorkbenchPart part = page.getActivePart(); if (!(part instanceof FilterView)) { return null; } FilterView v = (FilterView) part; ITmfFilterTreeNode sel = v.getSelection(); if (sel == null) { sel = v.getFilterRoot(); } ITmfFilterTreeNode objectToPaste = FilterEditUtils.getTransferredTreeNode(); objectToPaste = objectToPaste.clone(); sel.addChild(objectToPaste); v.refresh(); v.setSelection(objectToPaste); return null; }
Source:
<code>public void dispose() { <START> <END> }</code><technical_language>view is closed need stop build thread</technical_language>

Target:
public void dispose() { fSyncLock.lock(); try { BuildThread buildThread = fBuildThread; if (buildThread != null) { buildThread.cancel(); } } finally { fSyncLock.unlock(); } }
Source:
<code>public final void doGenerateAndDownload(StaplerRequest req, StaplerResponse rsp) throws ServletException, IOException, Descriptor.FormException { Jenkins.get().checkPermission(Jenkins.ADMINISTER); LOGGER.fine("Preparing response..."); rsp.setContentType("application/zip"); JSONObject json = req.getSubmittedForm(); if (!json.has("components")) { rsp.sendError(HttpServletResponse.SC_BAD_REQUEST); return; } LOGGER.fine("Parsing request..."); List<ObjectComponent<T>> components = new ArrayList<>(parseRequest(req)); rsp.addHeader("Content-Disposition", "inline; filename=" + SupportPlugin.getBundleFileName() + ";"); try { SupportPlugin.setRequesterAuthentication(Jenkins.getAuthentication()); try (ACLContext old = ACL.as(ACL.SYSTEM)) { SupportPlugin.writeBundle(rsp.getOutputStream(), components, new ComponentVisitor() { <START> @Override <END> public <C extends Component> void visit(Container container, C component) { ((ObjectComponent<T>)component).addContents(container, object); } }); } catch (IOException e) { LOGGER.log(Level.WARNING, e.getMessage(), e); } finally { SupportPlugin.clearRequesterAuthentication(); } } finally { LOGGER.fine("Response completed"); } }</code><technical_language>This is parsed method</technical_language>

Target:
public final void doGenerateAndDownload(StaplerRequest req, StaplerResponse rsp) throws ServletException, IOException, Descriptor.FormException { Jenkins.get().checkPermission(Jenkins.ADMINISTER); LOGGER.fine("Preparing response..."); rsp.setContentType("application/zip"); JSONObject json = req.getSubmittedForm(); if (json == null || !json.has("components")) { rsp.sendError(HttpServletResponse.SC_BAD_REQUEST); return; } LOGGER.fine("Parsing request..."); List<ObjectComponent<T>> components = new ArrayList<>(parseRequest(req)); rsp.addHeader("Content-Disposition", "inline; filename=" + SupportPlugin.getBundleFileName() + ";"); try { SupportPlugin.setRequesterAuthentication(Jenkins.getAuthentication()); try (ACLContext old = ACL.as(ACL.SYSTEM)) { SupportPlugin.writeBundle(rsp.getOutputStream(), components, new ComponentVisitor() { @Override public <C extends Component> void visit(Container container, C component) { ((ObjectComponent<T>)component).addContents(container, object); } }); } catch (IOException e) { LOGGER.log(Level.WARNING, e.getMessage(), e); } finally { SupportPlugin.clearRequesterAuthentication(); } } finally { LOGGER.fine("Response completed"); } }
Source:
<code>public void testProviderUnavailableCreate() throws SourceUnavailableException { MockEventProcessor eventAdmin = new MockEventProcessor(); MockMemoryProvider provider = <START> new MockMemoryProvider("Provider", "Provider", "v1.0", "DDF", new HashSet<>(), false, null); <END> CatalogFramework framework = createDummyCatalogFramework(provider, storageProvider, eventAdmin, false); List<Metacard> metacards = new ArrayList<>(); MetacardImpl newCard = new MetacardImpl(); newCard.setId(null); metacards.add(newCard); CreateRequest create = new CreateRequestImpl(metacards); try { framework.create(create); } catch (IngestException e) { fail(); } }</code><technical_language>Provider v1.0 constants</technical_language>

Target:
public void testProviderUnavailableCreate() throws SourceUnavailableException { MockEventProcessor eventAdmin = new MockEventProcessor(); MockMemoryProvider provider = new MockMemoryProvider( PROVIDER, PROVIDER, PROVIDER_VERSION, "DDF", new HashSet<>(), false, null); CatalogFramework framework = createDummyCatalogFramework(provider, storageProvider, eventAdmin, false); List<Metacard> metacards = new ArrayList<>(); MetacardImpl newCard = new MetacardImpl(); newCard.setId(null); metacards.add(newCard); CreateRequest create = new CreateRequestImpl(metacards); try { framework.create(create); } catch (IngestException e) { fail(); } }
Source:
<code>public void testDisableSlowConsumerReconnectWithKilled() throws Exception { ClientSessionFactory sf = createSessionFactory(locator); ClientSession session = addClientSession(sf.createSession(false, true, true, false)); session.createQueue(QUEUE, QUEUE, null, false); ClientProducer producer = addClientProducer(session.createProducer(QUEUE)); final int numMessages = 25; for (int i = 0; i < numMessages; i++) { producer.send(createTextMessage(session, "m" + i)); } ClientConsumer consumer = addClientConsumer(session.createConsumer(QUEUE)); session.start(); Thread.sleep(3000); RemotingService service = server.getRemotingService(); Set<RemotingConnection> connections = service.getConnections(); <START> assertEquals(true, connections.isEmpty()); <END> if (sf instanceof ClientSessionFactoryImpl) { int reconnectAttemps = ((ClientSessionFactoryImpl)sf).getReconnectAttempts(); assertEquals(0, reconnectAttemps); } else { throw new ActiveMQException(); } }</code><technical_language>assertTrue instead</technical_language>

Target:
public void testDisableSlowConsumerReconnectWithKilled() throws Exception { ClientSessionFactory sf = createSessionFactory(locator); ClientSession session = addClientSession(sf.createSession(false, true, true, false)); session.createQueue(QUEUE, QUEUE, null, false); ClientProducer producer = addClientProducer(session.createProducer(QUEUE)); final int numMessages = 25; for (int i = 0; i < numMessages; i++) { producer.send(createTextMessage(session, "m" + i)); } ClientConsumer consumer = addClientConsumer(session.createConsumer(QUEUE)); session.start(); Thread.sleep(3000); RemotingService service = server.getRemotingService(); Set<RemotingConnection> connections = service.getConnections(); assertTrue(connections.isEmpty()); if (sf instanceof ClientSessionFactoryImpl) { int reconnectAttemps = ((ClientSessionFactoryImpl)sf).getReconnectAttempts(); assertEquals(0, reconnectAttemps); } else { fail("ClientSessionFactory is not the instance of ClientSessionFactoryImpl"); } }
Source:
<code>public int compare(Method o1, Method o2) { <START> return o2.getParameterTypes().length - o1.getParameterTypes().length; <END> }</code><technical_language>Integer.compare(o1.., o2..) here, this method return -1, 0 1</technical_language>

Target:
public int compare(Method o1, Method o2) { return Integer.compare(o2.getParameterTypes().length, o1.getParameterTypes().length); }
Source:
<code>private static boolean isSimilar(Object expected, Object actual) { <START> logger.debug("Comparing EXPECTED and ACTUAL {}", expected, actual); <END> if (expected instanceof String && actual instanceof String) { return expected.equals(ANY_VALUE) || expected.equals(actual); } else if (expected instanceof Number && actual instanceof Number) { return expected.getClass() == actual.getClass() && expected.equals(actual); } else if (expected instanceof JSONObject && actual instanceof JSONObject) { return areJsonObjectsSimilarEnough((JSONObject) expected, (JSONObject) actual); } return false; }</code><technical_language>caps EXPECTED ACTUAL here</technical_language>

Target:
private static boolean isSimilar(Object expected, Object actual) { logger.debug("Comparing expected and actual {}", expected, actual); if (expected instanceof String && actual instanceof String) { return expected.equals(ANY_VALUE) || expected.equals(actual); } else if (expected instanceof Number && actual instanceof Number) { return expected.getClass() == actual.getClass() && expected.equals(actual); } else if (expected instanceof JSONObject && actual instanceof JSONObject) { return areJsonObjectsSimilarEnough((JSONObject) expected, (JSONObject) actual); } return false; }
Source:
<code>private boolean isAddAccessEnabled() { boolean returnValue; try { if (SystemGroup.OseeAccessAdmin.isCurrentUserMember()) { <START> returnValue = true; } else if (policyTableViewer.getAccessControlList().size() > 0) { <END> returnValue = AccessControlManager.hasPermission(accessControlledObject, PermissionEnum.FULLACCESS); } else { returnValue = true; } } catch (OseeCoreException ex) { OseeLog.log(Activator.class, Level.SEVERE, ex); returnValue = false; } return returnValue; }</code><technical_language>above</technical_language>

Target:
private boolean isAddAccessEnabled() { boolean returnValue; try { if (!SystemGroup.OseeAccessAdmin.isCurrentUserMember() && policyTableViewer.getAccessControlList().size() > 0) { returnValue = AccessControlManager.hasPermission(accessControlledObject, PermissionEnum.FULLACCESS); } else { returnValue = true; } } catch (OseeCoreException ex) { OseeLog.log(Activator.class, Level.SEVERE, ex); returnValue = false; } return returnValue; }
Source:
<code><START> private final List<Expression> extractNodes = extractNode() ? Collections.<Expression>singletonList(PrefixFunction.this) : Collections.<Expression>emptyList(); <END> private final KeyPart childPart; PrefixKeyPart(KeyPart childPart) { this.childPart = childPart; }</code><technical_language>this ll give line length warning</technical_language>

Target:
Collections.<Expression>singletonList(PrefixFunction.this) : Collections.<Expression>emptyList(); private final KeyPart childPart; PrefixKeyPart(KeyPart childPart) { this.childPart = childPart; }
Source:
<code>public <START> void setMirroringEnabled(boolean <END> value) { fMirroringEnabled = value; }</code><technical_language>final</technical_language>

Target:
public final void setMirroringEnabled(boolean value) { fMirroringEnabled = value; }
Source:
<code>private String getErrorMessage( List<MissingEntry> missingEntries ) { StringBuilder entries = new StringBuilder(); for ( MissingEntry entry : missingEntries ) { <START> if ( missingEntries.indexOf( entry ) == missingEntries.size() - 1 ) { <END> entries.append( "- " + entry.getName() + " - " + entry.getMissingPluginId() + "\n\n" ); } else { entries.append( "- " + entry.getName() + " - " + entry.getMissingPluginId() + "\n" ); } } return BaseMessages.getString( PKG, "MissingEntryDialog.MissingJobEntries", entries.toString() ); }</code><technical_language>this refactored this? entries.append( "- " + entry.getName() + " - " + entry.getMissingPluginId() + "\n"); if ( missingEntries.indexOf( entry ) == missingEntries.size() - 1 ) { entries.append("\n"); }</technical_language>

Target:
private String getErrorMessage( List<MissingEntry> missingEntries ) { StringBuilder entries = new StringBuilder(); for ( MissingEntry entry : missingEntries ) { entries.append( "- " + entry.getName() + " - " + entry.getMissingPluginId() + "\n" ); if ( missingEntries.indexOf( entry ) == missingEntries.size() - 1 ) { entries.append( '\n' ); } } return BaseMessages.getString( PKG, "MissingEntryDialog.MissingJobEntries", entries.toString() ); }
Source:
<code>private IAction createHierarchicalAction() { IAction action = new Action(Messages.ControlFlowView_hierarchicalViewLabel, IAction.AS_RADIO_BUTTON) { @Override public void run() { ITmfTrace parentTrace = getTrace(); fFlatTraces.remove(parentTrace); for (ITmfTrace trace : TmfTraceManager.getTraceSet(parentTrace)) { final ITmfStateSystem ss = TmfStateSystemAnalysisModule.getStateSystem(trace, KernelAnalysisModule.ID); List<ControlFlowEntry> currentRootList = getEntryList(ss).stream().filter(e -> e instanceof ControlFlowEntry).map(e -> (ControlFlowEntry) e).collect(Collectors.toList()); addEntriesToHierarchicalTree(currentRootList, parentTrace, ss); refresh(); } } }; action.setChecked(true); action.setToolTipText(Messages.ControlFlowView_hierarchicalViewToolTip); <START> action.setImageDescriptor(Activator.getDefault().getImageDescripterFromPath(IControlflowImageConstants.IMG_UI_HIERARCHICAL_VIEW)); <END> return action; }</code><technical_language>suggested image descriptors for actions platform show radio button, is more visible for user is selected. images more useful in earlier patch actions tool bar. Ubuntu images menu items display default</technical_language>

Target:
private IAction createHierarchicalAction() { IAction action = new Action(Messages.ControlFlowView_hierarchicalViewLabel, IAction.AS_RADIO_BUTTON) { @Override public void run() { ITmfTrace parentTrace = getTrace(); synchronized (fFlatTraces) { fFlatTraces.remove(parentTrace); for (ITmfTrace trace : TmfTraceManager.getTraceSet(parentTrace)) { final ITmfStateSystem ss = TmfStateSystemAnalysisModule.getStateSystem(trace, KernelAnalysisModule.ID); List<ControlFlowEntry> currentRootList = getEntryList(ss).stream().filter(e -> e instanceof ControlFlowEntry).map(e -> (ControlFlowEntry) e).collect(Collectors.toList()); addEntriesToHierarchicalTree(currentRootList, parentTrace, ss); } } refresh(); } }; action.setChecked(true); action.setToolTipText(Messages.ControlFlowView_hierarchicalViewToolTip); return action; }
Source:
<code>private static String readUrl(String urlString) throws Exception { BufferedReader reader = null; try { URL url = new URL(urlString); <START> reader = new BufferedReader(new InputStreamReader(url.openStream())); <END> StringBuffer buffer = new StringBuffer(); int read; char[] chars = new char[1024]; while ((read = reader.read(chars)) != -1) buffer.append(chars, 0, read); return buffer.toString(); } finally { if (reader != null) reader.close(); } }</code><technical_language>this? <LINK_0></technical_language>

Target:
private static String readUrl(String urlString) throws Exception { URL url = new URL(urlString); try (BufferedReader reader = new BufferedReader(new InputStreamReader(url.openStream()))) { StringBuffer buffer = new StringBuffer(); int read; char[] chars = new char[1024]; while ((read = reader.read(chars)) != -1) buffer.append(chars, 0, read); return buffer.toString(); } }
Source:
<code>public boolean equals(final Object obj) { <START> if (!(obj instanceof DueDateAmountMap)) { <END> return false; } return innerMap.equals(obj); }</code><technical_language>do this instead: return obj instanceof DueDateAmountMap && innerMap.equals(obj);</technical_language>

Target:
public boolean equals(final Object obj) { return obj instanceof DueDateAmountMap && innerMap.equals(obj); }
Source:
<code>public void findByNullSchema() throws Exception { <START> context.turnOffAuthorisationSystem(); <END> getClient().perform(get("/api/core/metadatafields/search/bySchema")) .andExpect(status().isUnprocessableEntity()); }</code><technical_language>I Auth system remain in this method</technical_language>

Target:
public void findByNullSchema() throws Exception { getClient().perform(get("/api/core/metadatafields/search/bySchema")) .andExpect(status().isUnprocessableEntity()); }
Source:
<code>public List<Contentlet> getRelatedContentFromIndex(Contentlet contentlet,Relationship rel, boolean pullByParent, User user, boolean respectFrontendRoles) throws DotDataException, DotSecurityException { try { return getRelatedContentESQuery(contentlet, rel, user, respectFrontendRoles, pullByParent); } catch (Exception e){ <START> final String errorMessage = "Unable to look up related content for contentlet with identifier " <END> + contentlet.getIdentifier(); if (e instanceof SearchPhaseExecutionException || e .getCause() instanceof SearchPhaseExecutionException) { Logger.warnAndDebug(ESContentletAPIImpl.class, errorMessage + ". An empty list will be returned", e); return Collections.emptyList(); } throw new DotDataException(errorMessage, e); } }</code><technical_language>Please log relationship name too</technical_language>

Target:
public List<Contentlet> getRelatedContentFromIndex(Contentlet contentlet,Relationship rel, boolean pullByParent, User user, boolean respectFrontendRoles) throws DotDataException, DotSecurityException { try { return getRelatedContentESQuery(contentlet, rel, user, respectFrontendRoles, pullByParent); } catch (Exception e){ final String errorMessage = "Unable to look up related content for contentlet with identifier " + contentlet.getIdentifier() + ". Relationship Name: " + rel.getRelationTypeValue(); if (e instanceof SearchPhaseExecutionException || e .getCause() instanceof SearchPhaseExecutionException) { Logger.warnAndDebug(ESContentletAPIImpl.class, errorMessage + ". An empty list will be returned", e); return Collections.emptyList(); } throw new DotDataException(errorMessage, e); } }
Source:
<code>public <T> Provider<T> scope(final Key<T> key, final Provider<T> unscopedProvider) { return new Provider<T>() { @Override public T get() { CacheableContext cacheableContext = cacheableContextProvider.get(); String resourcePath = resourcePathProvider.get(); <START> T unscoped = unscopedProvider.get(); <END> T scoped = cacheableContext.putIfAbsent(resourcePath, key, unscoped); return scoped == null ? unscoped : scoped; } }; }</code><technical_language>is point of cache, if create uncached anyway? This method invoked if is in cache</technical_language>

Target:
public <T> Provider<T> scope(final Key<T> key, final Provider<T> unscopedProvider) { return new Provider<T>() { @SuppressWarnings("unchecked") @Override public T get() { CacheableContext cacheableContext = cacheableContextProvider.get(); String resourcePath = resourcePathProvider.get(); CacheableContextKey contextKey = new CacheableContextKey(resourcePath, key); T value = (T) cacheableContext.get(contextKey); if (value == null) { value = unscopedProvider.get(); cacheableContext.put(contextKey, value); } return value; } }; }
Source:
<code>private void testMenu(final boolean enabled) { <START> final DMNEditorMenuSessionItems menuItems = spy(new DMNEditorMenuSessionItems(builder, sessionCommands, mock(PlaceManager.class))); <END> menuItems.setEnabled(enabled); verify(menuItems).setItemEnabled(ClearSessionCommand.class, enabled); verify(menuItems).setItemEnabled(VisitGraphSessionCommand.class, enabled); verify(menuItems).setItemEnabled(SwitchGridSessionCommand.class, enabled); verify(menuItems).setItemEnabled(ValidateSessionCommand.class, enabled); verify(menuItems).setItemEnabled(ExportToJpgSessionCommand.class, enabled); verify(menuItems).setItemEnabled(ExportToPngSessionCommand.class, enabled); verify(menuItems).setItemEnabled(ExportToSvgSessionCommand.class, enabled); verify(menuItems).setItemEnabled(ExportToPdfSessionCommand.class, enabled); verify(menuItems).setItemEnabled(ExportToRawFormatSessionCommand.class, enabled); verify(menuItems).setItemEnabled(DeleteSelectionSessionCommand.class, false); verify(menuItems).setItemEnabled(UndoSessionCommand.class, false); verify(menuItems).setItemEnabled(RedoSessionCommand.class, false); verify(menuItems).setItemEnabled(CopySelectionSessionCommand.class, false); verify(menuItems).setItemEnabled(CutSelectionSessionCommand.class, false); verify(menuItems).setItemEnabled(PasteSelectionSessionCommand.class, false); verify(menuItems).setItemEnabled(DMNPerformAutomaticLayoutCommand.class, enabled); }</code><technical_language>@Mock'ed instance variable</technical_language>

Target:
private void testMenu(final boolean enabled) { final DMNEditorMenuSessionItems menuItems = spy(new DMNEditorMenuSessionItems(builder, sessionCommands, placeManager)); menuItems.setEnabled(enabled); verify(menuItems).setItemEnabled(ClearSessionCommand.class, enabled); verify(menuItems).setItemEnabled(VisitGraphSessionCommand.class, enabled); verify(menuItems).setItemEnabled(SwitchGridSessionCommand.class, enabled); verify(menuItems).setItemEnabled(ValidateSessionCommand.class, enabled); verify(menuItems).setItemEnabled(ExportToJpgSessionCommand.class, enabled); verify(menuItems).setItemEnabled(ExportToPngSessionCommand.class, enabled); verify(menuItems).setItemEnabled(ExportToSvgSessionCommand.class, enabled); verify(menuItems).setItemEnabled(ExportToPdfSessionCommand.class, enabled); verify(menuItems).setItemEnabled(ExportToRawFormatSessionCommand.class, enabled); verify(menuItems).setItemEnabled(DeleteSelectionSessionCommand.class, false); verify(menuItems).setItemEnabled(UndoSessionCommand.class, false); verify(menuItems).setItemEnabled(RedoSessionCommand.class, false); verify(menuItems).setItemEnabled(CopySelectionSessionCommand.class, false); verify(menuItems).setItemEnabled(CutSelectionSessionCommand.class, false); verify(menuItems).setItemEnabled(PasteSelectionSessionCommand.class, false); verify(menuItems).setItemEnabled(DMNPerformAutomaticLayoutCommand.class, enabled); }
Source:
<code>public static void installMetadataSharingPackages() { try { Collection<File> mdsFiles = loadMdsFiles(); if (mdsFiles == null) { <START> log.error("Unable to find any metadata sharing files"); <END> return; } List<PackageImporter> packageImporters = loadPackageImporters(mdsFiles); removeAlreadyLoadedPackageImporters(packageImporters); sortPackageImporters(packageImporters); loadPackages(packageImporters); Context.flushSession(); } catch(Exception e) { log.error("Unable to load metadata sharing packages", e); } }</code><technical_language>This is redundant error messages in loadMdsFiles</technical_language>

Target:
public static void installMetadataSharingPackages() { try { Collection<File> mdsFiles = loadMdsFiles(); if (mdsFiles == null) { return; } List<PackageImporter> packageImporters = loadPackageImporters(mdsFiles); removeAlreadyLoadedPackageImporters(packageImporters); sortPackageImporters(packageImporters); loadPackages(packageImporters); Context.flushSession(); } catch(Exception e) { log.error("Unable to load metadata sharing packages", e); } }
Source:
<code><START> protected GdbLaunch getGDBLaunch() { <END> return (GdbLaunch) getSession().getModelAdapter(ILaunch.class); }</code><technical_language>create this new API. Instead, in doInitialize() set a member variable store launch. this method private</technical_language>

Target:
private GdbLaunch getGDBLaunch() { return (GdbLaunch) getSession().getModelAdapter(ILaunch.class); }
Source:
<code>public void setUp() throws Exception { final String apiKey = System.getProperty(KILLBILL_PAYMENT_RECURLY_API_KEY); final String subDomain = System.getProperty(KILLBILL_PAYMENT_RECURLY_SUBDOMAIN); if (apiKey == null) { Assert.fail("You need to set your Recurly api key to run integration tests:" + " -Dkillbill.payment.recurly.apiKey=..."); <START> } if (subDomain == null) { <END> Assert.fail("You need to set your Recurly subdomain to run integration tests:" + " -Dkillbill.payment.recurly.subDomain=..."); } recurlyClient = new RecurlyClient(apiKey, subDomain); recurlyClient.open(); }</code><technical_language>for testing simply default api, simplify setup</technical_language>

Target:
public void setUp() throws Exception { final String apiKey = System.getProperty(KILLBILL_PAYMENT_RECURLY_API_KEY); String subDomainTemp = System.getProperty(KILLBILL_PAYMENT_RECURLY_SUBDOMAIN); if (apiKey == null) { Assert.fail("You need to set your Recurly api key to run integration tests:" + " -Dkillbill.payment.recurly.apiKey=..."); } if (subDomainTemp == null) { subDomainTemp = "api"; } final String subDomain = subDomainTemp; recurlyClient = new RecurlyClient(apiKey, subDomain); recurlyClient.open(); }
Source:
<code>List<Page> getBufferedPages() { <START> ImmutableList.Builder<Page> builder = new ImmutableList.Builder<>(); <END> for (int i = 0; i < currentPageCount; i++) { if (pageReferences.get(i) != null) { builder.add(pageReferences.get(i).getPage()); } } return builder.build(); }</code><technical_language>If this is for testing, stream api</technical_language>

Target:
List<Page> getBufferedPages() { return IntStream.range(0, currentPageCount) .filter(i -> pageReferences.get(i) != null) .mapToObj(i -> pageReferences.get(i).getPage()) .collect(toImmutableList()); }
Source:
<code>private void writeAttributes(Iterable<Attribute> attrs, ExcelWriter writer) throws IOException { if (!writer.hasSheet(EMX_ATTRIBUTES)) { writer.createSheet(EMX_ATTRIBUTES, newArrayList(ATTRIBUTE_ATTRS.keySet())); } writer.writeRows( <START> StreamSupport.stream(attrs.spliterator(), false).map(attr -> map(attr)), EMX_ATTRIBUTES); <END> }</code><technical_language>Guava Streams.stream(myStream) instead of StreamSupport.stream(myStream.spliterator(), false)</technical_language>

Target:
private void writeAttributes(Iterable<Attribute> attrs, ExcelWriter writer) throws IOException { if (!writer.hasSheet(EMX_ATTRIBUTES)) { writer.createSheet(EMX_ATTRIBUTES, newArrayList(ATTRIBUTE_ATTRS.keySet())); } writer.writeRows(Streams.stream(attrs).map(AttributeMapper::map), EMX_ATTRIBUTES); }
Source:
<code>@Before public void vars() throws IOException, InterruptedException { listener = StreamTaskListener.fromStdout(); ws = j.jenkins.getRootPath().child("ws"); launcher = j.jenkins.createLauncher(listener); Properties properties = System.getProperties(); String pathSeparator = properties.getProperty("path.separator"); String[] paths = System.getenv("PATH").split(pathSeparator); boolean powershellExists = false; <START> String cmd = launcher.isUnix()?"pwsh":"powershell.exe"; <END> for (String p : paths) { File f = new File(p, cmd); if (f.exists()) { powershellExists = true; break; } } Assume.assumeTrue("This test should only run if powershell is available", powershellExists == true); if (powershellExists == true) { List<String> args = new ArrayList<>(Collections.singleton(cmd)); if (!launcher.isUnix()) { args.addAll(Arrays.asList("-ExecutionPolicy", "Bypass")); } args.addAll(Arrays.asList("-Command", "& {Write-Output $PSVersionTable.PSVersion.Major}")); Launcher.ProcStarter ps = launcher.launch().cmds(args).quiet(true); ps.readStdout(); Proc proc = ps.start(); String psVersionStr = IOUtils.toString(proc.getStdout()); try { psVersion = Integer.parseInt(psVersionStr.trim()); } catch (NumberFormatException x) { throw new AssumptionViolatedException(psVersionStr, x); } Assume.assumeTrue("This test should only run if the powershell major version is at least 3", psVersion >= 3); } }</code><technical_language>Ahh dragons... People cygwin sshd launch slaves windows I ends telling Jenkins OS is Unix, powershell executable is powershell pwsh is linux.... this break existing setup I this change here</technical_language>

Target:
@Before public void vars() throws IOException, InterruptedException { listener = StreamTaskListener.fromStdout(); ws = j.jenkins.getRootPath().child("ws"); launcher = j.jenkins.createLauncher(listener); Properties properties = System.getProperties(); String pathSeparator = properties.getProperty("path.separator"); String[] paths = System.getenv("PATH").split(pathSeparator); boolean powershellExists = false; String cmd = "powershell"; for (String p : paths) { File withoutExtension = new File(p, cmd); File withExtension = new File(p, cmd + ".exe"); if (withoutExtension.exists() || withExtension.exists()) { powershellExists = true; break; } } Assume.assumeTrue("This test should only run if powershell is available", powershellExists == true); if (powershellExists == true) { List<String> args = new ArrayList<>(Collections.singleton(cmd)); if (!launcher.isUnix()) { args.addAll(Arrays.asList("-ExecutionPolicy", "Bypass")); } args.addAll(Arrays.asList("-Command", "& {Write-Output $PSVersionTable.PSVersion.Major}")); Launcher.ProcStarter ps = launcher.launch().cmds(args).quiet(true); ps.readStdout(); Proc proc = ps.start(); String psVersionStr = IOUtils.toString(proc.getStdout()); try { psVersion = Integer.parseInt(psVersionStr.trim()); } catch (NumberFormatException x) { throw new AssumptionViolatedException(psVersionStr, x); } Assume.assumeTrue("This test should only run if the powershell major version is at least 3", psVersion >= 3); } }
Source:
<code>public ObjectTag getContext(String name) { if (name.equals("mob")) { return mob; } else if (name.equals("entity")) { return entity; } else if (name.equals("location")) { return location; } else if (name.equals("from_spawner")) { return new ElementTag(event.isFromMythicSpawner()); } <START> else if (name.equals("spawner_location")) { <END> AbstractLocation loc = event.getMythicSpawner().getLocation(); return new LocationTag(loc.getX(), loc.getY(), loc.getZ(),loc.getWorld().getName()); } return super.getContext(name); }</code><technical_language>This validate isFromMythicSpawner</technical_language>

Target:
public ObjectTag getContext(String name) { if (name.equals("mob")) { return mythicmob; } else if (name.equals("entity")) { return new EntityTag(event.getEntity()); } else if (name.equals("location")) { return location; } else if (name.equals("from_spawner")) { return new ElementTag(event.isFromMythicSpawner()); } else if (name.equals("spawner_location") && event.isFromMythicSpawner()) { AbstractLocation loc = event.getMythicSpawner().getLocation(); return new LocationTag(loc.getX(), loc.getY(), loc.getZ(), loc.getWorld().getName()); } return super.getContext(name); }
Source:
<code>public void run() { Shell shell = getShell(); if (shell == null) { return; } FileDialog fd = <START> TmfFileDialogFactory.createFileDialog(shell); <END> fd.setFilterExtensions(getExtension()); String fileName = fd.open(); if (fileName == null) { return; } try (FileOutputStream fos = new FileOutputStream(fileName)) { exportToTsv(fos); } catch (IOException e) { Activator.getDefault().logError("IO Error " + fileName, e); } }</code><technical_language>Personally I preferred FileDialogFactory.create()..</technical_language>

Target:
public void run() { Shell shell = getShell(); if (shell == null) { return; } FileDialog fd = TmfFileDialogFactory.create(shell); fd.setFilterExtensions(getExtension()); String fileName = fd.open(); if (fileName == null) { return; } try (FileOutputStream fos = new FileOutputStream(fileName)) { exportToTsv(fos); } catch (IOException e) { Activator.getDefault().logError("IO Error " + fileName, e); } }
Source:
<code>public void waitForKrux() { waitPageLoaded(); <START> wait.until(CommonExpectedConditions.scriptReturnsTrue("return !!window.Krux")); <END> }</code><technical_language>change immplicit rever change waiting</technical_language>

Target:
public void waitForKrux() { waitPageLoaded(); driver.manage().timeouts().implicitlyWait(500, TimeUnit.MILLISECONDS); try { wait.until(CommonExpectedConditions.scriptReturnsTrue("return !!window.Krux")); } finally { restoreDeaultImplicitWait(); } }
Source:
<code>private ResourceKey(String p, String f, String r) { project = <START> p != null ? <END> new Project.NameKey(p) : null; file = f; revision = r; }</code><technical_language>this happen? If care</technical_language>

Target:
private ResourceKey(String p, String f, String r) { project = new Project.NameKey(p); file = f; revision = r; }
Source:
<code><START> public static void goOnline() { <END> RetryStrategies.linear(new RetryStrategies.Retryable() { @Override public void call() { AirplaneMode.disable(); } }, new RetryStrategies.Condition() { @Override public boolean isMet() { return InternetConnectivity.isOnline(); } }, 3, 2); }</code><technical_language>do need synchronize methods? a race condition checking for connection status changing connection status</technical_language>

Target:
public synchronized static void goOnline() { RetryStrategies.linear(new RetryStrategies.Retryable() { @Override public void call() { AirplaneMode.disable(); } }, new RetryStrategies.Condition() { @Override public boolean isMet() { return InternetConnectivity.isOnline(); } }, 3, 2); }
Source:
<code>private static String getUserId(String userName) { String getUserIDURL; try { <START> getUserIDURL = String.format("%s/api.php?action=query&list=users&ususers=%s&format=json&cb=%d", <END> new UrlBuilder().getUrlForWiki("community"), URLEncoder.encode(userName, "UTF-8"), DateTime.now().getMillis()); } catch (UnsupportedEncodingException e) { PageObjectLogging.logError("UNSUPPORTED ENCODING EXCEPTION", e); throw new WebDriverException(e); } HttpGet httpGet = new HttpGet(getUserIDURL); PageObjectLogging.logInfo("USER_ID_REQUEST", httpGet.getURI().toString()); try { return executeAndRetry(httpGet, extractUserId()); } catch (ClientProtocolException e) { PageObjectLogging.log(CLIENT_PROTOCOL_EXCEPTION, ExceptionUtils.getStackTrace(e), false); throw new WebDriverException(e); } catch (IOException e) { PageObjectLogging.log(IOEXCEPTION_COMMAND, IOEXCEPTION_ERROR_MESSAGE + ExceptionUtils.getStackTrace(e), false); throw new WebDriverException(e); } }</code><technical_language>extract this variable evaluation another method, a hanging variable declaration. variable final</technical_language>

Target:
private static String getUserId(String userName) { try { String encodedUsername = URLEncoder.encode(userName, "UTF-8"); HttpGet httpGet = new HttpGet(getUserIdUrl(encodedUsername)); PageObjectLogging.logInfo("USER_ID_REQUEST", httpGet.getURI().toString()); return executeAndRetry(httpGet, extractUserId()); } catch (UnsupportedEncodingException e) { PageObjectLogging.logError("UNSUPPORTED ENCODING EXCEPTION", e); throw new WebDriverException(e); } catch (ClientProtocolException e) { PageObjectLogging.log(CLIENT_PROTOCOL_EXCEPTION, ExceptionUtils.getStackTrace(e), false); throw new WebDriverException(e); } catch (IOException e) { PageObjectLogging.log(IOEXCEPTION_COMMAND, IOEXCEPTION_ERROR_MESSAGE + ExceptionUtils.getStackTrace(e), false); throw new WebDriverException(e); } }