auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public Token getAccessToken(final Token requestToken) { PostMethod accessTokenPostMethod = new PostMethod(this.config.getAccessTokenURL()); signRequest(requestToken, accessTokenPostMethod, true); int accessTokenRequestResponse = -1; try { accessTokenRequestResponse = this.httpClient.executeMethod(accessTokenPostMethod); System.out.println(accessTokenRequestResponse); } catch (HttpException e1) { e1.printStackTrace(); } catch (IOException e1) { e1.printStackTrace(); } Token accessToken = null; try { if ((accessTokenRequestResponse != 200)) { return null; } System.out.println(accessTokenRequestResponse); System.out.println("Access Token" + accessTokenPostMethod.getResponseBodyAsString()); InputStream responseBodyAsStream = accessTokenPostMethod.getResponseBodyAsStream(); TokenExtractorImpl tokenextractor = new TokenExtractorImpl(); accessToken = tokenextractor.extract(StreamUtils.getStreamContents(responseBodyAsStream)); } catch (IOException e1) { e1.printStackTrace(); } return accessToken; }

Target:
public Token getAccessToken(final Token requestToken) { PostMethod accessTokenPostMethod = new PostMethod(this.config.getAccessTokenURL()); signRequest(requestToken, accessTokenPostMethod, true); int accessTokenRequestResponse = -1; try { accessTokenRequestResponse = this.httpClient.executeMethod(accessTokenPostMethod); OseeLog.log(DWAOAuthService.class, Level.INFO, "Response: " + accessTokenRequestResponse); } catch (HttpException e1) { OseeLog.log(getClass(), Level.SEVERE, e1); } catch (IOException e1) { OseeLog.log(getClass(), Level.SEVERE, e1); } Token accessToken = null; try { if ((accessTokenRequestResponse != 200)) { return null; } OseeLog.log(DWAOAuthService.class, Level.INFO, "Response: " + accessTokenRequestResponse); OseeLog.log(DWAOAuthService.class, Level.INFO, "Access Token" + accessTokenPostMethod.getResponseBodyAsString()); InputStream responseBodyAsStream = accessTokenPostMethod.getResponseBodyAsStream(); TokenExtractorImpl tokenextractor = new TokenExtractorImpl(); accessToken = tokenextractor.extract(StreamUtils.getStreamContents(responseBodyAsStream)); } catch (IOException e1) { OseeLog.log(getClass(), Level.SEVERE, e1); } return accessToken; }
Source:
private void safelyAddProperty(Properties properties, String key, String value) { String safeValue = value; if (StringUtils.isBlank(value)) { safeValue = KFSConstants.EMPTY_STRING; } properties.put(key, safeValue); }

Target:
private void safelyAddProperty(Properties properties, String key, String value) { properties.put(key, StringUtils.defaultIfBlank(value, KFSConstants.EMPTY_STRING)); }
Source:
private boolean doesClassContainDeprecatedAnnotation(MetadataReader metadataReader) throws ClassNotFoundException { try { Class dwrClass = Class.forName(metadataReader.getClassMetadata().getClassName()); String canonicalName = dwrClass.getCanonicalName(); if (!canonicalName.contains("Service") || canonicalName.contains("Test")) return false; if (dwrClass.isAnnotationPresent(Deprecated.class)) { return true; } Method[] methods = dwrClass.getDeclaredMethods(); for (Method method : methods) { if (method.isAnnotationPresent(Deprecated.class)) return true; } } catch (Throwable e) return false; }

Target:
private boolean doesClassContainDeprecatedAnnotation(MetadataReader metadataReader) throws ClassNotFoundException { try { Class dwrClass = Class.forName(metadataReader.getClassMetadata().getClassName()); if (dwrClass.isAnnotationPresent(Deprecated.class)) { return true; } Method[] methods = dwrClass.getDeclaredMethods(); for (Method method : methods) { if (method.isAnnotationPresent(Deprecated.class)) return true; } } catch (Throwable e) return false; }
Source:
private List<Question> getOldieQuestions(final Long accountId, final DateTime today, final Integer numQuestions, final Set<Integer> seenIds) { final List<Question> questions = new ArrayList<>(); final Set<Integer> addedIds = new HashSet<>(); addedIds.addAll(seenIds); addedIds.addAll(this.getUserAnsweredQuestionIds(accountId)); List<Question> selectedQs; selectedQs = this.randomlySelectFromQuestionPool(accountId, seenIds, Question.FREQUENCY.DAILY, today, 1); if (selectedQs.size() > 0 && !addedIds.contains(selectedQs.get(0).id)) { addedIds.add(selectedQs.get(0).id); questions.addAll(selectedQs); } if (questions.size() < numQuestions) { final Boolean answeredAll = addedIds.containsAll(this.baseQuestionIds); if (!answeredAll) { selectedQs.clear(); selectedQs = this.randomlySelectFromQuestionPool(accountId, addedIds, Question.FREQUENCY.ONE_TIME, today, 1); if (selectedQs.size() > 0) { addedIds.add(selectedQs.get(0).id); questions.addAll(selectedQs); } } } if (questions.size() < numQuestions) { final int numToGet = numQuestions - questions.size(); selectedQs.clear(); selectedQs= this.randomlySelectFromQuestionPool(accountId, addedIds, Question.FREQUENCY.OCCASIONALLY, today, numToGet); if (selectedQs.size() > 0) { questions.addAll(selectedQs); } } return questions; }

