auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>protected void doCatch(final Throwable throwable) { final Throwable t = throwable.getCause() != null ? throwable.getCause() : throwable; super.doCatch(t); final String message = "Error while querying REST resource " + getClass().getName() + " message: " + t.getMessage(); ErrorMessage errorMessage = new ErrorMessage(t); getResponse().setStatus(getStatus(), message); if (t instanceof IllegalArgumentException || t instanceof JsonParseException) { if (LOGGER.isLoggable(Level.FINE)) { LOGGER.log(Level.FINE, "***" + message); } getResponse().setStatus(Status.CLIENT_ERROR_BAD_REQUEST); } else if (t instanceof FileNotFoundException) { if (LOGGER.isLoggable(Level.FINE)) { LOGGER.log(Level.FINE, "***" + message); } getResponse().setStatus(Status.CLIENT_ERROR_NOT_FOUND); errorMessage.setMessage("File Not Found"); } else if (t instanceof NotFoundException) { if (LOGGER.isLoggable(Level.FINE)) { LOGGER.log(Level.FINE, "***" + message); } getResponse().setStatus(Status.CLIENT_ERROR_NOT_FOUND); <START> errorMessage.setMessage("File Not Found"); <END> } else { LOGGER.log(Level.SEVERE, t.getMessage(), t); } getResponse().setEntity(errorMessage.toEntity()); }</code><technical_language>I override message here. This is "engine" NotFoundException a FileNotFound exception</technical_language>

Target:
protected void doCatch(final Throwable throwable) { final Throwable t = throwable.getCause() != null ? throwable.getCause() : throwable; super.doCatch(t); final String message = "Error while querying REST resource " + getClass().getName() + " message: " + t.getMessage(); ErrorMessage errorMessage = new ErrorMessage(t); getResponse().setStatus(getStatus(), message); if (t instanceof IllegalArgumentException || t instanceof JsonParseException) { if (LOGGER.isLoggable(Level.FINE)) { LOGGER.log(Level.FINE, "***" + message); } getResponse().setStatus(Status.CLIENT_ERROR_BAD_REQUEST); } else if (t instanceof FileNotFoundException) { if (LOGGER.isLoggable(Level.FINE)) { LOGGER.log(Level.FINE, "***" + message); } getResponse().setStatus(Status.CLIENT_ERROR_NOT_FOUND); errorMessage.setMessage("File Not Found"); } else if (t instanceof NotFoundException) { if (LOGGER.isLoggable(Level.FINE)) { LOGGER.log(Level.FINE, "***" + message); } getResponse().setStatus(Status.CLIENT_ERROR_NOT_FOUND); } else { LOGGER.log(Level.SEVERE, t.getMessage(), t); } getResponse().setEntity(errorMessage.toEntity()); }
Source:
<code>public void createGroupUnionForIndirectRelationship() throws Exception { System.out.println(CLASS_NAME + "createGroupUnionForIndirectRelationship"); Vo vo = setUpVo(); groupsManagerBl.createGroup(sess, vo, group2); groupsManagerBl.createGroup(sess, group2, group3); groupsManagerBl.createGroup(sess, group3, group4); <START> groupsManagerBl.createGroupUnion(sess, group4, group2, false); <END> }</code><technical_language>I is invalid order of groups. is implemented now, this test creates this relation: 2 | 3 | 4 calling createGroupUnion(sess, group4, group2, false) import members group2 group4. This a cycle, I if detect this in current implementation. Also, test passes of error I pointed out above. suggestion groupsManagerBl.createGroupUnion(sess, group2, group4, false);</technical_language>

Target:
public void createGroupUnionForIndirectRelationship() throws Exception { System.out.println(CLASS_NAME + "createGroupUnionForIndirectRelationship"); Vo vo = setUpVo(); groupsManagerBl.createGroup(sess, vo, group2); groupsManagerBl.createGroup(sess, group2, group3); groupsManagerBl.createGroup(sess, group3, group4); groupsManagerBl.createGroupUnion(sess, group2, group4, false); }
Source:
<code>public void test() { connect(); click(jq("$listbox1").toWidget().firstChild()); waitResponse(); Assert.assertTrue(jq("@notification").exists()); waitResponse(); click(jq("body")); waitResponse(); click(jq("$listbox2").toWidget().firstChild()); waitResponse(); Assert.assertTrue(jq("@notification").exists()); <START> waitResponse(); <END> }</code><technical_language>waitResponse is unnecessary</technical_language>

Target:
public void test() { connect(); click(jq("$listbox1").toWidget().firstChild()); waitResponse(); Assert.assertTrue(jq("@notification").exists()); waitResponse(); click(jq("body")); waitResponse(); click(jq("$listbox2").toWidget().firstChild()); waitResponse(); Assert.assertTrue(jq("@notification").exists()); }
Source:
<code>private void assertNeverErrorObserver(Observer<String> observer) { verify(observer, never()).onNext("one"); verify(observer, never()).onNext("two"); verify(observer, never()).onNext("three"); verify(observer, never()).onNext("four"); verify(observer, times(1)).onError(any(Throwable.class)); verify(observer, never()).onCompleted(); <START> } <END></code><technical_language>I want verifyNoMoreInteractions(observer) end methods, sending onNext of "five" fail test</technical_language>

Target:
private void assertNeverErrorObserver(Observer<String> observer) { verify(observer, never()).onNext("one"); verify(observer, never()).onNext("two"); verify(observer, never()).onNext("three"); verify(observer, never()).onNext("four"); verify(observer, times(1)).onError(any(Throwable.class)); verify(observer, never()).onCompleted(); verifyNoMoreInteractions(observer); }
Source:
<code>public void start() { if (Boolean.TRUE.equals(NO_START.get())) { <START> LOG.trace("Ignoring maybeStart() as NO_START is false"); <END> return; } if (!isStarted() && !isStarting()) { try { StopWatch watch = new StopWatch(); super.start(); LOG.debug("start() took millis", watch.stop()); } catch (Exception e) { throw wrapRuntimeCamelException(e); } } else { LOG.trace("Ignoring maybeStart() as Apache Camel is already started"); } }</code><technical_language>Update logging message maybeStart anymore</technical_language>

