auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code><START> public final void setup() { <END> customHandler = new CustomHandler(); wasCustomHandlerInvoked = false; throwable = new TestRejectedTaskException(); activeThreadCount = 2; corePoolSize = 4; largestPoolSize = 8; maximumPoolSize = 16; executorQueue = new SynchronousQueue<>(); final Lease lease = new LeaseBuilder().build(); leaseAssignments = Collections.singletonList(lease); when(executor.getQueue()).thenReturn(executorQueue); when(executor.getActiveCount()).thenReturn(activeThreadCount); when(executor.getCorePoolSize()).thenReturn(corePoolSize); when(executor.getLargestPoolSize()).thenReturn(largestPoolSize); when(executor.getMaximumPoolSize()).thenReturn(maximumPoolSize); when(leaseCoordinator.getAssignments()).thenReturn(leaseAssignments); }</code><technical_language>need for final methods in tests</technical_language>

Target:
public void setup() { wasCustomHandlerInvoked = false; executorQueue = new SynchronousQueue<>(); final Lease lease = new LeaseBuilder().build(); leaseAssignments = Collections.singletonList(lease); when(executor.getQueue()).thenReturn(executorQueue); when(executor.getActiveCount()).thenReturn(activeThreadCount); when(executor.getCorePoolSize()).thenReturn(corePoolSize); when(executor.getLargestPoolSize()).thenReturn(largestPoolSize); when(executor.getMaximumPoolSize()).thenReturn(maximumPoolSize); when(leaseCoordinator.getAssignments()).thenReturn(leaseAssignments); }
Source:
<code>public IPropertyDescriptor[] getPropertyDescriptors() { List<IPropertyDescriptor> descriptors= new ArrayList<IPropertyDescriptor>(); descriptors.add(new ReadOnlyTextPropertyDescriptor(ID_TIMESTAMP, NAME_TIMESTAMP)); descriptors.add(new ReadOnlyTextPropertyDescriptor(ID_SOURCE, NAME_SOURCE)); descriptors.add(new ReadOnlyTextPropertyDescriptor(ID_TYPE, NAME_TYPE)); descriptors.add(new ReadOnlyTextPropertyDescriptor(ID_REFERENCE, NAME_REFERENCE)); descriptors.add(new ReadOnlyTextPropertyDescriptor(ID_CONTENT, NAME_CONTENT)); if ((fEvent instanceof ITmfSourceLookup) && (((ITmfSourceLookup)fEvent).getCallsite() != null)) { descriptors.add(new ReadOnlyTextPropertyDescriptor(ID_SOURCE_LOOKUP, NAME_SOURCE_LOOKUP)); } <START> <END> if (fEvent instanceof ITmfCustomAttributes) { ITmfCustomAttributes event = (ITmfCustomAttributes) fEvent; if (event.listCustomAttributes() != null && !event.listCustomAttributes().isEmpty()) { descriptors.add(new ReadOnlyTextPropertyDescriptor(ID_CUSTOM_ATTRIBUTE, NAME_CUSTOM_ATTRIBUTES)); } } return descriptors.toArray(new IPropertyDescriptor[0]); }</code><technical_language>display of IModelLookup property removed. For CTF traces needed duplicate entries in properties table for model other trace types implement ITmfModelLookup interface display in properties view. Please put back</technical_language>

Target:
public IPropertyDescriptor[] getPropertyDescriptors() { List<IPropertyDescriptor> descriptors= new ArrayList<IPropertyDescriptor>(); descriptors.add(new ReadOnlyTextPropertyDescriptor(ID_TIMESTAMP, NAME_TIMESTAMP)); descriptors.add(new ReadOnlyTextPropertyDescriptor(ID_SOURCE, NAME_SOURCE)); descriptors.add(new ReadOnlyTextPropertyDescriptor(ID_TYPE, NAME_TYPE)); descriptors.add(new ReadOnlyTextPropertyDescriptor(ID_REFERENCE, NAME_REFERENCE)); descriptors.add(new ReadOnlyTextPropertyDescriptor(ID_CONTENT, NAME_CONTENT)); if ((fEvent instanceof ITmfSourceLookup) && (((ITmfSourceLookup)fEvent).getCallsite() != null)) { descriptors.add(new ReadOnlyTextPropertyDescriptor(ID_SOURCE_LOOKUP, NAME_SOURCE_LOOKUP)); } if ((fEvent instanceof ITmfModelLookup) && (((ITmfModelLookup) fEvent).getModelUri() != null)) { descriptors.add(new ReadOnlyTextPropertyDescriptor(ID_MODEL_URI, NAME_MODEL_URI)); } if (fEvent instanceof ITmfCustomAttributes) { ITmfCustomAttributes event = (ITmfCustomAttributes) fEvent; if (event.listCustomAttributes() != null && !event.listCustomAttributes().isEmpty()) { descriptors.add(new ReadOnlyTextPropertyDescriptor(ID_CUSTOM_ATTRIBUTE, NAME_CUSTOM_ATTRIBUTES)); } } return descriptors.toArray(new IPropertyDescriptor[0]); }
Source:
<code>public ExtendedEmailPublisherContext(ExtendedEmailPublisher publisher, AbstractBuild<?, ?> build, Launcher launcher, BuildListener listener) { this.publisher = publisher; this.run = build; this.workspace = build.getWorkspace(); this.launcher = launcher; <START> this.listener = listener; <END> }</code><technical_language>call new constructor? for easier maintenance in future</technical_language>

Target:
public ExtendedEmailPublisherContext(ExtendedEmailPublisher publisher, AbstractBuild<?, ?> build, Launcher launcher, BuildListener listener) { this(publisher, build, build.getWorkspace(), launcher, listener); }
Source:
<code>public DirCache call() throws IOException { DirCache dc = DirCache.lock(repo); try { ObjectWriter ow = new ObjectWriter(repo); ObjectId id; DirCacheIterator c; DirCacheBuilder builder = dc.builder(); final TreeWalk tw = new TreeWalk(repo); tw.reset(); tw.addTree(new DirCacheBuildIterator(builder)); FileTreeIterator fileTreeIterator = new FileTreeIterator( repo.getWorkDir(), repo.getFS()); tw.addTree(fileTreeIterator); tw.setRecursive(true); <START> tw.setFilter(PathFilterGroup.createFromStrings(filepatterns)); <END> String lastAddedFile = null; while (tw.next()) { String path = tw.getPathString(); final File file = new File(repo.getWorkDir(), path); if (!(path.equals(lastAddedFile))) { if (file.exists()) { id = ow.writeBlob(file); DirCacheEntry entry = new DirCacheEntry(path); entry.setObjectId(id); entry.setFileMode(repo.getFS().canExecute(file) ? FileMode.EXECUTABLE_FILE : FileMode.REGULAR_FILE); entry.setLastModified(file.lastModified()); entry.setLength((int) file.length()); builder.add(entry); lastAddedFile = path; } else { c = tw.getTree(0, DirCacheIterator.class); builder.add(c.getDirCacheEntry()); } } } builder.commit(); } finally { dc.unlock(); } return dc; }</code><technical_language>I this work if filepatterns is empty. throw IllegalStateException call() if filepatterns.isEmpty() is true</technical_language>

