auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>protected String[] customCommandLineValidation() { try { final boolean isBamOrSamOrCramFile = isBamOrSamOrCram(IOUtil.getPath(INPUT)); <START> if (!isBamOrSamOrCramFile && IGNORE_READ_GROUPS) { <END> return new String[]{"The parameter IGNORE_READ_GROUPS can only be used with BAM/SAM/CRAM inputs."}; } if (isBamOrSamOrCramFile && OBSERVED_SAMPLE_ALIAS != null) { return new String[]{"The parameter OBSERVED_SAMPLE_ALIAS can only be used with a VCF input."}; } } catch (IOException e) { e.printStackTrace(); } if (REFERENCE_SEQUENCE == null && INPUT.endsWith(SamReader.Type.CRAM_TYPE.fileExtension())) { return new String[]{"REFERENCE must be provided when using CRAM as input."}; } return super.customCommandLineValidation(); }</code><technical_language>this is becomming silly, change variable fileContainsReads</technical_language>

Target:
protected String[] customCommandLineValidation() { try { final boolean fileContainsReads = fileContainsReads(IOUtil.getPath(INPUT)); if (!fileContainsReads && IGNORE_READ_GROUPS) { return new String[]{"The parameter IGNORE_READ_GROUPS can only be used with BAM/SAM/CRAM inputs."}; } if (fileContainsReads && OBSERVED_SAMPLE_ALIAS != null) { return new String[]{"The parameter OBSERVED_SAMPLE_ALIAS can only be used with a VCF input."}; } } catch (IOException e) { e.printStackTrace(); } if (REFERENCE_SEQUENCE == null && INPUT.endsWith(SamReader.Type.CRAM_TYPE.fileExtension())) { return new String[]{"REFERENCE must be provided when using CRAM as input."}; } return super.customCommandLineValidation(); }
Source:
<code><START> public void testInvalidQuestionNumber() { <END> FeedbackSessionAttributes fs = typicalBundle.feedbackSessions.get("session1InCourse1"); String[] params = new String[] { Const.ParamsNames.COURSE_ID, fs.getCourseId(), Const.ParamsNames.FEEDBACK_SESSION_NAME, fs.getFeedbackSessionName(), Const.ParamsNames.FEEDBACK_QUESTION_TEMPLATE_NUMBER, "6" }; verifyAssumptionFailure(params); modifyParamValue(params, Const.ParamsNames.FEEDBACK_QUESTION_TEMPLATE_NUMBER, "0"); verifyAssumptionFailure(params); modifyParamValue(params, Const.ParamsNames.FEEDBACK_QUESTION_TEMPLATE_NUMBER, "ABC"); try { InstructorFeedbackTemplateQuestionAddAction action = getAction(params); action.executeAndPostProcess(); signalFailureToDetectException(); } catch (NumberFormatException e) { ignoreExpectedException(); } }</code><technical_language>If contains scenarios, ______TS(""); separate them</technical_language>

Target:
public void testInvalidQuestionNumber() { FeedbackSessionAttributes fs = typicalBundle.feedbackSessions.get("session1InCourse1"); ______TS("Input for template question is more than the range"); String[] params = new String[] { Const.ParamsNames.COURSE_ID, fs.getCourseId(), Const.ParamsNames.FEEDBACK_SESSION_NAME, fs.getFeedbackSessionName(), Const.ParamsNames.FEEDBACK_QUESTION_TEMPLATE_NUMBER, "6" }; verifyAssumptionFailure(params); ______TS("Input for template question is lesser than the range"); modifyParamValue(params, Const.ParamsNames.FEEDBACK_QUESTION_TEMPLATE_NUMBER, "0"); verifyAssumptionFailure(params); ______TS("Input for template question is a word"); modifyParamValue(params, Const.ParamsNames.FEEDBACK_QUESTION_TEMPLATE_NUMBER, "ABC"); try { InstructorFeedbackTemplateQuestionAddAction action = getAction(params); action.executeAndPostProcess(); signalFailureToDetectException(); } catch (NumberFormatException e) { ignoreExpectedException(); } }
Source:
<code>private Exception convertThrowableToException(Throwable e) { if (e.getCause() instanceof Exception) { return (Exception) e.getCause(); } else { <START> return new RuntimeException(e); <END> } }</code><technical_language>1. new RuntimeException(e.getCause()) ? 2. this handle if e is IgnoreTransactionRollbackException e.getCause() is null</technical_language>

Target:
private Exception convertThrowableToException(Throwable e) { if (e instanceof Exception) { return (Exception) e; } else { return new RuntimeException(e); } }
Source:
<code>protected int computeGrowthAmount(Material material) { if (!isAdult() && getBreedingFoods().contains(material)) { return Math.abs(getAge() / 10); <START> } else { <END> return 0; } }</code><technical_language>else statement is redundant of return statement</technical_language>

Target:
protected int computeGrowthAmount(Material material) { if (!isAdult() && getBreedingFoods().contains(material)) { return Math.abs(getAge() / 10); } return 0; }
Source:
<code>protected MultivaluedMap<String, String> setRequestHeaders(MultivaluedMap<String, String> headers, OperationResourceInfo ori, boolean formParams, Class<?> bodyClass, Class<?> responseClass) { if (headers.getFirst(HttpHeaders.CONTENT_TYPE) == null) { if (formParams || bodyClass != null && MultivaluedMap.class.isAssignableFrom(bodyClass)) { headers.putSingle(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_FORM_URLENCODED); } else { String ctType = null; List<MediaType> consumeTypes = ori.getConsumeTypes(); if (!consumeTypes.isEmpty() && !consumeTypes.get(0).equals(MediaType.WILDCARD_TYPE)) { ctType = JAXRSUtils.mediaTypeToString(ori.getConsumeTypes().get(0)); } if (ctType != null) { headers.putSingle(HttpHeaders.CONTENT_TYPE, ctType); } } } List<MediaType> accepts = getAccept(headers); if (accepts == null) { <START> List<MediaType> produceTypes = ori.getProduceTypes(); <END> if (responseClass == Void.class || responseClass == Void.TYPE) { accepts = Collections.singletonList(MediaType.WILDCARD_TYPE); } else { boolean produceWildcard = produceTypes.isEmpty() || produceTypes.get(0).equals(MediaType.WILDCARD_TYPE); if (produceWildcard) { accepts = InjectionUtils.isPrimitive(responseClass) ? Collections.singletonList(MediaType.TEXT_PLAIN_TYPE) : Collections.singletonList(MediaType.APPLICATION_XML_TYPE); } else { accepts = produceTypes; } } for (MediaType mt : accepts) { headers.add(HttpHeaders.ACCEPT, JAXRSUtils.mediaTypeToString(mt)); } } return headers; }</code><technical_language>LGTM "produceTypes" in else statement instead</technical_language>