Target:
private List<Question> getOldieQuestions(final Long accountId, final DateTime today, final Integer numQuestions, final Set<Integer> seenIds) { final List<Question> questions = new ArrayList<>(); final Set<Integer> addedIds = new HashSet<>(); addedIds.addAll(seenIds); addedIds.addAll(this.getUserAnsweredQuestionIds(accountId)); List<Question> dailyQs = this.randomlySelectFromQuestionPool(accountId, seenIds, Question.FREQUENCY.DAILY, today, 1); if (dailyQs.size() > 0 && !addedIds.contains(dailyQs.get(0).id)) { addedIds.add(dailyQs.get(0).id); questions.add(dailyQs.get(0)); } if (questions.size() < numQuestions) { final Boolean answeredAll = addedIds.containsAll(this.baseQuestionIds); if (!answeredAll) { final List<Question> selectedBaseQs = this.randomlySelectFromQuestionPool(accountId, addedIds, Question.FREQUENCY.ONE_TIME, today, 1); if (selectedBaseQs.size() > 0) { addedIds.add(selectedBaseQs.get(0).id); questions.add(selectedBaseQs.get(0)); } } } if (questions.size() < numQuestions) { final int numToGet = numQuestions - questions.size(); final List<Question> moreQs= this.randomlySelectFromQuestionPool(accountId, addedIds, Question.FREQUENCY.OCCASIONALLY, today, numToGet); if (moreQs.size() > 0) { questions.addAll(moreQs); } } return questions; }
Source:
private KieCompilationResponse compileAndLoadKieJarMetadataAllResourcesPackagedJar() { String alternateSettingsAbsPath = TestUtilMaven.getSettingsFile(); Path tmpRoot = Files.createTempDirectory("repo_" + UUID.randomUUID().toString()); Path tmp = Files.createDirectories(Paths.get(tmpRoot.toString(), "dummy")); try { TestUtil.copyTree(Paths.get(ResourcesConstants.KJAR_2_ALL_RESOURCES), tmp); } catch (Exception e) { logger.error(e.getMessage()); } final AFCompiler compiler = KieMavenCompilerFactory.getCompiler(EnumSet.of(KieDecorator.STORE_KIE_OBJECTS, KieDecorator.ENABLE_LOGGING)); final KieCompilationResponse res; try { final WorkspaceCompilationInfo info = new WorkspaceCompilationInfo(tmp); final CompilationRequest req = new DefaultCompilationRequest(mavenRepoPath, info, new String[]{ MavenCLIArgs.COMPILE, MavenCLIArgs.ALTERNATE_USER_SETTINGS + alternateSettingsAbsPath }, Boolean.FALSE); res = (KieCompilationResponse) compiler.compile(req); logger.info("\nFinished " + res.isSuccessful() + " all Metadata tmp:{} UUID:{} res.getMavenOutput().isEmpty():{}", tmp , req.getRequestUUID(), res.getMavenOutput().isEmpty()); if (!res.isSuccessful()) { try { logger.error("writing output on target folder:{}", tmp); TestUtil.writeMavenOutputIntoTargetFolder(tmp, res.getMavenOutput(), "ConcurrentBuildTest.compileAndLoadKieJarMetadataAllResourcesPackagedJar_" + req.getRequestUUID()); } catch (Exception e) { logger.error(e.getMessage()); } } } finally { latch.countDown(); } return res; }

Target:
private KieCompilationResponse compileAndLoadKieJarMetadataAllResourcesPackagedJar() { String alternateSettingsAbsPath = TestUtilMaven.getSettingsFile(); Path tmpRoot = Files.createTempDirectory("repo_" + UUID.randomUUID().toString()); Path tmp = Files.createDirectories(Paths.get(tmpRoot.toString(), "dummy")); try { TestUtil.copyTree(Paths.get(ResourcesConstants.KJAR_2_ALL_RESOURCES), tmp); } catch (Exception e) { logger.error(e.getMessage()); } final AFCompiler compiler = KieMavenCompilerFactory.getCompiler(EnumSet.of(KieDecorator.STORE_KIE_OBJECTS, KieDecorator.ENABLE_LOGGING)); final KieCompilationResponse res; try { final WorkspaceCompilationInfo info = new WorkspaceCompilationInfo(tmp); final CompilationRequest req = new DefaultCompilationRequest(mavenRepoPath, info, new String[]{ MavenCLIArgs.COMPILE, MavenCLIArgs.ALTERNATE_USER_SETTINGS + alternateSettingsAbsPath }, Boolean.FALSE); res = (KieCompilationResponse) compiler.compile(req); logger.info("\nFinished, successful:{} , all Metadata tmp:{} UUID:{} res.getMavenOutput().isEmpty():{}", res.isSuccessful(), tmp , req.getRequestUUID(), res.getMavenOutput().isEmpty()); if (!res.isSuccessful()) { try { logger.error("writing output on target folder:{}", tmp); TestUtil.writeMavenOutputIntoTargetFolder(tmp, res.getMavenOutput(), "ConcurrentBuildTest.compileAndLoadKieJarMetadataAllResourcesPackagedJar_" + req.getRequestUUID()); } catch (Exception e) { logger.error(e.getMessage()); } } } finally { latch.countDown(); } return res; }
Source:
public static Collection<IPod> getPodsForDeploymentConfig(IDeploymentConfig deploymentConfig) { String dcName = deploymentConfig.getName(); List<IPod> projectPods = deploymentConfig.getProject().getResources(ResourceKind.POD); List<IPod> deploymentConfigPods = projectPods.stream() .filter(p -> dcName.equals(p.getAnnotation("openshift.io/deployment-config.name"))) .collect(Collectors.toList()); return deploymentConfigPods; }

Target:
public static Collection<IPod> getPodsForDeploymentConfig(IDeploymentConfig deploymentConfig) { List<IPod> pods = deploymentConfig.getProject().getResources(ResourceKind.POD); Map<String, String> selector = deploymentConfig.getReplicaSelector(); return getPodsForSelector(selector, pods); }
Source:
void testDescribeSpotRequestsInRegionFilter() { for (String region : Region.DEFAULT_REGIONS) { SortedSet<SpotInstanceRequest> allResults = ImmutableSortedSet.copyOf(client.getSpotInstanceApi().get() .describeSpotInstanceRequestsInRegion(region)); assertNotNull(allResults); if (allResults.size() >= 1) { SpotInstanceRequest request = allResults.last(); SortedSet<SpotInstanceRequest> result = ImmutableSortedSet.copyOf(client.getSpotInstanceApi().get() .describeSpotInstanceRequestsInRegionWithFilter(region, ImmutableMultimap.<String, String>builder() .put("spot-instance-request-id", request.getId()).build())); assertNotNull(result); SpotInstanceRequest compare = result.last(); assertEquals(compare, request); } } }

Target:
public void testDescribeSpotRequestsInRegionFilter() { for (String region : Region.DEFAULT_REGIONS) { SortedSet<SpotInstanceRequest> allResults = ImmutableSortedSet.copyOf(client.getSpotInstanceApi().get() .describeSpotInstanceRequestsInRegion(region)); assertNotNull(allResults); if (allResults.size() >= 1) { SpotInstanceRequest request = allResults.last(); SortedSet<SpotInstanceRequest> result = ImmutableSortedSet.copyOf(client.getSpotInstanceApi().get() .describeSpotInstanceRequestsInRegionWithFilter(region, ImmutableMultimap.<String, String>builder() .put("spot-instance-request-id", request.getId()).build())); assertNotNull(result); SpotInstanceRequest compare = result.last(); assertEquals(compare, request); } } }
Source:
@Nullable private static ProjectSpecificLanguageServerWrapper getLSWrapper(@NonNull IFile file, @Nullable Predicate<ServerCapabilities> request, @Nullable String serverId) throws IOException { IProject project = file.getProject(); if (project == null) { return null; } IContentType[] fileContentTypes = null; try (InputStream contents = file.getContents()) { fileContentTypes = Platform.getContentTypeManager().findContentTypesFor(contents, file.getName()); } catch (CoreException e) { LanguageServerPlugin.logError(e); return null; } ProjectSpecificLanguageServerWrapper wrapper = getMatchingStartedWrapper(project, fileContentTypes, request, serverId); if (wrapper != null) { return wrapper; } wrapper = getMatchingStartedWrapper(file, request, serverId); if (wrapper != null) { return wrapper; } for (IContentType contentType : fileContentTypes) { if (contentType == null) { continue; } for (LanguageServerDefinition serverDefinition : LanguageServersRegistry.getInstance().findProviderFor(contentType)) { if (serverDefinition != null && (serverId == null || serverDefinition.getId().equals(serverId))) { wrapper = getLSWrapperForConnection(project, contentType, serverDefinition); if (request == null || wrapper.getServerCapabilities() == null || request.test(wrapper.getServerCapabilities())) { return wrapper; } } } } return null; }