Target:
public DirCache call() throws NoFilepatternException { if (filepatterns.isEmpty()) throw new NoFilepatternException(JGitText.get().atLeastOnePatternIsRequired); checkCallable(); DirCache dc = null; try { dc = DirCache.lock(repo); ObjectWriter ow = new ObjectWriter(repo); DirCacheIterator c; DirCacheBuilder builder = dc.builder(); final TreeWalk tw = new TreeWalk(repo); tw.reset(); tw.addTree(new DirCacheBuildIterator(builder)); FileTreeIterator fileTreeIterator = new FileTreeIterator( repo.getWorkDir(), repo.getFS()); tw.addTree(fileTreeIterator); tw.setRecursive(true); tw.setFilter(PathFilterGroup.createFromStrings(filepatterns)); String lastAddedFile = null; while (tw.next()) { String path = tw.getPathString(); final File file = new File(repo.getWorkDir(), path); if (!(path.equals(lastAddedFile))) { FileTreeIterator f = tw.getTree(1, FileTreeIterator.class); if (f != null) { DirCacheEntry entry = new DirCacheEntry(path); entry.setLength((int)f.getEntryLength()); entry.setLastModified(f.getEntryLastModified()); entry.setFileMode(f.getEntryFileMode()); entry.setObjectId(ow.writeBlob(file)); builder.add(entry); lastAddedFile = path; } else { c = tw.getTree(0, DirCacheIterator.class); builder.add(c.getDirCacheEntry()); } } } builder.commit(); setCallable(false); } catch (IOException e) { throw new JGitInternalException( JGitText.get().exceptionCaughtDuringExecutionOfAddCommand, e); } finally { if (dc != null) dc.unlock(); } return dc; }
Source:
<code>public void combine_WithPlugins_annotations() throws Exception { List<WithPlugins> annotations = Arrays.asList( FakeTestClass.class.getAnnotation(WithPlugins.class), FakeTestClass.class.getMethod("test").getAnnotation(WithPlugins.class) ); List<PluginSpec> actual = WithPlugins.RuleImpl.combinePlugins(annotations); List<PluginSpec> expected = Arrays.asList( new PluginSpec("keep"), new PluginSpec("keepv@1"), new PluginSpec("specify@42"), new PluginSpec("keepspecific@42"), new PluginSpec("override@2"), new PluginSpec("donotoverride@2"), <START> new PluginSpec("inherrit"), <END> new PluginSpec("add") ); assertThat(actual, equalTo(expected)); }</code><technical_language>Typo. (Though I it, rr feel more natural in English!)</technical_language>

Target:
public void combine_WithPlugins_annotations() throws Exception { List<WithPlugins> annotations = Arrays.asList( FakeTestClass.class.getAnnotation(WithPlugins.class), FakeTestClass.class.getMethod("test").getAnnotation(WithPlugins.class) ); List<PluginSpec> actual = WithPlugins.RuleImpl.combinePlugins(annotations); List<PluginSpec> expected = Arrays.asList( new PluginSpec("keep"), new PluginSpec("keepv@1"), new PluginSpec("specify@42"), new PluginSpec("keepspecific@42"), new PluginSpec("override@2"), new PluginSpec("donotoverride@2"), new PluginSpec("inherit"), new PluginSpec("add") ); assertThat(actual, equalTo(expected)); }
Source:
<code>private ValidationResult validate(String line) { getLog().info("Testing import: " + line); ValidationResult validationResult = new ValidationResult(line, IS_VALID_IMPORT.test(line)); <START> if (!validationResult.isValid()) { <END> if (warnOnlyModules.contains(project.getArtifactId()) || warnOnlyModules.contains("*")) { getLog().warn("Import with missing version found: " + line); } else { getLog().error("Import with missing version found: " + line); } } return validationResult; }</code><technical_language>Reversing predicate get rid of level of nesting</technical_language>

Target:
private ValidationResult validate(String line) { getLog().info("Testing import: " + line); ValidationResult validationResult = new ValidationResult(line, IS_VALID_IMPORT.test(line)); if (validationResult.isValid()) { return validationResult; } if (warnOnlyModules.contains(project.getArtifactId()) || warnOnlyModules.contains("*")) { getLog().warn("Import with missing version found: " + line); } else { getLog().error("Import with missing version found: " + line); } return validationResult; }
Source:
<code>public void testFactories() { <START> assertTrue(OkHttpClientConnectionPoolFactory.class.isInstance(connectionPoolFactory)); <END> assertTrue(OkHttpClientConfigurationTestApp.MyOkHttpClientConnectionPoolFactory.class.isInstance(connectionPoolFactory)); assertTrue(OkHttpClientFactory.class.isInstance(okHttpClientFactory)); assertTrue(OkHttpClientConfigurationTestApp.MyOkHttpClientFactory.class.isInstance(okHttpClientFactory)); }</code><technical_language>prefer Assertions.assertThat(connectionPoolFactory).isInstanceOf(OkHttpClientConnectionPoolFactory.class). way, if fails, a decent message :-)</technical_language>

Target:
public void testFactories() { Assertions.assertThat(connectionPoolFactory).isInstanceOf(OkHttpClientConnectionPoolFactory.class); Assertions.assertThat(connectionPoolFactory).isInstanceOf(OkHttpClientConfigurationTestApp.MyOkHttpClientConnectionPoolFactory.class); Assertions.assertThat(okHttpClientFactory).isInstanceOf(OkHttpClientFactory.class); Assertions.assertThat(okHttpClientFactory).isInstanceOf(OkHttpClientConfigurationTestApp.MyOkHttpClientFactory.class); }
Source:
<code>public void getDiseaseOccurrencesYetToBeReviewedMustOnlyReturnSpecifiedDiseaseGroup() { Expert expert = expertDao.getByEmail("zool1250@zoo.ox.ac.uk"); DiseaseOccurrence occurrence = diseaseOccurrenceDao.getById(1); DiseaseOccurrenceReviewResponse response = DiseaseOccurrenceReviewResponse.YES; createAndSaveDiseaseOccurrenceReview(expert, occurrence, response); Integer expertId = expert.getId(); Integer diseaseGroupId = occurrence.getDiseaseGroup().getId(); List<DiseaseOccurrence> list = diseaseOccurrenceDao.getDiseaseOccurrencesYetToBeReviewed(expertId, diseaseGroupId); for (DiseaseOccurrence item : list) { <START> assertThat(item.getDiseaseGroup().getId()).isSameAs(diseaseGroupId); <END> } }</code><technical_language>I this isEqualTo (isSameAs checks integers object)</technical_language>