Target:
public void start() { if (Boolean.TRUE.equals(NO_START.get())) { LOG.trace("Ignoring start() as NO_START is false"); return; } if (!isStarted() && !isStarting()) { try { StopWatch watch = new StopWatch(); super.start(); LOG.debug("start() took millis", watch.stop()); } catch (Exception e) { throw wrapRuntimeCamelException(e); } } else { LOG.trace("Ignoring start() as Camel is already started"); } }
Source:
<code><START> public String toString() { <END> return String.format("%s, nextNode=[%s]", super.toString(), next); }</code><technical_language>@override function declaration line</technical_language>

Target:
@Override public String toString() { return String.format("%s, nextNode=[%s]", super.toString(), next); }
Source:
<code>public void pollDoesNotReturnNullBeforeTimeoutUsingTransactionContext() throws InterruptedException { assertThat(inQueue.getSize(), is(0)); long timeout = 300; long timeBeforePoll = currentTimeMillis(); Serializable polledValue = persistentTransactionContext.poll(inQueue, timeout); long timeAfterPoll = currentTimeMillis(); assertThat(polledValue, nullValue()); <START> assertThat(timeAfterPoll - timeBeforePoll, greaterThanOrEqualTo(timeout)); <END> }</code><technical_language>some kind of error margin for this, currentTimeMillis some precision issues this assertion flaky. Check out org.hamcrest.number.IsCloseTo.closeTo</technical_language>

Target:
public void pollDoesNotReturnNullBeforeTimeoutUsingTransactionContext() throws InterruptedException { assertThat(inQueue.getSize(), is(0)); long timeout = 300; long timeBeforePoll = currentTimeMillis(); Serializable polledValue = persistentTransactionContext.poll(inQueue, timeout); long timeAfterPoll = currentTimeMillis(); assertThat(polledValue, nullValue()); assertThat((double) (timeAfterPoll - timeBeforePoll), anyOf(greaterThanOrEqualTo((double) timeout), closeTo((double) timeout, 20))); }
Source:
<code>private boolean areSameZone( ZoneId thisZone, ZoneId thatZone ) { boolean thisIsOffset = thisZone instanceof ZoneOffset; <START> boolean thatIsOffset = thatZone instanceof ZoneOffset; <END> if ( thisIsOffset && thatIsOffset ) { return thisZone.equals( thatZone ); } else if ( !thisIsOffset && !thatIsOffset ) { return TimeZones.map( thisZone.getId() ) == TimeZones.map( thatZone.getId() ); } return false; }</code><technical_language>thisIsOffset thatIsOffset evaluated in unsafeCompareTo. Send in boolean parameters this function instead of evaluating agan</technical_language>

Target:
private boolean areSameZone( ZoneId thisZone, ZoneId thatZone ) { boolean thisIsOffset = thisZone instanceof ZoneOffset; boolean thatIsOffset = thatZone instanceof ZoneOffset; return areSameZone( thisZone, thatZone, thisIsOffset, thatIsOffset ); }
Source:
<code>@Test public void testPutIntoBackgroundWithoutRestore() { final long msStarted = System.currentTimeMillis(); driver.runAppInBackground(-1); <START> assertThat(System.currentTimeMillis() - msStarted, lessThan(1000L)); <END> }</code><technical_language>Yeah greater for ideal situation</technical_language>

Target:
@Test public void testPutIntoBackgroundWithoutRestore() { assertThat(driver.findElementsById("IntegerA"), is(not(empty()))); driver.runAppInBackground(-1); assertThat(driver.findElementsById("IntegerA"), is(empty())); }
Source:
<code>private File findDockerFileFile(Logger log) { if (dockerFile != null) { File dFile = new File(dockerFile); if (dockerFileDir == null) { return dFile; } else { <START> if (dFile.isAbsolute() || !EnvUtil.isValidWindowsFileName(dockerFile)) { <END> throw new IllegalArgumentException("<dockerFile> can not be absolute path if <dockerFileDir> also set."); } return new File(dockerFileDir, dockerFile); } } if (dockerFileDir != null) { return new File(dockerFileDir, "Dockerfile"); } if (dockerArchive == null) { String deprecatedDockerFileDir = getAssemblyConfiguration() != null ? getAssemblyConfiguration().getDockerFileDir() : null; if (deprecatedDockerFileDir != null) { log.warn("<dockerFileDir> in the <assembly> section of a <build> configuration is deprecated"); log.warn("Please use <dockerFileDir> or <dockerFile> directly within the <build> configuration instead"); return new File(deprecatedDockerFileDir,"Dockerfile"); } } return null; }</code><technical_language>please add this extra check extra error message for invalide windows file name case ? confusing exception message fit error</technical_language>

Target:
private File findDockerFileFile(Logger log) { if (dockerFile != null) { File dFile = new File(dockerFile); if (dockerFileDir == null) { return dFile; } else { if (dFile.isAbsolute()) { throw new IllegalArgumentException("<dockerFile> can not be absolute path if <dockerFileDir> also set."); } if (EnvUtil.isWindows() && !EnvUtil.isValidWindowsFileName(dockerFile)) { throw new IllegalArgumentException(String.format("Invalid Windows file name %s for <dockerFile>", dockerFile)); } return new File(dockerFileDir, dockerFile); } } if (dockerFileDir != null) { return new File(dockerFileDir, "Dockerfile"); } if (dockerArchive == null) { String deprecatedDockerFileDir = getAssemblyConfiguration() != null ? getAssemblyConfiguration().getDockerFileDir() : null; if (deprecatedDockerFileDir != null) { log.warn("<dockerFileDir> in the <assembly> section of a <build> configuration is deprecated"); log.warn("Please use <dockerFileDir> or <dockerFile> directly within the <build> configuration instead"); return new File(deprecatedDockerFileDir,"Dockerfile"); } } return null; }
Source:
<code>protected Map<K, V> fromString(String s) { final String[] buckets = s.split(Pattern.quote(delimiter)); final Map<K, V> resultMap = newHashMap(); for (String bucket : buckets) { saveConvertedBucket(resultMap, bucket); } <START> Ints.stringConverter(); <END> return resultMap; }</code><technical_language>weird</technical_language>

Target:
protected Map<K, V> fromString(String s) { final String escapedString = escaper.escape(s); final String[] buckets = escapedString.split(bucketPattern); final Map<K, V> resultMap = newHashMap(); for (String bucket : buckets) { final Map.Entry<K, V> convertedBucket = convert(bucket); resultMap.put(convertedBucket.getKey(), convertedBucket.getValue()); } return resultMap; }
Source:
<code>public void onInitialize(MatchingFrame frame, ISearchContext context) { Iterable<? extends Object> values = context.getRuntimeContext().enumerateValues(type, null); it <START> = Iterables.filter(values, EObject.class).iterator(); <END> }</code><technical_language>Is this filtering necessary? runtime context return a non-EObject instance for EClassTransitiveInstancesKey? If this is required ensure iterator is of proper type, I safely cast instead for sake of performance. (and readability, this is misleading - filtering is done in fact)</technical_language>

