auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public void copySupplementaryFolder(IFolder destination) { IFolder oldSupplFolder = getTraceSupplementaryFolder(getResourceName()); if (oldSupplFolder.exists()) { try { oldSupplFolder.copy(destination.getFullPath(), true, new NullProgressMonitor()); } catch (CoreException e) { Activator.getDefault().logError("Error copying supplementary folder " + oldSupplFolder, e); } } }

Target:
public void copySupplementaryFolder(IFolder destination) { IFolder oldSupplFolder = getTraceSupplementaryFolder(getResourceName()); if (oldSupplFolder.exists()) { try { oldSupplFolder.copy(destination.getFullPath(), true, new NullProgressMonitor()); } catch (CoreException e) { Activator.getDefault().logError(Messages.TmfCommonProjectElement_ErrorCopyingSF + oldSupplFolder, e); } } }
Source:
public void implicitLinkWithSymbols() { String[] evilurls = new String[] { "<LINK_6>.", "<LINK_6>.a", "<LINK_3>", "<LINK_4>", "<LINK_4>a", "<LINK_6>,", "<LINK_6>,a", "<LINK_6>;", "<LINK_6>;a", "<LINK_0>", "<LINK_0>a", "<LINK_1>", "<LINK_1>a", }; for (String url : evilurls) { assertEquals("<p><a href=\"" + url + "\">" + url + "</a></p>\n", parseToHtml(url) ); } }

Target:
public void implicitLinkWithSymbols() { String[] problematicUrls = new String[] { "<LINK_6>.", "<LINK_6>.a", "<LINK_3>", "<LINK_4>", "<LINK_4>a", "<LINK_6>,", "<LINK_6>,a", "<LINK_6>;", "<LINK_6>;a", "<LINK_0>", "<LINK_0>a", "<LINK_1>", "<LINK_1>a", }; for (String url : problematicUrls) { assertEquals("<p><a href=\"" + url + "\">" + url + "</a></p>\n", parseToHtml(url)); } }
Source:
public Dialog onCreateDialog(final Bundle savedInstanceState) { super.onCreateDialog(savedInstanceState); AlertDialog.Builder builder = new AlertDialog.Builder(getContext()); builder.setTitle(viewUser.getName()) .setItems(R.array.user_options, new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { if (which == 0) { if (listener != null) { listener.onEditUser(viewUser); } } else { if (listener != null) { listener.onDeleteUser(viewUser); } } dismiss(); } }); return builder.create(); }

Target:
public Dialog onCreateDialog(final Bundle savedInstanceState) { super.onCreateDialog(savedInstanceState); AlertDialog.Builder builder = new AlertDialog.Builder(getContext()); builder.setTitle(viewUser.getName()) .setItems(R.array.user_options, new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int selectedOption) { if (selectedOption == OPTION_EDIT_USER) { if (listener != null) { listener.onEditUser(viewUser); } } else { if (listener != null) { listener.onDeleteUser(viewUser); } } dismiss(); } }); return builder.create(); }
Source:
public SpongeStatisticData() { this(Maps.<Statistic, Long>newLinkedHashMap()); }

Target:
public SpongeStatisticData() { this(Maps.newLinkedHashMap()); }
Source:
public int run() throws IOException { Preconditions.checkArgument(hdfs || hbase || zk, "At least one service must be specified."); Preconditions .checkArgument(localBaseFsLocation != null, "Minicluster directory and a valid zookeeper client port are required."); MiniCluster.Builder builder = new MiniCluster.Builder() .localBaseFsLocation(localBaseFsLocation).clean(clean).conf(conf); if (forceBindIP != null) { builder.forceBindIP(forceBindIP); } if (hdfs) { builder.addHdfsService(); } if (zk) { builder.addZookeeperService(zkClientPort); } if (hbase) { builder.addHBaseService(); } final MiniCluster miniCluster = builder.build(); final Object wait = new Object(); Thread exitThread = new Thread() { @Override public void run() { try { miniCluster.stop(); } catch (Throwable e) { console.error("Error stopping mini cluster. Exiting anyways...", e); } wait.notify(); } }; Runtime.getRuntime().addShutdownHook(exitThread); miniCluster.start(); try { synchronized(wait) { wait.wait(); } } catch (InterruptedException e) { throw new IOException(e); } return 0; }

Target:
public int run() throws IOException { Preconditions.checkArgument(services.size() > 0, "At least one service must be specified."); Preconditions.checkArgument(workDir != null, "A valid work dir is required."); MiniCluster.Builder builder = new MiniCluster.Builder().workDir(workDir) .clean(clean).hadoopConf(conf).bindIP(bindIP) .namenodeRpcPort(namenodeRpcPort).zkPort(zkPort); for (String serviceName : services) { if (simpleServiceNameMap.containsKey(serviceName)) { serviceName = simpleServiceNameMap.get(serviceName); } try { builder.addService((Class<? extends Service>) Class .forName(serviceName)); } catch (ClassNotFoundException e) { console.error("Unknown service class specified: " + serviceName); throw new RuntimeException(e); } } for (Entry<String, String> serviceParam : serviceParams.entrySet()) { builder.setServiceConfig(serviceParam.getKey(), serviceParam.getValue()); } final MiniCluster miniCluster = builder.build(); final CountDownLatch doneSignal = new CountDownLatch(1); Thread exitThread = new Thread() { @Override public void run() { try { miniCluster.stop(); } catch (Throwable e) { console.error("Error stopping mini cluster. Exiting anyways...", e); } doneSignal.countDown(); } }; Runtime.getRuntime().addShutdownHook(exitThread); try { miniCluster.start(); doneSignal.await(); } catch (InterruptedException e) { Thread.currentThread().interrupt(); return 1; } return 0; }
Source:
public void run() { int attempt = 1; AbstractRerunPolicy policy = new ExpBackoffPolicy(); Frequency frequency = new Frequency("minutes(1)"); while (!Thread.currentThread().isInterrupted()) { T message = null; try { try { message = handler.takeFromQueue(); attempt = 1; } catch (FalconException e) { if (ExceptionUtils.getRootCause(e) instanceof InterruptedException){ LOG.info("Rerun handler daemon has been interrupted"); return; } else { LOG.error("Error while reading message from the queue", e); GenericAlert.alertRerunConsumerFailed( "Error while reading message from the queue: ", e); Thread.sleep(policy.getDelay(frequency, attempt)); handler.reconnect(); attempt++; continue; } } CurrentUser.authenticate(message.getWorkflowUser()); AbstractWorkflowEngine wfEngine = handler.getWfEngine(message.getEntityType(), message.getEntityName()); String jobStatus = wfEngine.getWorkflowStatus( message.getClusterName(), message.getWfId()); handleRerun(message.getClusterName(), jobStatus, message, message.getEntityType(), message.getEntityName()); } catch (Throwable e) { if (e instanceof EntityNotRegisteredException) { LOG.warn("Entity of type doesn't exist in config store. Rerun " + "cannot be done for workflow ", message.getEntityName(), message.getEntityType(), message.getWfId()); } LOG.error("Error in rerun consumer", e); } } }