Target:
@Nullable private static ProjectSpecificLanguageServerWrapper getLSWrapper(@NonNull IFile file, @Nullable Predicate<ServerCapabilities> request, @Nullable String serverId) throws IOException { IProject project = file.getProject(); if (project == null) { return null; } ProjectSpecificLanguageServerWrapper wrapper = getMatchingStartedWrapper(file, request, serverId); if (wrapper != null) { return wrapper; } IContentType[] fileContentTypes = null; try (InputStream contents = file.getContents()) { fileContentTypes = Platform.getContentTypeManager().findContentTypesFor(contents, file.getName()); } catch (CoreException e) { LanguageServerPlugin.logError(e); return null; } wrapper = getMatchingStartedWrapper(project, fileContentTypes, request, serverId); if (wrapper != null) { return wrapper; } for (IContentType contentType : fileContentTypes) { if (contentType == null) { continue; } for (LanguageServerDefinition serverDefinition : LanguageServersRegistry.getInstance().findProviderFor(contentType)) { if (serverDefinition != null && (serverId == null || serverDefinition.getId().equals(serverId))) { wrapper = getLSWrapperForConnection(project, contentType, serverDefinition); if (request == null || wrapper.getServerCapabilities() == null || request.test(wrapper.getServerCapabilities())) { return wrapper; } } } } return null; }
Source:
protected Configuration createConfiguration() { Configuration conf = super.createConfiguration(); conf.set(S3_METADATA_STORE_IMPL, S3GUARD_METASTORE_LOCAL); return conf; }

Target:
protected Configuration createConfiguration() { Configuration conf = super.createConfiguration(); removeBaseAndBucketOverrides(conf, S3_METADATA_STORE_IMPL, S3A_BUCKET_PROBE); conf.set(S3_METADATA_STORE_IMPL, S3GUARD_METASTORE_LOCAL); conf.setInt(S3A_BUCKET_PROBE, S3A_BUCKET_PROBE_DEFAULT); return conf; }
Source:
private void handleGetCommand(AndroidSessionWrapper asw) { Intent i; String command = asw.getSession().getCommand(); if (useGridMenu(command)) { i = new Intent(getApplicationContext(), MenuGrid.class); } else { i = new Intent(getApplicationContext(), MenuList.class); } i.putExtra(SessionFrame.STATE_COMMAND_ID, command); addPendingDatumIdExtra(i, asw.getSession()); startActivityForResult(i, GET_COMMAND); }

Target:
private void handleGetCommand(AndroidSessionWrapper asw) { Intent i; String command = asw.getSession().getCommand(); if (useGridMenu(command)) { i = new Intent(getApplicationContext(), MenuGrid.class); } else { i = new Intent(getApplicationContext(), MenuList.class); } i.putExtra(SessionFrame.STATE_COMMAND_ID, command); addPendingDataExtra(i, asw.getSession()); startActivityForResult(i, GET_COMMAND); }
Source:
@Override Bitmap decodeStream(InputStream stream, PicassoBitmapOptions options) throws IOException { if (stream == null) { return null; } try { if (options != null && options.inJustDecodeBounds) { MarkableInputStream markStream = new MarkableInputStream(stream); stream = markStream; long mark = markStream.savePosition(1024); BitmapFactory.decodeStream(stream, null, options); calculateInSampleSize(options); markStream.reset(mark); } return BitmapFactory.decodeStream(stream, null, options); } finally { Utils.closeQuietly(stream); } }

Target:
private Bitmap decodeStream(InputStream stream, PicassoBitmapOptions options) throws IOException { if (stream == null) { return null; } if (options != null && options.inJustDecodeBounds) { MarkableInputStream markStream = new MarkableInputStream(stream); stream = markStream; long mark = markStream.savePosition(1024); BitmapFactory.decodeStream(stream, null, options); calculateInSampleSize(options); markStream.reset(mark); } return BitmapFactory.decodeStream(stream, null, options); }
Source:
public void testBySearch() throws Exception { SubClass testClass = new SubClass(); testClass.setName( "John Doe" ); FullTextSession s = Search.getFullTextSession( openSession() ); Transaction tx = s.beginTransaction(); s.persist( testClass ); tx.commit(); tx = s.beginTransaction(); QueryParser parser = new QueryParser( "name", TestConstants.keywordAnalyzer ); org.apache.lucene.search.Query luceneQuery = parser.parse( "name:John" ); FullTextQuery query = s.createFullTextQuery( luceneQuery, SubClass.class ); assertEquals( 1, query.getResultSize() ); luceneQuery = parser.parse( "name:Doe" ); query = s.createFullTextQuery( luceneQuery, SubClass.class ); assertEquals( 1, query.getResultSize() ); luceneQuery = parser.parse( "name:foo" ); query = s.createFullTextQuery( luceneQuery, SubClass.class ); assertEquals( 0, query.getResultSize() ); tx.commit(); s.close(); }

Target:
public void testBySearch() throws Exception { SubClass testClass = new SubClass(); testClass.setName( "I\u0307stanbul" ); FullTextSession s = Search.getFullTextSession( openSession() ); Transaction tx = s.beginTransaction(); s.persist( testClass ); tx.commit(); tx = s.beginTransaction(); QueryParser parser = new QueryParser( "name", TestConstants.keywordAnalyzer ); org.apache.lucene.search.Query luceneQuery = parser.parse( "name:istanbul" ); FullTextQuery query = s.createFullTextQuery( luceneQuery, SubClass.class ); assertEquals( 1, query.getResultSize() ); luceneQuery = parser.parse( "name:foo" ); query = s.createFullTextQuery( luceneQuery, SubClass.class ); assertEquals( 0, query.getResultSize() ); tx.commit(); s.close(); }
Source:
default void bulkIndex(List<IndexQuery> queries) { this.bulkIndex(queries, null); }