Target:
public void onInitialize(MatchingFrame frame, ISearchContext context) { Iterable<? extends Object> values = context.getRuntimeContext().enumerateValues(type, null); it = (Iterator<EObject>) values.iterator(); }
Source:
<code>public List<String> findMissingUsers(Set<DbUser> usersToAdd) { List<String> missingUsers = new ArrayList<>(); usersToAdd.forEach(dbUser -> { <START> DbUser userToAdd = dbUserDao.getByUsernameAndDomain(dbUser.getLoginName(), dbUser.getDomain()); if (userToAdd == null) { missingUsers.add(String.format("%s@%s", dbUser.getLoginName(), dbUser.getDomain())); } <END> }); return missingUsers; }</code><technical_language>findMissingEntities</technical_language>

Target:
public List<DbUser> findMissingUsers(Set<DbUser> usersToAdd) { List<DbUser> missingUsers = new ArrayList<>(); usersToAdd.forEach(dbUser -> { DbUser userToAdd = getDbUserDao().getByUsernameAndDomain(dbUser.getLoginName(), dbUser.getDomain()); if (userToAdd == null) { missingUsers.add(dbUser); } }); if (!missingUsers.isEmpty()) { log.warn("Missing users: {}", missingUsers .stream() .map(dbUser -> String.format("%s@%s", dbUser.getName(), dbUser.getDomain())) .collect(Collectors.joining(", "))); } return missingUsers; }
Source:
<code>public void checkMergeConflictingTreesWithoutIndex() throws Exception { Git git = Git.wrap(db); writeTrashFile("d/1", "orig"); git.add().addFilepattern("d/1").call(); RevCommit first = git.commit().setMessage("added d/1").call(); writeTrashFile("d/1", "master"); RevCommit masterCommit = git.commit().setAll(true) .setMessage("modified d/1 on master").call(); git.checkout().setCreateBranch(true).setStartPoint(first) .setName("side").call(); writeTrashFile("d/1", "side"); git.commit().setAll(true).setMessage("modified d/1 on side").call(); git.rm().addFilepattern("d/1").call(); git.rm().addFilepattern("d").call(); MergeResult mergeRes = git.merge().include(masterCommit).call(); <START> assertEquals(mergeRes.getMergeStatus(), MergeStatus.CONFLICTING); <END> assertEquals( "[d/1, mode:100644, stage:1, content:orig][d/1, mode:100644, stage:2, content:side][d/1, mode:100644, stage:3, content:master]", indexState(CONTENT)); }</code><technical_language>expected is argument, I arguments flipped for changes</technical_language>

Target:
public void checkMergeConflictingTreesWithoutIndex() throws Exception { Git git = Git.wrap(db); writeTrashFile("d/1", "orig"); git.add().addFilepattern("d/1").call(); RevCommit first = git.commit().setMessage("added d/1").call(); writeTrashFile("d/1", "master"); RevCommit masterCommit = git.commit().setAll(true) .setMessage("modified d/1 on master").call(); git.checkout().setCreateBranch(true).setStartPoint(first) .setName("side").call(); writeTrashFile("d/1", "side"); git.commit().setAll(true).setMessage("modified d/1 on side").call(); git.rm().addFilepattern("d/1").call(); git.rm().addFilepattern("d").call(); MergeResult mergeRes = git.merge().include(masterCommit).call(); assertEquals(MergeStatus.CONFLICTING, mergeRes.getMergeStatus()); assertEquals( "[d/1, mode:100644, stage:1, content:orig][d/1, mode:100644, stage:2, content:side][d/1, mode:100644, stage:3, content:master]", indexState(CONTENT)); }
Source:
<code>public void testTTLOnOutputTable() throws SQLException, IOException { String mockString = "mock_value"; byte[] mockStringBytes = Strings.toByteArray(mockString); ManualEnvironmentEdge customClock = new ManualEnvironmentEdge(); customClock.setValue(1); EnvironmentEdgeManager.injectEdge(customClock); try (Connection conn = DriverManager.getConnection(getUrl())) { IndexVerificationOutputRepository outputRepository = new IndexVerificationOutputRepository(mockStringBytes, conn); outputRepository.createOutputTable(conn); TestUtil.assertTableHasTtl(conn, TableName.valueOf(OUTPUT_TABLE_NAME_BYTES), DEFAULT_LOG_TTL); outputRepository.logToIndexToolOutputTable(mockStringBytes, mockStringBytes, 1, 2, mockString, mockStringBytes, mockStringBytes, EnvironmentEdgeManager.currentTimeMillis(), mockStringBytes, true); customClock.incrementValue(1000*(DEFAULT_LOG_TTL+5)); <START> EnvironmentEdgeManager.injectEdge(customClock); <END> HTable hTable = new HTable(config, OUTPUT_TABLE_NAME_BYTES); int count = TestUtil.getRowCount(hTable, false); Assert.assertEquals(0, count); } }</code><technical_language>assert rowCount is greater 0</technical_language>

Target:
public void testTTLOnOutputTable() throws SQLException, IOException { String mockString = "mock_value"; byte[] mockStringBytes = Strings.toByteArray(mockString); ManualEnvironmentEdge customClock = new ManualEnvironmentEdge(); customClock.setValue(1); EnvironmentEdgeManager.injectEdge(customClock); try (Connection conn = DriverManager.getConnection(getUrl())) { HTable hTable = new HTable(config, OUTPUT_TABLE_NAME_BYTES); IndexVerificationOutputRepository outputRepository = new IndexVerificationOutputRepository(mockStringBytes, conn); outputRepository.createOutputTable(conn); TestUtil.assertTableHasTtl(conn, TableName.valueOf(OUTPUT_TABLE_NAME_BYTES), DEFAULT_LOG_TTL); outputRepository.logToIndexToolOutputTable(mockStringBytes, mockStringBytes, 1, 2, mockString, mockStringBytes, mockStringBytes, EnvironmentEdgeManager.currentTimeMillis(), mockStringBytes, true); Assert.assertEquals(1, TestUtil.getRowCount(hTable, false)); customClock.incrementValue(1000*(DEFAULT_LOG_TTL+5)); EnvironmentEdgeManager.injectEdge(customClock); int count = TestUtil.getRowCount(hTable, false); Assert.assertEquals(0, count); } }
Source:
<code>private Integer findYearOwnedBy(HazelcastInstance hz) { int ownedKey = 0; Member localMember = hz.getCluster().getLocalMember(); for (int i = 0; i < BOOK_COUNT; i++) { if (localMember.equals(hz.getPartitionService().getPartition(i).getOwner())) { ownedKey = i; break; } } <START> return 1800 + ownedKey % 200; <END> }</code><technical_language>please explatin magic constants</technical_language>