Target:
public void getDiseaseOccurrencesYetToBeReviewedMustOnlyReturnSpecifiedDiseaseGroup() { Expert expert = expertDao.getByEmail("zool1250@zoo.ox.ac.uk"); DiseaseOccurrence occurrence = diseaseOccurrenceDao.getById(1); DiseaseOccurrenceReviewResponse response = DiseaseOccurrenceReviewResponse.YES; createAndSaveDiseaseOccurrenceReview(expert, occurrence, response); Integer expertId = expert.getId(); Integer diseaseGroupId = occurrence.getDiseaseGroup().getId(); List<DiseaseOccurrence> list = diseaseOccurrenceDao.getDiseaseOccurrencesYetToBeReviewed(expertId, diseaseGroupId); for (DiseaseOccurrence item : list) { assertThat(item.getDiseaseGroup().getId()).isEqualTo(diseaseGroupId); } }
Source:
<code>public void GIVEN_correct_date_from_UI_WHEN_validate_date_time_THEN_validation_pass() { String actual = "" ; Calendar calendar_1 = new GregorianCalendar(2013, 2, 12, 10, 2, 3); Calendar calendar_2 = new GregorianCalendar(2015, 2, 12, 15, 3, 4); viewModel = new JournalViewModel(model); viewModel.setInitialFromDateTime(calendar_1, calendar_1); viewModel.setInitialToDateTime(calendar_2, calendar_2); viewModel.setFromDate(calendar_1); viewModel.setFromTime(calendar_1); viewModel.setToDate(calendar_2); viewModel.setToTime(calendar_2); <START> <END> viewModel.setErrorMessage(actual); String expected = viewModel.getErrorMessage(); assertEquals(expected, actual); }</code><technical_language>in other test</technical_language>

Target:
public void GIVEN_correct_date_from_UI_WHEN_validate_date_time_THEN_validation_pass() { String actual = "" ; Calendar calendar_1 = new GregorianCalendar(2013, 2, 12, 10, 2, 3); Calendar calendar_2 = new GregorianCalendar(2015, 2, 12, 15, 3, 4); viewModel = new JournalViewModel(model); viewModel.setInitialFromDateTime((Calendar)calendar_1.clone(), (Calendar)calendar_1.clone()); viewModel.setInitialToDateTime((Calendar)calendar_2.clone(), (Calendar)calendar_2.clone()); viewModel.setFromDate(calendar_1); viewModel.setFromTime(calendar_1); viewModel.setToDate(calendar_2); viewModel.setToTime(calendar_2); String expected = viewModel.getErrorMessage(); assertEquals(expected, actual); }
Source:
<code><START> public static SAXParserProvider getInstance() throws PrivilegedActionException <END> { final SecurityManager sm = System.getSecurityManager(); ClassLoader tccl = null; if (sm == null) { tccl = Thread.currentThread().getContextClassLoader(); } else { tccl = AccessController.doPrivileged(new PrivilegedExceptionAction<ClassLoader>() { public ClassLoader run() throws Exception { return Thread.currentThread().getContextClassLoader(); } }); } SAXParserProvider spp; spp = saxParserProviders.get(tccl); if (spp == null) { spp = new SAXParserProvider(); SAXParserProvider s = saxParserProviders.putIfAbsent(tccl, spp); if (s != null) spp = s; } return spp; }</code><technical_language>I noticed this. Adding "throws PrivilegedActionException" basically breaks compatibility this public method, result in problems backporting this PR 3.x series. So, questions: is needed? If is, catch throw wrapping a RuntimeException (or SecurityException) if a RuntimeException already? remove explicit "throws" in method signature</technical_language>

Target:
public static SAXParserProvider getInstance() { final SecurityManager sm = System.getSecurityManager(); ClassLoader tccl = null; if (sm == null) { tccl = Thread.currentThread().getContextClassLoader(); } else { try { tccl = AccessController.doPrivileged(new PrivilegedExceptionAction<ClassLoader>() { public ClassLoader run() throws Exception { return Thread.currentThread().getContextClassLoader(); } }); } catch (PrivilegedActionException e) { throw new SecurityException(e); } } SAXParserProvider spp; spp = saxParserProviders.get(tccl); if (spp == null) { spp = new SAXParserProvider(); SAXParserProvider s = saxParserProviders.putIfAbsent(tccl, spp); if (s != null) spp = s; } return spp; }
Source:
<code>static Evaluator forName(String nameOfScriptEngine, String name) { try { Class.forName(nameOfScriptEngine); } catch (Throwable cause) { <START> String message = "Class `" + nameOfScriptEngine + "` is not loadable, " END> + "script-based test execution is disabled. " + "If the originating cause is a `NoClassDefFoundError: javax/script/...` and " + "the underlying runtime environment is executed with an activated module system " + "(aka Jigsaw or JPMS) you need to add the `java.scripting` module to the " + "root modules via `--add-modules ...,java.scripting`"; return new ThrowingEvaluator(message, cause); } try { return (Evaluator) Class.forName(name).getDeclaredConstructor().newInstance(); } catch (ReflectiveOperationException cause) { String message = "Creating instance of class `" + name + "` failed," + "script-based test execution is disabled."; return new ThrowingEvaluator(message, cause); } }</code><technical_language>Do want catch Throwable here? ClassNotFoundException</technical_language>