Target:
default void bulkIndex(List<IndexQuery> queries) { bulkIndex(queries, BulkOptions.defaultOptions()); }
Source:
private boolean hasSelectedMilestone(List<PickerMilestone> milestoneList) { return milestoneList.stream() .filter(milestone -> milestone.isSelected()) .findAny() .isPresent(); }

Target:
private boolean hasSelectedMilestone(List<PickerMilestone> milestoneList) { return milestoneList.stream() .filter(PickerMilestone::isSelected) .findAny() .isPresent(); }
Source:
private CorfuRuntime(@Nonnull CorfuRuntimeParameters parameters) { this.parameters = parameters; bootstrapLayoutServers = parameters.getLayoutServers().stream() .map(NodeLocator::toString) .collect(Collectors.toList()); layoutServers = new ArrayList<>(bootstrapLayoutServers); clusterId = parameters.getClusterId(); nettyEventLoop = parameters.nettyEventLoop == null ? getNewEventLoopGroup() : parameters.nettyEventLoop; nodeRouterPool = new NodeRouterPool(getRouterFunction); MetricsUtils.metricsReportingSetup(defaultMetrics); if (parameters.getPrometheusMetricsPort() != MetricsUtils.NO_METRICS_PORT) { MetricsUtils.metricsReportingSetup( defaultMetrics, parameters.getPrometheusMetricsPort()); } CorfuRuntimeParameters.MicroMeterRuntimeConfig microMeterRuntimeConfig = this.parameters.getMicroMeterRuntimeConfig(); if (microMeterRuntimeConfig.metricsEnabled) { LoggerContext loggerContext = (LoggerContext) LoggerFactory.getILoggerFactory(); registry = Optional.ofNullable(loggerContext.exists(microMeterRuntimeConfig.configuredLoggerName)) .map(logger -> MeterRegistryProvider.MeterRegistryInitializer.newInstance(logger, microMeterRuntimeConfig.loggingInterval, parameters.clientId)); } else { registry = Optional.empty(); } log.info("Corfu runtime version initialized.", getVersionString()); }

Target:
private CorfuRuntime(@Nonnull CorfuRuntimeParameters parameters) { this.parameters = parameters; bootstrapLayoutServers = parameters.getLayoutServers().stream() .map(NodeLocator::toString) .collect(Collectors.toList()); layoutServers = new ArrayList<>(bootstrapLayoutServers); clusterId = parameters.getClusterId(); nettyEventLoop = parameters.nettyEventLoop == null ? getNewEventLoopGroup() : parameters.nettyEventLoop; nodeRouterPool = new NodeRouterPool(getRouterFunction); MetricsUtils.metricsReportingSetup(defaultMetrics); if (parameters.getPrometheusMetricsPort() != MetricsUtils.NO_METRICS_PORT) { MetricsUtils.metricsReportingSetup( defaultMetrics, parameters.getPrometheusMetricsPort()); } CorfuRuntimeParameters.MicroMeterRuntimeConfig microMeterRuntimeConfig = this.parameters.getMicroMeterRuntimeConfig(); if (microMeterRuntimeConfig.metricsEnabled) { registry = Optional.ofNullable(LoggerFactory.getLogger(microMeterRuntimeConfig.configuredLoggerName)) .map(logger -> MeterRegistryProvider.MeterRegistryInitializer .newInstance(logger, microMeterRuntimeConfig.loggingInterval, parameters.clientId)); if (!registry.isPresent()) { log.warn("Configured logger could not be found."); } } else { registry = Optional.empty(); } fetchLayoutTimer = registry.map(r -> Timer.builder("runtime.fetch_layout.timer") .publishPercentileHistogram(true).publishPercentiles(0.50, 0.95, 0.99).register(r)); log.info("Corfu runtime version initialized.", getVersionString()); }
Source:
public CompletableFuture<Void> hostGame(NewGameInfo newGameInfo) { if (isRunning()) { logger.debug("Game is running, ignoring host request"); return completedFuture(null); } newGameInfo.setMap("NeroxisMapGenerator_1_0.0.1-prealpha"); stopSearchLadder1v1(); return updateGameIfNecessary(newGameInfo.getFeaturedMod(), null, emptyMap(), newGameInfo.getSimMods()) .thenCompose(aVoid -> downloadMapIfNecessary(newGameInfo.getMap())) .thenCompose(aVoid -> fafService.requestHostGame(newGameInfo)) .thenAccept(gameLaunchMessage -> startGame(gameLaunchMessage, null, RatingMode.GLOBAL)); }

Target:
public CompletableFuture<Void> hostGame(NewGameInfo newGameInfo) { if (isRunning()) { logger.debug("Game is running, ignoring host request"); return completedFuture(null); } stopSearchLadder1v1(); return updateGameIfNecessary(newGameInfo.getFeaturedMod(), null, emptyMap(), newGameInfo.getSimMods()) .thenCompose(aVoid -> downloadMapIfNecessary(newGameInfo.getMap())) .thenCompose(aVoid -> fafService.requestHostGame(newGameInfo)) .thenAccept(gameLaunchMessage -> startGame(gameLaunchMessage, null, RatingMode.GLOBAL)); }
Source:
public final Object getData(String sessionId, String key, boolean refresh) { Date now = new Date(); SessionInfo sessionInfo = getSessionInfo(sessionId); Object value = null; if (sessionInfo != null) { if (refresh) { synchronized (sessionInfo) { Date softLimit = (Date) sessionInfo.sessionMap.get(SOFT_LIMIT_PARAMETER_NAME); if (softLimit == null) { softLimit = now; sessionInfo.sessionMap.put(LAST_REFRESH, softLimit); } long minutesSinceLastRefresh = (now.getTime() - ((Date) sessionInfo.sessionMap.get(LAST_REFRESH)).getTime()) / 60000; int numberOfIntervalsToAdd = (int) minutesSinceLastRefresh / Config.<Integer> getValue(ConfigValues.UserSessionTimeOutInterval); softLimit = DateUtils.addMinutes(softLimit, (numberOfIntervalsToAdd > 2 ? 2 : numberOfIntervalsToAdd) * Config.<Integer> getValue(ConfigValues.UserSessionTimeOutInterval)); sessionInfo.sessionMap.put(SOFT_LIMIT_PARAMETER_NAME, softLimit); sessionInfo.sessionMap.put(LAST_REFRESH, now); } } value = sessionInfo.sessionMap.get(key); } return value; }