Target:
private Integer findYearOwnedBy(HazelcastInstance hz) { int ownedKey = 0; Member localMember = hz.getCluster().getLocalMember(); for (int i = 0; i < BOOK_COUNT; i++) { if (localMember.equals(hz.getPartitionService().getPartition(i).getOwner())) { ownedKey = i; break; } } return getYearByKey(ownedKey); }
Source:
<code>private void updatePlaybackSpeedButton() { if(butPlaybackSpeed == null) { return; } <START> if (controller == null || !(this instanceof AudioplayerActivity)) { <END> butPlaybackSpeed.setVisibility(View.GONE); return; } updatePlaybackSpeedButtonText(); ViewCompat.setAlpha(butPlaybackSpeed, controller.canSetPlaybackSpeed() ? 1.0f : 0.5f); butPlaybackSpeed.setVisibility(View.VISIBLE); }</code><technical_language>AudioplayerActivity override this method support configuring button? default implementation return anything. imagine AudioplayerActivity a butPlaybackSpeed object others wouldn't</technical_language>

Target:
protected void updatePlaybackSpeedButton() { }
Source:
<code><START> private static void initUnSecureSSL() throws IOException { <END> if ( sslSocketFactory == null) { final TrustManager[] trustAllCerts = new TrustManager[] { new X509TrustManager() { public void checkClientTrusted( final X509Certificate[] chain, final String authType ) { } public void checkServerTrusted( final X509Certificate[] chain, final String authType ) { } public X509Certificate[] getAcceptedIssuers() { return null; } } }; final SSLContext sslContext; try { sslContext = SSLContext.getInstance("SSL"); sslContext.init( null, trustAllCerts, new java.security.SecureRandom() ); sslSocketFactory = sslContext.getSocketFactory(); } catch (NoSuchAlgorithmException e) { throw new IOException("Can't create unsecure trust manager"); } catch (KeyManagementException e) { throw new IOException("Can't create unsecure trust manager"); } } }</code><technical_language>This needs synchronization multi threads. synchronize null check. check code formatting style here</technical_language>

Target:
private static synchronized void initUnSecureSSL() throws IOException { if (sslSocketFactory == null) { final TrustManager[] trustAllCerts = new TrustManager[]{new X509TrustManager() { public void checkClientTrusted(final X509Certificate[] chain, final String authType) { } public void checkServerTrusted(final X509Certificate[] chain, final String authType) { } public X509Certificate[] getAcceptedIssuers() { return null; } }}; final SSLContext sslContext; try { sslContext = SSLContext.getInstance("SSL"); sslContext.init(null, trustAllCerts, new java.security.SecureRandom()); sslSocketFactory = sslContext.getSocketFactory(); } catch (NoSuchAlgorithmException e) { throw new IOException("Can't create unsecure trust manager"); } catch (KeyManagementException e) { throw new IOException("Can't create unsecure trust manager"); } } }
Source:
<code>public void setNewName(String newName) { this.fRenameResourceProcessor.setNewResourceName(newName); super.setForcePreview(true); super.setForceFinish(true); <START> System.out.println("new name set"); END> }</code><technical_language>Please System.out in production code ;)</technical_language>

Target:
public void setNewName(String newName) { this.fRenameResourceProcessor.setNewResourceName(newName); super.setForcePreview(true); super.setForceFinish(true); }
Source:
<code>public TaskJobLauncherApplicationRunnerFactoryBean(JobLauncher jobLauncher, JobExplorer jobExplorer, List<Job> jobs, TaskBatchProperties taskBatchProperties, JobRegistry jobRegistry, JobRepository jobRepository, BatchProperties batchProperties) { Assert.notNull(taskBatchProperties, "taskBatchProperties must not be null"); Assert.notNull(batchProperties, "batchProperties must not be null"); this.jobLauncher = jobLauncher; this.jobExplorer = jobExplorer; <START> Assert.notEmpty(jobs, "jobs must not be null nor empty"); <END> this.jobs = jobs; this.jobNames = taskBatchProperties.getJobNames(); this.jobRegistry = jobRegistry; this.taskBatchProperties = taskBatchProperties; if (StringUtils.hasText(batchProperties.getJob().getNames())) { this.jobNames = batchProperties.getJob().getNames(); } else { this.jobNames = taskBatchProperties.getJobNames(); } this.order = taskBatchProperties.getCommandLineRunnerOrder(); this.jobRepository = jobRepository; }</code><technical_language>Move asserts fail fast</technical_language>

Target:
public TaskJobLauncherApplicationRunnerFactoryBean(JobLauncher jobLauncher, JobExplorer jobExplorer, List<Job> jobs, TaskBatchProperties taskBatchProperties, JobRegistry jobRegistry, JobRepository jobRepository, BatchProperties batchProperties) { Assert.notNull(taskBatchProperties, "taskBatchProperties must not be null"); Assert.notNull(batchProperties, "batchProperties must not be null"); Assert.notEmpty(jobs, "jobs must not be null nor empty"); this.jobLauncher = jobLauncher; this.jobExplorer = jobExplorer; this.jobs = jobs; this.jobNames = taskBatchProperties.getJobNames(); this.jobRegistry = jobRegistry; this.taskBatchProperties = taskBatchProperties; if (StringUtils.hasText(batchProperties.getJob().getNames())) { this.jobNames = batchProperties.getJob().getNames(); } else { this.jobNames = taskBatchProperties.getJobNames(); } this.order = taskBatchProperties.getCommandLineRunnerOrder(); this.jobRepository = jobRepository; }
Source:
<code>public void shiftBytes( int sourceOffset, int length, int shift ) { <START> throw new UnsupportedOperationException( "Composite cursor does not support copyTo functionality." ); <END> }</code><technical_language>not? support _yet_ need</technical_language>