Target:
static Evaluator forName(String nameOfScriptEngine, String name) { try { Class.forName(nameOfScriptEngine); } catch (Throwable cause) { BlacklistedExceptions.rethrowIfBlacklisted(cause); String message = "Class `" + nameOfScriptEngine + "` is not loadable, " + "script-based test execution is disabled. " + "If the originating cause is a `NoClassDefFoundError: javax/script/...` and " + "the underlying runtime environment is executed with an activated module system " + "(aka Jigsaw or JPMS) you need to add the `java.scripting` module to the " + "root modules via `--add-modules ...,java.scripting`"; return new ThrowingEvaluator(message, cause); } try { return (Evaluator) Class.forName(name).getDeclaredConstructor().newInstance(); } catch (ReflectiveOperationException cause) { String message = "Creating instance of class `" + name + "` failed," + "script-based test execution is disabled."; return new ThrowingEvaluator(message, cause); } }
Source:
<code>public Message<String> receive() { try { synchronized (this.monitor) { if (!this.blockAndCloseContext && !this.reader.ready()) { return null; } String line = this.reader.readLine(); if (line == null) { ConfigurableApplicationContext context = (ConfigurableApplicationContext) getApplicationContext(); if (context != null) { this.logger.info("EOF on stream; closing context"); <START> context.close(); <END> } } return (line != null) ? new GenericMessage<String>(line) : null; } } catch (IOException e) { throw new MessagingException("IO failure occurred in adapter", e); } }</code><technical_language>I this. EndOfStreamEvent application free chose do fact. Close ctx, stop adapters switch another stream. possible, aggressive unconditional ctx.close() . I mind if enough arguments stay this solution. Thanks</technical_language>

Target:
public Message<String> receive() { try { synchronized (this.monitor) { if (!this.blockToDetectEOF && !this.reader.ready()) { return null; } String line = this.reader.readLine(); if (line == null && this.applicationEventPublisher != null) { this.applicationEventPublisher.publishEvent(new StreamClosedEvent(this)); } return (line != null) ? new GenericMessage<String>(line) : null; } } catch (IOException e) { throw new MessagingException("IO failure occurred in adapter", e); } }
Source:
<code>void shouldReturnKeys() { final Issues<Issue> issues = new Issues<>(); IssueBuilder builder = new IssueBuilder(); issues.add(builder.setCategory("key").build()); PropertyStatistics statistics = new PropertyStatistics(issues, "category", Function.identity()); Set<String> str = new HashSet(); str.add("key"); Set<String> actualProperty = statistics.getKeys(); <START> assertThat(actualProperty).isEqualTo(str); <END> }</code><technical_language>assertThat(statistics).hasOnlyKeys("key");</technical_language>

Target:
void shouldReturnKeys() { Issues<Issue> issues = new Issues<>(); IssueBuilder builder = new IssueBuilder(); issues.add(builder.setCategory("key").build()); PropertyStatistics statistics = new PropertyStatistics(issues, "category", Function.identity()); assertThat(statistics).hasOnlyKeys("key"); }
Source:
<code>public void testSchemaRetrieval() throws IOException { InputStream stream = getClass().getClassLoader().getResourceAsStream("data/exemple.json"); <START> Schema schema = new Schema.Parser().parse(stream); <END> long fingerprint = SchemaNormalization.parsingFingerprint64(schema); Schema retrieved = service.findByFingerprint(fingerprint); Assert.assertEquals(schema, retrieved); }</code><technical_language>example (with a)</technical_language>

Target:
public void testSchemaRetrieval() throws IOException { InputStream stream = getClass().getClassLoader().getResourceAsStream("data/avro-schema-example.json"); Schema schema = new Schema.Parser().parse(stream); long fingerprint = SchemaNormalization.parsingFingerprint64(schema); Schema retrieved = service.findByFingerprint(fingerprint); assertEquals(schema, retrieved); }
Source:
<code>public IHyperlink[] detectHyperlinks(ITextViewer textViewer, IRegion region, boolean canShowMultipleHyperlinks) { for (@NonNull LSPDocumentInfo info : LanguageServiceAccessor.getLSPDocumentInfosFor(textViewer.getDocument(), capabilities -> Boolean.TRUE.equals(capabilities.getDefinitionProvider()))) { try { CompletableFuture<List<? extends Location>> documentHighlight = info.getInitializedLanguageClient() <START> .get(500, TimeUnit.MILLISECONDS).getTextDocumentService() <END> .definition(LSPEclipseUtils.toTextDocumentPosistionParams(info.getFileUri(), region.getOffset(), info.getDocument())); List<? extends Location> locations = documentHighlight.get(2, TimeUnit.SECONDS); if (locations == null || locations.isEmpty()) { continue; } IRegion linkRegion = findWord(textViewer.getDocument(), region.getOffset()); if (linkRegion == null) { linkRegion = region; } List<IHyperlink> hyperlinks = new ArrayList<IHyperlink>(locations.size()); for (Location responseLocation : locations) { hyperlinks.add(new LSBasedHyperlink(responseLocation, linkRegion)); } return hyperlinks.toArray(new IHyperlink[hyperlinks.size()]); } catch (BadLocationException | InterruptedException | ExecutionException | TimeoutException e) { LanguageServerPlugin.logError(e); } } return null; }</code><technical_language>I need a get here. Chaining thenAccept thenRun is fine. "get" line 81 covers chain, this method return in 2 seconds anyway. If long, change timeout of chain line 81 introducing intermediary delay longer run in worst cases</technical_language>

Target:
public IHyperlink[] detectHyperlinks(ITextViewer textViewer, IRegion region, boolean canShowMultipleHyperlinks) { for (@NonNull LSPDocumentInfo info : LanguageServiceAccessor.getLSPDocumentInfosFor(textViewer.getDocument(), capabilities -> Boolean.TRUE.equals(capabilities.getDefinitionProvider()))) { try { CompletableFuture<List<? extends Location>> documentHighlight = info.getInitializedLanguageClient().thenCompose(ls -> { try { return ls.getTextDocumentService() .definition(LSPEclipseUtils.toTextDocumentPosistionParams(info.getFileUri(), region.getOffset(), info.getDocument())); } catch (BadLocationException e) { LanguageServerPlugin.logError(e); return CompletableFuture.completedFuture(Collections.emptyList()); } } ); List<? extends Location> locations = documentHighlight.get(2, TimeUnit.SECONDS); if (locations == null || locations.isEmpty()) { continue; } IRegion linkRegion = findWord(textViewer.getDocument(), region.getOffset()); if (linkRegion == null) { linkRegion = region; } List<IHyperlink> hyperlinks = new ArrayList<IHyperlink>(locations.size()); for (Location responseLocation : locations) { hyperlinks.add(new LSBasedHyperlink(responseLocation, linkRegion)); } return hyperlinks.toArray(new IHyperlink[hyperlinks.size()]); } catch (InterruptedException | ExecutionException | TimeoutException e) { LanguageServerPlugin.logError(e); } } return null; }
Source:
<code><START> public synchronized static MetricRegistry setDefault(String name) { <END> if (defaultRegistryName == null) { final MetricRegistry registry = getOrCreate(name); defaultRegistryName = name; return registry; } throw new IllegalStateException("Default metric registry name is already set."); }</code><technical_language>another method for instances MetricRegistry? I Dropwizard a metrics registry is created framework I instance default. proposed: java SharedMetricRegistries.add("default", bootstrap.getMetricRegistry()); SharedMetricRegistries.setDefault("default"); overloaded setDefault method. java SharedMetricRegistries.setDefault("default", bootstrap.getMetricRegistry());</technical_language>