Target:
public void run() { int attempt = 1; AbstractRerunPolicy policy = new ExpBackoffPolicy(); Frequency frequency = new Frequency("minutes(1)"); while (!Thread.currentThread().isInterrupted()) { T message = null; try { try { message = handler.takeFromQueue(); attempt = 1; } catch (FalconException e) { if (ExceptionUtils.getRootCause(e) instanceof InterruptedException){ LOG.info("Rerun handler daemon has been interrupted"); return; } else { LOG.error("Error while reading message from the queue", e); GenericAlert.alertRerunConsumerFailed( "Error while reading message from the queue: ", e); Thread.sleep(policy.getDelay(frequency, attempt)); handler.reconnect(); attempt++; continue; } } CurrentUser.authenticate(message.getWorkflowUser()); AbstractWorkflowEngine wfEngine = handler.getWfEngine(message.getEntityType(), message.getEntityName()); String jobStatus = wfEngine.getWorkflowStatus( message.getClusterName(), message.getWfId()); handleRerun(message.getClusterName(), jobStatus, message, message.getEntityType(), message.getEntityName()); } catch (Throwable e) { if (e instanceof EntityNotRegisteredException) { LOG.warn("Entity of type doesn't exist in config store. Rerun " + "cannot be done for workflow ", message.getEntityName(), message.getEntityType(), message.getWfId()); continue; } LOG.error("Error in rerun consumer", e); } } }
Source:
public DirectConnectionConfig() { this.connectionEndpointRediscoveryEnabled = true; this.connectTimeout = DEFAULT_CONNECT_TIMEOUT; this.idleConnectionTimeout = Duration.ZERO; this.idleEndpointTimeout = DEFAULT_IDLE_ENDPOINT_TIMEOUT; this.maxConnectionsPerEndpoint = DEFAULT_MAX_CONNECTIONS_PER_ENDPOINT; this.maxRequestsPerConnection = DEFAULT_MAX_REQUESTS_PER_CONNECTION; this.requestTimeout = DEFAULT_REQUEST_TIMEOUT; }

Target:
public DirectConnectionConfig() { this.connectionEndpointRediscoveryEnabled = DEFAULT_CONNECTION_ENDPOINT_REDISCOVERY_ENABLED; this.connectTimeout = DEFAULT_CONNECT_TIMEOUT; this.idleConnectionTimeout = Duration.ZERO; this.idleEndpointTimeout = DEFAULT_IDLE_ENDPOINT_TIMEOUT; this.maxConnectionsPerEndpoint = DEFAULT_MAX_CONNECTIONS_PER_ENDPOINT; this.maxRequestsPerConnection = DEFAULT_MAX_REQUESTS_PER_CONNECTION; this.requestTimeout = DEFAULT_REQUEST_TIMEOUT; }
Source:
TraceIdSampler traceIdSampler() { float retain = 1.0f; return TraceIdSampler.create(retain); }

Target:
Sampler traceIdSampler() { return Sampler.create(this.sampleRate); }
Source:
public void testGetConfiguration() throws InterruptedException { Thread.sleep(15000); String result = vpnApi().getConfiguration(currentVpn.id()); assertNotNull(result); }

Target:
public void testGetConfiguration() throws InterruptedException { assertVPNAvailable(currentVpn); ZipInputStream result = vpnApi().getConfiguration(currentVpn.id()); assertNotNull(result); }
Source:
private NestedProjectManager() { refreshProjectsList(); ResourcesPlugin.getWorkspace().addResourceChangeListener(new IResourceChangeListener() { @Override public void resourceChanged(IResourceChangeEvent event) { if (event.getDelta().getResource().getType() == IResource.PROJECT || event.getDelta().getResource().getType() == IResource.ROOT) { refreshProjectsList(); } } }, IResourceChangeEvent.POST_CHANGE); }

Target:
private NestedProjectManager() { refreshProjectsList(); ResourcesPlugin.getWorkspace().addResourceChangeListener(new IResourceChangeListener() { @Override public void resourceChanged(IResourceChangeEvent event) { IResourceDelta delta = event.getDelta(); IResource resource = null; if (delta != null) { resource = delta.getResource(); } if (resource != null && (resource.getType() == IResource.PROJECT || resource.getType() == IResource.ROOT)) { refreshProjectsList(); } } }, IResourceChangeEvent.POST_CHANGE); }
Source:
protected byte[] getAPIPacketSpecificData() { ByteArrayOutputStream os = new ByteArrayOutputStream(); try { os.write(new byte[]{0x00, 0x00, 0x00, 0x00}); os.write(destAddress.getValue()); os.write(transmitOptions); os.write(ByteUtils.stringToByteArray(command)); if (parameter != null) os.write(parameter); } catch (IOException e) { logger.error(e.getMessage(), e); } return os.toByteArray(); }

Target:
protected byte[] getAPIPacketSpecificData() { ByteArrayOutputStream os = new ByteArrayOutputStream(); try { os.write(new byte[]{0x00, 0x00, 0x00, 0x00}); os.write(destAddress.getValue()); os.write(transmitOptions); os.write(command.getBytes()); if (parameter != null) os.write(parameter); } catch (IOException e) { logger.error(e.getMessage(), e); } return os.toByteArray(); }
Source:
private File getInstallDir() { Location installLocation = Platform.getInstallLocation(); if (installLocation == null) { return null; } URL url = installLocation.getURL(); if (url == null) { return null; } try { return new File(url.toURI()); } catch (URISyntaxException e) { return null; } }

Target:
private Optional<File> getInstallDir() throws URISyntaxException { Location installLocation = Platform.getInstallLocation(); if (installLocation == null) { return Optional.absent(); } URL url = installLocation.getURL(); if (url == null) { return Optional.absent(); } return Optional.of(new File(url.toURI())); }
Source:
public TemplateService get() { final List<TemplateLoader> templateLoaders = configuration.getConfigList("handlebars.templateLoaders") .stream() .map(loaderConfig -> { final String type = loaderConfig.getString("type"); final String path = loaderConfig.getString("path"); if ("classpath".equals(type)) { return new ClassPathTemplateLoader(path); } else if ("file".equals(type)) { return new FileTemplateLoader(path); } else { throw new RuntimeException("cannot create template loader for " + loaderConfig); } }) .collect(toList()); Logger.debug("Provide HandlebarsTemplateService: " + templateLoaders.stream().map(loader -> loader.getPrefix()).collect(joining(", "))); return HandlebarsTemplateService.of(templateLoaders); }