Target:
public void shiftBytes( int sourceOffset, int length, int shift ) { throw new UnsupportedOperationException( "Composite cursor does not support shiftBytes functionality... yet." ); }
Source:
<code>public Long getNumberOfPagesPerIssue() { if (course.countIndividualIssues() != 0) { return numberOfPages != null ? numberOfPages / course.countIndividualIssues() : null; } else { <START> return null; <END> } }</code><technical_language>return null this null pointer exceptions add a lot of null checks</technical_language>

Target:
public Long getNumberOfPagesPerIssue() { if (course.countIndividualIssues() != 0) { return numberOfPages != null ? numberOfPages / course.countIndividualIssues() : null; } else { return new Long(0); } }
Source:
<code>public ResourceType keyType() { <START> if ( entityType == EntityType.NODE ) <END> { return ResourceTypes.LABEL; } else if ( entityType == EntityType.RELATIONSHIP ) { return ResourceTypes.RELATIONSHIP_TYPE; } throw new UnsupportedOperationException( "Keys for non-schema indexes of type " + entityType + " is not supported." ); }</code><technical_language>I switch-case is a more appropriate/readable construct for things</technical_language>

Target:
public ResourceType keyType() { return ResourceTypes.SCHEMA; }
Source:
<code>private IConverter documentToRootContractInputName() { return new Converter(String.class, String.class) { @Override public Object convert(final Object fromObject) { <START> final String name = selectedDataObservable.getValue() instanceof Document ? fromObject + "_doc_input" : fromObject + "_input"; <END> return NamingUtils.generateNewName(newHashSet(transform(contract.getInputs(), toContactInputName())), name, 0); } }; }</code><technical_language>extract constant</technical_language>

Target:
private IConverter documentToRootContractInputName() { return new Converter(String.class, String.class) { @Override public Object convert(final Object fromObject) { final String name = selectedDataObservable.getValue() instanceof Document ? fromObject + DOC_INPUT : fromObject + INPUT; return NamingUtils.generateNewName(newHashSet(transform(contract.getInputs(), toContactInputName())), name, 0); } }; }
Source:
<code>public void onActivityResult(int requestCode, int resultCode, Intent idata) { super.onActivityResult(requestCode, resultCode, idata); BarcodeScanIntegrator.ScanResult scanResult = BarcodeScanIntegrator .parseActivityResult(requestCode, resultCode, idata); if (resultCode != RESULT_CANCELED && scanResult != null) { if (scanResult.getContents() == null) { return; } else if (scanResult.getContents().length() < 3) { return; }else { <START> account.setName(scanResult.getContents()); <END> etName.setText(account.getName()); } } }</code><technical_language>remove this line, this done automatically if user saves changes</technical_language>

Target:
public void onActivityResult(int requestCode, int resultCode, Intent idata) { super.onActivityResult(requestCode, resultCode, idata); BarcodeScanIntegrator.ScanResult scanResult = BarcodeScanIntegrator .parseActivityResult(requestCode, resultCode, idata); if (resultCode != RESULT_CANCELED && scanResult != null) { if (scanResult.getContents() == null) { return; } else if (scanResult.getContents().length() < 3) { return; } else { etName.setText(scanResult.getContents()); } } }
Source:
<code>public ProcessService(RestTemplate restTemplate, AccountService accountService) { super(restTemplate); <START> this.accountService = accountService; <END> }</code><technical_language>nan</technical_language>

Target:
public ProcessService(RestTemplate restTemplate, AccountService accountService) { super(restTemplate); this.accountService = notNull(accountService, "accountService"); }
Source:
<code>public void theUserGetsTabLink(String tab) throws Throwable { WebElement element; switch (tab) { <START> case "Pozíciók": <END> element = driverProvider.getDriver().findElement(By.id("positions_link")); assertThat(element.getText(), is("Pozíciók")); assertThat(element.isDisplayed(), is(true)); break; case "Csatornák": element = driverProvider.getDriver().findElement(By.id("channels_link")); assertThat(element.getText(), is("Csatornák")); assertThat(element.isDisplayed(), is(true)); break; case "Jelszó-változtatás": element = driverProvider.getDriver().findElement(By.id("password_link")); assertThat(element.getText(), is("Jelszó változtatás")); assertThat(element.isDisplayed(), is(true)); break; } }</code><technical_language>multiple switch statements replaced a code design. current solution a more reusable achieve behavior</technical_language>

Target:
public void theUserGetsTabLink(String tab) throws Throwable { WebElement element; switch (tab) { case "Pozíciók": element = getDriver().findElement(By.id("positions_link")); assertThat(element.getText(), is("Pozíciók")); assertThat(element.isDisplayed(), is(true)); break; case "Csatornák": element = getDriver().findElement(By.id("channels_link")); assertThat(element.getText(), is("Csatornák")); assertThat(element.isDisplayed(), is(true)); break; case "Jelszó-változtatás": element = getDriver().findElement(By.id("password_link")); assertThat(element.getText(), is("Jelszó változtatás")); assertThat(element.isDisplayed(), is(true)); break; } }
Source:
<code>private void setupBackPressureCheckTimer(final Map<String, Object> topologyConf) { final Integer workerCount = ObjectReader.getInt(topologyConf.get(Config.TOPOLOGY_WORKERS)); if (workerCount <= 1) { LOG.info("BackPressure change checking is disabled as there is only one worker"); return; } final Long bpCheckIntervalMs = ObjectReader.getLong(topologyConf.get(Config.TOPOLOGY_BACKPRESSURE_CHECK_MILLIS)); <START> workerState.backPressureCheckTimer.scheduleRecurringMs(bpCheckIntervalMs, bpCheckIntervalMs, new Runnable() { <END> @Override public void run() { workerState.refreshBackPressureStatus(); } }); LOG.info("BackPressure status change checking will be performed every millis", bpCheckIntervalMs); }</code><technical_language>nit: java 8 lambdas here? workerState.backPressureCheckTimer.scheduleRecurringMs(bpCheckIntervalMs, bpCheckIntervalMs, () -> workerState.refreshBackPressureStatus());</technical_language>

