auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public static BridgeConfig toBridgeConfig(Bridge bridge) { BridgeConfig bridgeConfig = new BridgeConfig(); <START> org.slf4j.LoggerFactory.getLogger(Converter.class).error("TO BC {}", bridge.getVxLanPortIds(), bridge.getVxLanPortId()); <END> bridgeConfig.name = bridge.getName(); bridgeConfig.adminStateUp = bridge.isAdminStateUp(); bridgeConfig.inboundFilter = bridge.getInboundFilter(); bridgeConfig.outboundFilter = bridge.getOutboundFilter(); bridgeConfig.vxLanPortId = bridge.getVxLanPortId(); bridgeConfig.vxLanPortIds = bridge.getVxLanPortIds(); bridgeConfig.tunnelKey = bridge.getTunnelKey(); bridgeConfig.properties = new HashMap<>(bridge.getProperties()); return bridgeConfig; }</code><technical_language>delete</technical_language>

Target:
public static BridgeConfig toBridgeConfig(Bridge bridge) { BridgeConfig bridgeConfig = new BridgeConfig(); bridgeConfig.name = bridge.getName(); bridgeConfig.adminStateUp = bridge.isAdminStateUp(); bridgeConfig.inboundFilter = bridge.getInboundFilter(); bridgeConfig.outboundFilter = bridge.getOutboundFilter(); bridgeConfig.vxLanPortId = bridge.getVxLanPortId(); bridgeConfig.vxLanPortIds = bridge.getVxLanPortIds(); bridgeConfig.tunnelKey = bridge.getTunnelKey(); bridgeConfig.properties = new HashMap<>(bridge.getProperties()); return bridgeConfig; }
Source:
<code>public User getUserByUserExtSource(PerunSession sess, UserExtSource userExtSource) throws InternalErrorException, UserNotExistsException { try { return jdbc.queryForObject("select " + userMappingSelectQuery + " from users, user_ext_sources " + "where users.id=user_ext_sources.user_id and user_ext_sources.login_ext=? and user_ext_sources.ext_sources_id=? ", USER_MAPPER, userExtSource.getLogin(), userExtSource.getExtSource().getId()); } catch (EmptyResultDataAccessException ex) { <START> log.debug("GET_USER_BY_USER_EXT_SOURCE"); <END> throw new UserNotExistsException("userExtSource=" + userExtSource.toString()); } catch (RuntimeException err) { throw new InternalErrorException(err); } }</code><technical_language>Again, this change a part of this pull-request, related ExtSources purpose is debugging it</technical_language>

Target:
public User getUserByUserExtSource(PerunSession sess, UserExtSource userExtSource) throws InternalErrorException, UserNotExistsException { try { return jdbc.queryForObject("select " + userMappingSelectQuery + " from users, user_ext_sources " + "where users.id=user_ext_sources.user_id and user_ext_sources.login_ext=? and user_ext_sources.ext_sources_id=? ", USER_MAPPER, userExtSource.getLogin(), userExtSource.getExtSource().getId()); } catch (EmptyResultDataAccessException ex) { throw new UserNotExistsException("userExtSource=" + userExtSource.toString()); } catch (RuntimeException err) { throw new InternalErrorException(err); } }
Source:
<code>public void testNoName(){ try { createConfigFileWithRobot(""); RobobuggyConfigFile.loadConfigFile(); Assert.fail(); } catch (IOException e) { e.printStackTrace(); Assert.fail(); } catch (IllegalArgumentException e) { <START> } <END> }</code><technical_language>need add Assert.fail() catch. is wrong thing. do that, Illegal argument catch block, put a return statement accidentally trigger failure</technical_language>

Target:
public void testNoName(){ try { createConfigFileWithRobot(""); RobobuggyConfigFile.loadConfigFile(); Assert.fail(); } catch (IOException e) { e.printStackTrace(); Assert.fail(); } catch (IllegalArgumentException e) { return; } Assert.fail(); }
Source:
<code>private List<DiseaseOccurrence> refineSubsetForAfricanDiseaseGroup(List<DiseaseOccurrence> occurrences) { if (parametersNotNull(minDistinctCountries, highFrequencyThreshold, minHighFrequencyCountries)) { countriesOfInterest = locationService.getCountriesForMinDataSpreadCalculation(); constructOccurrenceCountPerCountryMap(occurrences); while (!minDataSpreadCheckForAfricanDiseaseGroup()) { <START> if (occurrences.equals(allOccurrences)) { <END> return null; } int n = occurrences.size(); occurrences = allOccurrences.subList(0, n + 1); addCountryToOccurrenceCountMap(occurrences.get(n).getLocation().getCountryGaulCode()); } } return occurrences; }</code><technical_language>"if (occurrences.size().equals(allOccurrences.size())" sufficient? equals entire list is pretty slow a DiseaseOccurrence contains objects</technical_language>

Target:
private List<DiseaseOccurrence> refineSubsetForAfricanDiseaseGroup(List<DiseaseOccurrence> occurrences) { if (parametersNotNull(minDistinctCountries, highFrequencyThreshold, minHighFrequencyCountries)) { countriesOfInterest = locationService.getCountriesForMinDataSpreadCalculation(); constructOccurrenceCountPerCountryMap(occurrences); while (!minDataSpreadCheckForAfricanDiseaseGroup()) { int n = occurrences.size(); if (n == allOccurrences.size()) { return null; } DiseaseOccurrence nextOccurrence = allOccurrences.get(n); occurrences.add(nextOccurrence); addCountryToOccurrenceCountMap(nextOccurrence.getLocation().getCountryGaulCode()); } } return occurrences; }
Source:
<code>public String getErrorResultMessage(Context context) { String errorMessage = context.getString(R.string.error) + " "; switch (this) { case NOT_ENOUGH_SPACE: return errorMessage + context.getString(R.string.storage_migration_not_enough_space); case CHANGES_IN_PROGRESS: <START> return errorMessage + context.getString(R.string.storage_migration_form_downloader_is_running); <END> case MOVING_FILES_FAILED: return errorMessage + context.getString(R.string.storage_migration_failed); default: return errorMessage; } }</code><technical_language>I understand this</technical_language>