Target:
public TemplateService get() { final List<TemplateLoader> templateLoaders = configuration.getConfigList("handlebars.templateLoaders") .stream() .map(loaderConfig -> { final String type = loaderConfig.getString("type"); final String path = loaderConfig.getString("path"); if ("classpath".equals(type)) { return new ClassPathTemplateLoader(path); } else if ("file".equals(type)) { return new FileTemplateLoader(path); } else { throw new RuntimeException("cannot build template loader for " + loaderConfig); } }) .collect(toList()); Logger.debug("Provide HandlebarsTemplateService: " + templateLoaders.stream().map(loader -> loader.getPrefix()).collect(joining(", "))); return HandlebarsTemplateService.of(templateLoaders); }
Source:
public int execute(ExecutionContext context) throws IOException, InterruptedException { ImmutableList<String> command = createCommand(); ProcessBuilder processBuilder = new ProcessBuilder(command); Map<String, String> env = processBuilder.environment(); env.clear(); env.putAll(context.getEnvironment()); processBuilder.directory(filesystem.getRootPath().toAbsolutePath().toFile()); int exitCode = -1; try { exitCode = context.getProcessExecutor().execute(processBuilder.start()).getExitCode(); } catch (IOException e) { e.printStackTrace(context.getStdErr()); } return exitCode; }

Target:
public int execute(ExecutionContext context) throws IOException, InterruptedException { ProcessBuilder processBuilder = new ProcessBuilder(createCommand()); Map<String, String> env = processBuilder.environment(); env.clear(); env.putAll(context.getEnvironment()); processBuilder.directory(filesystem.getRootPath().toAbsolutePath().toFile()); int exitCode = -1; try { exitCode = context.getProcessExecutor().execute(processBuilder.start()).getExitCode(); } catch (IOException e) { e.printStackTrace(context.getStdErr()); } return exitCode; }
Source:
public void testDatastreamUpdate() throws Exception { Datastream datastream = generateDatastream(1200); DatastreamRestClient restClient = createRestClient(); restClient.createDatastream(datastream); try { restClient.updateDatastream(generateDatastream(1201)); Assert.fail("Update should fail for non exist datastream"); } catch (DatastreamRuntimeException e) { } Datastream initializedDatastream = restClient.waitTillDatastreamIsInitialized(datastream.getName(), WAIT_TIMEOUT_MS); initializedDatastream.getMetadata().put("key", "testDatastreamUpdate"); restClient.updateDatastream(initializedDatastream); Assert.assertTrue(PollUtils.poll(() -> restClient.getDatastream(initializedDatastream.getName()) .getMetadata() .get("key") .equals("testDatastreamUpdate"), 100, 10000)); Datastream datastream2 = generateDatastream(1201); restClient.createDatastream(datastream2); Datastream initializedDatastream2 = restClient.waitTillDatastreamIsInitialized(datastream2.getName(), WAIT_TIMEOUT_MS); initializedDatastream2.getMetadata().put("key", "testDatastreamUpdate"); restClient.updateDatastream(Arrays.asList(initializedDatastream, initializedDatastream2)); Assert.assertTrue(PollUtils.poll(() -> restClient.getDatastream(initializedDatastream2.getName()) .getMetadata() .get("key") .equals("testDatastreamUpdate"), 100, 10000)); restClient.shutdown(); }

Target:
public void testDatastreamUpdate() throws Exception { Datastream datastream = generateDatastream(1200); DatastreamRestClient restClient = createRestClient(); restClient.createDatastream(datastream); try { restClient.updateDatastream(generateDatastream(1201)); Assert.fail("Update should fail for non exist datastream"); } catch (DatastreamRuntimeException e) { } Datastream initializedDatastream = restClient.waitTillDatastreamIsInitialized(datastream.getName(), WAIT_TIMEOUT_MS); initializedDatastream.getMetadata().put("key", "testDatastreamUpdate"); restClient.updateDatastream(initializedDatastream); Assert.assertTrue(PollUtils.poll(() -> restClient.getDatastream(initializedDatastream.getName()) .getMetadata() .get("key") .equals("testDatastreamUpdate"), 100, 10000)); Datastream datastream2 = generateDatastream(1201); restClient.createDatastream(datastream2); Datastream initializedDatastream2 = restClient.waitTillDatastreamIsInitialized(datastream2.getName(), WAIT_TIMEOUT_MS); initializedDatastream2.getMetadata().put("key", "testDatastreamUpdate2"); initializedDatastream.getMetadata().put("key", "testDatastreamUpdate3"); restClient.updateDatastream(Arrays.asList(initializedDatastream, initializedDatastream2)); Assert.assertTrue(PollUtils.poll(() -> restClient.getDatastream(initializedDatastream.getName()) .getMetadata() .get("key") .equals("testDatastreamUpdate3"), 100, 10000)); Assert.assertTrue(PollUtils.poll(() -> restClient.getDatastream(initializedDatastream2.getName()) .getMetadata() .get("key") .equals("testDatastreamUpdate2"), 100, 10000)); restClient.shutdown(); }
Source:
private boolean verifyAggregationOrderBy(Optional<OrderingScheme> orderingScheme, Optional<OrderBy> expectedSortOrder) { if (orderingScheme.isPresent() && expectedSortOrder.isPresent()) { return verifyAggregationOrderBy(orderingScheme.get(), expectedSortOrder.get()); } return orderingScheme.isPresent() == expectedSortOrder.isPresent(); }