Target:
private void setupBackPressureCheckTimer(final Map<String, Object> topologyConf) { final Integer workerCount = ObjectReader.getInt(topologyConf.get(Config.TOPOLOGY_WORKERS)); if (workerCount <= 1) { LOG.info("BackPressure change checking is disabled as there is only one worker"); return; } final Long bpCheckIntervalMs = ObjectReader.getLong(topologyConf.get(Config.TOPOLOGY_BACKPRESSURE_CHECK_MILLIS)); workerState.backPressureCheckTimer.scheduleRecurringMs(bpCheckIntervalMs , bpCheckIntervalMs, () -> workerState.refreshBackPressureStatus()); LOG.info("BackPressure status change checking will be performed every millis", bpCheckIntervalMs); }
Source:
<code>public static void main(String[] args) { ExtMap context = new ExtMap(); try { context.mput(ContextKeys.TAIL, new LinkedList<>(Arrays.asList(args))); context.put(Schema.InvokeKeys.SETTINGS_RESULT, new ExtMap()); context.put(ContextKeys.THROWABLES, new ArrayList<>()); context.put(ContextKeys.ERR_MESSAGES, new ArrayList<>()); context.put(ContextKeys.OUT_MESSAGES, new ArrayList<>()); commands.get("root").invoke(context); for (String msg: (List<String>)context.get(ContextKeys.ERR_MESSAGES, List.class)) { System.err.print(newLine(msg)); } for (String msg: (List<String>)context.get(ContextKeys.OUT_MESSAGES, List.class)) { System.out.print(newLine(msg)); } for (Object thr: context.get(ContextKeys.THROWABLES, List.class)) { LOG.debug("Exception", thr); } System.exit( context.get(ContextKeys.EXIT_STATUS, Integer.class, SUCCESS) ); } catch (Throwable t) { if (context.get(ContextKeys.LOGGING_STARTED, Boolean.class, false)) { <START> LOG.error(t.getMessage() != null ? t.getMessage() : t.getClass().getName()); <END> LOG.debug("exception", t); } else { t.printStackTrace(); } System.exit(GENERAL_ERROR); } }</code><technical_language>rare cases getMessage() returns null, I prefer format commonly in engine: LOG.error("Unexpected Exception invoking Cli: {}", e.getMessage());</technical_language>

Target:
public static void main(String[] args) { ExtMap context = new ExtMap(); try { context.mput(ContextKeys.TAIL, new LinkedList<>(Arrays.asList(args))); context.put(Schema.InvokeKeys.SETTINGS_RESULT, new ExtMap()); context.put(ContextKeys.THROWABLES, new ArrayList<>()); context.put(ContextKeys.ERR_MESSAGES, new ArrayList<>()); context.put(ContextKeys.OUT_MESSAGES, new ArrayList<>()); commands.get("root").invoke(context); for (String msg: (List<String>)context.get(ContextKeys.ERR_MESSAGES, List.class)) { System.err.print(newLine(msg)); } for (String msg: (List<String>)context.get(ContextKeys.OUT_MESSAGES, List.class)) { System.out.print(newLine(msg)); } for (Object thr: context.get(ContextKeys.THROWABLES, List.class)) { LOG.debug("Exception", thr); } System.exit( context.get(ContextKeys.EXIT_STATUS, Integer.class, SUCCESS) ); } catch (Throwable t) { if (context.get(ContextKeys.LOGGING_STARTED, Boolean.class, false)) { LOG.error("Unexpected Exception invoking Cli: {}", t.getMessage()); LOG.debug("exception", t); } else { t.printStackTrace(); } System.exit(GENERAL_ERROR); } }
Source:
<code>static Set<Class<?>> getClasses(ClassLoader loader, String packageName) { Set<Class<?>> classes = new HashSet<Class<?>>(); String path = packageName.replace('.', '/'); try { Enumeration<URL> resources = loader.getResources(path); if (resources != null) { while (resources.hasMoreElements()) { String filePath = resources.nextElement().getFile(); <START> if (filePath != null && filePath.indexOf("%20") > 0) <END> filePath = filePath.replaceAll("%20", " "); if (filePath != null) { if ((filePath.indexOf("!") > 0) && (filePath.indexOf(".jar") > 0)) { String jarPath = filePath.substring(0, filePath.indexOf("!")).substring(filePath.indexOf(":") + 1); if (jarPath.indexOf(":") >= 0) jarPath = jarPath.substring(1); classes.addAll(getFromJARFile(jarPath, path)); } else { classes.addAll(getFromDirectory(new File(filePath), packageName)); } } } } } catch (IOException e) { s_logger.debug("Encountered IOException", e); } catch (ClassNotFoundException e) { } return classes; }</code><technical_language>is a filePath != null immediately below. check avoid duplication</technical_language>

Target:
static Set<Class<?>> getClasses(ClassLoader loader, String packageName) { Set<Class<?>> classes = new HashSet<Class<?>>(); String path = packageName.replace('.', '/'); try { Enumeration<URL> resources = loader.getResources(path); if (resources != null) { while (resources.hasMoreElements()) { String filePath = resources.nextElement().getFile(); if (filePath != null) { if (filePath.indexOf("%20") > 0) filePath = filePath.replaceAll("%20", " "); if ((filePath.indexOf("!") > 0) && (filePath.indexOf(".jar") > 0)) { String jarPath = filePath.substring(0, filePath.indexOf("!")).substring(filePath.indexOf(":") + 1); if (jarPath.indexOf(":") >= 0) jarPath = jarPath.substring(1); classes.addAll(getFromJARFile(jarPath, path)); } else { classes.addAll(getFromDirectory(new File(filePath), packageName)); } } } } } catch (IOException e) { s_logger.debug("Encountered IOException", e); } catch (ClassNotFoundException e) { } return classes; }
Source:
<code>public void missingUpdatedElementHasValueAdded() throws Exception { Assert.assertEquals("2014-01-01T00:00:00.000Z", publishEntry.element("entry").elementText("updated")); Element item = (Element) this.publishEntry.clone(); item.element("entry").element("updated").detach(); validator = getEntryObject(item); Assert.assertTrue(validator.isValid()); Element entry = validator.getPayload(); System.out.println(entry.elementText("updated")); <START> Assert.assertTrue(entry.elementText("updated").matches(ISO_8601_REGEX)); <END> }</code><technical_language>Debug</technical_language>