Target:
protected MultivaluedMap<String, String> setRequestHeaders(MultivaluedMap<String, String> headers, OperationResourceInfo ori, boolean formParams, Class<?> bodyClass, Class<?> responseClass) { if (headers.getFirst(HttpHeaders.CONTENT_TYPE) == null) { if (formParams || bodyClass != null && MultivaluedMap.class.isAssignableFrom(bodyClass)) { headers.putSingle(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_FORM_URLENCODED); } else { String ctType = null; List<MediaType> consumeTypes = ori.getConsumeTypes(); if (!consumeTypes.isEmpty() && !consumeTypes.get(0).equals(MediaType.WILDCARD_TYPE)) { ctType = JAXRSUtils.mediaTypeToString(ori.getConsumeTypes().get(0)); } if (ctType != null) { headers.putSingle(HttpHeaders.CONTENT_TYPE, ctType); } } } List<MediaType> accepts = getAccept(headers); if (accepts == null) { if (responseClass == Void.class || responseClass == Void.TYPE) { accepts = Collections.singletonList(MediaType.WILDCARD_TYPE); } else { List<MediaType> produceTypes = ori.getProduceTypes(); boolean produceWildcard = produceTypes.isEmpty() || produceTypes.get(0).equals(MediaType.WILDCARD_TYPE); if (produceWildcard) { accepts = InjectionUtils.isPrimitive(responseClass) ? Collections.singletonList(MediaType.TEXT_PLAIN_TYPE) : Collections.singletonList(MediaType.APPLICATION_XML_TYPE); } else { accepts = produceTypes; } } for (MediaType mt : accepts) { headers.add(HttpHeaders.ACCEPT, JAXRSUtils.mediaTypeToString(mt)); } } return headers; }
Source:
<code>public static String getServicePrincipal(String serviceName, String hostName) throws UnknownHostException { requireNonNull(serviceName, "serviceName is null"); requireNonNull(hostName, "hostName is null"); InetAddress address = InetAddress.getByName(hostName); String fqdn; if (address.getHostName().toLowerCase().startsWith("localhost")) { return getServicePrincipal(serviceName); } fqdn = address.getCanonicalHostName(); <START> return String.format("%s/%s", serviceName, fqdn.toLowerCase(Locale.US)); <END> }</code><technical_language>Static import format</technical_language>

Target:
public static String getServicePrincipal(String serviceName, String hostName) throws UnknownHostException { requireNonNull(serviceName, "serviceName is null"); requireNonNull(hostName, "hostName is null"); InetAddress address = InetAddress.getByName(hostName); String fqdn; if ("localhost".equalsIgnoreCase(address.getHostName())) { return getServicePrincipal(serviceName); } fqdn = address.getCanonicalHostName(); return format("%s/%s", serviceName, fqdn.toLowerCase(Locale.US)); }
Source:
<code>public void initialize(ConfigurableListableBeanFactory configurableListableBeanFactory) throws BeansException { Assert.isInstanceOf(BeanDefinitionRegistry.class, configurableListableBeanFactory, "To use Spring Integration Java DSL the 'beanFactory' has to be an instance of " + "'BeanDefinitionRegistry'. Consider using 'GenericApplicationContext' implementation." ); BeanDefinitionRegistry registry = (BeanDefinitionRegistry) configurableListableBeanFactory; if (!registry.containsBeanDefinition(INTEGRATION_FLOW_BPP_BEAN_NAME)) { registry.registerBeanDefinition(INTEGRATION_FLOW_BPP_BEAN_NAME, new RootBeanDefinition(IntegrationFlowBeanPostProcessor.class)); registry.registerBeanDefinition(INTEGRATION_FLOW_CONTEXT_BEAN_NAME, new RootBeanDefinition(StandardIntegrationFlowContext.class)); } <START> if (!configurableListableBeanFactory.containsBean(INTEGRATION_FLOW_REPLY_PRODUCER_CLEANER_BEAN_NAME)) { <END> registry.registerBeanDefinition(INTEGRATION_FLOW_REPLY_PRODUCER_CLEANER_BEAN_NAME, new RootBeanDefinition(IntegrationFlowDefinition.ReplyProducerCleaner.class)); } }</code><technical_language>this a problem if child context is loaded a class loader</technical_language>

Target:
public void initialize(ConfigurableListableBeanFactory configurableListableBeanFactory) throws BeansException { Assert.isInstanceOf(BeanDefinitionRegistry.class, configurableListableBeanFactory, "To use Spring Integration Java DSL the 'beanFactory' has to be an instance of " + "'BeanDefinitionRegistry'. Consider using 'GenericApplicationContext' implementation." ); BeanDefinitionRegistry registry = (BeanDefinitionRegistry) configurableListableBeanFactory; if (!registry.containsBeanDefinition(INTEGRATION_FLOW_BPP_BEAN_NAME)) { registry.registerBeanDefinition(INTEGRATION_FLOW_BPP_BEAN_NAME, new RootBeanDefinition(IntegrationFlowBeanPostProcessor.class)); registry.registerBeanDefinition(INTEGRATION_FLOW_CONTEXT_BEAN_NAME, new RootBeanDefinition(StandardIntegrationFlowContext.class)); registry.registerBeanDefinition(INTEGRATION_FLOW_REPLY_PRODUCER_CLEANER_BEAN_NAME, new RootBeanDefinition(IntegrationFlowDefinition.ReplyProducerCleaner.class)); } }
Source:
<code>public void canReplaceKeyspace() { <START> CassandraKeyValueServiceConfig newConfig = CassandraKeyValueServiceConfigs.copyWithKeyspace( <END> CONFIG_WITH_KEYSPACE, KEYSPACE); assertThat(newConfig.getKeyspaceOrThrow()).isEqualTo(KEYSPACE); }</code><technical_language>above: if change CONFIG_WITH_KEYSPACE KEYSPACE, fix tests in this class</technical_language>

Target:
public void canReplaceKeyspace() { CassandraKeyValueServiceConfig newConfig = CassandraKeyValueServiceConfigs.copyWithKeyspace( CONFIG_WITH_KEYSPACE, KEYSPACE_2); assertThat(newConfig.getKeyspaceOrThrow()).isEqualTo(KEYSPACE_2); }
Source:
<code>protected boolean validateDestStorage() { <START> if (getParameters().getOperation() == ImageOperation.Move) { <END> if (getImage().isShareable()) { if (getStorageDomain().getStorageType().equals(StorageType.GLUSTERFS)) { return failCanDoAction(VdcBllMessages.ACTION_TYPE_FAILED_CANT_MOVE_SHAREABLE_DISK_TO_GLUSTERFS, String.format("$%1$s %2$s", "diskAlias", getImage().getDiskAlias())); } } } StorageDomainValidator validator = new StorageDomainValidator(getStorageDomain()); return validate(validator.isDomainExistAndActive()) && validate(validator.domainIsValidDestination()); }</code><technical_language>merge 3 IF's 1</technical_language>