Target:
public String getErrorResultMessage(Context context) { String errorMessage = context.getString(R.string.error) + " "; switch (this) { case NOT_ENOUGH_SPACE: return errorMessage + context.getString(R.string.storage_migration_not_enough_space); case CHANGES_IN_PROGRESS: return errorMessage + context.getString(R.string.changes_in_progress); case MOVING_FILES_FAILED: return errorMessage + context.getString(R.string.storage_migration_failed); default: return errorMessage; } }
Source:
<code>protected List<JsonNode> readJsonFiles(File configPath) { List<JsonNode> nodes = new ArrayList<JsonNode>(); List<String> jsonFiles = getJsonFiles(configPath); for (String jsonFile : jsonFiles) { File file = new File(configPath, jsonFile); if (file.exists() && file.canRead()) { BufferedReader reader = null; <START> try { <END> reader = new BufferedReader(new FileReader(file.getAbsolutePath())); nodes.add(mapper.readTree(reader)); log.info("Successfully read CSH mapping file '{}'", file.getAbsolutePath()); } catch (IOException e) { log.error("Exception parsing documentation mapping file '{}': {}", file.getAbsolutePath(), e.getMessage()); log.error("Exception: ", e); } finally { try { reader.close(); } catch (IOException e) { log.error("Couldn't close CSH mapping file", e); } } } } return nodes; }</code><technical_language>Do Java 7 construct, file reader is closed properly</technical_language>

Target:
protected List<JsonNode> readJsonFiles(File configPath) { List<JsonNode> nodes = new ArrayList<JsonNode>(); List<String> jsonFiles = getJsonFiles(configPath); for (String jsonFile : jsonFiles) { File file = new File(configPath, jsonFile); if (file.exists() && file.canRead()) { try (BufferedReader reader = new BufferedReader(new FileReader(file.getAbsolutePath()))) { nodes.add(mapper.readTree(reader)); log.info("Successfully read CSH mapping file '{}'", file.getAbsolutePath()); } catch (IOException e) { log.error("Exception parsing documentation mapping file '{}': {}", file.getAbsolutePath(), e.getMessage()); log.error("Exception: ", e); } } } return nodes; }
Source:
<code>public ConfigResource parse(TopLevelResource root, IdString id) throws ResourceNotFoundException { <START> if (!"server".equals(id.get())) { <END> throw new ResourceNotFoundException(id); } return new ConfigResource(); }</code><technical_language>nit: write id.equals("server")</technical_language>

Target:
public ConfigResource parse(TopLevelResource root, IdString id) throws ResourceNotFoundException { if (id.equals("server")) { return new ConfigResource(); } throw new ResourceNotFoundException(id); }
Source:
<code>public void readCachesWritersStartToCommitTimestamp() { Transaction writer = txMgr.runTaskWithRetry(txn -> { put(txn, TEST_TABLE, "row", "column", "test"); return txn; }); assertThat(timestampCache.getCommitTimestampIfPresent(writer.getTimestamp())).isNull(); txMgr.runTaskWithRetry(txn -> { get(txn, TEST_TABLE, "row", "column"); return txn; }); assertThat(timestampCache.getCommitTimestampIfPresent(writer.getTimestamp())) .isNotNull() <START> .isEqualTo(transactionService.get(writer.getTimestamp())); <END> }</code><technical_language>In general this class, is isNotNull() needed? I imagine isEqualTo check good enough. Transaction#getTimestamp returns a primitive long, non-null</technical_language>

Target:
public void readCachesWritersStartToCommitTimestamp() { Transaction writer = txMgr.runTaskWithRetry(txn -> { put(txn, TEST_TABLE, "row", "column", "test"); return txn; }); assertThat(timestampCache.getCommitTimestampIfPresent(writer.getTimestamp())).isNull(); txMgr.runTaskWithRetry(txn -> get(txn, TEST_TABLE, "row", "column")); assertThat(timestampCache.getCommitTimestampIfPresent(writer.getTimestamp())) .isEqualTo(transactionService.get(writer.getTimestamp())); }
Source:
<code>public void execute(JobExecutionContext context) throws JobExecutionException { if (LOGGER.isDebugEnabled()) { LOGGER.debug("Starting a deadline job"); } JobDetail jobDetail = context.getJobDetail(); JobDataMap jobData = jobDetail.getJobDataMap(); try { SchedulerContext schedulerContext = context.getScheduler().getContext(); DeadlineMessage deadlineMessage = DeadlineJobDataBinder.deadlineMessage(jobData); DeadlineContext deadlineContext = DeadlineJobDataBinder.deadlineContext(jobData); TransactionManager transactionManager = (TransactionManager) schedulerContext.get(TRANSACTION_MANAGER_KEY); DeadlineTargetLoader deadlineTargetLoader = (DeadlineTargetLoader) schedulerContext.get( DEADLINE_TARGET_LOADER_KEY); <START> <END> DefaultUnitOfWork<DeadlineMessage<?>> unitOfWork = DefaultUnitOfWork.startAndGet(null); Transaction transaction = transactionManager.startTransaction(); unitOfWork.onCommit(u -> transaction.commit()); unitOfWork.onRollback(u -> transaction.rollback()); unitOfWork.execute(() -> deadlineTargetLoader.load(deadlineContext).handle(deadlineMessage)); if (LOGGER.isInfoEnabled()) { LOGGER.info("Job successfully executed. Deadline message processed.", deadlineMessage.getPayloadType().getSimpleName()); } } catch (Exception e) { LOGGER.error("Exception occurred during processing a deadline job [{}]", jobDetail.getDescription(), e); throw new JobExecutionException(e); } }</code><technical_language>Super nit: unintentional additional white space I assume</technical_language>

Target:
public void execute(JobExecutionContext context) throws JobExecutionException { if (LOGGER.isDebugEnabled()) { LOGGER.debug("Starting a deadline job"); } JobDetail jobDetail = context.getJobDetail(); JobDataMap jobData = jobDetail.getJobDataMap(); try { SchedulerContext schedulerContext = context.getScheduler().getContext(); Serializer serializer = (Serializer) schedulerContext.get(JOB_DATA_SERIALIZER); TransactionManager transactionManager = (TransactionManager) schedulerContext.get(TRANSACTION_MANAGER_KEY); ScopeAwareProvider scopeAwareComponents = (ScopeAwareProvider) schedulerContext.get(SCOPE_AWARE_RESOLVER); DeadlineMessage<?> deadlineMessage = deadlineMessage(serializer, jobData); ScopeDescriptor deadlineScope = deadlineScope(serializer, jobData); DefaultUnitOfWork<DeadlineMessage<?>> unitOfWork = DefaultUnitOfWork.startAndGet(deadlineMessage); unitOfWork.attachTransaction(transactionManager); unitOfWork.execute(() -> executeScheduledDeadline(scopeAwareComponents, deadlineMessage, deadlineScope)); if (LOGGER.isInfoEnabled()) { LOGGER.info("Job successfully executed. Deadline message processed.", deadlineMessage.getPayloadType().getSimpleName()); } } catch (Exception e) { LOGGER.error("Exception occurred during processing a deadline job [{}]", jobDetail.getDescription(), e); throw new JobExecutionException(e); } }
Source:
<code>public MessageChannel getObject() throws Exception { <START> return new DirectChannel(); <END> }</code><technical_language>this assigned a field instance returned if invoked multiple times</technical_language>

