auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public void doParse_unhandledFieldTypeRecursion() throws UnableToCompleteException { Set<? extends JClassType> ownerTypeParentFieldTypeSubField1TypeFlattenedSupertypeHierarchy = new HashSet<>(Collections.singletonList(ownerTypeParentFieldTypeSubField1Type)); doReturn(ownerTypeParentFieldTypeSubField1TypeFlattenedSupertypeHierarchy) .when(ownerTypeParentFieldTypeSubField1Type).getFlattenedSupertypeHierarchy(); when(ownerTypeParentFieldTypeSubField1Type.getFields()).thenReturn(new JField[] { ownerTypeParentField }); tested.doParse(ownerType, new ArrayList<JClassType>(), ".", "IdPrefix"); }

Target:
public void doParse_unhandledFieldTypeRecursion() throws UnableToCompleteException { Set<? extends JClassType> ownerTypeParentFieldTypeSubField1TypeFlattenedSupertypeHierarchy = Collections.singleton(ownerTypeParentFieldTypeSubField1Type); doReturn(ownerTypeParentFieldTypeSubField1TypeFlattenedSupertypeHierarchy) .when(ownerTypeParentFieldTypeSubField1Type).getFlattenedSupertypeHierarchy(); when(ownerTypeParentFieldTypeSubField1Type.getFields()).thenReturn(new JField[] { ownerTypeParentField }); tested.doParse(ownerType, new ArrayList<JClassType>(), ".", "IdPrefix"); }
Source:
public static String createHeader(String username, String password) { StringBuffer buf = new StringBuffer(username); buf.append(':').append(password); return "Basic " + java.util.Base64.getEncoder().encodeToString(buf.toString().getBytes(StandardCharsets.UTF_8)); }

Target:
public static String createHeader(String username, String password) { StringBuffer buf = new StringBuffer(username); buf.append(':').append(password); return "Basic " + Base64.getEncoder().encodeToString(buf.toString().getBytes(StandardCharsets.UTF_8)); }
Source:
public static BridgeConfig toBridgeConfig(Bridge bridge) { BridgeConfig bridgeConfig = new BridgeConfig(); org.slf4j.LoggerFactory.getLogger(Converter.class).error("TO BC {}", bridge.getVxLanPortIds(), bridge.getVxLanPortId()); 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; }

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:
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) { log.debug("GET_USER_BY_USER_EXT_SOURCE"); throw new UserNotExistsException("userExtSource=" + userExtSource.toString()); } catch (RuntimeException err) { throw new InternalErrorException(err); } }

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:
public void testNoName(){ try { createConfigFileWithRobot(""); RobobuggyConfigFile.loadConfigFile(); Assert.fail(); } catch (IOException e) { e.printStackTrace(); Assert.fail(); } catch (IllegalArgumentException e) { } }

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

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:
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.storage_migration_form_downloader_is_running); case MOVING_FILES_FAILED: return errorMessage + context.getString(R.string.storage_migration_failed); default: return errorMessage; } }

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:
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; try { 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; }

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:
public ConfigResource parse(TopLevelResource root, IdString id) throws ResourceNotFoundException { if (!"server".equals(id.get())) { throw new ResourceNotFoundException(id); } return new ConfigResource(); }

Target:
public ConfigResource parse(TopLevelResource root, IdString id) throws ResourceNotFoundException { if (id.equals("server")) { return new ConfigResource(); } throw new ResourceNotFoundException(id); }
Source:
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() .isEqualTo(transactionService.get(writer.getTimestamp())); }

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:
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); 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); } }

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:
public MessageChannel getObject() throws Exception { return new DirectChannel(); }

Target:
public synchronized MessageChannel getObject() throws Exception { if (directChannel == null) { directChannel = new DirectChannel(); } return directChannel; }
Source:
default Long getGlobalAddress() { if (getMetadataMap() == null) { return Address.NON_ADDRESS; } return Optional.ofNullable((Long) getMetadataMap() .get(LogUnitMetadataType.GLOBAL_ADDRESS)).orElse(Address.NON_ADDRESS); }