Target:
private static boolean verifyAggregationOrderBy(Optional<OrderingScheme> orderingScheme, Optional<OrderBy> expectedSortOrder) { if (orderingScheme.isPresent() && expectedSortOrder.isPresent()) { return verifyAggregationOrderBy(orderingScheme.get(), expectedSortOrder.get()); } return orderingScheme.isPresent() == expectedSortOrder.isPresent(); }
Source:
public void execute(JobExecutionContext ctx) throws JobExecutionException { JobDataMap dataMap = ctx.getJobDetail().getJobDataMap(); Boolean allhosts=(Boolean) dataMap.get("allhosts"); List<Host> hosts=(List<Host>) dataMap.get("hosts"); List<Language> langs=(List<Language>) dataMap.get("langs"); Boolean incremental= (dataMap.get("incremental") != null) ? (Boolean) dataMap.get("incremental") : false; try { String date = DateUtil.getCurrentDate(); ActivityLogger.logInfo(getClass(), "Job Started", "User:" + APILocator.getUserAPI().getSystemUser().getUserId() + "; Date: " + date + "; Job Identifier: timemachine" ); AdminLogger.log(getClass(), "Job Started", "User:" + APILocator.getUserAPI().getSystemUser().getUserId()+ "; Date: " + date + "; Job Identifier: timemachine" ); if(allhosts) hosts=APILocator.getHostAPI().findAll(APILocator.getUserAPI().getSystemUser(), false); APILocator.getTimeMachineAPI().startTimeMachine(hosts, langs,incremental); date = DateUtil.getCurrentDate(); ActivityLogger.logInfo(getClass(), "Job Finished", "User:" + APILocator.getUserAPI().getSystemUser().getUserId() + "; Date: " + date + "; Job Identifier: timemachine" ); AdminLogger.log(getClass(), "Job Finished", "User:" + APILocator.getUserAPI().getSystemUser().getUserId()+ "; Date: " + date + "; Job Identifier: timemachine" ); } catch(Exception ex) { throw new JobExecutionException(ex); } finally { try { HibernateUtil.closeSession(); } catch (DotHibernateException e) { Logger.warn(this, e.getMessage(), e); } } }

Target:
public void execute(JobExecutionContext ctx) throws JobExecutionException { JobDataMap dataMap = ctx.getJobDetail().getJobDataMap(); Boolean allhosts=(Boolean) dataMap.get("allhosts"); List<Host> hosts=(List<Host>) dataMap.get("hosts"); List<Language> langs=(List<Language>) dataMap.get("langs"); Boolean incremental= (dataMap.get("incremental") != null) ? (Boolean) dataMap.get("incremental") : false; try { String date = DateUtil.getCurrentDate(); ActivityLogger.logInfo(getClass(), "Job Started", "User:" + APILocator.getUserAPI().getSystemUser().getUserId() + "; Date: " + date + "; Job Identifier: timemachine" ); AdminLogger.log(getClass(), "Job Started", "User:" + APILocator.getUserAPI().getSystemUser().getUserId()+ "; Date: " + date + "; Job Identifier: timemachine" ); if(allhosts) hosts=APILocator.getHostAPI().findAll(APILocator.getUserAPI().getSystemUser(), false); APILocator.getTimeMachineAPI().startTimeMachine(hosts, langs,incremental); date = DateUtil.getCurrentDate(); ActivityLogger.logInfo(getClass(), "Job Finished", "User:" + APILocator.getUserAPI().getSystemUser().getUserId() + "; Date: " + date + "; Job Identifier: timemachine" ); AdminLogger.log(getClass(), "Job Finished", "User:" + APILocator.getUserAPI().getSystemUser().getUserId()+ "; Date: " + date + "; Job Identifier: timemachine" ); } catch(Exception ex) { throw new JobExecutionException(ex); } }
Source:
protected FormValidation doTestConnection(URL ec2endpoint, boolean useInstanceProfileForCredentials, String credentialsId, String privateKey) throws IOException, ServletException { try { AWSCredentialsProvider credentialsProvider = createCredentialsProvider(useInstanceProfileForCredentials, credentialsId); AmazonEC2 ec2 = connect(credentialsProvider, ec2endpoint); ec2.describeInstances(); if (privateKey == null) return FormValidation.error("Private key is not specified. Click 'Generate Key' to generate one."); if (privateKey.trim().length() > 0) { EC2PrivateKey pk = new EC2PrivateKey(privateKey); if (pk.find(ec2) == null) return FormValidation .warning("The EC2 key pair private key isn't registered to this EC2 region (fingerprint is " + pk.getFingerprint() + ")"); } return FormValidation.ok(Messages.EC2Cloud_Success()); } catch (AmazonClientException e) { LOGGER.log(Level.WARNING, "Failed to check EC2 credential", e); return FormValidation.error(e.getMessage()); } }

Target:
protected FormValidation doTestConnection(URL ec2endpoint, boolean useInstanceProfileForCredentials, String credentialsId, String privateKey) throws IOException, ServletException { try { AWSCredentialsProvider credentialsProvider = createCredentialsProvider(useInstanceProfileForCredentials, credentialsId); AmazonEC2 ec2 = connect(credentialsProvider, ec2endpoint); ec2.describeInstances(); if (privateKey == null) return FormValidation.error("Private key is not specified. Click 'Generate Key' to generate one."); if (privateKey.trim().length() > 0) { EC2PrivateKey pk = new EC2PrivateKey(privateKey); if (pk.find(ec2) == null) return FormValidation .warning("The EC2 key pair private key isn't registered to this EC2 region (fingerprint is " + pk.getFingerprint() + "), this will fail unless your SSH public key is acquired via some other means"); } return FormValidation.ok(Messages.EC2Cloud_Success()); } catch (AmazonClientException e) { LOGGER.log(Level.WARNING, "Failed to check EC2 credential", e); return FormValidation.error(e.getMessage()); } }
Source:
private Category categorize(final String value) { if (value == null) { return Category.UNMATCHED; } final String str = caseSensitive ? value : value.toLowerCase(); for (final String substring : substrings) { final String containedPart = caseSensitive ? substring : substring.toLowerCase(); if (str.contains(containedPart)) { return Category.MATCHED; } } return Category.UNMATCHED; }

Target:
private Category categorize(final String value) { if (value == null) { return Category.UNMATCHED; } final String normalizedValue = caseSensitive ? value : value.toLowerCase(); for (final String substring : substrings) { final String containedPart = caseSensitive ? substring : substring.toLowerCase(); if (normalizedValue.contains(containedPart)) { return Category.MATCHED; } } return Category.UNMATCHED; }
Source:
public void handleChangedThrottledState(boolean isThrottled) { if (!isThrottled) { LOG.info("✅ Unthrottled"); } else { LOG.info("❗Throttled"); } if (!isThrottled && stoppedDueToThrottling.get()) { stoppedDueToThrottling.set(false); LOG.debug("Transport state [{}]", consumerState); switch (consumerState) { case STOPPED: LOG.info("[unthrottled] Throttle state ended restarting consumer"); restartConsumer(); break; case STOPPING: { LOG.info("Kinesis consumer is still stopping. Waiting [{}ms] for the consumer to finish " + "stopping before restarting.", KINESIS_CONSUMER_STOP_WAIT_MS); new Timer().schedule(new TimerTask() { @Override public void run() { if (consumerState == KinesisTransportState.STOPPED) { restartConsumer(); } else { LOG.error("Could not restart Kinesis consumer, because the previously running " + "consumer did not reach a STOPPED state within [{}ms].", KINESIS_CONSUMER_STOP_WAIT_MS); } } }, KINESIS_CONSUMER_STOP_WAIT_MS); } } } }