Target:
public synchronized static MetricRegistry setDefault(String name) { final MetricRegistry registry = getOrCreate(name); return setDefault(name, registry); }
Source:
<code>private void updateGlobalKeys() { Set<String> activeKeys = new HashSet<String>(m_globalKeyStrokes.size()); for (IRwtKeyStroke stroke : m_globalKeyStrokes) { if (stroke.isRegisterActiveKey()) { String activeKey = resolveKeyString(stroke); activeKeys.add(activeKey); } } <START> Set<Entry<Widget, List<String>>> map = m_widgetActiveKeys.entrySet(); <END> Iterator<Entry<Widget, List<String>>> iterator = map.iterator(); while (iterator.hasNext()) { Entry<Widget, List<String>> item = iterator.next(); activeKeys.addAll(item.getValue()); } if (activeKeys.size() == 0) { m_environment.getDisplay().setData(RWT.ACTIVE_KEYS, EMPTY_STRING_ARRAY); } else { String[] activeKeyArray = activeKeys.toArray(new String[activeKeys.size()]); m_environment.getDisplay().setData(RWT.ACTIVE_KEYS, activeKeyArray); } if (m_globalCancelKeyList == null || m_globalCancelKeyList.size() == 0) { m_environment.getDisplay().setData(RWT.CANCEL_KEYS, EMPTY_STRING_ARRAY); } else { String[] cancelKeyArray = m_globalCancelKeyList.toArray(new String[m_globalCancelKeyList.size()]); m_environment.getDisplay().setData(RWT.CANCEL_KEYS, cancelKeyArray); } }</code><technical_language>Adding control keystrokes global keys is right creates unnecessary requests. For example: If a table a delete keystroke a stringfield, press of delete in stringfield create a request. Additionally local keystrokes removed correctly global map. for another solution</technical_language>

Target:
private void updateGlobalKeys() { Set<String> activeKeys = new HashSet<String>(m_globalKeyStrokes.size()); for (IRwtKeyStroke stroke : m_globalKeyStrokes) { if (stroke.isRegisterActiveKey()) { String activeKey = resolveKeyString(stroke); if (!activeKeys.contains(activeKey)) { activeKeys.add(activeKey); } } } if (activeKeys.size() == 0) { m_environment.getDisplay().setData(RWT.ACTIVE_KEYS, EMPTY_STRING_ARRAY); } else { String[] activeKeyArray = activeKeys.toArray(new String[activeKeys.size()]); m_environment.getDisplay().setData(RWT.ACTIVE_KEYS, activeKeyArray); } if (m_globalCancelKeyList == null || m_globalCancelKeyList.size() == 0) { m_environment.getDisplay().setData(RWT.CANCEL_KEYS, EMPTY_STRING_ARRAY); } else { String[] cancelKeyArray = m_globalCancelKeyList.toArray(new String[m_globalCancelKeyList.size()]); m_environment.getDisplay().setData(RWT.CANCEL_KEYS, cancelKeyArray); } }
Source:
<code>public int writeAsBinary(ByteBuf buffer, @Nonnull Object value) { Period period = (Period) value; buffer.writeInt(TYPE_LEN); <START> buffer.writeLong(period.getSeconds()); <END> buffer.writeInt(period.getDays()); buffer.writeInt(period.getMonths()); return TYPE_LEN; }</code><technical_language>extend testByteReadWrite in PGTypesTest part of this, round-trip of encode/decode is tested</technical_language>

Target:
public int writeAsBinary(ByteBuf buffer, @Nonnull Object value) { Period period = (Period) value; buffer.writeInt(TYPE_LEN); buffer.writeLong( (period.getHours() * 60 * 60 * 1000_000L) + (period.getMinutes() * 60 * 1000_000L) + (period.getSeconds() * 1000_000L) + (period.getMillis() * 1000) ); buffer.writeInt((period.getWeeks() * 7) + period.getDays()); buffer.writeInt((period.getYears() * 12) + period.getMonths()); return INT32_BYTE_SIZE + TYPE_LEN; }
Source:
<code>public boolean isActivated() { Jenkins j = Jenkins.getInstance(); CrumbIssuer currentIssuer = j.getCrumbIssuer(); if (currentIssuer == null) { return true; } <START> return false; <END> }</code><technical_language>return Jenkins.getInstance().getCrumbIssuer() == null</technical_language>

Target:
public boolean isActivated() { return Jenkins.getInstance().getCrumbIssuer() == null; }
Source:
<code>private void verifyHealthy(final String host, final TaskStatus status) { log.debug("Checking health of on {}", job.getImage(), host); final TaskStatus.State state = status.getState(); <START> if (state == TaskStatus.State.UNKNOWN || <END> state == TaskStatus.State.FAILED || state == TaskStatus.State.EXITED || state == TaskStatus.State.STOPPED) { String stateString = state.toString(); if (status.getThrottled() != ThrottleState.NO) { stateString += format("(%s)", status.getThrottled()); } throw new AssertionError(format( "Unexpected job state %s. Check helios agent logs for details.", stateString)); } }</code><technical_language>Hmmm. want UNKNOWN here? IIRC, UNKNOWN is if job deployed agent act it. time verifyHealthy is called if agent acted, time call off</technical_language>