Target:
public final Object getData(String sessionId, String key, boolean refresh) { Date now = new Date(); SessionInfo sessionInfo = getSessionInfo(sessionId); Object value = null; if (sessionInfo != null) { if (refresh) { synchronized (sessionInfo) { Date softLimit = (Date) sessionInfo.sessionMap.get(SOFT_LIMIT_PARAMETER_NAME); if (softLimit == null) { softLimit = now; } softLimit = DateUtils.addMinutes(softLimit, 2 * Config.<Integer> getValue(ConfigValues.UserSessionTimeOutInterval)); sessionInfo.sessionMap.put(SOFT_LIMIT_PARAMETER_NAME, softLimit); } } value = sessionInfo.sessionMap.get(key); } return value; }
Source:
String write(@NonNull T streamable) { if (storeDirectory == null) { return null; } File exceptionDir = new File(storeDirectory); if (exceptionDir.isDirectory()) { File[] files = exceptionDir.listFiles(); if (files != null && files.length >= maxStoreCount) { Arrays.sort(files, comparator); Logger.warn(String.format("Discarding oldest error as stored " + "error limit reached (%s)", files[0].getPath())); if (!files[0].delete()) { files[0].deleteOnExit(); } } } String filename = getFilename(streamable); Writer out = null; try { FileOutputStream fos = new FileOutputStream(filename); out = new BufferedWriter(new OutputStreamWriter(fos, "UTF-8")); JsonStream stream = new JsonStream(out); stream.value(streamable); stream.close(); Logger.info(String.format("Saved unsent payload to disk (%s) ", filename)); return filename; } catch (Exception exception) { Logger.warn(String.format("Couldn't save unsent payload to disk (%s) ", filename), exception); } finally { IOUtils.closeQuietly(out); } return null; }

Target:
String write(@NonNull T streamable) { if (storeDirectory == null) { return null; } File exceptionDir = new File(storeDirectory); if (exceptionDir.isDirectory()) { File[] files = exceptionDir.listFiles(); if (files != null && files.length >= maxStoreCount) { Arrays.sort(files, comparator); for (int k = 0; k < files.length && files.length >= maxStoreCount; k++) { File oldestFile = files[k]; if (!queuedFiles.contains(oldestFile)) { Logger.warn(String.format("Discarding oldest error as stored " + "error limit reached (%s)", oldestFile.getPath())); deleteStoredFiles(Collections.singleton(oldestFile)); } } } } String filename = getFilename(streamable); JsonStream stream = null; lock.lock(); try { FileOutputStream fos = new FileOutputStream(filename); Writer out = new BufferedWriter(new OutputStreamWriter(fos, "UTF-8")); stream = new JsonStream(out); stream.value(streamable); Logger.info(String.format("Saved unsent payload to disk (%s) ", filename)); return filename; } catch (Exception exception) { Logger.warn(String.format("Couldn't save unsent payload to disk (%s) ", filename), exception); } finally { IOUtils.closeQuietly(stream); lock.unlock(); } return null; }
Source:
public long getVolume() { return (long) Math.floor(radius.getX() * radius.getZ() * Math.PI * getHeight()); }

Target:
public long getVolume() { return BigDecimal.valueOf(radius.getX()) .multiply(BigDecimal.valueOf(radius.getZ())) .multiply(PI) .multiply(BigDecimal.valueOf(getHeight())) .setScale(0, RoundingMode.FLOOR) .longValue(); }
Source:
protected void executeCommand() { updateQuotaCache(); if (_oldStoragePool.getstatus() == StoragePoolStatus.Up) { if (!StringHelper.EqOp(_oldStoragePool.getname(), getStoragePool().getname())) { runVdsCommand(VDSCommandType.SetStoragePoolDescription, new SetStoragePoolDescriptionVDSCommandParameters( getStoragePool().getId(), getStoragePool().getname()) ); } } updateNewStoragePoolEntity(getStoragePool(), _oldStoragePool); getStoragePoolDAO().updatePartial(getStoragePool()); updateStoragePoolFormatType(); setSucceeded(true); }

Target:
protected void executeCommand() { updateQuotaCache(); if (_oldStoragePool.getstatus() == StoragePoolStatus.Up) { if (!StringHelper.EqOp(_oldStoragePool.getname(), getStoragePool().getname())) { runVdsCommand(VDSCommandType.SetStoragePoolDescription, new SetStoragePoolDescriptionVDSCommandParameters( getStoragePool().getId(), getStoragePool().getname()) ); } } copyUnchangedStoragePoolProperties(getStoragePool(), _oldStoragePool); getStoragePoolDAO().updatePartial(getStoragePool()); updateStoragePoolFormatType(); setSucceeded(true); }
Source:
public Enumeration<Object> elements() { throw new RuntimeException("Method elements is not supported in LinkedProperties class"); }

Target:
public Enumeration<Object> elements() { return Collections.enumeration(linkMap.values()); }
Source:
public void run() { List<SurveyDB> surveys = SurveyDB.getAllCompletedUnsentSurveys(); for (SurveyDB survey : surveys) { survey.setStatus(SURVEY_SENT); survey.save(); } mMainExecutor.run(new Runnable() { @Override public void run() { mCallback.onPushFinished(); } }); }

Target:
public void run() { List<SurveyDB> surveys = SurveyDB.getAllCompletedUnsentSurveys(); for (SurveyDB survey : surveys) { survey.setStatus(SURVEY_SENT); survey.save(); } notifyOnPushFinished(); }
Source:
public static String decrypt(String message) throws InvalidParametersException { try { SecretKeySpec sks = new SecretKeySpec(hexStringToByteArray(Config.ENCRYPTION_KEY), "AES"); Cipher cipher = Cipher.getInstance("AES"); cipher.init(Cipher.DECRYPT_MODE, sks); byte[] decrypted = cipher.doFinal(hexStringToByteArray(message)); return new String(decrypted); } catch (NumberFormatException | IllegalBlockSizeException | BadPaddingException e) { log.warning("Attempted to decrypt invalid ciphertext: " + message); throw new InvalidParametersException(e.getMessage()); } catch (Exception e) { throw new RuntimeException(e); } }