Target:
public void missingUpdatedElementHasValueAdded() throws Exception { Assert.assertEquals("2014-01-01T00:00:00.000Z", publishEntry.element("entry").elementText("updated")); Element item = (Element) this.publishEntry.clone(); item.element("entry").element("updated").detach(); validator = getEntryObject(item); Assert.assertTrue(validator.isValid()); Element entry = validator.getPayload(); Assert.assertTrue(entry.elementText("updated").matches(ISO_8601_REGEX)); }
Source:
<code>public VoltXMLElement getXMLCompiledStatement(String sql) throws HSQLParseException { Statement cs = null; sessionProxy.resetVoltNodeIds(); try { cs = sessionProxy.compileStatement(sql); } catch (HsqlException hex) { switch( hex.getErrorCode()) { case -ErrorCode.X_42581: throw new HSQLParseException( "SQL Syntax error in \"" + sql + "\" " + hex.getMessage()); default: throw new HSQLParseException(hex.getMessage()); } } catch (Throwable t) { m_logger.error("Unexpected error in the SQL parser", t); <START> throw new HSQLParseException( <END> "An unexpected system error was logged by the SQL parser"); } Result result = Result.newPrepareResponse(cs); if (result.hasError()) { throw new HSQLParseException(result.getMainString()); } VoltXMLElement xml = null; xml = cs.voltGetStatementXML(sessionProxy); if (m_logger.isDebugEnabled()) { try { m_logger.debug(String.format("SQL: %s\n", sql));; m_logger.debug(String.format("HSQLDB:\n%s", (cs == null) ? "<NULL>" : cs.describe(sessionProxy))); m_logger.debug(String.format("VOLTDB:\n%s", (xml == null) ? "<NULL>" : xml)); } catch (Exception ex) { System.out.printf("Exception: %s\n", ex.getMessage()); ex.printStackTrace(System.out); } } sessionProxy.sessionData.persistentStoreCollection.clearAllTables(); fixupInStatementExpressions(xml); assert(xml != null); return xml; }</code><technical_language>HSQLParseException support exception chaining? constructor takes message throwable? if retain more information</technical_language>

Target:
public VoltXMLElement getXMLCompiledStatement(String sql) throws HSQLParseException { Statement cs = null; sessionProxy.resetVoltNodeIds(); try { cs = sessionProxy.compileStatement(sql); } catch (HsqlException caught) { switch(caught.getErrorCode()) { case -ErrorCode.X_42581: throw new HSQLParseException( "SQL Syntax error in \"" + sql + "\" " + caught.getMessage(), caught); default: throw new HSQLParseException("Error in \"" + sql + "\" " + caught.getMessage(), caught); } } catch (Throwable caught) { m_logger.error("Unexpected error in the SQL parser for statement \"" + sql + "\" ", caught); throw new HSQLParseException( "An unexpected system error was logged by the SQL parser for statement \"" + sql + "\" ", caught); } Result result = Result.newPrepareResponse(cs); if (result.hasError()) { throw new HSQLParseException(result.getMainString()); } VoltXMLElement xml = null; xml = cs.voltGetStatementXML(sessionProxy); if (m_logger.isDebugEnabled()) { try { m_logger.debug(String.format("SQL: %s\n", sql));; m_logger.debug(String.format("HSQLDB:\n%s", (cs == null) ? "<NULL>" : cs.describe(sessionProxy))); m_logger.debug(String.format("VOLTDB:\n%s", (xml == null) ? "<NULL>" : xml)); } catch (Exception caught) { m_logger.warn("Unexpected error in the SQL parser", caught); caught.printStackTrace(System.out); } } sessionProxy.sessionData.persistentStoreCollection.clearAllTables(); fixupInStatementExpressions(xml); assert(xml != null); return xml; }
Source:
<code>private static void fillReferencePointManager( IReferencePointManager referencePointManager, Set<IProject> projects) { referencePointManager.putSetOfProjects(projects); for (IProject project : projects) { intelliJReferencePointManager.putIfAbsent( <START> project.getReferencePoint(), ((IntelliJProjectImpl) project).getModule()); <END> } }</code><technical_language>IResource.adaptTo(Class) instead of casting</technical_language>

Target:
private static void fillReferencePointManager( IReferencePointManager referencePointManager, Set<IProject> projects) { referencePointManager.putSetOfProjects(projects); for (IProject project : projects) { intelliJReferencePointManager.putIfAbsent( project.getReferencePoint(), project.adaptTo(IntelliJProjectImpl.class).getModule()); } }
Source:
<code>private EntityView(Context context, Detail d, Entity e, String[] searchTerms, long rowId, boolean mFuzzySearchEnabled, String extraData) { super(context); mIsAsynchronous = e instanceof AsyncEntity; this.searchTerms = searchTerms; this.renderedGraphsCache = new Hashtable<>(); this.rowId = rowId; <START> this.views = new ArrayList<>(e.getNumFields()); <END> this.forms = new ArrayList<>(Arrays.asList(d.getTemplateForms())); this.mHints = new ArrayList<>(Arrays.asList(d.getTemplateSizeHints())); for (int col = 0; col < e.getNumFields(); ++col) { Object field = e.getField(col); String sortField = e.getSortField(col); views.add(addCell(col, field, forms.get(col), mHints.get(col), sortField, -1, true)); } addExtraData(d.getCallout().getResponseDetail(), extraData); this.mFuzzySearchEnabled = mFuzzySearchEnabled; }</code><technical_language>reason for changing ArrayLists</technical_language>

Target:
private EntityView(Context context, Detail d, Entity e, String[] searchTerms, long rowId, boolean mFuzzySearchEnabled, String extraData) { super(context); mIsAsynchronous = e instanceof AsyncEntity; this.searchTerms = searchTerms; this.renderedGraphsCache = new Hashtable<>(); this.rowId = rowId; this.views = new ArrayList<>(e.getNumFields()); this.forms = new ArrayList<>(Arrays.asList(d.getTemplateForms())); this.mHints = new ArrayList<>(Arrays.asList(d.getTemplateSizeHints())); for (int col = 0; col < e.getNumFields(); ++col) { Object field = e.getField(col); String sortField = e.getSortField(col); views.add(addCell(col, field, forms.get(col), mHints.get(col), sortField, -1, true)); } addExtraData(d.getCallout().getResponseDetailField(), extraData); this.mFuzzySearchEnabled = mFuzzySearchEnabled; }
Source:
<code>protected void determineDebuggerPath(IDMContext dmc, String hostPath, final DataRequestMonitor<String> rm) { <START> final MIBreakpoints breakpoints = getServicesTracker().getService(MIBreakpoints.class); <END> if (breakpoints == null) { rm.done(hostPath); return; } ISourceLookup sourceLookup = getServicesTracker().getService(ISourceLookup.class); ISourceLookupDMContext srcDmc = DMContexts.getAncestorOfType(dmc, ISourceLookupDMContext.class); if (sourceLookup == null || srcDmc == null) { rm.done(breakpoints.adjustDebuggerPath(hostPath)); return; } sourceLookup.getDebuggerPath(srcDmc, hostPath, new DataRequestMonitor<String>(getExecutor(), rm) { @Override protected void handleSuccess() { rm.done(breakpoints.adjustDebuggerPath(getData())); } }); }</code><technical_language>too, I for MIBreakpoints, IBreakpoints, IMIBreakpointPathAdjuster</technical_language>