Target:
private void verifyHealthy(final String host, final TaskStatus status) { log.debug("Checking health of on {}", job.getImage(), host); final TaskStatus.State state = status.getState(); if (state == TaskStatus.State.FAILED || state == TaskStatus.State.EXITED || state == TaskStatus.State.STOPPED) { String stateString = state.toString(); if (status.getThrottled() != ThrottleState.NO) { stateString += format("(%s)", status.getThrottled()); } throw new AssertionError(format( "Unexpected job state %s. Check helios agent logs for details.", stateString)); } }
Source:
<code>private void routeItems(Location inputNode, Block inputTarget, int frequency, Map<Integer, List<Location>> outputNodes) { ItemStackAndInteger slot = CargoUtils.withdraw(inventories, inputNode.getBlock(), inputTarget); if (slot == null) { return; } ItemStack stack = slot.getItem(); int previousSlot = slot.getInt(); List<Location> destinations = outputNodes.get(frequency); if (destinations != null) { stack = distributeItem(stack, inputNode, destinations); } if (stack != null) { Inventory inv = inventories.get(inputTarget.getLocation()); if (inv != null) { if (inv.getItem(previousSlot) == null) { inv.setItem(previousSlot, stack); } <START> else if((stack = inv.addItem(stack).get(0)) != null){ <END> inputTarget.getWorld().dropItem(inputTarget.getLocation().add(0, 1, 0), stack); } } else { DirtyChestMenu menu = CargoUtils.getChestMenu(inputTarget); if (menu != null) { if (menu.getItemInSlot(previousSlot) == null) { menu.replaceExistingItem(previousSlot, stack); } else { inputTarget.getWorld().dropItem(inputTarget.getLocation().add(0, 1, 0), stack); } } } } }</code><technical_language>This lead IndexOutOfBoundsException. .isEmpty() returned map instead safer</technical_language>

Target:
private void routeItems(Location inputNode, Block inputTarget, int frequency, Map<Integer, List<Location>> outputNodes) { ItemStackAndInteger slot = CargoUtils.withdraw(inventories, inputNode.getBlock(), inputTarget); if (slot == null) { return; } ItemStack stack = slot.getItem(); int previousSlot = slot.getInt(); List<Location> destinations = outputNodes.get(frequency); if (destinations != null) { stack = distributeItem(stack, inputNode, destinations); } if (stack != null) { Inventory inv = inventories.get(inputTarget.getLocation()); if (inv != null) { if (inv.getItem(previousSlot) == null) { inv.setItem(previousSlot, stack); } else { ItemStack rest = inv.addItem(stack).get(0); if (rest != null) { inputTarget.getWorld().dropItem(inputTarget.getLocation().add(0, 1, 0), rest); } } } else { DirtyChestMenu menu = CargoUtils.getChestMenu(inputTarget); if (menu != null) { if (menu.getItemInSlot(previousSlot) == null) { menu.replaceExistingItem(previousSlot, stack); } else { inputTarget.getWorld().dropItem(inputTarget.getLocation().add(0, 1, 0), stack); } } } } }
Source:
<code>private static void registerCustomIBClasses() { File ibClassesFile = new File(NSBundle.getMainBundle().getBundlePath() + "/ib.classes"); if (ibClassesFile.exists()) { try { <START> BufferedReader reader = new BufferedReader(new FileReader(ibClassesFile)); <END> String line = reader.readLine(); String[] customClasses = line.split(","); for (String customClass : customClasses) { try { ObjCClass.getByName(customClass); } catch (ObjCClassNotFoundException e) { } } reader.close(); } catch (IOException e) { e.printStackTrace(); } } }</code><technical_language>Sorry, missed this time I a look. try-with-resources again. :-)</technical_language>

Target:
private static void registerCustomIBClasses() { File ibClassesFile = new File(NSBundle.getMainBundle().getBundlePath() + "/ib.classes"); if (ibClassesFile.exists()) { try { try (BufferedReader reader = new BufferedReader(new FileReader(ibClassesFile))) { String line = reader.readLine(); String[] customClasses = line.split(","); for (String customClass : customClasses) { try { ObjCClass.getByName(customClass); } catch (ObjCClassNotFoundException e) { } } } } catch (IOException e) { e.printStackTrace(); } } }
Source:
<code>void receiveMessageAutoComplete() { final String messageId = UUID.randomUUID().toString(); final String contents = "Some-contents"; final ServiceBusMessage message = TestUtils.getServiceBusMessage(contents, messageId, 0); StepVerifier.create(sender.send(message).thenMany(receiver.receive().take(1))) .assertNext(receivedMessage -> { Assertions.assertEquals(contents, receivedMessage.getBodyAsString()); Assertions.assertTrue(receivedMessage.getProperties().containsKey(MESSAGE_TRACKING_ID)); }) .verifyComplete(); <START> System.out.println("Completed."); <END> }</code><technical_language>nit: remove System.out</technical_language>

Target:
void receiveMessageAutoComplete() { final String messageId = UUID.randomUUID().toString(); final String contents = "Some-contents"; final ServiceBusMessage message = TestUtils.getServiceBusMessage(contents, messageId, 0); StepVerifier.create(sender.send(message).thenMany(receiver.receive().take(1))) .assertNext(receivedMessage -> { Assertions.assertEquals(contents, new String(receivedMessage.getBody())); Assertions.assertTrue(receivedMessage.getProperties().containsKey(MESSAGE_TRACKING_ID)); }) .verifyComplete(); }
Source:
<code>private void renamePlaceDialog(final String placeName) { Log.d(TAG, "renamePlaceDialog"); AlertDialog.Builder dialog = new AlertDialog.Builder(getActivity()); final EditText input = new EditText(getActivity()); <START> dialog.setTitle("Rename " + placeName + "?") <END> .setMessage(R.string.write_place_name) .setView(input) .setPositiveButton("OK", new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { String newName = input.getText().toString(); renamePlace(placeName, newName); dialog.dismiss(); } }) .setNegativeButton("Cancel", new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { dialog.dismiss(); } }); dialog.show(); }</code><technical_language>a hard coded string in title</technical_language>

Target:
private void renamePlaceDialog(final String placeName) { Log.d(TAG, "renamePlaceDialog"); AlertDialog.Builder dialog = new AlertDialog.Builder(getActivity()); final EditText input = new EditText(getActivity()); String titleFormat = getResources().getString(R.string.rename_place); String title = String.format(titleFormat, placeName); dialog.setTitle(title) .setMessage(R.string.write_place_name) .setView(input) .setPositiveButton("OK", new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { String newName = input.getText().toString(); renamePlace(placeName, newName); dialog.dismiss(); } }) .setNegativeButton("Cancel", new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { dialog.dismiss(); } }); dialog.show(); }
Source:
<code>public void buttonStateChanged(VRControllerState_t stateBefore, VRControllerState_t stateAfter, int handIndex) { cachedStateBefore = stateBefore; cachedStateAfter = stateAfter; <START> queuedActions.add(new ControllerAction(InputType.CONTROLLER_BUTTON.getInput(ControllerId.X_AXIS), <END> "OpenVR", ButtonState.DOWN, 1.0f)); if (handIndex == 0) { handleController0(); } else { handleController1(); } }</code><technical_language>This odd here. is this for</technical_language>