Target:
public static String decrypt(String message) throws InvalidParametersException { try { SecretKeySpec sks = new SecretKeySpec(hexStringToByteArray(Config.ENCRYPTION_KEY), "AES"); Cipher cipher = Cipher.getInstance("AES"); cipher.init(Cipher.DECRYPT_MODE, sks); byte[] decrypted = cipher.doFinal(hexStringToByteArray(message)); return new String(decrypted); } catch (NumberFormatException | IllegalBlockSizeException | BadPaddingException e) { log.warning("Attempted to decrypt invalid ciphertext: " + message); throw new InvalidParametersException(e); } catch (Exception e) { throw new RuntimeException(e); } }
Source:
protected void execute() { for (SallegraBindingProvider provider : providers) { Collection<String> names = provider.getItemNames(); for (String name : names) { logger.debug("Name {}", name); SallegraBindingConfig bindingConfig = provider .getBindingConfigFor(name); String deviceId = bindingConfig.getModuleName(); if (sallegraNodes.containsKey(deviceId)) { SallegraNode node = sallegraNodes.get(deviceId); String value = null; switch (bindingConfig.getCmdId()) { case RELAY: value = node.getRelay(bindingConfig.getCmdValue()); break; case DIMMER: value = node.getDimmer(bindingConfig.getCmdValue()); break; case INPUT: value = node.getInput(bindingConfig.getCmdValue()); break; default: break; } if (value != null) { postUpdate(provider, bindingConfig.getItem(), value); } } else { logger.error("Unknown deviceId \"{}\"", deviceId); } } } }

Target:
protected void execute() { for (SallegraBindingProvider provider : providers) { Collection<String> names = provider.getItemNames(); for (String name : names) { logger.debug("Name {}", name); SallegraBindingConfig bindingConfig = provider .getBindingConfigFor(name); String deviceId = bindingConfig.getModuleName(); if (sallegraNodes.containsKey(deviceId)) { SallegraNode node = sallegraNodes.get(deviceId); String value = null; switch (bindingConfig.getCmdId()) { case RELAY: value = node.getRelay(bindingConfig.getCmdValue()); break; case DIMMER: value = node.getDimmer(bindingConfig.getCmdValue()); break; case INPUT: value = node.getInput(bindingConfig.getCmdValue()); break; } if (value != null) { postUpdate(provider, bindingConfig, value); } } else { logger.error("Unknown deviceId \"{}\"", deviceId); } } } }
Source:
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException { String swaggerSpecificationJSON = ""; try { StringBuilder baseUrl = new StringBuilder(); String scheme = request.getScheme(); int port = request.getServerPort(); baseUrl.append(scheme); baseUrl.append("://"); baseUrl.append(request.getServerName()); if ((scheme.equals("http") && port != 80) || (scheme.equals("https") && port != 443)) { baseUrl.append(':'); baseUrl.append(request.getServerPort()); } baseUrl.append(request.getContextPath()); String resourcesUrl = Context.getAdministrationService().getGlobalProperty(FHIRConstants.URI_PREFIX_GLOBAL_PROPERTY_NAME, baseUrl.toString()); String urlWithoutScheme = ""; String basePath = "/openmrs/ws/fhir"; if (scheme.equals("http")) { urlWithoutScheme = resourcesUrl.replace("http://", ""); } else if (scheme.equals("https")) { urlWithoutScheme = resourcesUrl.replace("https://", ""); } urlWithoutScheme = urlWithoutScheme.replace("/openmrs", ""); SwaggerSpecificationCreator creator = new SwaggerSpecificationCreator(urlWithoutScheme, basePath); swaggerSpecificationJSON = creator.buildJSON(); response.setContentType("application/json"); response.setCharacterEncoding("UTF-8"); response.getWriter().write(swaggerSpecificationJSON); } catch (Exception exception) { } }

Target:
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException { String swaggerSpecificationJSON; try { StringBuilder baseUrl = new StringBuilder(); String scheme = request.getScheme(); int port = request.getServerPort(); baseUrl.append(scheme); baseUrl.append(SwaggerDocConstants.SLASHES); baseUrl.append(request.getServerName()); if ((SwaggerDocConstants.HTTP.equals(scheme) && port != 80) || (SwaggerDocConstants.HTTPS.equals(scheme) && port != 443)) { baseUrl.append(SwaggerDocConstants.COLON); baseUrl.append(request.getServerPort()); } baseUrl.append(request.getContextPath()); String resourcesUrl = Context.getAdministrationService().getGlobalProperty(FHIRConstants.URI_PREFIX_GLOBAL_PROPERTY_NAME, baseUrl.toString()); String urlWithoutScheme = ""; String basePath = SwaggerDocConstants.SHORT_FHIR_REST_PREFIX; if (SwaggerDocConstants.HTTP.equals(scheme)) { urlWithoutScheme = resourcesUrl.replace(SwaggerDocConstants.HTTP_WITH_SLASHES, SwaggerDocConstants.STR_EMPTY); } else if (SwaggerDocConstants.HTTPS.equals(scheme)) { urlWithoutScheme = resourcesUrl.replace(SwaggerDocConstants.HTTPS_WITH_SLASHES, SwaggerDocConstants.STR_EMPTY); } urlWithoutScheme = urlWithoutScheme.replace(SwaggerDocConstants.OPENMRS_PREFIX, SwaggerDocConstants.STR_EMPTY); SwaggerSpecificationCreator creator = new SwaggerSpecificationCreator(urlWithoutScheme, basePath); swaggerSpecificationJSON = creator.buildJSON(); response.setContentType(SwaggerDocConstants.PRODUCES_JSON); response.setCharacterEncoding(SwaggerDocConstants.UTF_8); response.getWriter().write(swaggerSpecificationJSON); } catch (Exception e) { log.error("Error while processing request", e); } }
Source:
public void initMainThreadHandlerCalled() { final AtomicReference<Callable<Scheduler>> schedulerRef = new AtomicReference<>(); final Scheduler newScheduler = new EmptyScheduler(); RxAndroidPlugins .setInitMainThreadSchedulerHandler(new Function<Callable<Scheduler>, Scheduler>() { @Override public Scheduler apply(Callable<Scheduler> scheduler) { schedulerRef.set(scheduler); return newScheduler; } }); Callable<Scheduler> scheduler = new Callable<Scheduler>() { @Override public Scheduler call() throws Exception { return new EmptyScheduler(); } }; Scheduler actual = RxAndroidPlugins.initMainThreadScheduler(scheduler); assertSame(newScheduler, actual); assertSame(scheduler, schedulerRef.get()); }

Target:
public void initMainThreadHandlerCalled() { final AtomicReference<Callable<Scheduler>> schedulerRef = new AtomicReference<>(); final Scheduler newScheduler = new EmptyScheduler(); RxAndroidPlugins .setInitMainThreadSchedulerHandler(new Function<Callable<Scheduler>, Scheduler>() { @Override public Scheduler apply(Callable<Scheduler> scheduler) { schedulerRef.set(scheduler); return newScheduler; } }); Callable<Scheduler> scheduler = new Callable<Scheduler>() { @Override public Scheduler call() throws Exception { throw new AssertionError(); } }; Scheduler actual = RxAndroidPlugins.initMainThreadScheduler(scheduler); assertSame(newScheduler, actual); assertSame(scheduler, schedulerRef.get()); }
Source:
public void checkNetworkTenancyAfterRemove() throws Exception { List<NetworkTenancy> networkTenancies = given() .when() .get("/corsSites/search/findByFourCharacterId?id=ALIC") .then() .statusCode(HttpStatus.OK.value()) .extract().jsonPath().getList("networkTenancies", NetworkTenancy.class); assertThat(networkTenancies.size(), is(0)); }