Target:
default Long getGlobalAddress() { return Optional.ofNullable((Long) getMetadataMap() .get(LogUnitMetadataType.GLOBAL_ADDRESS)).orElse(Address.NON_ADDRESS); }
Source:
public boolean isAdapterForType(Object type) { if (IComparisonScope.class.equals(type)) { return true; } return super.isAdapterForType(type); }

Target:
public boolean isAdapterForType(Object type) { if (type == IComparisonScope2.class || type == IComparisonScope.class) { return true; } return super.isAdapterForType(type); }
Source:
public void testScreenshotCompare() throws Exception { wd.open(url); Image im = new Image(" im.waitForVisible(); ScreenshotUtils.assertSimilarToScreenshot(im.getLocator(), new File("src/test/resources/webapp/finralogo.jpg"), new File("testScreenshots/screenshot.png")); }

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:
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(); if (status.equalsIgnoreCase("CONNECTED")) { entity.setStatus(PeerStatus.CONNECTED); } else if (status.equalsIgnoreCase("DISCONNECTED")) { entity.setStatus(PeerStatus.DISCONNECTED); } else { entity.setStatus(PeerStatus.UNKNOWN); } return entity; }

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:
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(); } catch ( NullPointerException npe ) { } 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; }

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:
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().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)); }

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:
@Test public void onViewCreatedListener() { exception.expect(IllegalArgumentException.class); emitter.addListener(Event.VIEW_CREATED, mock(Listener.class)); }

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:
private static Charset getPlainTextEntityCharset(HttpConnection connection, URI uri) { String contentType = connection.getConnection().getHeaderField("Content-Type"); 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; }

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:
public static String logSpliceAuditEvent(String userid, String event, boolean status, String addr, String statement, String reason) { Pattern maskPattern = Pattern.compile(maskPasswordPatternStr,Pattern.CASE_INSENSITIVE); 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(); }

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:
public UpdateModuleStateJob(IServer server, IServerModuleStateVerifier verifier, boolean wait, int maxWait) { super("Update module running states 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; } }

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:
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); initMetricsInvoker(); 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; } }

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:
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()) { for (int i = 0; i < parentListItem.getChildItemList().size(); i++) { mItemList.remove(wrapperIndex); sizeChanged++; } } notifyItemRangeRemoved(wrapperIndex, sizeChanged); return parentListItem; }

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:
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); verify(o, never()).onComplete(); verify(o, never()).onError(any(Throwable.class)); }

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:
public void test() { connect(); waitResponse(); JQuery jqBar = jq(".z-columns-bar"); JQuery grid = jq(".z-grid"); 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()); }

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:
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(path, atts, this.config.pushAttachmentsInline, minRevPos); if (mpw == null) { itemsToPush.serializedDocs.add(sJsonHelper.toJson(json)); } else { itemsToPush.multiparts.add(mpw); } } } return itemsToPush; }

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:
private <T> T executeMethodWithoutException(Supplier<T> supplier) { try { return supplier.get(); } catch (Exception e) { isValid = !blackListedExceptions.stream() .anyMatch(b -> e.getClass().isInstance(b)); throw e; } }

Target:
private <T> T executeMethodWithoutException(Supplier<T> supplier) { checkIfValidClient(); try { return supplier.get(); } catch (Exception e) { updateIsValid(e); throw e; } }
Source:
public void testJavadocParseError() throws Exception { final String path = getPath("InputJavadocPropertiesGeneratorJavadocParseError.java"); final String destinationAbsolutePath = DESTFILE.getAbsolutePath(); 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"); }

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:
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", "v3", "zip"); return meta; }

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:
public void addScheduleToDistributedCache() { String filepath = "/tmp/splits_schedule.txt"; 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); }

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:
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 { module.getClassLoader().loadClass(CDI_INJECTOR_FACTORY_CLASS); 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) { } }

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:
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'"))); exit.checkAssertionAfterwards( () -> 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) { } }

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:
public static boolean isExpired(StandardBusinessDocumentHeader header) { ZonedDateTime zonedDateTime = header.getExpectedResponseDateTime(); ZonedDateTime now = ZonedDateTime.now(); if (now.isAfter(zonedDateTime)) { return true; } else { return false; } }