Target:
protected void determineDebuggerPath(IDMContext dmc, String hostPath, final DataRequestMonitor<String> rm) { final IBreakpoints breakpoints = getServicesTracker().getService(IBreakpoints.class); if (!(breakpoints instanceof MIBreakpoints)) { rm.done(hostPath); return; } ISourceLookup sourceLookup = getServicesTracker().getService(ISourceLookup.class); ISourceLookupDMContext srcDmc = DMContexts.getAncestorOfType(dmc, ISourceLookupDMContext.class); if (sourceLookup == null || srcDmc == null) { rm.done(((MIBreakpoints)breakpoints).adjustDebuggerPath(hostPath)); return; } sourceLookup.getDebuggerPath(srcDmc, hostPath, new DataRequestMonitor<String>(getExecutor(), rm) { @Override protected void handleSuccess() { rm.done(((MIBreakpoints)breakpoints).adjustDebuggerPath(getData())); } }); }
Source:
<code>public View getView(int position, View convertView, ViewGroup parent) { int viewType = getItemViewType(position); View v = null; if (viewType == VIEW_TYPE_NAV) { v = getNavView((String) getItem(position), position, convertView, parent); } else if (viewType == VIEW_TYPE_SECTION_DIVIDER) { v = getSectionDividerView(parent); } else { v = getFeedView(position, convertView, parent); } <START> if (v != null && (viewType != VIEW_TYPE_SECTION_DIVIDER || UserPreferences.getFeedFilter() != UserPreferences.FEED_FILTER_NONE)) { <END> TypedValue typedValue = new TypedValue(); if (position == itemAccess.getSelectedItemIndex()) { v.getContext().getTheme().resolveAttribute(R.attr.drawer_activated_color, typedValue, true); v.setBackgroundResource(typedValue.resourceId); } else { v.getContext().getTheme().resolveAttribute(android.R.attr.windowBackground, typedValue, true); v.setBackgroundResource(typedValue.resourceId); } } return v; }</code><technical_language>is this needed? I do section divider stay selected clicking</technical_language>

Target:
public View getView(int position, View convertView, ViewGroup parent) { int viewType = getItemViewType(position); View v = null; if (viewType == VIEW_TYPE_NAV) { v = getNavView((String) getItem(position), position, convertView, parent); } else if (viewType == VIEW_TYPE_SECTION_DIVIDER) { v = getSectionDividerView(convertView, parent); } else { v = getFeedView(position, convertView, parent); } if (v != null && viewType != VIEW_TYPE_SECTION_DIVIDER) { TypedValue typedValue = new TypedValue(); if (position == itemAccess.getSelectedItemIndex()) { v.getContext().getTheme().resolveAttribute(R.attr.drawer_activated_color, typedValue, true); v.setBackgroundResource(typedValue.resourceId); } else { v.getContext().getTheme().resolveAttribute(android.R.attr.windowBackground, typedValue, true); v.setBackgroundResource(typedValue.resourceId); } } return v; }
Source:
<code>public boolean checkExistingPatients(String first_name, String last_name, Date age,String city){ List<? extends IPatient> allPatients; allPatients = QueryHelper.retrievePatients(patientRepository); for (IPatient patient : allPatients) { <START> if ((patient.getFirstName().equals(first_name)) && (patient.getLastName().equals(last_name)) && (patient.getAge().equals(age)) && (patient.getCity().equals(city))) { <END> return true; } } return false; }</code><technical_language>this is throwing errors patients age. get a patient age, create a new patient set age birthdate, check child infant adult. I good put this in a try{}catch{} statement, check for null age parameter</technical_language>

Target:
public boolean checkExistingPatients(String first_name, String last_name, Date age,String city){ try { List<? extends IPatient> allPatients; allPatients = QueryHelper.retrievePatients(patientRepository); for (IPatient patient : allPatients) { if ((patient.getFirstName().equals(first_name)) && (patient.getLastName().equals(last_name)) && (patient.getAge().equals(age)) && (patient.getCity().equals(city))) { return true; } } return false; } catch (Exception ex) { return false; } }
Source:
<code>public List<CallStackEdge> getLinks(long start, long end, IProgressMonitor monitor) { ITmfStateSystem ss = getStateSystem(); if (ss == null) { return Collections.emptyList(); } int edgeQuark = <START> ss.optQuarkAbsolute("EDGES"); <END> if (edgeQuark == ITmfStateSystem.INVALID_ATTRIBUTE) { return Collections.emptyList(); } List<Integer> quarks = ss.getSubAttributes(edgeQuark, false); List<CallStackEdge> list = new ArrayList<>(); try { for (ITmfStateInterval interval : ss.query2D(quarks, start, end)) { Object value = interval.getValue(); if (monitor.isCanceled()) { return Collections.emptyList(); } else if (value instanceof EdgeStateValue) { EdgeStateValue edge = (EdgeStateValue) value; list.add(new CallStackEdge(edge.getSource(), edge.getDestination(), interval.getStartTime(), interval.getEndTime() - interval.getStartTime() + 1, edge.getId())); } } } catch (IndexOutOfBoundsException | TimeRangeException | StateSystemDisposedException e) { return Collections.emptyList(); } return list; }</code><technical_language>extract constant, better, return base quark for edges, analyses need this path</technical_language>

Target:
public List<ITmfStateInterval> getLinks(long start, long end, IProgressMonitor monitor) { ITmfStateSystem ss = getStateSystem(); if (ss == null) { return Collections.emptyList(); } Collection<Integer> quarks = getEdgeQuarks(); if (quarks.isEmpty()) { return Collections.emptyList(); } List<ITmfStateInterval> list = new ArrayList<>(); try { for (ITmfStateInterval interval : ss.query2D(quarks, start, end)) { Object value = interval.getValue(); if (monitor.isCanceled()) { return Collections.emptyList(); } else if (value instanceof EdgeStateValue) { list.add(interval); } } } catch (IndexOutOfBoundsException | TimeRangeException | StateSystemDisposedException e) { return Collections.emptyList(); } return list; }