Target:
protected boolean validateDestStorage() { StorageDomainValidator validator = new StorageDomainValidator(getStorageDomain()); if (!validate(validator.isDomainExistAndActive()) || !validate(validator.domainIsValidDestination())) { return false; } if (getParameters().getOperation() == ImageOperation.Move && getImage().isShareable() && getStorageDomain().getStorageType().equals(StorageType.GLUSTERFS)) { return failCanDoAction(VdcBllMessages.ACTION_TYPE_FAILED_CANT_MOVE_SHAREABLE_DISK_TO_GLUSTERFS, String.format("$%1$s %2$s", "diskAlias", getImage().getDiskAlias())); } return true; }
Source:
<code>public ClaimMapping getClaimMapping(String claimURI) throws UserStoreException { for (ClaimManagerListener listener : UMListenerServiceComponent .getClaimManagerListeners()) { if (!listener.getClaimMapping(claimURI)) { return null; } } if (claimCache.isInvalid()) { this.claimMapping = getClaimMapFromDB(); } if (claimURI != null) { return claimMapping.get(claimURI); } <START> return null; <END> }</code><technical_language>avoid returning "NULL" here, is root for NPE</technical_language>

Target:
public ClaimMapping getClaimMapping(String claimURI) throws UserStoreException { for (ClaimManagerListener listener : UMListenerServiceComponent .getClaimManagerListeners()) { if (!listener.getClaimMapping(claimURI)) { return null; } } if (claimCache.isInvalid()) { this.claimMapping = getClaimMapFromDB(); } if (claimURI != null) { return claimMapping.get(claimURI); } else { throw new UserStoreException("claimURI value is null."); } }
Source:
<code>public static ProjectBuildType getProjectType(IProject project) { <START> if (isAutoTools(project)) <END> return ProjectBuildType.AUTO_TOOLS; IConfiguration defaultConfiguration = helper_getActiveConfiguration(project); IBuilder builder = defaultConfiguration.getBuilder(); Boolean projIsManaged = builder.isManagedBuildOn(); if (projIsManaged) return ProjectBuildType.MANAGED_MAKEFILE; else return ProjectBuildType.OTHER; }</code><technical_language>Please for if/else/for/etc. block</technical_language>

Target:
public static ProjectBuildType getProjectType(IProject project) { if (isAutoTools(project)) { return ProjectBuildType.AUTO_TOOLS; } IConfiguration defaultConfiguration = helper_getActiveConfiguration(project); IBuilder builder = defaultConfiguration.getBuilder(); Boolean projIsManaged = builder.isManagedBuildOn(); if (projIsManaged) { return ProjectBuildType.MANAGED_MAKEFILE; } else { return ProjectBuildType.OTHER; } }
Source:
<code><START> public void validate(ServerSideConfiguration config) throws ClusterException, TimeoutException { <END> invokeInternal(messageFactory.validateStoreManager(config), false); }</code><technical_language>Is validate a lifecycle a connection thing? this able timeout? If get rid of TimeoutException throw</technical_language>

Target:
public void validate(ServerSideConfiguration config) throws ClusterException { invokeInternal(messageFactory.validateStoreManager(config), false); }
Source:
<code>public static HTable getTable(UserProvider provider, Configuration config, String tableName) throws IOException, InterruptedException { UserGroupInformation ugi; if (provider != null) { ugi = provider.getCurrent().getUGI(); LOG.debug("Current USER for provider: {}", ugi.getUserName()); } else { ugi = UserGroupInformation.getCurrentUser(); LOG.debug("UGI for current USER : {}", ugi.getUserName()); boolean foundHBaseAuthToken = false; for (Token<? extends TokenIdentifier> token : ugi.getTokens()) { LOG.debug("Token in UGI (delegation token): / {}", token.toString(), token.decodeIdentifier().getUser()); if (token.getKind().toString().equals(TOKEN_KIND_HBASE_AUTH_TOKEN)) { LOG.debug("Found HBASE_AUTH_TOKEN - using the token to replace current user."); ugi = token.decodeIdentifier().getUser(); ugi.addToken(token); <START> foundHBaseAuthToken = true; <END> } } if (!foundHBaseAuthToken) { LOG.warn("Can't find HBase auth token in delegation tokens."); } } return ugi.doAs(new PrivilegedExceptionAction<HTable>() { @Override public HTable run() throws IOException { return new HTable(config, tableName); } }); }</code><technical_language>@HeartSaVioR more HBASE_AUTH_TOKEN token for current UGI</technical_language>

Target:
public static HTable getTable(UserProvider provider, Configuration config, String tableName) throws IOException, InterruptedException { UserGroupInformation ugi; if (provider != null) { ugi = provider.getCurrent().getUGI(); LOG.debug("Current USER for provider: {}", ugi.getUserName()); } else { ugi = UserGroupInformation.getCurrentUser(); LOG.debug("UGI for current USER : {}", ugi.getUserName()); boolean foundHBaseAuthToken = false; for (Token<? extends TokenIdentifier> token : ugi.getTokens()) { LOG.debug("Token in UGI (delegation token): / {}", token.toString(), token.decodeIdentifier().getUser()); if (token.getKind().toString().equals(TOKEN_KIND_HBASE_AUTH_TOKEN)) { if (!foundHBaseAuthToken) { LOG.debug("Found HBASE_AUTH_TOKEN - using the token to replace current user."); ugi = token.decodeIdentifier().getUser(); ugi.addToken(token); foundHBaseAuthToken = true; } else { LOG.warn("Found multiple HBASE_AUTH_TOKEN - will use already found token. " + "Please enable DEBUG log level to track delegation tokens."); } } } if (!foundHBaseAuthToken) { LOG.warn("Can't find HBase auth token in delegation tokens."); } } return ugi.doAs(new PrivilegedExceptionAction<HTable>() { @Override public HTable run() throws IOException { return new HTable(config, tableName); } }); }
Source:
<code>public boolean isOnSameDayAs(Timeslot other) { return startDateTime.getYear() == other.startDateTime.getYear() && startDateTime.getDayOfYear() == other.startDateTime.getDayOfYear() && endDateTime.getYear() == other.endDateTime.getYear() <START> && endDateTime.getDayOfYear() == other.endDateTime.getDayOfYear(); <END> }</code><technical_language>startDateTime.toLocalDate().equals(other.startDateTime.toLocalDate()) instead</technical_language>