Target:
public void checkNetworkTenancyAfterRemove() throws Exception { List<NetworkTenancy> networkTenancies = given() .when() .get("/corsSites/search/findByFourCharacterId?id=ALIC") .then() .statusCode(HttpStatus.OK.value()) .extract().jsonPath().getList("networkTenancies", NetworkTenancy.class); assertThat(networkTenancies, is(empty())); }
Source:
protected void clearIndex() { indexSpec.clear(); secondaryIndexes.clear(); indexGenerationFailed = true; }

Target:
protected void clearIndex() { indexSpec.clear(); secondaryIndexes.clear(); }
Source:
protected DataStoreTestHarness createHarness() { try { final String dataStoreSupplierName = System.getProperty("dataStoreHarness"); System.out.println("Datastore: " + dataStoreSupplierName); if (dataStoreSupplierName != null && !dataStoreSupplierName.isEmpty()) { return Class.forName(dataStoreSupplierName).asSubclass(DataStoreTestHarness.class).newInstance(); } return new InMemoryDataStoreHarness(); } catch (InstantiationException | IllegalAccessException | ClassNotFoundException | ClassCastException e) { throw new IllegalStateException(e); } }

Target:
protected DataStoreTestHarness createHarness() { try { final String dataStoreSupplierName = System.getProperty("dataStoreHarness"); if (dataStoreSupplierName != null && !dataStoreSupplierName.isEmpty()) { return Class.forName(dataStoreSupplierName).asSubclass(DataStoreTestHarness.class).newInstance(); } return new InMemoryDataStoreHarness(); } catch (InstantiationException | IllegalAccessException | ClassNotFoundException | ClassCastException e) { throw new IllegalStateException(e); } }
Source:
public void onNoteRemove(Note note) { try { notebookServer.broadcastUpdateNoteJobInfo(System.currentTimeMillis() - 5000); } catch (IOException ioe) { LOG.warn("can not broadcast for job manager {}", ioe.getMessage()); } try { getJobManagerService().removeNoteJobInfo(note.getId(), null, new JobManagerServiceCallback()); } catch (IOException ioe) { LOG.warn("can not broadcast for job manager {}", ioe.getMessage()); } }

Target:
public void onNoteRemove(Note note) { try { notebookServer.broadcastUpdateNoteJobInfo(System.currentTimeMillis() - 5000); } catch (IOException e) { LOG.warn("can not broadcast for job manager: " + e.getMessage(), e); } try { getJobManagerService().removeNoteJobInfo(note.getId(), null, new JobManagerServiceCallback()); } catch (IOException e) { LOG.warn("can not broadcast for job manager: " + e.getMessage(), e); } }
Source:
protected <T> Stream<Object> resolveEventTargets(EventMessage message, T parentEntity, Member member, ForwardingMode eventForwardingMode) { Iterable<Object> fieldValue = ReflectionUtils.getMemberValue(member, parentEntity); return fieldValue == null ? Stream.empty() : eventForwardingMode.filterCandidates(message, StreamSupport.stream(fieldValue.spliterator(), false)); }

Target:
protected <T> Stream<Object> resolveEventTargets(EventMessage message, T parentEntity, Member member, ForwardingMode eventForwardingMode) { Iterable<Object> memberValue = ReflectionUtils.getMemberValue(member, parentEntity); return memberValue == null ? Stream.empty() : eventForwardingMode.filterCandidates(message, StreamSupport.stream(memberValue.spliterator(), false)); }
Source:
public void sendRedirect(String uri) { try { ((HttpServletResponse) getNativeResponse()).sendRedirect(uri != null ? getContextPath() + uri : ""); setVoided(true); } catch (IOException ex) { throw new UiException(ex); } }

Target:
public void sendRedirect(String uri) { try { ((HttpServletResponse) getNativeResponse()).sendRedirect(uri != null ? encodeURL(uri) : ""); setVoided(true); } catch (IOException ex) { throw new UiException(ex); } }
Source:
public void addMessageListener(org.apache.helix.MessageListener listener, String instanceName) { addListener(listener, new Builder(_clusterName).messages(instanceName), ChangeType.MESSAGE, new EventType[] { EventType.NodeChildrenChanged }, _messageRefreshTriggerInterval); }

Target:
public void addMessageListener(org.apache.helix.MessageListener listener, String instanceName) { addMessageListener((MessageListener) listener, instanceName); }
Source:
public void transferSuccessful() { if (PullServerUtil.isNativeIOPossible() && manageOsCache && count() > 0) { try { PullServerUtil.posixFadviseIfPossible(identifier, fd, position(), count(), NativeIO.POSIX.POSIX_FADV_DONTNEED); } catch (Throwable t) { LOG.warn("Failed to manage OS cache for " + identifier, t); } } }

Target:
public void transferSuccessful() { if (PullServerUtil.isNativeIOPossible() && manageOsCache && count() > 0 && super.isOpen()) { try { PullServerUtil.posixFadviseIfPossible(identifier, fd, position(), count(), NativeIO.POSIX.POSIX_FADV_DONTNEED); } catch (Throwable t) { LOG.warn("Failed to manage OS cache for " + identifier, t); } } }
Source:
protected void log(final Level level, final String msg) { this.logger.log(level, this.simpleName + " " + msg); }

Target:
protected void log(final Level level, final String msg) { this.LOGGER.log(level, this.simpleName + " " + msg); }
Source:
public void define(Context context) { System.err.println("Fake GOV WS being setup: " + actions.length); NewController controller = context.createController("api/fake_gov"); Arrays.stream(actions).forEach(action -> action.define(controller)); controller.done(); }

Target:
public void define(Context context) { NewController controller = context.createController("api/fake_gov"); Arrays.stream(actions).forEach(action -> action.define(controller)); controller.done(); }
Source:
private void stageSchemaFiles(Configuration config){ if (config.m_userSchema == null){ return; } File stagedCatalogFH = new VoltFile(getStagedCatalogPath()); final boolean standalone = true; final boolean isXCDR = false; VoltCompiler compiler = new VoltCompiler(standalone, isXCDR); if (!compiler.compileFromDDL(stagedCatalogFH.getAbsolutePath(), config.m_userSchema.getAbsolutePath())){ VoltDB.crashLocalVoltDB("Could not compile specified schema " + config.m_userSchema, false, null); } }