Target:
public synchronized MessageChannel getObject() throws Exception { if (directChannel == null) { directChannel = new DirectChannel(); } return directChannel; }
Source:
<code>default Long getGlobalAddress() { if (getMetadataMap() == null) { <START> return Address.NON_ADDRESS; <END> } return Optional.ofNullable((Long) getMetadataMap() .get(LogUnitMetadataType.GLOBAL_ADDRESS)).orElse(Address.NON_ADDRESS); }</code><technical_language>I need this, empyt, key</technical_language>

Target:
default Long getGlobalAddress() { return Optional.ofNullable((Long) getMetadataMap() .get(LogUnitMetadataType.GLOBAL_ADDRESS)).orElse(Address.NON_ADDRESS); }
Source:
<code>public boolean isAdapterForType(Object type) { <START> if (IComparisonScope.class.equals(type)) { <END> return true; } return super.isAdapterForType(type); }</code><technical_language>In general == compare classes (Cf. *AdapterFactory implementations for example)</technical_language>

Target:
public boolean isAdapterForType(Object type) { if (type == IComparisonScope2.class || type == IComparisonScope.class) { return true; } return super.isAdapterForType(type); }
Source:
<code>public void testScreenshotCompare() throws Exception { wd.open(url); Image im = new Image(" im.waitForVisible(); <START> <END> ScreenshotUtils.assertSimilarToScreenshot(im.getLocator(), new File("src/test/resources/webapp/finralogo.jpg"), new File("testScreenshots/screenshot.png")); }</code><technical_language>If assertSimilarToScreenshot method signature changes boolean isSimilar - adjust this test accordingly</technical_language>

Target:
public void testScreenshotCompare() throws Exception { wd.open(url); Image im = new Image(" im.waitForVisible(); Assert.assertTrue("The screenshots are similar", ScreenshotUtils.isSimilarToScreenshot( im, new File("src/test/resources/webapp/finralogo.jpg"), new File("testScreenshots/screenshot.png"))); }
Source:
<code>private GlusterServerInfo prepareHostsEntity(Map<String, Object> map) { GlusterServerInfo entity = new GlusterServerInfo(); entity.setHostName(map.get(HOST_NAME).toString()); entity.setUuid(new Guid(map.get(UUID).toString())); String status = map.get(PEER_STATUS).toString(); <START> if (status.equalsIgnoreCase("CONNECTED")) { <END> entity.setStatus(PeerStatus.CONNECTED); } else if (status.equalsIgnoreCase("DISCONNECTED")) { entity.setStatus(PeerStatus.DISCONNECTED); } else { entity.setStatus(PeerStatus.UNKNOWN); } return entity; }</code><technical_language>In case enum names expect receive VDSM, PeerStatus.valueOf()</technical_language>

Target:
private GlusterServerInfo prepareHostsEntity(Map<String, Object> map) { GlusterServerInfo entity = new GlusterServerInfo(); entity.setHostName(map.get(HOST_NAME).toString()); entity.setUuid(new Guid(map.get(UUID).toString())); String status = map.get(PEER_STATUS).toString(); entity.setStatus(PeerStatus.valueOf(status)); return entity; }
Source:
<code>public Bundle getAuthToken(AccountAuthenticatorResponse response, Account account, String authTokenType, Bundle options) throws NetworkErrorException { final Bundle bundle = new Bundle(); if(!authTokenType.equals(ACCOUNT_TYPE)) return bundle; AccountManager am = AccountManager.get(context); String username = account.name; String password = am.getPassword(account); String authToken = null; DefaultClient client = new DefaultClient(); client.setCredentials(username, password); OAuthService oAuthService = new OAuthService(client); try { try { List<Authorization> auths = oAuthService.getAuthorizations(); for(Authorization auth : auths) if(auth.getApp().getName().equals(ACCOUNT_NAME)) authToken = auth.getToken(); } <START> catch ( NullPointerException npe ) { } <END> if(TextUtils.isEmpty(authToken)) { Authorization auth = oAuthService.createAuthorization( new Authorization().setNote(ACCOUNT_NAME).setUrl(APP_URL) ); if(auth != null) authToken = auth.getToken(); } if(TextUtils.isEmpty(authToken)) { final Intent intent = new Intent(context, LoginActivity.class); intent.putExtra(PARAM_AUTHTOKEN_TYPE, ACCOUNT_TYPE); intent.putExtra(KEY_ACCOUNT_AUTHENTICATOR_RESPONSE, response); bundle.putParcelable(KEY_INTENT, intent); return bundle; } bundle.putString(AccountManager.KEY_ACCOUNT_NAME, account.name); bundle.putString(AccountManager.KEY_ACCOUNT_TYPE, ACCOUNT_TYPE); bundle.putString(AccountManager.KEY_AUTHTOKEN, authToken); am.clearPassword(account); return bundle; } catch ( Exception e ) { e.printStackTrace(); } return bundle; }</code><technical_language>catching a NPE here</technical_language>

Target:
public Bundle getAuthToken(AccountAuthenticatorResponse response, Account account, String authTokenType, Bundle options) throws NetworkErrorException { final Bundle bundle = new Bundle(); if(!authTokenType.equals(ACCOUNT_TYPE)) return bundle; AccountManager am = AccountManager.get(context); String username = account.name; String password = am.getPassword(account); String authToken = null; DefaultClient client = new DefaultClient(); client.setCredentials(username, password); OAuthService oAuthService = new OAuthService(client); try { List<Authorization> auths = oAuthService.getAuthorizations(); for(Authorization auth : auths) if(auth.getApp().getName().equals(ACCOUNT_NAME)) authToken = auth.getToken(); if(TextUtils.isEmpty(authToken)) { Authorization auth = oAuthService.createAuthorization( new Authorization().setNote(ACCOUNT_NAME).setUrl(APP_URL) ); if(auth != null) authToken = auth.getToken(); } if(TextUtils.isEmpty(authToken)) { final Intent intent = new Intent(context, LoginActivity.class); intent.putExtra(PARAM_AUTHTOKEN_TYPE, ACCOUNT_TYPE); intent.putExtra(KEY_ACCOUNT_AUTHENTICATOR_RESPONSE, response); bundle.putParcelable(KEY_INTENT, intent); return bundle; } bundle.putString(AccountManager.KEY_ACCOUNT_NAME, account.name); bundle.putString(AccountManager.KEY_ACCOUNT_TYPE, ACCOUNT_TYPE); bundle.putString(AccountManager.KEY_AUTHTOKEN, authToken); am.clearPassword(account); return bundle; } catch ( Exception e ) { Log.e(TAG, e.getMessage()); } return bundle; }
Source:
<code>public void getUserBioInfoPresentTest()throws IOException { Account accountTest = new Account.Builder() .withId(0L) .build(); UserBioInfo userBioInfo = UserBioInfo.getUserBioInfo(Optional.of(accountTest), false); assertThat(userBioInfo.age, is(0.0) ); assertThat(userBioInfo.bmi, is(0.0)); assertThat(userBioInfo.male, is(0)); assertThat(userBioInfo.female, is(0)); assertThat(userBioInfo.partner, is(0)); final double age = 20.0; final int height = 160; final int weight = 70000; final double bmi = (weight/ 1000)/( (((double)height) / 100) * (((double)height) / 100)); final Gender gender = Gender.MALE; <START> final DateTime dob = DateTime.now().minusYears((int) age); <END> accountTest = new Account.Builder() .withId(0L) .withDOB(dob.toString()) .withGender(gender) .withHeight(height) .withWeight(weight) .build(); userBioInfo = UserBioInfo.getUserBioInfo(Optional.of(accountTest), true); assertThat(userBioInfo.age, is(age)); assertThat(userBioInfo.bmi, is(bmi)); assertThat(userBioInfo.male, is(1)); assertThat(userBioInfo.female, is(0)); assertThat(userBioInfo.partner, is(1)); }</code><technical_language>a timezone avoid weird time related test failures</technical_language>

Target:
public void getUserBioInfoPresentTest()throws IOException { Account accountTest = new Account.Builder() .withId(0L) .build(); UserBioInfo userBioInfo = UserBioInfo.getUserBioInfo(Optional.of(accountTest), false); assertThat(userBioInfo.age, is(0.0) ); assertThat(userBioInfo.bmi, is(0.0)); assertThat(userBioInfo.male, is(0)); assertThat(userBioInfo.female, is(0)); assertThat(userBioInfo.partner, is(0)); final double age = 20.0; final int height = 160; final int weight = 70000; final double bmi = (weight/ 1000)/( (((double)height) / 100) * (((double)height) / 100)); final Gender gender = Gender.MALE; final DateTime dob = DateTime.now(DateTimeZone.UTC).minusYears((int) age); accountTest = new Account.Builder() .withId(0L) .withDOB(dob.toString()) .withGender(gender) .withHeight(height) .withWeight(weight) .build(); userBioInfo = UserBioInfo.getUserBioInfo(Optional.of(accountTest), true); assertThat(userBioInfo.age, is(age)); assertThat(userBioInfo.bmi, is(bmi)); assertThat(userBioInfo.male, is(1)); assertThat(userBioInfo.female, is(0)); assertThat(userBioInfo.partner, is(1)); }
Source:
<code><START> @Test public void onViewCreatedListener() { <END> exception.expect(IllegalArgumentException.class); emitter.addListener(Event.VIEW_CREATED, mock(Listener.class)); }</code><technical_language>This test verifying _can_ this event, throws exception</technical_language>

Target:
@Test public void onViewCreatedListener() { Listener<ViewCreated> listener = mock(Listener.class); emitter.addListener(Event.VIEW_CREATED, listener); ViewCreated result = mock(ViewCreated.class); emitter.onViewCreated(result); verify(listener).call(result); emitter.removeListener(listener); emitter.onCreate(new Bundle()); verifyNoMoreInteractions(listener); }
Source:
<code>private static Charset getPlainTextEntityCharset(HttpConnection connection, URI uri) { <START> String contentType = connection.getConnection().getHeaderField("Content-Type"); <END> if (contentType == null) { contentType = "text/plain"; } String charsetName = null; Matcher m = Pattern.compile(".*;\\s*charset=(^;)+.*").matcher(contentType); if (m.matches() && m.groupCount() > 1) { charsetName = m.group(1); } Charset charset; if (charsetName == null) { if ("application/json".equalsIgnoreCase(contentType)) { charset = Charset.forName("UTF-8"); } else { charset = Charset.forName("ISO-8859-1"); } } else { charset = Charset.forName(charsetName); } return charset; }</code><technical_language>connection.getConnection().getContentType()</technical_language>

Target:
private static Charset getPlainTextEntityCharset(HttpConnection connection, URI uri) { String contentType = connection.getConnection().getContentType(); if (contentType == null) { contentType = "text/plain"; } String charsetName = null; Matcher m = Pattern.compile(".*;\\s*charset=(^;)+.*", Pattern.CASE_INSENSITIVE).matcher (contentType); if (m.matches() && m.groupCount() > 1) { charsetName = m.group(1); } Charset charset; if (charsetName == null) { if ("application/json".equalsIgnoreCase(contentType)) { charset = Charset.forName("UTF-8"); } else { charset = Charset.forName("ISO-8859-1"); } } else { charset = Charset.forName(charsetName); } return charset; }
Source:
<code>public static String logSpliceAuditEvent(String userid, String event, boolean status, String addr, String statement, String reason) { <START> Pattern maskPattern = Pattern.compile(maskPasswordPatternStr,Pattern.CASE_INSENSITIVE); <END> StringBuilder sb = new StringBuilder(); sb.setLength(0); sb.append("userid=").append(userid).append("\t"); sb.append("event=").append(event).append("\t"); sb.append("status=").append(status ? "SUCCEED" : "FAILED").append("\t"); sb.append("ip=").append(addr).append("\t"); if (statement != null) sb.append("statement=").append(maskMessage(statement,maskPattern,maskString)).append("\t"); if (!status) sb.append("reason=").append(reason); return sb.toString(); }</code><technical_language>Is expensive create compile a pattern time log a entry? is pattern using, is thread share Pattern object</technical_language>

Target:
public static String logSpliceAuditEvent(String userid, String event, boolean status, String addr, String statement, String reason) { StringBuilder sb = new StringBuilder(); sb.setLength(0); sb.append("userid=").append(userid).append("\t"); sb.append("event=").append(event).append("\t"); sb.append("status=").append(status ? "SUCCEED" : "FAILED").append("\t"); sb.append("ip=").append(addr).append("\t"); if (statement != null) sb.append("statement=").append(maskMessage(statement, maskPasswordPattern,maskString)).append("\t"); if (!status) sb.append("reason=").append(reason); return sb.toString(); }
Source:
<code>public UpdateModuleStateJob(IServer server, IServerModuleStateVerifier verifier, boolean wait, int maxWait) { <START> super("Update module running states for server " + server.getName()); END> this.wait = wait; this.maxWait = maxWait; this.server = server; if( verifier == null ) { JBossExtendedProperties properties = (JBossExtendedProperties)server.loadAdapter(JBossExtendedProperties.class, null); this.verifier = properties.getModuleStateVerifier(); } else { this.verifier = verifier; } }</code><technical_language>This is job name - "Check module status for server "</technical_language>

Target:
public UpdateModuleStateJob(IServer server, IServerModuleStateVerifier verifier, boolean wait, int maxWait) { super("Check module status for server " + server.getName()); this.wait = wait; this.maxWait = maxWait; this.server = server; if( verifier == null ) { JBossExtendedProperties properties = (JBossExtendedProperties)server.loadAdapter(JBossExtendedProperties.class, null); this.verifier = properties.getModuleStateVerifier(); } else { this.verifier = verifier; } }
Source:
<code>public Result invoke(Invoker<?> invoker, Invocation invocation) throws RpcException { this.port = invoker.getUrl().getParameter(Constants.METRICS_PORT) == null ? 20880 : Integer.valueOf(invoker.getUrl().getParameter(Constants.METRICS_PORT)); this.protocolName = invoker.getUrl().getParameter(Constants.METRICS_PROTOCOL) == null ? Constants.DEFAULT_PROTOCOL : invoker.getUrl().getParameter(Constants.METRICS_PROTOCOL); <START> initMetricsInvoker(); <END> if (exported.compareAndSet(false, true)) { Protocol protocol = ExtensionLoader.getExtensionLoader(Protocol.class).getExtension(protocolName); try { protocol.export(metricsInvoker); } catch (RuntimeException e) { logger.error("Metrics Service need to be configured" + " when multiple processes are running on a host" + e.getMessage()); } } RpcContext context = RpcContext.getContext(); boolean isProvider = context.isProviderSide(); long start = System.currentTimeMillis(); try { Result result = invoker.invoke(invocation); long duration = System.currentTimeMillis() - start; reportMetrics(invoker, invocation, duration, "success", isProvider); return result; } catch (RpcException e) { long duration = System.currentTimeMillis() - start; String result = "error"; if (e.isTimeout()) { result = "timeoutError"; } if (e.isBiz()) { result = "bisError"; } if (e.isNetwork()) { result = "networkError"; } if (e.isSerialization()) { result = "serializationError"; } reportMetrics(invoker, invocation, duration, result, isProvider); throw e; } }</code><technical_language>this create a new object time</technical_language>

Target:
public Result invoke(Invoker<?> invoker, Invocation invocation) throws RpcException { if (exported.compareAndSet(false, true)) { this.protocolName = invoker.getUrl().getParameter(Constants.METRICS_PROTOCOL) == null ? Constants.DEFAULT_PROTOCOL : invoker.getUrl().getParameter(Constants.METRICS_PROTOCOL); Protocol protocol = ExtensionLoader.getExtensionLoader(Protocol.class).getExtension(protocolName); this.port = invoker.getUrl().getParameter(Constants.METRICS_PORT) == null ? protocol.getDefaultPort() : Integer.valueOf(invoker.getUrl().getParameter(Constants.METRICS_PORT)); Invoker<MetricsService> metricsInvoker = initMetricsInvoker(); try { protocol.export(metricsInvoker); } catch (RuntimeException e) { logger.error("Metrics Service need to be configured" + " when multiple processes are running on a host" + e.getMessage()); } } RpcContext context = RpcContext.getContext(); boolean isProvider = context.isProviderSide(); long start = System.currentTimeMillis(); try { Result result = invoker.invoke(invocation); long duration = System.currentTimeMillis() - start; reportMetrics(invoker, invocation, duration, "success", isProvider); return result; } catch (RpcException e) { long duration = System.currentTimeMillis() - start; String result = "error"; if (e.isTimeout()) { result = "timeoutError"; } if (e.isBiz()) { result = "bisError"; } if (e.isNetwork()) { result = "networkError"; } if (e.isSerialization()) { result = "serializationError"; } reportMetrics(invoker, invocation, duration, result, isProvider); throw e; } }
Source:
<code>public ParentListItem removeParent(int parentPosition) { ParentListItem parentListItem = mParentItemList.remove(parentPosition); int sizeChanged = 1; int wrapperIndex = getParentWrapperIndex(parentPosition); if (wrapperIndex == -1) { throw new IllegalStateException("Parent not found"); } ParentWrapper parentWrapper = (ParentWrapper) mItemList.remove(wrapperIndex); if (parentWrapper.isExpanded()) { <START> for (int i = 0; i < parentListItem.getChildItemList().size(); i++) { <END> mItemList.remove(wrapperIndex); sizeChanged++; } } notifyItemRangeRemoved(wrapperIndex, sizeChanged); return parentListItem; }</code><technical_language>pull List#size call out of loop</technical_language>

Target:
public ParentListItem removeParent(int parentPosition) { ParentListItem parentListItem = mParentItemList.remove(parentPosition); int sizeChanged = 1; int wrapperIndex = getParentWrapperIndex(parentPosition); if (wrapperIndex == -1) { throw new IllegalStateException("Parent not found"); } ParentWrapper parentWrapper = (ParentWrapper) mItemList.remove(wrapperIndex); if (parentWrapper.isExpanded()) { int childListSize = parentListItem.getChildItemList().size(); for (int i = 0; i < childListSize; i++) { mItemList.remove(wrapperIndex); sizeChanged++; } } notifyItemRangeRemoved(wrapperIndex, sizeChanged); return parentListItem; }
Source:
<code>public void testDelaySubscriptionDisposeBeforeTime() { TestScheduler scheduler = new TestScheduler(); Completable result = Completable.complete() .delaySubscription(100, TimeUnit.MILLISECONDS, scheduler); Observer<Void> o = TestHelper.mockObserver(); TestObserver<Void> to = new TestObserver<Void>(o); result.subscribe(to); to.assertEmpty(); scheduler.advanceTimeBy(90, TimeUnit.MILLISECONDS); to.dispose(); scheduler.advanceTimeBy(15, TimeUnit.MILLISECONDS); <START> verify(o, never()).onComplete(); <END> verify(o, never()).onError(any(Throwable.class)); }</code><technical_language>need talk a mocked observer, TestObserver.assertEmpty() verifies these</technical_language>

Target:
public void testDelaySubscriptionDisposeBeforeTime() { TestScheduler scheduler = new TestScheduler(); Completable result = Completable.complete() .delaySubscription(100, TimeUnit.MILLISECONDS, scheduler); TestObserver<Void> to = result.test(); to.assertEmpty(); scheduler.advanceTimeBy(90, TimeUnit.MILLISECONDS); to.dispose(); scheduler.advanceTimeBy(15, TimeUnit.MILLISECONDS); to.assertEmpty(); }
Source:
<code>public void test() { connect(); waitResponse(); JQuery jqBar = jq(".z-columns-bar"); <START> JQuery grid = jq(".z-grid"); <END> assertEquals(grid.eq(0).find(".z-row-content").eq(0).outerWidth() + jqBar.eq(0).outerWidth(), grid.eq(0).width()); jq("$grid1").scrollTop(100); waitResponse(); assertEquals(grid.eq(0).find(".z-row-content").eq(0).outerWidth() + jqBar.eq(0).outerWidth(), grid.eq(0).width()); assertEquals(grid.eq(1).find(".z-row-content").eq(0).outerWidth(), jq(".z-grid").eq(1).width()); }</code><technical_language>$grid1, $grid2</technical_language>

Target:
public void test() { connect(); waitResponse(); JQuery jqBar = jq(".z-columns-bar"); JQuery grid1 = jq("$grid1"); JQuery grid2 = jq("$grid2"); assertEquals(grid1.find(".z-row-content:eq(0)").outerWidth() + jqBar.outerWidth(), grid1.width()); grid1.scrollTop(100); waitResponse(); assertEquals(grid1.find(".z-row-content:eq(0)").outerWidth() + jqBar.outerWidth(), grid1.width()); assertEquals(grid2.find(".z-row-content:eq(0)").outerWidth(), grid2.width()); }
Source:
<code>private ItemsToPush missingRevisionsToJsonDocs( Map<String, DocumentRevisionTree> allTrees, Map<String, CouchClient.MissingRevisions> revisions) throws AttachmentException { ItemsToPush itemsToPush = new ItemsToPush(); for(Map.Entry<String, CouchClient.MissingRevisions> e : revisions.entrySet()) { String docId = e.getKey(); Set<String> missingRevisions = e.getValue().missing; DocumentRevisionTree tree = allTrees.get(docId); for(String rev : missingRevisions) { long sequence = tree.lookup(docId, rev).getSequence(); List<BasicDocumentRevision> path = tree.getPathForNode(sequence); BasicDocumentRevision dr = path.get(0); List<? extends Attachment> atts = this.sourceDb.getDbCore().attachmentsForRevision(dr); int minRevPos = 0; for (BasicDocumentRevision ancestor : path) { <START> if (e.getValue().possible_ancestors != null && e.getValue().possible_ancestors.contains(ancestor.getRevision())) { <END> minRevPos = ancestor.getGeneration(); } } Map<String, Object> json = RevisionHistoryHelper.revisionHistoryToJson(path, atts, this.config.pushAttachmentsInline, minRevPos); MultipartAttachmentWriter mpw = RevisionHistoryHelper.createMultipartWriter(path, atts, this.config.pushAttachmentsInline, minRevPos); if (mpw == null) { itemsToPush.serializedDocs.add(sJsonHelper.toJson(json)); } else { itemsToPush.multiparts.add(mpw); } } } return itemsToPush; }</code><technical_language>contains equals</technical_language>

Target:
private ItemsToPush missingRevisionsToJsonDocs( Map<String, DocumentRevisionTree> allTrees, Map<String, CouchClient.MissingRevisions> revisions) throws AttachmentException { ItemsToPush itemsToPush = new ItemsToPush(); for(Map.Entry<String, CouchClient.MissingRevisions> e : revisions.entrySet()) { String docId = e.getKey(); Set<String> missingRevisions = e.getValue().missing; DocumentRevisionTree tree = allTrees.get(docId); for(String rev : missingRevisions) { long sequence = tree.lookup(docId, rev).getSequence(); List<BasicDocumentRevision> path = tree.getPathForNode(sequence); BasicDocumentRevision dr = path.get(0); List<? extends Attachment> atts = this.sourceDb.getDbCore().attachmentsForRevision(dr); int minRevPos = 0; for (BasicDocumentRevision ancestor : path) { if (e.getValue().possible_ancestors != null && e.getValue().possible_ancestors.contains(ancestor.getRevision())) { minRevPos = ancestor.getGeneration(); } } Map<String, Object> json = RevisionHistoryHelper.revisionHistoryToJson(path, atts, this.config.pushAttachmentsInline, minRevPos); MultipartAttachmentWriter mpw = RevisionHistoryHelper.createMultipartWriter(dr, atts, this.config.pushAttachmentsInline, minRevPos); if (mpw == null) { itemsToPush.serializedDocs.add(sJsonHelper.toJson(json)); } else { itemsToPush.multiparts.add(mpw); } } } return itemsToPush; }
Source:
<code>private <T> T executeMethodWithoutException(Supplier<T> supplier) { try { return supplier.get(); } catch (Exception e) { isValid = !blackListedExceptions.stream() <START> .anyMatch(b -> e.getClass().isInstance(b)); <END> throw e; } }</code><technical_language>Do need traverse wrapped exceptions</technical_language>

Target:
private <T> T executeMethodWithoutException(Supplier<T> supplier) { checkIfValidClient(); try { return supplier.get(); } catch (Exception e) { updateIsValid(e); throw e; } }
Source:
<code>public void testJavadocParseError() throws Exception { final String path = getPath("InputJavadocPropertiesGeneratorJavadocParseError.java"); <START> final String destinationAbsolutePath = DESTFILE.getAbsolutePath(); <END> try { JavadocPropertiesGenerator.main(path, "--destfile", destinationAbsolutePath); fail("Exception was expected"); } catch (IllegalArgumentException ex) { assertTrue(ex.getMessage() .contains("mismatched input '<EOF>' expecting JAVADOC_INLINE_TAG_END"), "Invalid error message"); } final long size = FileUtils.sizeOf(DESTFILE); assertEquals(0, size, "File '" + DESTFILE + "' must be empty"); }</code><technical_language>I see, this expression DESTFILE.getAbsolutePath() is repeated 10 times in file. Please extract class constant reuse everywhere. avoid sonar issues in future</technical_language>

Target:
public void testJavadocParseError() throws Exception { final String path = getPath("InputJavadocPropertiesGeneratorJavadocParseError.java"); try { JavadocPropertiesGenerator.main(path, "--destfile", DESTFILE_ABSOLUTE_PATH); fail("Exception was expected"); } catch (IllegalArgumentException ex) { assertTrue(ex.getMessage() .contains("mismatched input '<EOF>' expecting JAVADOC_INLINE_TAG_END"), "Invalid error message"); } final long size = FileUtils.sizeOf(DESTFILE); assertEquals(0, size, "File '" + DESTFILE + "' must be empty"); }
Source:
<code>static public ServiceType getMetaData() { ServiceType meta = new ServiceType(OpenCV.class.getCanonicalName()); meta.addDescription("OpenCV (computer vision) service wrapping many of the functions and filters of OpenCV"); meta.addCategory("video", "vision", "sensors"); meta.sharePeer("streamer", "streamer", "VideoStreamer", "Shared Video Streamer"); String javaCvVersion = "1.5.2"; meta.addDependency("org.bytedeco", "javacv", javaCvVersion); meta.addDependency("org.bytedeco", "javacv-platform", javaCvVersion); boolean gpu = false; if (gpu) { } meta.addDependency("com.github.sarxos", "webcam-capture", "0.3.10"); meta.addDependency("org.apache.commons", "commons-lang3", "3.3.2"); meta.addDependency("net.sf.jipcam", "jipcam", "0.9.1"); meta.exclude("javax.servlet", "servlet-api"); meta.exclude("commons-lang", "commons-lang"); meta.addDependency("commons-lang", "commons-lang", "2.6"); meta.addDependency("opencv", "opencv_classifiers", "0.0.2", "zip"); meta.addDependency("opencv", "opencv_facedetectdnn", "1.0.1", "zip"); meta.addDependency("com.github.axet", "vget", "1.1.34"); <START> meta.addDependency("yolo", "yolov2", "v3", "zip"); <END> return meta; }</code><technical_language>start supporting yolo v3?! added recently? I supported in current version of opencv..</technical_language>

Target:
static public ServiceType getMetaData() { ServiceType meta = new ServiceType(OpenCV.class.getCanonicalName()); meta.addDescription("OpenCV (computer vision) service wrapping many of the functions and filters of OpenCV"); meta.addCategory("video", "vision", "sensors"); meta.sharePeer("streamer", "streamer", "VideoStreamer", "Shared Video Streamer"); String javaCvVersion = "1.5.2"; meta.addDependency("org.bytedeco", "javacv", javaCvVersion); meta.addDependency("org.bytedeco", "javacv-platform", javaCvVersion); boolean gpu = false; if (gpu) { } meta.addDependency("com.github.sarxos", "webcam-capture", "0.3.10"); meta.addDependency("org.apache.commons", "commons-lang3", "3.3.2"); meta.addDependency("net.sf.jipcam", "jipcam", "0.9.1"); meta.exclude("javax.servlet", "servlet-api"); meta.exclude("commons-lang", "commons-lang"); meta.addDependency("commons-lang", "commons-lang", "2.6"); meta.addDependency("opencv", "opencv_classifiers", "0.0.2", "zip"); meta.addDependency("opencv", "opencv_facedetectdnn", "1.0.1", "zip"); meta.addDependency("com.github.axet", "vget", "1.1.34"); meta.addDependency("yolo", "yolov2", "0.0.2", "zip"); return meta; }
Source:
<code>public void addScheduleToDistributedCache() { <START> String filepath = "/tmp/splits_schedule.txt"; <END> String dfs_path = "vxquery_splits_schedule.txt"; PrintWriter writer; try { writer = new PrintWriter(filepath, "UTF-8"); for (int split : this.schedule.keySet()) { writer.write(split + "," + this.schedule.get(split)); } writer.close(); } catch (FileNotFoundException e) { System.err.println(e); } catch (UnsupportedEncodingException e) { System.err.println(e); } this.put(filepath, dfs_path); }</code><technical_language>system tmp folder variable instead of hard coding path</technical_language>

Target:
public void addScheduleToDistributedCache() throws FileNotFoundException, UnsupportedEncodingException { PrintWriter writer; writer = new PrintWriter(filepath, "UTF-8"); for (int split : this.schedule.keySet()) { writer.write(split + "," + this.schedule.get(split)); } writer.close(); this.put(filepath, dfs_path); }
Source:
<code>public void deploy(final DeploymentPhaseContext phaseContext) throws DeploymentUnitProcessingException { final DeploymentUnit deploymentUnit = phaseContext.getDeploymentUnit(); final Module module = deploymentUnit.getAttachment(Attachments.MODULE); if (!JaxrsDeploymentMarker.isJaxrsDeployment(deploymentUnit)) { return; } if (!DeploymentTypeMarker.isType(DeploymentType.WAR, deploymentUnit)) { return; } final WarMetaData warMetaData = deploymentUnit.getAttachment(WarMetaData.ATTACHMENT_KEY); final JBossWebMetaData webdata = warMetaData.getMergedJBossWebMetaData(); try { <START> module.getClassLoader().loadClass(CDI_INJECTOR_FACTORY_CLASS); <END> final CapabilityServiceSupport support = deploymentUnit.getAttachment(Attachments.CAPABILITY_SERVICE_SUPPORT); support.getOptionalCapabilityRuntimeAPI(WELD_CAPABILITY_NAME, WeldCapability.class).ifPresent(api -> { if (api.isWeldDeployment(deploymentUnit)) { JAXRS_LOGGER.debug("Found CDI, adding injector factory class"); setContextParameter(webdata, "resteasy.injector.factory", CDI_INJECTOR_FACTORY_CLASS); } }); } catch (ClassNotFoundException ignored) { } }</code><technical_language>@asoldano confirm I reason this line block guarded isWeldDeployment. (The class static initializer code get run if moved.) Moving resteasy-cdi module optional in more cases (i.e. user CDI apps.) a big deal; this entire DUP get executed if weld is installed</technical_language>

Target:
public void deploy(final DeploymentPhaseContext phaseContext) throws DeploymentUnitProcessingException { final DeploymentUnit deploymentUnit = phaseContext.getDeploymentUnit(); final Module module = deploymentUnit.getAttachment(Attachments.MODULE); if (!JaxrsDeploymentMarker.isJaxrsDeployment(deploymentUnit)) { return; } if (!DeploymentTypeMarker.isType(DeploymentType.WAR, deploymentUnit)) { return; } final WarMetaData warMetaData = deploymentUnit.getAttachment(WarMetaData.ATTACHMENT_KEY); final JBossWebMetaData webdata = warMetaData.getMergedJBossWebMetaData(); try { final CapabilityServiceSupport support = deploymentUnit.getAttachment(Attachments.CAPABILITY_SERVICE_SUPPORT); if (support.hasCapability(WELD_CAPABILITY_NAME)) { final WeldCapability api = support.getOptionalCapabilityRuntimeAPI(WELD_CAPABILITY_NAME, WeldCapability.class).get(); if (api.isWeldDeployment(deploymentUnit)) { module.getClassLoader().loadClass(CDI_INJECTOR_FACTORY_CLASS); JAXRS_LOGGER.debug("Found CDI, adding injector factory class"); setContextParameter(webdata, "resteasy.injector.factory", CDI_INJECTOR_FACTORY_CLASS); } } } catch (ClassNotFoundException ignored) { } }
Source:
<code>public void entry2jsonBadVersion() { WorkflowVersion aWorkflowVersion1 = new WorkflowVersion(); aWorkflowVersion1.setName("1.0.0"); aWorkflowVersion1.setValid(false); Date laterDate = new Date(1000L); aWorkflowVersion1.setLastModified(laterDate); List<WorkflowVersion> listWorkflowVersions = new ArrayList<WorkflowVersion>(); listWorkflowVersions.add(aWorkflowVersion1); Workflow workflow = new Workflow(); workflow.setWorkflowVersions(listWorkflowVersions); workflow.setLastModified(1); WorkflowsApi api = mock(WorkflowsApi.class); UsersApi usersApi = mock(UsersApi.class); Client client = new Client(); doReturn(workflow).when(api).getPublishedWorkflowByPath(anyString(), eq(null)); WorkflowClient workflowClient = new WorkflowClient(api, usersApi, client, false); exit.expectSystemExit(); exit.checkAssertionAfterwards( () -> assertTrue("output should include error message", systemOutRule.getLog().contains("Could not locate workflow with version '2.0.0'"))); <START> exit.checkAssertionAfterwards( <END> () -> assertTrue("output should include error message", systemErrRule.getLog().contains("Cannot use workflow version '1.0.0'"))); try { workflowClient.downloadTargetEntry("quay.io/collaboratory/dockstore-tool-linux-sort:2.0.0", ToolDescriptor.TypeEnum.WDL, false); } catch (IOException e) { } }</code><technical_language>suure assertion overwrites first, play safe check conditions once. below, I is expected? A bit confusing</technical_language>

Target:
public void entry2jsonBadVersion() throws IOException { WorkflowVersion aWorkflowVersion1 = new WorkflowVersion(); aWorkflowVersion1.setName("1.0.0"); aWorkflowVersion1.setValid(false); Date laterDate = new Date(1000L); aWorkflowVersion1.setLastModified(laterDate); List<WorkflowVersion> listWorkflowVersions = new ArrayList<WorkflowVersion>(); listWorkflowVersions.add(aWorkflowVersion1); Workflow workflow = new Workflow(); workflow.setWorkflowVersions(listWorkflowVersions); workflow.setLastModified(1); WorkflowsApi api = mock(WorkflowsApi.class); UsersApi usersApi = mock(UsersApi.class); Client client = new Client(); doReturn(workflow).when(api).getPublishedWorkflowByPath(anyString(), eq(null)); WorkflowClient workflowClient = new WorkflowClient(api, usersApi, client, false); exit.expectSystemExit(); exit.checkAssertionAfterwards( () -> assertTrue("output should include error messages", (systemOutRule.getLog().contains("Could not locate workflow with version '2.0.0'") && systemErrRule.getLog().contains("Cannot use workflow version '1.0.0'")))); workflowClient.downloadTargetEntry("quay.io/collaboratory/dockstore-tool-linux-sort:2.0.0", ToolDescriptor.TypeEnum.WDL, false); }
Source:
<code>public static boolean isExpired(StandardBusinessDocumentHeader header) { ZonedDateTime zonedDateTime = header.getExpectedResponseDateTime(); <START> ZonedDateTime now = ZonedDateTime.now(); <END> if (now.isAfter(zonedDateTime)) { return true; } else { return false; } }</code><technical_language>Kan bare skrive: return ZonedDateTime.now().isAfter(header.getExpectedResponseDateTime());</technical_language>

Target:
public static boolean isExpired(StandardBusinessDocumentHeader header) { return ZonedDateTime.now().isAfter(header.getExpectedResponseDateTime()); }
Source:
<code>public Object execute(ExecutionEvent event) { InputDialog dialog = new InputDialog(Display.getCurrent() .getActiveShell(), Messages.PerfSaveSession_title, Messages.PerfSaveSession_msg, "", new IInputValidator() { @Override public String isValid(String newText) { <START> if ("".equals(newText)) { END> return Messages.PerfSaveSession_invalid_filename_msg; } return null; } }); if (dialog.open() == Window.OK) { saveData(dialog.getValue()); } return null; }</code><technical_language>newText.isEmpty() here</technical_language>

Target:
public Object execute(ExecutionEvent event) { InputDialog dialog = new InputDialog(Display.getCurrent() .getActiveShell(), Messages.PerfSaveSession_title, Messages.PerfSaveSession_msg, "", new IInputValidator() { @Override public String isValid(String newText) { if (newText.isEmpty()) { return Messages.PerfSaveSession_invalid_filename_msg; } return null; } }); if (dialog.open() == Window.OK) { saveData(dialog.getValue()); } return null; }
Source:
<code>NavigableSet<RangePosition> getPositionsIn(@NonNull ROW row, @NonNull BOUND start, @NonNull BOUND end) { <START> TreeMap<ROW, TreeSet<RangePosition>> m = positions; <END> TreeSet<RangePosition> rowSet = m.get(row); if (rowSet == null || rowSet.isEmpty()) { return emptySet; } startMarker.setStartMarker(start); endMarker.setEndMarker(end); return rowSet.subSet(startMarker, false, endMarker, false); }</code><technical_language>Wat? access positions directly</technical_language>

Target:
NavigableSet<RangePosition<BOUND>> getPositionsIn(@NonNull ROW row, @NonNull BOUND start, @NonNull BOUND end) { TreeSet<RangePosition<BOUND>> rowSet = positions.get(row); if (rowSet == null || rowSet.isEmpty()) { return emptySet; } startMarker.setStartMarker(start); endMarker.setEndMarker(end); return rowSet.subSet(startMarker, false, endMarker, false); }