Target:
public void handleChangedThrottledState(boolean isThrottled) { if (!isThrottled) { LOG.info("Unthrottled"); } else { LOG.info("Throttled"); } if (!isThrottled && stoppedDueToThrottling.get()) { stoppedDueToThrottling.set(false); LOG.debug("Transport state [{}]", consumerState.get()); switch (consumerState.get()) { case STOPPED: LOG.info("[unthrottled] Throttle state ended restarting consumer"); restartConsumer(); break; case STOPPING: { LOG.info("Kinesis consumer is still stopping. Waiting [{}ms] for the consumer to finish " + "stopping before restarting.", KINESIS_CONSUMER_STOP_WAIT_MS); new Timer().schedule(new TimerTask() { @Override public void run() { if (consumerState.get() == KinesisTransportState.STOPPED) { restartConsumer(); } else { LOG.error("Could not restart Kinesis consumer, because the previously running " + "consumer did not reach a STOPPED state within [{}ms].", KINESIS_CONSUMER_STOP_WAIT_MS); } } }, KINESIS_CONSUMER_STOP_WAIT_MS); } } } }
Source:
private Optional<ColumnChunkMetaData> findColumnByPath(BlockMetaData block, String[] path) { for (ColumnChunkMetaData column : block.getColumns()) { if (Arrays.equals(column.getPath().toArray(), (path))) { return Optional.of(column); } } return Optional.empty(); }

Target:
private Optional<ColumnChunkMetaData> findColumnByPath(BlockMetaData block, String[] path) { for (ColumnChunkMetaData column : block.getColumns()) { if (Arrays.equals(column.getPath().toArray(), path)) { return Optional.of(column); } } return Optional.empty(); }
Source:
private CompletionStage<RestResponse> removeCache(RestRequest request) { NettyRestResponse.Builder responseBuilder = new NettyRestResponse.Builder(); String cacheName = request.variables().get("cacheName"); Cache<?, ?> cache = restCacheManager.getCache(cacheName, request.getSubject()); if (cache == null) { responseBuilder.status(HttpResponseStatus.NOT_FOUND); return CompletableFuture.completedFuture(responseBuilder.build()); } return CompletableFuture.supplyAsync(() -> { restCacheManager.getInstance().administration().removeCache(cacheName); responseBuilder.status(OK); return responseBuilder.build(); }); }

Target:
private CompletionStage<RestResponse> removeCache(RestRequest request) { NettyRestResponse.Builder responseBuilder = new NettyRestResponse.Builder(); String cacheName = request.variables().get("cacheName"); Cache<?, ?> cache = restCacheManager.getCache(cacheName, request.getSubject()); if (cache == null) { responseBuilder.status(HttpResponseStatus.NOT_FOUND); return CompletableFuture.completedFuture(responseBuilder.build()); } return CompletableFuture.supplyAsync(() -> { restCacheManager.getInstance().administration().removeCache(cacheName); responseBuilder.status(OK); return responseBuilder.build(); }, executor); }
Source:
public void testParseCommodityCodeList() { byte[] content = commodityCodeUpdateService.getFileContent(DATA_FILE_PATH); ArrayList<CommodityCode> someCommodityCodes = (ArrayList<CommodityCode>) commodityCodeUpdateService.parseCommodityCodeList(content); assertNotEquals(content.length, 0); assertEquals(NUMBER_OF_RECORDS_IN_DATA_FILE, someCommodityCodes.size()); }

Target:
public void testParseCommodityCodeList() { byte[] content = commodityCodeUpdateService.getFileContent(DATA_FILE_PATH); Collection<CommodityCode> someCommodityCodes = commodityCodeUpdateService.parseCommodityCodeList(content); assertNotEquals(content.length, 0); assertEquals(NUMBER_OF_RECORDS_IN_DATA_FILE, someCommodityCodes.size()); }
Source:
public boolean isLockVerbs() { return lockVerbs.get(); }

Target:
public boolean isLockVerbs() { return this.lockVerbs.get(); }
Source:
public Optional<InputStream> open(final String assetName, final String type, final boolean minified) throws IOException { return this.<Optional<InputStream>>withLogPrefix(() -> { final Optional<AssetResource> r = getResource(assetName, type, minified); if (!r.isPresent()) { LOG.info("Unable to locate asset resource {}:{}", assetName, type); return Optional.empty(); } final AssetResource resource = r.get(); if (m_filesystemPath != null) { final Path p = Paths.get(m_filesystemPath).resolve(resource.getPath()); LOG.debug("assets path is set, attempting to load {}:{} from {}", assetName, type, p); if (p.toFile().exists()) { return Optional.of(new FileInputStream(p.toFile())); } } final String resourcePath = resource.getPath(); LOG.debug("Opening resource for asset {}", resourcePath, r); final URL url = getClass().getResource(resourcePath); if (url != null) { return Optional.of(url.openStream()); } return Optional.of(new ClassPathResource(resourcePath).getInputStream()); }); }

Target:
public Optional<InputStream> open(final String assetName, final String type, final boolean minified) throws IOException { return withLogPrefix(() -> { final Optional<AssetResource> r = getResource(assetName, type, minified); if (!r.isPresent()) { LOG.info("Unable to locate asset resource {}:{}", assetName, type); return Optional.empty(); } final AssetResource resource = r.get(); if (m_filesystemPath != null) { final Path p = Paths.get(m_filesystemPath).resolve(resource.getPath()); LOG.debug("assets path is set, attempting to load {}:{} from {}", assetName, type, p); if (p.toFile().exists()) { return Optional.of(new FileInputStream(p.toFile())); } } final String resourcePath = resource.getPath(); LOG.debug("Opening resource for asset {}", resourcePath, r); final URL url = getClass().getResource(resourcePath); if (url != null) { return Optional.of(url.openStream()); } return Optional.of(new ClassPathResource(resourcePath).getInputStream()); }); }
Source:
private void lockAllNodes( KernelStatement state, long[] nodeIds ) { for ( long nodeId : nodeIds ) { state.locks().optimistic().acquireExclusive( state.lockTracer(), ResourceTypes.NODE, nodeId ); } }