Target:
public void buttonStateChanged(VRControllerState_t stateBefore, VRControllerState_t stateAfter, int handIndex) { cachedStateBefore = stateBefore; cachedStateAfter = stateAfter; if (handIndex == 0) { handleController0(); } else { handleController1(); } }
Source:
<code>private SearchResponse doSearch(Object searchAfterValues) { SearchRequest searchRequest = new SearchRequest(index); searchRequest.indicesOptions(MlIndicesUtils.addIgnoreUnavailable(SearchRequest.DEFAULT_INDICES_OPTIONS)); SearchSourceBuilder sourceBuilder = (new SearchSourceBuilder() .size(BATCH_SIZE) .query(getQuery()) .fetchSource(shouldFetchSource()) <START> .trackTotalHits(true) <END> .sort(sortField())); if (searchAfterValues != null) { sourceBuilder.searchAfter(searchAfterValues); } searchRequest.source(sourceBuilder); return client.search(searchRequest).actionGet(); }</code><technical_language>need total hits for query. good this false total hits recorded</technical_language>

Target:
private SearchResponse doSearch(Object searchAfterValues) { SearchRequest searchRequest = new SearchRequest(index); searchRequest.indicesOptions(MlIndicesUtils.addIgnoreUnavailable(SearchRequest.DEFAULT_INDICES_OPTIONS)); SearchSourceBuilder sourceBuilder = (new SearchSourceBuilder() .size(batchSize) .query(getQuery()) .fetchSource(shouldFetchSource()) .sort(sortField())); if (searchAfterValues != null) { sourceBuilder.searchAfter(searchAfterValues); } searchRequest.source(sourceBuilder); return client.search(searchRequest).actionGet(); }
Source:
<code>public GlobalDirectoryResourceDefinition() { super(new SimpleResourceDefinition.Parameters(PathElement.pathElement(EESubsystemModel.GLOBAL_DIRECTORY), EeExtension.getResourceDescriptionResolver(EESubsystemModel.GLOBAL_DIRECTORY)) <START> .setAddRestartLevel(OperationEntry.Flag.RESTART_JVM) <END> .setRemoveRestartLevel(OperationEntry.Flag.RESTART_JVM) .setAddHandler(GlobalDirectoryResourceDefinition.ADD) .setRemoveHandler(GlobalDirectoryResourceDefinition.REMOVE) .setCapabilities(EE_GLOBAL_DIRECTORY_CAPABILITY) ); }</code><technical_language>RESTART_JVM? AFAICT if I add this boot service is installed immediately. redeploy app for module, require a reload a process restart</technical_language>

Target:
public GlobalDirectoryResourceDefinition() { super(new SimpleResourceDefinition.Parameters(PathElement.pathElement(EESubsystemModel.GLOBAL_DIRECTORY), EeExtension.getResourceDescriptionResolver(EESubsystemModel.GLOBAL_DIRECTORY)) .setAddHandler(GlobalDirectoryResourceDefinition.ADD) .setRemoveHandler(GlobalDirectoryResourceDefinition.REMOVE) .setCapabilities(EE_GLOBAL_DIRECTORY_CAPABILITY) ); }
Source:
<code>public String getDisplayName() { <START> return "VisualSVN"; <END> }</code><technical_language>Good practice: name localizable. <LINK_0></technical_language>

Target:
public String getDisplayName() { return Messages.SubversionSCM_browsers_VisualSVN(); }
Source:
<code>public static void main(String[] args) { HazelcastInstance hz = Hazelcast.newHazelcastInstance(); IMap<String, Person> map = hz.getMap("map"); map.put("1", new Person("peter", limb("left-hand"), limb("right-hand"))); <START> map.put("2", new Person("hans", limb("linke-hand"), limb("rechte-hand"))); <END> Set<Person> employees = (Set<Person>) map.values(new SqlPredicate("limbs[any].name == linke-hand")); System.out.println("People:" + employees); }</code><technical_language>this left-hand right hand</technical_language>

Target:
public static void main(String[] args) { HazelcastInstance hz = Hazelcast.newHazelcastInstance(); IMap<String, Person> map = hz.getMap("map"); map.put("1", new Person("peter", limb("left-hand"), limb("right-hand"))); map.put("2", new Person("hans", limb("left-leg"), limb("right-leg"))); Set<Person> employees = (Set<Person>) map.values(new SqlPredicate("limbs[any].name == right-leg")); System.out.println("People:" + employees); }
Source:
<code>public void testGetCollectorConfigurationWithBusinessTxnConfigs() { assertNull(service.getBusinessTransaction(null, BTXNCONFIG1)); assertNull(service.getBusinessTransaction(null, BTXNCONFIG2)); BusinessTxnConfig btxnconfig1 = new BusinessTxnConfig(); btxnconfig1.setDescription(DESCRIPTION1); btxnconfig1.setFilter(new Filter()); btxnconfig1.getFilter().getInclusions().add("myfilter"); BusinessTxnConfig btxnconfig2 = new BusinessTxnConfig(); btxnconfig2.setDescription(DESCRIPTION2); btxnconfig2.setFilter(new Filter()); btxnconfig2.getFilter().getInclusions().add("myfilter"); try { service.setBusinessTransaction(null, BTXNCONFIG1, btxnconfig1); service.setBusinessTransaction(null, BTXNCONFIG2, btxnconfig2); } catch (Exception e1) { fail("Failed to add btxnconfigs: " + e1); } <START> service.getCollector(null, null, null, null); <END> Wait.until(() -> service.getCollector(null, null, null, null) != null); CollectorConfiguration cc = service.getCollector(null, null, null, null); assertNotNull(cc); assertNotNull(cc.getBusinessTransactions().get(BTXNCONFIG1)); assertNotNull(cc.getBusinessTransactions().get(BTXNCONFIG2)); try { service.removeBusinessTransaction(null, BTXNCONFIG1); service.removeBusinessTransaction(null, BTXNCONFIG2); } catch (Exception e1) { fail("Failed to remove btxnconfigs: " + e1); } Wait.until( () -> service.getBusinessTransaction(null, BTXNCONFIG1) == null && service.getBusinessTransaction(null, BTXNCONFIG2) == null); assertNull(service.getBusinessTransaction(null, BTXNCONFIG1)); assertNull(service.getBusinessTransaction(null, BTXNCONFIG2)); }</code><technical_language>call this wait</technical_language>