Target:
public boolean isOnSameDayAs(Timeslot other) { return startDateTime.toLocalDate().equals(other.getStartDateTime().toLocalDate()); }
Source:
<code>public boolean areHubsLinksVisible() { for (WebElement hubLink : hubLinks) { if (!hubLink.isDisplayed()) { return false; } } <START> return true; <END> }</code><technical_language>please provide extra line</technical_language>

Target:
public boolean areHubsLinksVisible() { for (WebElement hubLink : hubsLinks) { if (!hubLink.isDisplayed()) { return false; } } return true; }
Source:
<code>protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); RxPermissions rxPermissions = new RxPermissions(this); rxPermissions.setLogging(true); <START> setContentView(R.layout.activity_main); <END> surfaceView = (SurfaceView) findViewById(R.id.surfaceView); RxView.clicks(findViewById(R.id.enableCamera)) .compose(rxPermissions.ensureEach(Manifest.permission.CAMERA)) .subscribe(new Action1<Permission>() { @Override public void call(Permission permission) { Log.i(TAG, "Permission result " + permission); if (permission.granted) { releaseCamera(); camera = Camera.open(0); try { camera.setPreviewDisplay(surfaceView.getHolder()); camera.startPreview(); } catch (IOException e) { Log.e(TAG, "Error while trying to display the camera preview", e); } } else if (permission.shouldShowRequestPermissionRationale) { Toast.makeText(MainActivity.this, "Denied permission without ask never again", Toast.LENGTH_SHORT).show(); } else { Toast.makeText(MainActivity.this, "Permission denied, can't enable the camera", Toast.LENGTH_SHORT).show(); } } }, new Action1<Throwable>() { @Override public void call(Throwable t) { Log.e(TAG, "onError", t); } }, new Action0() { @Override public void call() { Log.i(TAG, "OnComplete"); } }); }</code><technical_language>Please respect owner naming convention ^^</technical_language>

Target:
protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); RxPermissions rxPermissions = new RxPermissions(this); rxPermissions.setLogging(true); setContentView(R.layout.act_main); surfaceView = (SurfaceView) findViewById(R.id.surfaceView); RxView.clicks(findViewById(R.id.enableCamera)) .compose(rxPermissions.ensureEach(Manifest.permission.CAMERA)) .subscribe(new Action1<Permission>() { @Override public void call(Permission permission) { Log.i(TAG, "Permission result " + permission); if (permission.granted) { releaseCamera(); camera = Camera.open(0); try { camera.setPreviewDisplay(surfaceView.getHolder()); camera.startPreview(); } catch (IOException e) { Log.e(TAG, "Error while trying to display the camera preview", e); } } else if (permission.shouldShowRequestPermissionRationale) { Toast.makeText(MainActivity.this, "Denied permission without ask never again", Toast.LENGTH_SHORT).show(); } else { Toast.makeText(MainActivity.this, "Permission denied, can't enable the camera", Toast.LENGTH_SHORT).show(); } } }, new Action1<Throwable>() { @Override public void call(Throwable t) { Log.e(TAG, "onError", t); } }, new Action0() { @Override public void call() { Log.i(TAG, "OnComplete"); } }); }
Source:
<code>public void run() { try { JsonNode node = JsonUtil.JSON_SERDE.valueToTree( new StatusData( SustainedConnectionWorker.this.totalProducerConnections.get(), SustainedConnectionWorker.this.totalProducerFailedConnections.get(), SustainedConnectionWorker.this.totalConsumerConnections.get(), SustainedConnectionWorker.this.totalConsumerFailedConnections.get(), SustainedConnectionWorker.this.totalMetadataConnections.get(), SustainedConnectionWorker.this.totalMetadataFailedConnections.get(), SustainedConnectionWorker.this.totalAborts.get(), System.currentTimeMillis())); status.update(node); } catch (Exception e) { <START> SustainedConnectionWorker.log.error("Abort while running StatusUpdater", e.getMessage()); <END> WorkerUtils.abort(log, "StatusUpdater", e, doneFuture); } }</code><technical_language>This log error. want public void error(String msg, Throwable t); overload, need change e.getMessage() -> e</technical_language>