Target:
public static boolean isExpired(StandardBusinessDocumentHeader header) { return ZonedDateTime.now().isAfter(header.getExpectedResponseDateTime()); }
Source:
private void handleSnapshotEvent() throws NoCurrentCaseException, IOException { Case currentCase = Case.getCurrentCaseThrows(); Date generationDate = new Date(); final String defaultReportName = FileUtil.escapeFileName(currentCase.getDisplayName() + " " + new SimpleDateFormat("MMddyyyyHHmmss").format(generationDate)); final JTextField text = new JTextField(50); final JPanel panel = new JPanel(new GridLayout(2, 1)); panel.add(new JLabel(Bundle.VisualizationPane_fileName_prompt())); panel.add(text); text.setText(defaultReportName); int result = JOptionPane.showConfirmDialog(graphComponent, panel, Bundle.VisualizationPanel_action_dialogs_title(), JOptionPane.OK_CANCEL_OPTION); List<CommunicationsFilter.SubFilter> filters = currentFilter.getAndFilters(); if (result == JOptionPane.OK_OPTION) { String enteredReportName = text.getText(); String reportName = StringUtils.defaultIfBlank(enteredReportName, defaultReportName); Path reportPath = Paths.get(currentCase.getReportDirectory(), reportName); if (!Files.exists(reportPath)) { createReport(currentCase, reportName); } else { String message = String.format("Overwrite existing report?\n%s", reportName); result = JOptionPane.showConfirmDialog(graphComponent, message, Bundle.VisualizationPanel_action_dialogs_title(), JOptionPane.OK_CANCEL_OPTION); if (result == JOptionPane.OK_OPTION) { FileUtil.deleteFileDir(reportPath.toFile()); createReport(currentCase, reportName); } } } }

Target:
private void handleSnapshotEvent() throws NoCurrentCaseException, IOException, TskCoreException { Case currentCase = Case.getCurrentCaseThrows(); Date generationDate = new Date(); final String defaultReportName = FileUtil.escapeFileName(currentCase.getDisplayName() + " " + new SimpleDateFormat("MMddyyyyHHmmss").format(generationDate)); final JTextField text = new JTextField(50); final JPanel panel = new JPanel(new GridLayout(2, 1)); panel.add(new JLabel(Bundle.VisualizationPane_fileName_prompt())); panel.add(text); text.setText(defaultReportName); int result = JOptionPane.showConfirmDialog(graphComponent, panel, Bundle.VisualizationPanel_action_dialogs_title(), JOptionPane.OK_CANCEL_OPTION); if (result == JOptionPane.OK_OPTION) { String enteredReportName = text.getText(); if(enteredReportName.trim().isEmpty()){ result = JOptionPane.showConfirmDialog(graphComponent, Bundle.VisualizationPane_accept_defaultName(defaultReportName), Bundle.VisualizationPane_blank_report_title(), JOptionPane.OK_CANCEL_OPTION); if(result != JOptionPane.OK_OPTION) { return; } } String reportName = StringUtils.defaultIfBlank(enteredReportName, defaultReportName); Path reportPath = Paths.get(currentCase.getReportDirectory(), reportName); if (Files.exists(reportPath)) { result = JOptionPane.showConfirmDialog(graphComponent, Bundle.VisualizationPane_overrite_exiting(reportName), Bundle.VisualizationPanel_action_dialogs_title(), JOptionPane.OK_CANCEL_OPTION); if (result == JOptionPane.OK_OPTION) { FileUtil.deleteFileDir(reportPath.toFile()); createReport(currentCase, reportName); } } else { createReport(currentCase, reportName); currentCase.addReport(reportPath.toString(), Bundle.VisualizationPanel_module_name(), reportName); } } }
Source:
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 ("".equals(newText)) { return Messages.PerfSaveSession_invalid_filename_msg; } return null; } }); if (dialog.open() == Window.OK) { saveData(dialog.getValue()); } return null; }

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:
NavigableSet<RangePosition> getPositionsIn(@NonNull ROW row, @NonNull BOUND start, @NonNull BOUND end) { TreeMap<ROW, TreeSet<RangePosition>> m = positions; 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); }

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); }