Target:
public void testGetCollectorConfigurationWithBusinessTxnConfigs() { assertNull(service.getBusinessTransaction(null, BTXNCONFIG1)); assertNull(service.getBusinessTransaction(null, BTXNCONFIG2)); BusinessTxnConfig btxnconfig1 = new BusinessTxnConfig(); btxnconfig1.setDescription(DESCRIPTION1); btxnconfig1.setFilter(new Filter()); btxnconfig1.getFilter().getInclusions().add("myfilter"); BusinessTxnConfig btxnconfig2 = new BusinessTxnConfig(); btxnconfig2.setDescription(DESCRIPTION2); btxnconfig2.setFilter(new Filter()); btxnconfig2.getFilter().getInclusions().add("myfilter"); try { service.setBusinessTransaction(null, BTXNCONFIG1, btxnconfig1); service.setBusinessTransaction(null, BTXNCONFIG2, btxnconfig2); } catch (Exception e1) { fail("Failed to add btxnconfigs: " + e1); } Wait.until(() -> service.getCollector(null, null, null, null) != null); CollectorConfiguration cc = service.getCollector(null, null, null, null); assertNotNull(cc); assertNotNull(cc.getBusinessTransactions().get(BTXNCONFIG1)); assertNotNull(cc.getBusinessTransactions().get(BTXNCONFIG2)); try { service.removeBusinessTransaction(null, BTXNCONFIG1); service.removeBusinessTransaction(null, BTXNCONFIG2); } catch (Exception e1) { fail("Failed to remove btxnconfigs: " + e1); } Wait.until( () -> service.getBusinessTransaction(null, BTXNCONFIG1) == null && service.getBusinessTransaction(null, BTXNCONFIG2) == null); assertNull(service.getBusinessTransaction(null, BTXNCONFIG1)); assertNull(service.getBusinessTransaction(null, BTXNCONFIG2)); }
Source:
<code>public void close() throws Exception { writer.close(); <START> super.close(); <END> }</code><technical_language>super.close() method close executor, task queues empty workers terminated. If close writer close executor, risk racing on-going work, not</technical_language>

Target:
public void close() throws Exception { super.close(); writer.close(); }
Source:
<code>public void testPersistBookieStatus() throws Exception { File tmpDir = createTempDir("bookie", "test"); final ServerConfiguration conf = TestBKConfiguration.newServerConfiguration(); conf.setJournalDirName(tmpDir.getPath()) .setLedgerDirNames(new String[] { tmpDir.getPath() }) .setReadOnlyModeEnabled(true) .setPersistBookieStatusEnabled(true).setZkServers(zkUtil.getZooKeeperConnectString()); BookieServer bookieServer = new BookieServer(conf); bookieServer.start(); Bookie bookie = bookieServer.getBookie(); assertFalse(bookie.isReadOnly()); ((Bookie.BookieStateManager) bookie.getStateManager()).doTransitionToReadOnlyMode(); assertTrue(bookie.isReadOnly()); bookieServer.shutdown(); bookieServer = new BookieServer(conf); bookieServer.start(); bookie = bookieServer.getBookie(); assertTrue(bookie.isReadOnly()); <START> ((Bookie.BookieStateManager) bookie.getStateManager()).doTransitionToWritableMode(); <END> bookieServer.shutdown(); bookieServer = new BookieServer(conf); bookieServer.start(); bookie = bookieServer.getBookie(); assertFalse(bookie.isReadOnly()); bookieServer.shutdown(); }</code><technical_language>do need this kind of cast</technical_language>

Target:
public void testPersistBookieStatus() throws Exception { File tmpDir = createTempDir("bookie", "test"); final ServerConfiguration conf = TestBKConfiguration.newServerConfiguration(); conf.setJournalDirName(tmpDir.getPath()) .setLedgerDirNames(new String[] { tmpDir.getPath() }) .setReadOnlyModeEnabled(true) .setPersistBookieStatusEnabled(true).setZkServers(zkUtil.getZooKeeperConnectString()); BookieServer bookieServer = new BookieServer(conf); bookieServer.start(); Bookie bookie = bookieServer.getBookie(); assertFalse(bookie.isReadOnly()); bookie.getStateManager().doTransitionToReadOnlyMode(); assertTrue(bookie.isReadOnly()); bookieServer.shutdown(); bookieServer = new BookieServer(conf); bookieServer.start(); bookie = bookieServer.getBookie(); assertTrue(bookie.isReadOnly()); bookie.getStateManager().doTransitionToWritableMode(); bookieServer.shutdown(); bookieServer = new BookieServer(conf); bookieServer.start(); bookie = bookieServer.getBookie(); assertFalse(bookie.isReadOnly()); bookieServer.shutdown(); }
Source:
<code>public void iterateOrganizations() throws Exception { <START> final Github github = RtOrganizationsITCase.github(); <END> final Organizations orgs = github.users().self().organizations(); MatcherAssert.assertThat(orgs.iterate(), Matchers.notNullValue()); }</code><technical_language>github is unnecessary variable</technical_language>

Target:
public void iterateOrganizations() throws Exception { final Organizations orgs = github().users().self().organizations(); MatcherAssert.assertThat( orgs.iterate("yegor256").iterator().next(), Matchers.notNullValue() ); }
Source:
<code>final boolean execute() { <START> for (Map.Entry<ServiceName, Dependent[]> dependentEntry : dependents.entrySet()) { <END> ServiceName serviceName = dependentEntry.getKey(); for (Dependent dependent : dependentEntry.getValue()) { if (dependent != null) inform(dependent, serviceName); } } final ServiceName primaryRegistrationName = primaryRegistration.getName(); for (Dependent child : children) { if (child != null) inform(child, primaryRegistrationName); } return true; }</code><technical_language>If iterating map, want is a list of pairs, a map</technical_language>

Target:
final boolean execute() { for (Dependent dependent : primaryRegistration.getDependents()) { inform(dependent, primaryRegistration.getName()); } for (ServiceRegistrationImpl aliasRegistration : aliasRegistrations) { for (Dependent dependent : aliasRegistration.getDependents()) { inform(dependent, aliasRegistration.getName()); } } synchronized (ServiceControllerImpl.this) { for (Dependent child : children) { inform(child, primaryRegistration.getName()); } execFlags |= execFlag; } return true; }
Source:
<code><START> public void setConfiguration(String domain, List<OpenHABConfigurationRecord> records) { <END> if (domain == null) return; if (domain.isEmpty()) { return; } if (domain.startsWith("node/") == false) return; ZWaveNode node = zController.getNode(5); if (node == null) return; int parameter = 1; int value = 1; int size = 1; node.configParameterSet(parameter, value, size); }</code><technical_language>This a test method of some sort a hardcode Node ID, parameter size in it. Is this OK</technical_language>

Target:
public void setConfiguration(String domain, List<OpenHABConfigurationRecord> records) { }