Target:
private void stageSchemaFiles(Configuration config){ if (config.m_userSchema == null){ return; } assert( config.m_userSchema.isFile() ); File stagedCatalogFH = new VoltFile(getStagedCatalogPath()); assert( !stagedCatalogFH.exists() || config.m_forceVoltdbCreate ); final boolean standalone = true; final boolean isXCDR = false; VoltCompiler compiler = new VoltCompiler(standalone, isXCDR); if (!compiler.compileFromDDL(stagedCatalogFH.getAbsolutePath(), config.m_userSchema.getAbsolutePath())){ VoltDB.crashLocalVoltDB("Could not compile specified schema " + config.m_userSchema, false, null); } }
Source:
public @Nonnull String getDescription() { Node node = getNode(); return (node != null) ? node.getNodeDescription() : ""; }

Target:
public @Nonnull String getDescription() { Node node = getNode(); return (node != null) ? node.getNodeDescription() : null; }
Source:
private void loadImage(String mediaUri) { if (TextUtils.isEmpty(mediaUri)) { showLoadingError(); return; } mImageView.setVisibility(View.VISIBLE); if (mSite == null || SiteUtils.isPhotonCapable(mSite)) { int maxWidth = Math.max(DisplayUtils.getDisplayPixelWidth(getActivity()), DisplayUtils.getDisplayPixelHeight(getActivity())); mediaUri = PhotonUtils.getPhotonImageUrl(mediaUri, maxWidth, 0); } showProgress(true); mImageManager.load(mImageView, ImageType.FULLSCREEN_PHOTO, mediaUri, ScaleType.CENTER, new RequestListener() { @Override public void onResourceReady(@Nullable Drawable resource) { if (isAdded()) { if (resource != null) { PhotoViewAttacher attacher = new PhotoViewAttacher(mImageView); attacher.setOnViewTapListener(new PhotoViewAttacher.OnViewTapListener() { @Override public void onViewTap(View view, float x, float y) { if (mMediaTapListener != null) { mMediaTapListener.onMediaTapped(); } } }); showProgress(false); } else { AppLog.e(T.MEDIA, "Loading media preview failed - resource is null."); } } } @Override public void onLoadFailed(@Nullable Exception e) { if (isAdded()) { AppLog.e(T.MEDIA, e); showProgress(false); showLoadingError(); } } }); }

Target:
private void loadImage(String mediaUri) { if (TextUtils.isEmpty(mediaUri)) { showLoadingError(); return; } mImageView.setVisibility(View.VISIBLE); if (mSite == null || SiteUtils.isPhotonCapable(mSite)) { int maxWidth = Math.max(DisplayUtils.getDisplayPixelWidth(getActivity()), DisplayUtils.getDisplayPixelHeight(getActivity())); mediaUri = PhotonUtils.getPhotonImageUrl(mediaUri, maxWidth, 0); } showProgress(true); mImageManager.load(mImageView, ImageType.FULLSCREEN_PHOTO, mediaUri, ScaleType.CENTER, new RequestListener() { @Override public void onResourceReady(@NotNull Drawable resource) { if (isAdded()) { PhotoViewAttacher attacher = new PhotoViewAttacher(mImageView); attacher.setOnViewTapListener(new PhotoViewAttacher.OnViewTapListener() { @Override public void onViewTap(View view, float x, float y) { if (mMediaTapListener != null) { mMediaTapListener.onMediaTapped(); } } }); showProgress(false); } } @Override public void onLoadFailed(@Nullable Exception e) { if (isAdded()) { AppLog.e(T.MEDIA, e); showProgress(false); showLoadingError(); } } }); }
Source:
public static @Nullable ITmfEvent getPreviousEventMatching(ITmfTrace trace, long startRank, Predicate<ITmfEvent> predicate) { final int step = 100; long currentRank = startRank; try { while (currentRank > 0) { currentRank = Math.max(currentRank - step, 0); EventMatchingRequest req = new EventMatchingRequest(currentRank, step, predicate, true); trace.sendRequest(req); req.waitForCompletion(); ITmfEvent event = req.getFoundEvent(); if (event != null) { return event; } } } catch (InterruptedException e) { return null; } return null; }

Target:
public static @Nullable ITmfEvent getPreviousEventMatching(ITmfTrace trace, long startRank, Predicate<ITmfEvent> predicate) { final int targetStep = 100; int step = (startRank < targetStep ? (int) startRank : targetStep); long currentRank = startRank; try { while (currentRank > 0) { currentRank = Math.max(currentRank - step, 0); EventMatchingRequest req = new EventMatchingRequest(currentRank, step, predicate, true); trace.sendRequest(req); req.waitForCompletion(); ITmfEvent event = req.getFoundEvent(); if (event != null) { return event; } } } catch (InterruptedException e) { return null; } return null; }
Source:
private Set<String> toDirSet(String dirs) { if (dirs == null || dirs.length() == 0) return Collections.emptySet(); Set<String> configuredStrings = new HashSet<String>(); StringTokenizer tok = new StringTokenizer(dirs, File.pathSeparator); while (tok.hasMoreTokens()) { configuredStrings .add(workspacePath.resolve(tok.nextToken()).toString()); } return configuredStrings; }

Target:
private Set<String> toDirSet(String dirs) { if (dirs == null || dirs.isEmpty()) { return Collections.emptySet(); } Set<String> configuredStrings = new HashSet<String>(); StringTokenizer tok = new StringTokenizer(dirs, File.pathSeparator); while (tok.hasMoreTokens()) { configuredStrings .add(workspacePath.resolve(tok.nextToken()).toString()); } return configuredStrings; }
Source:
public Map<AccountGroup.UUID, GroupMembersList> getUnresolvedGroups( final boolean recursive) { if (!recursive) { if (isResolved()) { return Collections.emptyMap(); } else { return Collections.singletonMap(getGroup().getGroupUUID(), this); } } else { return getAllUnresolvedGroups(new HashSet<AccountGroup.Id>()); } }

Target:
public Map<AccountGroup.UUID, GroupMembersList> getUnresolvedGroups( final boolean recursive) { if (!recursive) { if (isResolved()) { return Collections.emptyMap(); } return Collections.singletonMap(getGroup().getGroupUUID(), this); } return getAllUnresolvedGroups(new HashSet<AccountGroup.Id>()); }
Source:
public String getTitle() { return I18N.tr("Simple Style Editor - ") + layer.getName(); }

Target:
public String getTitle() { return I18N.tr("Simple Style Editor - {0}", layer.getName()); }