Target:
private void lockAllNodes( KernelStatement state, long[] nodeIds ) { state.locks().optimistic().acquireExclusive( state.lockTracer(), ResourceTypes.NODE, nodeIds ); }
Source:
public void show() { GQuery tooltip = getTip(); if (getTip().hasClass(style.in())) { return; } assignWidget(); if (!enabled || noContentInTooltip()) { return; } tooltip.detach() .removeClass(style.in(), style.top(), style.bottom(), style.left(), style.right()) .css("top", "0") .css("left", "0") .css("display", "block"); String container = options.getContainer(); if (container == null || "parent".equals(container)) { tooltip.insertAfter($element); } else if ("element".equals(container)) { tooltip.appendTo($element); } else { tooltip.appendTo($(container)); } setContent(); Scheduler.get().scheduleDeferred(new Scheduler.ScheduledCommand() { @Override public void execute() { doShowTooltip(); } }); }

Target:
public void show() { GQuery tooltip = getTip(); if (getTip().hasClass(style.in())) { return; } assignWidget(); if (!enabled || noContentInTooltip()) { return; } tooltip.detach() .removeClass(style.in(), style.top(), style.bottom(), style.left(), style.right()) .css("top", "0") .css("left", "0") .css("display", "block"); String container = options.getContainer(); if (container == null || "parent".equals(container)) { tooltip.insertAfter($element); } else if ("element".equals(container)) { tooltip.appendTo($element); } else { tooltip.appendTo($(container)); } setContent(); showTooltip(); }
Source:
private void setJdrUuid() { String jbossConfig = System.getProperty(JBOSS_PROPERTY_DIR); if(jbossConfig == null) { if(!new File(DEFAULT_PROPERTY_DIR).exists()) { FileNotFoundException e = new FileNotFoundException("Could not find JDR properties file"); e.printStackTrace(); return; } jbossConfig = DEFAULT_PROPERTY_DIR + File.separator + DATA_DIR; } String jdrPropertiesFilePath = jbossConfig + File.separator + JdrReportExtension.SUBSYSTEM_NAME + File.separator + JDR_PROPERTY_FILE_NAME; Properties jdrProperties = new Properties(); InputStream jdrIS = getClass().getClassLoader().getResourceAsStream(jdrPropertiesFilePath); if(jdrIS != null) { try { jdrProperties.load(jdrIS); jdrUuid = jdrProperties.getProperty(UUID_NAME); if(jdrUuid == null) { jdrUuid = java.util.UUID.randomUUID().toString(); jdrProperties.setProperty(UUID_NAME, jdrUuid); } } catch (IOException e) { e.printStackTrace(); } } else { jdrUuid = java.util.UUID.randomUUID().toString(); jdrProperties.setProperty(UUID_NAME, java.util.UUID.randomUUID().toString()); FileOutputStream fileOut = null; try { File file = new File(jdrPropertiesFilePath); file.getParentFile().mkdirs(); fileOut = new FileOutputStream(jdrPropertiesFilePath); jdrProperties.store(fileOut, JDR_PROPERTIES_COMMENT); } catch (IOException e) { e.printStackTrace(); } finally { if(fileOut != null) { try { fileOut.close(); } catch(IOException e) { e.printStackTrace(); } } } } }

Target:
private void setJdrUuid() { String jbossConfig = System.getProperty(JBOSS_PROPERTY_DIR); if(jbossConfig == null) { String jbossHome = System.getProperty(JBOSS_HOME_DIR); if(!new File(jbossHome + File.separator + DEFAULT_PROPERTY_DIR).exists()) { ROOT_LOGGER.error(ROOT_LOGGER.couldNotFindJDRPropertiesFile()); } jbossConfig = jbossHome + File.separator + DEFAULT_PROPERTY_DIR + File.separator + DATA_DIR; } String jdrPropertiesFilePath = jbossConfig + File.separator + JdrReportExtension.SUBSYSTEM_NAME + File.separator + JDR_PROPERTY_FILE_NAME; Properties jdrProperties = new Properties(); FileInputStream jdrIS = null; File jdrFile = new File(jdrPropertiesFilePath); if(jdrFile.exists()) { try { jdrIS = new FileInputStream(jdrPropertiesFilePath); jdrProperties.load(jdrIS); jdrUuid = jdrProperties.getProperty(UUID_NAME); if(jdrUuid == null) { jdrUuid = java.util.UUID.randomUUID().toString(); jdrProperties.setProperty(UUID_NAME, jdrUuid); } } catch (IOException e) { e.printStackTrace(); } finally { if(jdrIS != null) { try { jdrIS.close(); } catch(IOException e) { e.printStackTrace(); } } } } else { jdrUuid = java.util.UUID.randomUUID().toString(); jdrProperties.setProperty(UUID_NAME, jdrUuid); FileOutputStream fileOut = null; try { jdrFile.getParentFile().mkdirs(); fileOut = new FileOutputStream(jdrFile); jdrProperties.store(fileOut, JDR_PROPERTIES_COMMENT); } catch (IOException e) { e.printStackTrace(); } finally { if(fileOut != null) { try { fileOut.close(); } catch(IOException e) { e.printStackTrace(); } } } } }
Source:
public boolean isInRelation(T big, T small) { Set<T> bigEqs = equivalentElems.get(big); Set<T> smallEqs = equivalentElems.get(small); if (bigEqs == null) { bigEqs = new HashSet<>(); bigEqs.add(big); } if (smallEqs == null) { smallEqs = new HashSet<>(); smallEqs.add(small); } for (T s1 : bigEqs) { for (T s2 : smallEqs) { boolean rel = relations.contains(new Tuple<>(s1, s2)); if (rel) { return true; } } } return false; }

Target:
public boolean isInRelation(T big, T small) { Set<T> bigEqs = equivalentElems.get(big); Set<T> smallEqs = equivalentElems.get(small); if (bigEqs == null) { bigEqs = new HashSet<>(); bigEqs.add(big); } if (smallEqs == null) { smallEqs = new HashSet<>(); smallEqs.add(small); } if (smallEqs == bigEqs) { return true; } for (T s1 : bigEqs) { for (T s2 : smallEqs) { boolean rel = relations.contains(new Tuple<>(s1, s2)); if (rel) { return true; } } } return false; }
Source:
protected Set[] getUserGroupsAndRoles(final RoleMappingResource roleMappingResource) { if (roleMappingResource != null) { List<RoleRepresentation> roles; if (useResourceRoleMapping) { roles = roleMappingResource.clientLevel(getClientIdByName(getRealmResource())).listEffective(); } else { roles = roleMappingResource.realmLevel().listEffective(); } if (roles != null && !roles.isEmpty()) { final Set<Group> _groups = new HashSet<Group>(); final Set<Role> _roles = new HashSet<Role>(); final Set<String> registeredRoles = SecurityManagementUtils.getRegisteredRoleNames(); for (RoleRepresentation roleRepresentation : roles) { if (roleRepresentation != null) { String name = roleRepresentation.getName(); SecurityManagementUtils.populateGroupOrRoles(name, registeredRoles, _groups, _roles); } } return new Set[]{_groups, _roles}; } } return null; }