Target:
public void run() { try { JsonNode node = JsonUtil.JSON_SERDE.valueToTree( new StatusData( SustainedConnectionWorker.this.totalProducerConnections.get(), SustainedConnectionWorker.this.totalProducerFailedConnections.get(), SustainedConnectionWorker.this.totalConsumerConnections.get(), SustainedConnectionWorker.this.totalConsumerFailedConnections.get(), SustainedConnectionWorker.this.totalMetadataConnections.get(), SustainedConnectionWorker.this.totalMetadataFailedConnections.get(), SustainedConnectionWorker.this.totalAbortedThreads.get(), SustainedConnectionWorker.SYSTEM_TIME.milliseconds())); status.update(node); } catch (Exception e) { SustainedConnectionWorker.log.error("Aborted test while running StatusUpdater", e); WorkerUtils.abort(log, "StatusUpdater", e, doneFuture); } }
Source:
<code>MasterAddressRefresher(Configuration conf, MasterRegistry registry) { pool = Executors.newSingleThreadExecutor(new ThreadFactoryBuilder() .setNameFormat("master-registry-refresh-end-points").setDaemon(true).build()); <START> periodicRefreshMs = 1000 * conf.getLong(PERIODIC_REFRESH_INTERVAL_SECS, <END> PERIODIC_REFRESH_INTERVAL_SECS_DEFAULT); timeBetweenRefreshesMs = 1000 * conf.getLong(MIN_SECS_BETWEEN_REFRESHES, MIN_SECS_BETWEEN_REFRESHES_DEFAULT); Preconditions.checkArgument(periodicRefreshMs > 0); Preconditions.checkArgument(timeBetweenRefreshesMs < periodicRefreshMs); this.registry = registry; pool.submit(new RefreshThread()); }</code><technical_language>I notice this earlier. a [ScheduledThreadPoolExecutor](<LINK_0> simplify scheduling need</technical_language>

Target:
MasterAddressRefresher(Configuration conf, MasterRegistry registry) { pool = Executors.newSingleThreadExecutor(new ThreadFactoryBuilder() .setNameFormat("master-registry-refresh-end-points").setDaemon(true).build()); periodicRefreshMs = TimeUnit.SECONDS.toMillis(conf.getLong(PERIODIC_REFRESH_INTERVAL_SECS, PERIODIC_REFRESH_INTERVAL_SECS_DEFAULT)); timeBetweenRefreshesMs = TimeUnit.SECONDS.toMillis(conf.getLong(MIN_SECS_BETWEEN_REFRESHES, MIN_SECS_BETWEEN_REFRESHES_DEFAULT)); Preconditions.checkArgument(periodicRefreshMs > 0); Preconditions.checkArgument(timeBetweenRefreshesMs < periodicRefreshMs); this.registry = registry; pool.submit(new RefreshThread()); }
Source:
<code>public void unavailable() { <START> JobScheduler.JobHandle handle = profileHandle; <END> if ( handle != null ) { handle.cancel( false ); profileHandle = null; } }</code><technical_language>I benefit of this. obvious is object cancel called set null below</technical_language>

Target:
public synchronized void unavailable() { available = false; if ( jobHandle != null ) { jobHandle.cancel( false ); jobHandle = null; } }
Source:
<code>private void addAndroidCompilerOutputPath( Map<String, Object> androidProperties, IjModule module, Path moduleBasePath) { Optional<Path> compilerOutputPath = module.getCompilerOutputPath(); if (compilerOutputPath.isPresent()) { String fullCompilerOutputPath; <START> String relativeOutputPath = <END> MODULE_DIR + MorePaths.pathWithUnixSeparators( moduleBasePath.relativize(compilerOutputPath.get())); if (compilerOutputPath.get().toString().endsWith(JAR_FILE_EXTENSION)) { fullCompilerOutputPath = JAR_PREFIX + relativeOutputPath + JAR_SUFFIX; } else { fullCompilerOutputPath = FILE_PREFIX + relativeOutputPath; } androidProperties.put("compiler_output_path", fullCompilerOutputPath); } }</code><technical_language>move this functionality IjProjectPaths</technical_language>

Target:
private void addAndroidCompilerOutputPath( Map<String, Object> androidProperties, IjModule module, Path moduleBasePath) { Optional<Path> compilerOutputPath = module.getCompilerOutputPath(); if (compilerOutputPath.isPresent()) { androidProperties.put( "compiler_output_path", IjProjectPaths.toModuleDirRelativeString(compilerOutputPath.get(), moduleBasePath)); } }
Source:
<code>private void initialize() { contentResolver.registerContentObserver(getContentUri(), true, getContentObserver()); Observable<CoreOperation> operationObservable = operationSubject .onBackpressureBuffer() .observeOn(Schedulers.io()) .flatMap(this::createCoreOperation); updateSubscription = groupOperations(operationObservable) .observeOn(Schedulers.computation()) .doOnNext(operations -> Log.v(TAG, "Grouped list of " + operations.size())) <START> .flatMap(this::applyOperations) <END> .subscribe(this::release, error -> Log.e(TAG, "Error while handling data operations!", error)); }</code><technical_language>I this is part of earlier implementation, this a concat map? execution order of batches change, I suppose undesirable</technical_language>

Target:
private void initialize() { contentResolver.registerContentObserver(getContentUri(), true, getContentObserver()); Observable<CoreOperation> operationObservable = operationSubject .onBackpressureBuffer() .observeOn(Schedulers.io()) .flatMap(this::createCoreOperation); updateSubscription = groupOperations(operationObservable) .observeOn(Schedulers.computation()) .doOnNext(operations -> Log.v(TAG, "Grouped list of " + operations.size())) .concatMap(this::applyOperations) .subscribe(this::release, error -> Log.e(TAG, "Error while handling data operations!", error)); }
Source:
<code>private void registerDeleteAction() { registerAction(KEY_DELETE, KeyStroke.getKeyStroke(KEY_DELETE), new JobGraphBindingAction() { @Override public void actionPerformed(final ActionEvent e) { final Set<Object> vertices = _graphContext.getSelectedVertices(); if ((vertices == null) || vertices.isEmpty()) { return; } for (Object vertex : vertices) { final AnalysisJobBuilder analysisJobBuilder = _graphContext.getAnalysisJobBuilder(vertex); if (vertex instanceof TransformerComponentBuilder) { final TransformerComponentBuilder<?> tjb = (TransformerComponentBuilder<?>) vertex; analysisJobBuilder.removeTransformer(tjb); } else if (vertex instanceof AnalyzerComponentBuilder) { final AnalyzerComponentBuilder<?> ajb = (AnalyzerComponentBuilder<?>) vertex; analysisJobBuilder.removeAnalyzer(ajb); } else if (vertex instanceof FilterComponentBuilder) { final FilterComponentBuilder<?, ?> fjb = (FilterComponentBuilder<?, ?>) vertex; analysisJobBuilder.removeFilter(fjb); } else if (vertex instanceof Table) { final Table table = (Table) vertex; analysisJobBuilder.removeSourceTable(table); } else if (vertex instanceof Column) { final Column column = (Column) vertex; analysisJobBuilder.removeSourceColumn(column); } } } }); <START> _component.getInputMap(INPUT_MAP_CONDITION).put(KeyStroke.getKeyStroke(KEY_BACKSPACE), KEY_BACKSPACE); <END> }</code><technical_language>this work? KEY_DELETE action key</technical_language>

Target:
private void registerDeleteAction() { registerAction(KEY_DELETE, KeyStroke.getKeyStroke(KEY_DELETE), new JobGraphBindingAction() { @Override public void actionPerformed(final ActionEvent e) { final Set<Object> vertices = _graphContext.getSelectedVertices(); if ((vertices == null) || vertices.isEmpty()) { return; } for (Object vertex : vertices) { final AnalysisJobBuilder analysisJobBuilder = _graphContext.getAnalysisJobBuilder(vertex); if (vertex instanceof TransformerComponentBuilder) { final TransformerComponentBuilder<?> tjb = (TransformerComponentBuilder<?>) vertex; analysisJobBuilder.removeTransformer(tjb); } else if (vertex instanceof AnalyzerComponentBuilder) { final AnalyzerComponentBuilder<?> ajb = (AnalyzerComponentBuilder<?>) vertex; analysisJobBuilder.removeAnalyzer(ajb); } else if (vertex instanceof FilterComponentBuilder) { final FilterComponentBuilder<?, ?> fjb = (FilterComponentBuilder<?, ?>) vertex; analysisJobBuilder.removeFilter(fjb); } else if (vertex instanceof Table) { final Table table = (Table) vertex; analysisJobBuilder.removeSourceTable(table); } else if (vertex instanceof Column) { final Column column = (Column) vertex; analysisJobBuilder.removeSourceColumn(column); } } } }); _component.getInputMap(INPUT_MAP_CONDITION).put(KeyStroke.getKeyStroke(KEY_BACKSPACE), KEY_DELETE); }
Source:
<code>public static void sortByCreatedDate(List<CourseAttributes> courses) { Collections.sort(courses, new Comparator<CourseAttributes>() { <START> public int compare(CourseAttributes course1, CourseAttributes course2) { <END> if (course1.createdAt.compareTo(course2.createdAt) == 0) { return course1.id.compareTo(course2.id); } return -1 * course1.createdAt.compareTo(course2.createdAt); } }); }</code><technical_language>Create comparator function, in CourseAttributes class instead</technical_language>

Target:
public static void sortByCreatedDate(List<CourseAttributes> courses) { Collections.sort(courses, createdDateComparator); }
Source:
<code>public void reset() { size = 0; growthCount = 0; for (int i = 0; i < maxBuckets; i++) { subHashTableBuffers[0].put(i * bucketSizeWithHash, (byte) 0); <START> subHashTableBuffers[1].put(i * bucketSizeWithHash, (byte) 0); <END> } tableBuffer = subHashTableBuffers[0]; }</code><technical_language>this is needed automatically zeroed out in adjustTableWhenFull(..) needed</technical_language>

Target:
public void reset() { size = 0; growthCount = 0; for (int i = 0; i < maxBuckets; i++) { subHashTableBuffers[0].put(i * bucketSizeWithHash, (byte) 0); } tableBuffer = subHashTableBuffers[0]; }
Source:
<code>private void mergeBranches(ImFunction func) { ControlFlowGraph cfg = new ControlFlowGraph(func.getBody()); for (Node n : cfg.getNodes()) { @Nullable ImStmt stmt = n.getStmt(); if (stmt != null && stmt.getParent() != null && stmt.getParent() instanceof ImIf) { ImIf imIf = (ImIf) stmt.getParent(); if (n.getPredecessors().size() <= 1 && n.getSuccessors().size() == 2) { Node leftStmt = n.getSuccessors().get(0); Node rightStmt = n.getSuccessors().get(1); <START> if (leftStmt.toString().equals(rightStmt.toString())) { <END> if (n.getPredecessors().size() == 1) { if (hasNoSideEffects(n, leftStmt)) { ImStmt mergedStmt = leftStmt.getStmt().copy(); ImIf oldIf = imIf.copy(); oldIf.getThenBlock().get(0).replaceBy(JassIm.ImNull()); oldIf.getElseBlock().get(0).replaceBy(JassIm.ImNull()); imIf.replaceBy(JassIm.ImStatementExpr(JassIm.ImStmts(mergedStmt, oldIf), JassIm.ImNull())); } } } } } } }</code><technical_language>toString in compiler (unless want print something). want is if (leftStmt.getStmt().structuralEquals(rightStmt.getStmt())) {</technical_language>

Target:
private void mergeBranches(ImFunction func) { func.getBody().accept(new Element.DefaultVisitor() { @Override public void visit(ImStmts stmts) { ListIterator<ImStmt> it = stmts.listIterator(); while (it.hasNext()) { ImStmt s = it.next(); if (s instanceof ImIf) { ImIf ifStmt = (ImIf) s; ifStmt.getThenBlock().accept(this); ifStmt.getElseBlock().accept(this); while (!ifStmt.getThenBlock().isEmpty() && !ifStmt.getElseBlock().isEmpty()) { ImStmt firstStmtThen = ifStmt.getThenBlock().get(0); ImStmt firstStmtElse = ifStmt.getElseBlock().get(0); if (firstStmtThen.structuralEquals(firstStmtElse) && !sideEffectAnalyzer.mightAffect(firstStmtThen, ifStmt.getCondition())) { ifStmt.getThenBlock().remove(0); ifStmt.getElseBlock().remove(0); it.previous(); it.add(firstStmtThen); it.next(); branchesMerged++; } else { break; } } } else { s.accept(this); } } } }); }
Source:
<code>private Map<String, Object> resolveArguments(Argument[] arguments) { Map<String, Object> map = new HashMap<String, Object>(); for (Argument arg : arguments) { String key = resolve(arg.name()); <START> if (StringUtils.hasText(key)) { <END> Object value = resolve(arg.value()); Object type = resolve(arg.type()); Class<?> typeClass; String typeName; if (type instanceof Class) { typeClass = (Class<?>) type; typeName = typeClass.getName(); } else { Assert.isTrue(type instanceof String, "type must resolve to a Class or String"); typeName = (String) type; try { typeClass = ClassUtils.forName(typeName, this.beanClassLoader); } catch (Exception e) { throw new IllegalStateException("Could not load class", e); } } if (value.getClass().getName().equals(typeName)) { if (typeClass.equals(String.class) && !StringUtils.hasText((String) value)) { map.put(key, null); } else { map.put(key, value); } } else { Assert.isTrue(value instanceof String, "value must resolve to a String for type conversion"); String valueString = (String) value; if (StringUtils.hasText(valueString)) { map.put(key, PARSER.parseExpression(valueString).getValue(typeClass)); } else { map.put(key, null); } } } } return map.size() < 1 ? null : map; }</code><technical_language>In pursuit of @Argument(name) property, I allow resolve empty String. Although... sense in some cases deploy application environment. WDYT</technical_language>

Target:
private Map<String, Object> resolveArguments(Argument[] arguments) { Map<String, Object> map = new HashMap<String, Object>(); for (Argument arg : arguments) { String key = resolveExpressionAsString(arg.name(), "@Argument.name"); if (StringUtils.hasText(key)) { Object value = resolveExpression(arg.value()); Object type = resolveExpression(arg.type()); Class<?> typeClass; String typeName; if (type instanceof Class) { typeClass = (Class<?>) type; typeName = typeClass.getName(); } else { Assert.isTrue(type instanceof String, "Type must resolve to a Class or String, but resolved to [" + type.getClass().getName() + "]"); typeName = (String) type; try { typeClass = ClassUtils.forName(typeName, this.beanClassLoader); } catch (Exception e) { throw new IllegalStateException("Could not load class", e); } } if (value.getClass().getName().equals(typeName)) { if (typeClass.equals(String.class) && !StringUtils.hasText((String) value)) { map.put(key, null); } else { map.put(key, value); } } else { if (value instanceof String && !StringUtils.hasText((String) value)) { map.put(key, null); } else { if (CONVERSION_SERVICE.canConvert(value.getClass(), typeClass)) { map.put(key, CONVERSION_SERVICE.convert(value, typeClass)); } else { throw new IllegalStateException("Cannot convert from " + value.getClass().getName() + " to " + typeClass); } } } } else { if (this.logger.isDebugEnabled()) { this.logger.debug("@Argument ignored because the name resolved to an empty String"); } } } return map.size() < 1 ? null : map; }
Source:
<code>public void testUnhandledCaughtExceptionSentOnCrashReportEnabled() { Gson gson = new Gson(); String json = gson.toJson(exception); editor.putString(CrashReporter.EXCEPTION_FOR_REPORT, json); <START> editor.commit(); <END> CrashReporter.sendUnhandledCaughtException(); verify(reporter, times(1)).logException(any(Exception.class)); }</code><technical_language>IMO CrashReporter.storeUnhandledException in tests instead</technical_language>

Target:
public void testUnhandledCaughtExceptionSentOnCrashReportEnabled() { CrashReporter.storeUnhandledException(exception); CrashReporter.sendUnhandledCaughtException(); verify(reporter, times(1)).logException(any(Exception.class)); }
Source:
<code>public void shouldThrowOnSendOffsetsToTransactionIfTransactionsNotInitialized() { buildMockProducer(true); <START> producer.sendOffsetsToTransaction(null, ""); <END> }</code><technical_language>this change? sendOffsetsToTransaction able handle null gracefully? a regression if change behavior start fail null</technical_language>

Target:
public void shouldThrowOnSendOffsetsToTransactionIfTransactionsNotInitialized() { buildMockProducer(true); producer.sendOffsetsToTransaction(null, groupId); }
Source:
<code>public boolean isSamePartType(Part part) { return (part instanceof BaArmor) && (isClanTechBase() == part.isClanTechBase()) && (getRefitUnit() == part.getRefitUnit()) <START> && (((BaArmor)part).getType() == getType()); <END> }</code><technical_language>suggestion && (((BaArmor) part).getType() == getType());</technical_language>

Target:
public boolean isSamePartType(Part part) { return (part instanceof BaArmor) && (isClanTechBase() == part.isClanTechBase()) && Objects.equals(getRefitUnit(), part.getRefitUnit()) && (((BaArmor) part).getType() == getType()); }
Source:
<code>private void execute(BlockExecution blockExecution) { CfgBlock block = blockExecution.block(); ProgramState currentState = blockExecution.state(); for (Tree element : block.elements()) { if (element.is(Kind.ASSIGNMENT)) { AssignmentExpressionTree assignment = (AssignmentExpressionTree) element; currentState = store(currentState, assignment.variable(), assignment.expression()); <START> } else if (element.is( <END> Kind.EXPONENT_ASSIGNMENT, Kind.MULTIPLY_ASSIGNMENT, Kind.DIVIDE_ASSIGNMENT, Kind.REMAINDER_ASSIGNMENT, Kind.PLUS_ASSIGNMENT, Kind.MINUS_ASSIGNMENT, Kind.LEFT_SHIFT_ASSIGNMENT, Kind.RIGHT_SHIFT_ASSIGNMENT, Kind.UNSIGNED_RIGHT_SHIFT_ASSIGNMENT, Kind.AND_ASSIGNMENT, Kind.XOR_ASSIGNMENT, Kind.OR_ASSIGNMENT)) { AssignmentExpressionTree assignment = (AssignmentExpressionTree) element; currentState = store(currentState, assignment.variable(), SymbolicValue.UNKNOWN); } else if (element.is( Kind.POSTFIX_DECREMENT, Kind.POSTFIX_INCREMENT, Kind.PREFIX_DECREMENT, Kind.PREFIX_INCREMENT)) { UnaryExpressionTree unary = (UnaryExpressionTree) element; currentState = store(currentState, unary.expression(), SymbolicValue.UNKNOWN); } else if (element.is(Kind.INITIALIZED_BINDING_ELEMENT)) { InitializedBindingElementTree initialized = (InitializedBindingElementTree) element; currentState = store(currentState, initialized.left(), initialized.right()); } } handleSuccessors(block, currentState); }</code><technical_language>@pynicolas WDYT extracting this list? this class level implementation of method more concise</technical_language>

Target:
private void execute(BlockExecution blockExecution) { CfgBlock block = blockExecution.block(); ProgramState currentState = blockExecution.state(); for (Tree element : block.elements()) { if (element.is(Kind.ASSIGNMENT)) { AssignmentExpressionTree assignment = (AssignmentExpressionTree) element; currentState = store(currentState, assignment.variable(), assignment.expression()); } else if (TreeKinds.isAssignment(element)) { AssignmentExpressionTree assignment = (AssignmentExpressionTree) element; currentState = store(currentState, assignment.variable(), SymbolicValue.UNKNOWN); } else if (element.is( Kind.POSTFIX_DECREMENT, Kind.POSTFIX_INCREMENT, Kind.PREFIX_DECREMENT, Kind.PREFIX_INCREMENT)) { UnaryExpressionTree unary = (UnaryExpressionTree) element; currentState = store(currentState, unary.expression(), SymbolicValue.UNKNOWN); } else if (element.is(Kind.INITIALIZED_BINDING_ELEMENT)) { InitializedBindingElementTree initialized = (InitializedBindingElementTree) element; currentState = store(currentState, initialized.left(), initialized.right()); } } handleSuccessors(block, currentState); }
Source:
<code>public static RGB getRGBFromCssString(String cssValue) { try { if (cssValue.startsWith("rgb(") && cssValue.endsWith(")")) { String[] rgbValues = cssValue.substring(4, cssValue.length() - 1).split(","); if (rgbValues.length == 3) { return new RGB(Integer.parseInt(rgbValues[0].trim()), Integer.parseInt(rgbValues[1].trim()), Integer.parseInt(rgbValues[2].trim())); } } throw new E4CssParseException("RGB", cssValue); } catch (NumberFormatException | E4CssParseException e) { <START> if (!loggedError) { <END> StatusHandler.log(new Status(IStatus.ERROR, CommonsUiConstants.ID_PLUGIN, e.getMessage(), e)); loggedError = true; } return null; } }</code><technical_language>extract logOnce method</technical_language>

Target:
public static RGB getRGBFromCssString(String cssValue) { try { if (cssValue.startsWith("rgb(") && cssValue.endsWith(")")) { String[] rgbValues = cssValue.substring(4, cssValue.length() - 1).split(","); if (rgbValues.length == 3) { return new RGB(Integer.parseInt(rgbValues[0].trim()), Integer.parseInt(rgbValues[1].trim()), Integer.parseInt(rgbValues[2].trim())); } } throw new E4CssParseException("RGB", cssValue); } catch (NumberFormatException | E4CssParseException e) { logOnce(e); return null; } }
Source:
<code>public void start() { if (memoryConfiguration.storageType() == StorageType.OFF_HEAP) { <START> minSize = UnpooledOffHeapMemoryAllocator.estimateSizeOverhead(ExpandingOffHeapConcurrentMap.INITIAL_SIZE << 3); <END> currentSize.set(minSize); } listener = this::entriesRemoved; container.addRemovalListener(listener); if (!cacheConfiguration.clustering().cacheMode().isClustered()) { cacheNotifier.addListener(this); } }</code><technical_language>Yeah, a complicated wrote this :)</technical_language>

Target:
public void start() { if (memoryConfiguration.storageType() == StorageType.OFF_HEAP && memoryConfiguration.evictionType() == EvictionType.MEMORY) { minSize = UnpooledOffHeapMemoryAllocator.estimateSizeOverhead(OffHeapConcurrentMap.INITIAL_SIZE << 3); currentSize.set(minSize); } listener = this::entriesRemoved; container.addRemovalListener(listener); if (!cacheConfiguration.clustering().cacheMode().isClustered()) { cacheNotifier.addListener(this); } }
Source:
<code>abstract JsonNode visitInnerNode(final ObjectNode parent, final Path.Element element) throws ScimException; abstract void visitLeafNode(final ObjectNode parent, final Path.Element element) throws ScimException; ArrayNode filterArray(final ArrayNode array, final Filter valueFilter, final boolean removeMatching) throws ScimException { <START> ArrayNode matchingArray = JsonUtils.getJsonNodeFactory().arrayNode(); <END> Iterator<JsonNode> i = array.elements(); while(i.hasNext()) { JsonNode node = i.next(); if(FilterEvaluator.evaluate(valueFilter, node)) { matchingArray.add(node); if(removeMatching) { i.remove(); } } } return matchingArray; }</code><technical_language>nit: unnecessary JsonUtils reference in call static method</technical_language>

Target:
abstract JsonNode visitInnerNode(final ObjectNode parent, final Path.Element element) throws ScimException; abstract void visitLeafNode(final ObjectNode parent, final Path.Element element) throws ScimException; ArrayNode filterArray(final ArrayNode array, final Filter valueFilter, final boolean removeMatching) throws ScimException { ArrayNode matchingArray = getJsonNodeFactory().arrayNode(); Iterator<JsonNode> i = array.elements(); while(i.hasNext()) { JsonNode node = i.next(); if(FilterEvaluator.evaluate(valueFilter, node)) { matchingArray.add(node); if(removeMatching) { i.remove(); } } } return matchingArray; }
Source:
<code>public Mono<String> updateCheckpoint(Checkpoint checkpoint) { if (checkpoint.sequenceNumber() == null && checkpoint.offset() == null) { throw logger.logExceptionAsWarning(Exceptions .propagate(new IllegalStateException( "Both sequence number and offset cannot be null when updating a checkpoint"))); } String partitionId = checkpoint.partitionId(); String blobName = getBlobName(checkpoint.eventHubName(), checkpoint.consumerGroupName(), partitionId); if (!blobClients.containsKey(blobName)) { blobClients.put(blobName, containerAsyncClient.getBlobAsyncClient(blobName)); } Metadata metadata = new Metadata(); <START> String sequenceNumber = checkpoint.sequenceNumber() == null ? null : <END> String.valueOf(checkpoint.sequenceNumber()); metadata.put(SEQUENCE_NUMBER, sequenceNumber); metadata.put(OFFSET, checkpoint.offset()); metadata.put(OWNER_ID, checkpoint.ownerId()); BlobAsyncClient blobAsyncClient = blobClients.get(blobName); BlobAccessConditions blobAccessConditions = new BlobAccessConditions() .modifiedAccessConditions(new ModifiedAccessConditions().ifMatch(checkpoint.eTag())); return blobAsyncClient.setMetadataWithResponse(metadata, blobAccessConditions) .map(response -> response.headers().get(ETAG).value()); }</code><technical_language>this fail checkstyles? I thought : a new line</technical_language>

Target:
public Mono<String> updateCheckpoint(Checkpoint checkpoint) { if (checkpoint.sequenceNumber() == null && checkpoint.offset() == null) { throw logger.logExceptionAsWarning(Exceptions .propagate(new IllegalStateException( "Both sequence number and offset cannot be null when updating a checkpoint"))); } String partitionId = checkpoint.partitionId(); String blobName = getBlobName(checkpoint.eventHubName(), checkpoint.consumerGroupName(), partitionId); if (!blobClients.containsKey(blobName)) { blobClients.put(blobName, containerAsyncClient.getBlobAsyncClient(blobName)); } Metadata metadata = new Metadata(); String sequenceNumber = checkpoint.sequenceNumber() == null ? null : String.valueOf(checkpoint.sequenceNumber()); String offset = checkpoint.offset() == null ? null : String.valueOf(checkpoint.offset()); metadata.put(SEQUENCE_NUMBER, sequenceNumber); metadata.put(OFFSET, offset); metadata.put(OWNER_ID, checkpoint.ownerId()); BlobAsyncClient blobAsyncClient = blobClients.get(blobName); BlobAccessConditions blobAccessConditions = new BlobAccessConditions() .modifiedAccessConditions(new ModifiedAccessConditions().ifMatch(checkpoint.eTag())); return blobAsyncClient.setMetadataWithResponse(metadata, blobAccessConditions) .map(response -> response.headers().get(ETAG).value()); }
Source:
<code><START> public Set<T> getSet() { <END> return set; }</code><technical_language>Minor: is a method, Predicates.asSet(In), exposes set. I purpose of mimic of Ranges.asSet(Range), a static method allow ranges of objects Comparable asSet method a Guava range requires a Comparable type. fine changing this method everywhere, this is more straight-forward. Predicates.asSet(In) In#getSet(), both</technical_language>

Target:
Set<T> getSet() { return set; }
Source:
<code>public void approveSourceRequest(Id id) throws NotFoundException { Optional<SourceRequest> sourceRequest = sourceRequestStore.sourceRequestFor(id); <START> if (sourceRequest.isPresent()) { <END> Application existing = applicationStore.applicationFor(sourceRequest.get().getAppId()).get(); applicationStore.updateApplication( existing.copyWithReadSourceState(sourceRequest.get().getSource(), SourceState.AVAILABLE)); SourceRequest approved = sourceRequest.get().copy().withApproved(true).build(); sourceRequestStore.store(approved); } else { throw new NotFoundException(id); } }</code><technical_language>This a guard statement: if (!present()) { throw exception } ..</technical_language>

Target:
public void approveSourceRequest(Id id) throws NotFoundException { Optional<SourceRequest> sourceRequest = sourceRequestStore.sourceRequestFor(id); if (!sourceRequest.isPresent()) { throw new NotFoundException(id); } Application existing = applicationStore.applicationFor(sourceRequest.get().getAppId()).get(); applicationStore.updateApplication( existing.copyWithReadSourceState(sourceRequest.get().getSource(), SourceState.AVAILABLE)); SourceRequest approved = sourceRequest.get().copy().withApproved(true).build(); sourceRequestStore.store(approved); }