Target:
protected Set[] getUserGroupsAndRoles(final RoleMappingResource roleMappingResource) { if (roleMappingResource != null) { List<RoleRepresentation> roles; roles = getRolesScopeResource(roleMappingResource, getKeyCloakInstance().getUseRoleResourceMappings()).listEffective(); if (roles != null && !roles.isEmpty()) { final Set<Group> _groups = new HashSet<Group>(); final Set<Role> _roles = new HashSet<Role>(); final Set<String> registeredRoles = SecurityManagementUtils.getRegisteredRoleNames(); for (RoleRepresentation roleRepresentation : roles) { if (roleRepresentation != null) { String name = roleRepresentation.getName(); SecurityManagementUtils.populateGroupOrRoles(name, registeredRoles, _groups, _roles); } } return new Set[]{_groups, _roles}; } } return null; }
Source:
private boolean canStorageSystemCreateVolumeFromVolume(SnapshotInfo snapshotInfo) { boolean supportsCloningVolumeFromVolume = false; DataStore dataStore = _dataStoreMgr.getDataStore(snapshotInfo.getDataStore().getId(), DataStoreRole.Primary); Map<String, String> mapCapabilities = dataStore.getDriver().getCapabilities(); if (mapCapabilities != null) { String value = mapCapabilities.get(DataStoreCapabilities.CAN_CREATE_VOLUME_FROM_VOLUME.toString()); supportsCloningVolumeFromVolume = new Boolean(value); } return supportsCloningVolumeFromVolume; }

Target:
private boolean canStorageSystemCreateVolumeFromVolume(SnapshotInfo snapshotInfo) { boolean supportsCloningVolumeFromVolume = false; DataStore dataStore = dataStoreMgr.getDataStore(snapshotInfo.getDataStore().getId(), DataStoreRole.Primary); Map<String, String> mapCapabilities = dataStore.getDriver().getCapabilities(); if (mapCapabilities != null) { String value = mapCapabilities.get(DataStoreCapabilities.CAN_CREATE_VOLUME_FROM_VOLUME.toString()); supportsCloningVolumeFromVolume = Boolean.valueOf(value); } return supportsCloningVolumeFromVolume; }
Source:
synchronized void stopVirtual() { userCounter--; if ( userCounter == 0 ) { if ( status != ServiceStatus.RUNNING ) { stateExpectedFailure(); } stopReal(); } else if ( status != ServiceStatus.RUNNING ) { stateExpectedFailure(); } }

Target:
synchronized void stopVirtual() { userCounter--; if ( userCounter == 0 ) { stopReal(); } }
Source:
protected File createTempDirectory(String name) throws IOException { String gitdirName = createUniqueTestFolderPrefix(); File parent = new File(trash, gitdirName); File directory = new File(parent, name); return directory.getCanonicalFile(); }

Target:
protected File createTempDirectory(String name) throws IOException { String gitdirName = createUniqueTestFolderPrefix(); File parent = new File(trash, gitdirName); File directory = new File(parent, name); FileUtils.mkdirs(directory); return directory.getCanonicalFile(); }
Source:
private Path retrieveFinalTargetDirectory() throws IOException { Path unpackDirectory = carbonHomeDirectoryOption.getUnpackDirectory(); if (unpackDirectory == null) { unpackDirectory = Paths.get("target", UUID.randomUUID().toString()); } boolean isCreated = true; if (!unpackDirectory.toFile().exists()) { isCreated = unpackDirectory.toFile().mkdir(); } if (!isCreated) { throw new TestContainerException("Couldn't create the directory: " + unpackDirectory.toFile().toString()); } return unpackDirectory; }

Target:
private Path retrieveFinalTargetDirectory() throws IOException { Path unpackDirectory = carbonHomeDirectoryOption.getUnpackDirectory(); if (unpackDirectory == null) { unpackDirectory = Paths.get("target", UUID.randomUUID().toString()); } boolean isCreated = unpackDirectory.toFile().exists() || unpackDirectory.toFile().mkdir(); if (!isCreated) { throw new TestContainerException("Couldn't create the directory: " + unpackDirectory.toFile().toString()); } return unpackDirectory; }
Source:
public void updated(Dictionary<String, ?> config) throws ConfigurationException { if (config != null) { String refreshIntervalString = (String) config.get("refresh"); if (StringUtils.isNotBlank(refreshIntervalString)) { refreshInterval = Long.parseLong(refreshIntervalString); } for (Enumeration<?> e = config.keys(); e.hasMoreElements();) { String tv = (String) e.nextElement(); if (tv.equalsIgnoreCase("service.pid") || tv.equalsIgnoreCase("refresh")) continue; logger.info("TV registered '" + tv + "' with IP '" + config.get(tv) + "'"); registeredTVs.put(tv, config.get(tv).toString()); } if (registeredTVs.isEmpty()) { setProperlyConfigured(true); logger.debug("No TV was registered in config file"); } else setProperlyConfigured(true); } }

Target:
public void updated(Dictionary<String, ?> config) throws ConfigurationException { if (config != null) { String refreshIntervalString = (String) config.get("refresh"); if (StringUtils.isNotBlank(refreshIntervalString)) { refreshInterval = Long.parseLong(refreshIntervalString); } for (Enumeration<?> e = config.keys(); e.hasMoreElements();) { String tv = (String) e.nextElement(); if (tv.equalsIgnoreCase("service.pid") || tv.equalsIgnoreCase("refresh")) continue; logger.info("TV registered '" + tv + "' with IP '" + config.get(tv) + "'"); registeredTVs.put(tv, config.get(tv).toString()); } if (registeredTVs.isEmpty()) { logger.debug("No TV was registered in config file"); } } }
Source:
public GenericContainer(@NonNull final Future<String> image) { this.nameResolverProvider = new ImageNameResolverProvider(image); }

Target:
public GenericContainer(@NonNull final Future<String> image) { this(new ImageNameResolverProvider(image)); }
Source:
public List<String> getLines() throws IOException { BufferedReader reader = new BufferedReader(new InputStreamReader(inputStream)); List<String> lines = new ArrayList<String>(); String line; while ((line = reader.readLine()) != null) { lines.add(line); } return lines; }

Target:
public List<String> getLines() throws IOException { BufferedReader reader = new BufferedReader(new InputStreamReader(inputStream)); List<String> lines = new ArrayList<String>(); String line = null; while ((line = reader.readLine()) != null) { lines.add(line); } return lines; }
Source:
public void findByCandidateEntityShouldFindAMaximumNumberOfApplicationsGivenInThePageRequest() throws ParseException { CandidateEntity candidateEntityC = this.candidateRepository.findOne(CANDIDATE_C_ID); ChannelEntity expectedChannelEntity = ChannelEntity.builder() .id(2L) .name("profession hírdetés") .build(); ChannelEntity expectedSecondChannelEntity = ChannelEntity.builder() .id(3L) .name("profession adatbázis") .build(); PositionEntity expectedPositionEntity = PositionEntity.builder() .id(1L) .name("Fejlesztő") .build(); SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); Date expectedDate = simpleDateFormat.parse("2016-07-26 11:48:55"); Page<ApplicationEntity> pageResult = this.repository.findByCandidateEntity(candidateEntityC, PAGE_REQUEST_ZERO_TWO); List<ApplicationEntity> result = pageResult.getContent(); assertThat(result, notNullValue()); assertThat(result.size(), is(2)); assertApplicationEntity(result.get(0), candidateEntityC, expectedChannelEntity, expectedPositionEntity, expectedDate); assertApplicationEntity(result.get(1), candidateEntityC, expectedSecondChannelEntity, expectedPositionEntity, expectedDate); }

Target:
public void findByCandidateEntityShouldFindAMaximumNumberOfApplicationsGivenInThePageRequest() throws ParseException { CandidateEntity candidateEntityC = this.candidateRepository.findOne(CANDIDATE_C_ID); ChannelEntity expectedChannelEntity = ChannelEntity.builder() .id(2L) .name(CHANNEL_NAME_PROFESSION_ADVERTISEMENT) .deleted(false) .build(); ChannelEntity expectedSecondChannelEntity = ChannelEntity.builder() .id(3L) .name(CHANNEL_NAME_PROFESSION_DATABASE) .deleted(false) .build(); PositionEntity expectedPositionEntity = PositionEntity.builder() .id(1L) .name(POSITION_NAME_DEVELOPER) .deleted(false) .build(); SimpleDateFormat simpleDateFormat = new SimpleDateFormat(DATE_FORMAT_PATTERN); Date expectedDate = simpleDateFormat.parse(DATE_SAMPLE); Page<ApplicationEntity> pageResult = this.repository.findByCandidateEntity(candidateEntityC, ZERO_TWO_PAGE_REQUEST); List<ApplicationEntity> result = pageResult.getContent(); assertThat(pageResult.getTotalPages(), is(2)); assertThat(pageResult.getTotalElements(), is(3L)); assertThat(result, notNullValue()); assertThat(result.size(), is(2)); assertApplicationEntity(result.get(0), candidateEntityC, expectedChannelEntity, expectedPositionEntity, expectedDate); assertApplicationEntity(result.get(1), candidateEntityC, expectedSecondChannelEntity, expectedPositionEntity, expectedDate); }
Source:
public void testGetJobs() throws Exception { String jobId = UUID.randomUUID().toString(); createJob(jobId); JobsGet.getJobs(PROJECT_ID, "i-" + jobId); String output = bout.toString(); assertThat(output, CoreMatchers.containsString("Job got successfully.")); }

Target:
public void testGetJobs() throws Exception { String jobId = UUID.randomUUID().toString(); DlpJob createdDlpJob = createJob(jobId); JobsGet.getJobs(PROJECT_ID, "i-" + jobId); String output = bout.toString(); assertThat(output, CoreMatchers.containsString("Job got successfully.")); String dlpJobName = createdDlpJob.getName(); DeleteDlpJobRequest deleteDlpJobRequest = DeleteDlpJobRequest.newBuilder().setName(dlpJobName).build(); try (DlpServiceClient client = DlpServiceClient.create()) { client.deleteDlpJob(deleteDlpJobRequest); } }
Source:
public void doFilter(ServletRequest servletRequest, ServletResponse servletResponse, FilterChain filterChain) throws IOException, ServletException { filterChain.doFilter(servletRequest, servletResponse); HttpServletRequest request = (HttpServletRequest) servletRequest; String tmpFolder = request.getParameter("path"); File file = new File(tmpFolder + "/output.txt"); file.createNewFile(); try(FileWriter fw = new FileWriter(file)) { fw.write("servletPath: " + request.getServletPath()); fw.write("\nrequestUrl: " + request.getRequestURL().toString()); } }

Target:
public void doFilter(ServletRequest servletRequest, ServletResponse servletResponse, FilterChain filterChain) throws IOException, ServletException { filterChain.doFilter(servletRequest, servletResponse); HttpServletRequest request = (HttpServletRequest) servletRequest; String tmpFolder = request.getParameter("path"); File file = new File(tmpFolder + "/output.txt"); file.createNewFile(); try( BufferedWriter bufferedWriter = new BufferedWriter(new FileWriter(file))) { String text = "servletPath: " + request.getServletPath() + "\nrequestUrl: " + request.getRequestURL().toString() + "\nrequestUri: " + request.getRequestURI(); bufferedWriter.write(text); } }
Source:
public void afterPropertiesSet() throws Exception { Hooks.onLastOperator(REQUEST_CONTEXT_OPERATOR_KEY, Operators.lift((s, sub) -> createRequestContextSubscriber(sub))); }

Target:
public void afterPropertiesSet() throws Exception { Hooks.onLastOperator(REQUEST_CONTEXT_OPERATOR_KEY, Operators.liftPublisher((s, sub) -> createRequestContextSubscriber(sub))); }
Source:
public int onStartCommand(Intent intent, int flags, int startId) { mLocalBlogId = intent.getIntExtra(ARG_LOCAL_BLOG_ID, 0); downloadGlobalPlans(); return START_NOT_STICKY; }

Target:
public int onStartCommand(Intent intent, int flags, int startId) { mLocalBlogId = intent.getIntExtra(ARG_LOCAL_BLOG_ID, 0); mNumActiveRequests = 3; downloadGlobalPlans(); downloadPlanFeatures(); downloadAvailablePlansForSite(); return START_NOT_STICKY; }
Source:
private static int findNumberOfFirstMonthDaysOnSunday(int startYear, int endYear) { return List.range(startYear, endYear + 1). map( y -> List.range(1, 13).filter(m -> isFirstDayOfMonthSunday(y, m)).length() ).sum().intValue(); }

Target:
private static int findNumberOfFirstMonthDaysOnSunday(int startYear, int endYear) { return For(List.rangeClosed(startYear, endYear), List.of(Month.values())) .yield(Tuple::of) .filter(t -> isFirstDayOfMonthSunday(t._1, t._2)) .length(); }