auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>private Set<BucketRegion> setupBucketRegions( PartitionedRegionDataStore partitionedRegionDataStore, BucketAdvisor bucketAdvisor) { final int numBuckets = 2; <START> HashSet<BucketRegion> bucketRegions = new HashSet<>(); <END> for (int i = 0; i < numBuckets; i++) { BucketRegion bucketRegion = mock(BucketRegion.class); when(bucketRegion.getBucketAdvisor()).thenReturn(bucketAdvisor); when(bucketRegion.size()).thenReturn(1); when(bucketRegion.getId()).thenReturn(i); bucketRegions.add(bucketRegion); } when(partitionedRegionDataStore.getAllLocalBucketRegions()).thenReturn(bucketRegions); when(partitionedRegionDataStore.getAllLocalPrimaryBucketRegions()).thenReturn(bucketRegions); return bucketRegions; }</code><technical_language>declaring vars interface instead of impl: Set<BucketRegion> bucketRegions = new HashSet<>();</technical_language>

Target:
private Set<BucketRegion> setupBucketRegions( PartitionedRegionDataStore partitionedRegionDataStore, BucketAdvisor bucketAdvisor) { final int numBuckets = 2; Set<BucketRegion> bucketRegions = new HashSet<>(); for (int i = 0; i < numBuckets; i++) { BucketRegion bucketRegion = mock(BucketRegion.class); when(bucketRegion.getBucketAdvisor()).thenReturn(bucketAdvisor); when(bucketRegion.size()).thenReturn(1); when(bucketRegion.getId()).thenReturn(i); bucketRegions.add(bucketRegion); } when(partitionedRegionDataStore.getAllLocalBucketRegions()).thenReturn(bucketRegions); when(partitionedRegionDataStore.getAllLocalPrimaryBucketRegions()).thenReturn(bucketRegions); return bucketRegions; }
Source:
<code>public void init() { Path trustStorePath = Paths.get(SecurityConstants.getTruststorePath()); if (!trustStorePath.isAbsolute()) { Path ddfHomePath = Paths.get(System.getProperty("ddf.home")); trustStorePath = Paths.get(ddfHomePath.toString(), trustStorePath.toString()); } <START> try (InputStream inputStream = Files.newInputStream(trustStorePath)) { <END> KeyStore trustStore = SecurityConstants.newTruststore(); trustStore.load(inputStream, SecurityConstants.getTruststorePassword().toCharArray()); merlin = new Merlin(); merlin.setKeyStore(trustStore); } catch (KeyStoreException | IOException | NoSuchAlgorithmException | CertificateException e) { LOGGER.warn("Unable to read merlin properties file. Unable to validate certificates.", e); } }</code><technical_language>want add doPrivileged calls InputStream initialization truststore.load below</technical_language>

Target:
public void init() { Path trustStorePath = Paths.get(SecurityConstants.getTruststorePath()); if (!trustStorePath.isAbsolute()) { Path ddfHomePath = Paths.get(System.getProperty("ddf.home")); trustStorePath = Paths.get(ddfHomePath.toString(), trustStorePath.toString()); } try (InputStream inputStream = Files.newInputStream(trustStorePath)) { KeyStore trustStore = SecurityConstants.newTruststore(); trustStore.load(inputStream, SecurityConstants.getTruststorePassword().toCharArray()); merlin = new Merlin(); merlin.setKeyStore(trustStore); } catch (KeyStoreException | IOException | NoSuchAlgorithmException | CertificateException e) { LOGGER.warn("Unable to read merlin properties file. Unable to validate certificates.", e); } Init.init(); }
Source:
<code>private void writeLastModified(String group) { if (readOnlyMode) { throw new ReadOnlyModeException(); } try { byte[] bytes = objectMapper.writeValueAsBytes( Collections.singletonMap("lastModified", System.currentTimeMillis())); ObjectMetadata objectMetadata = new ObjectMetadata(); objectMetadata.setContentLength(bytes.length); objectMetadata.setContentMD5( new String(org.apache.commons.codec.binary.Base64.encodeBase64(DigestUtils.md5(bytes)))); if (serverSideEncryption != null <START> && serverSideEncryption.toString().equalsIgnoreCase("AES256")) { <END> objectMetadata.setSSEAlgorithm(ObjectMetadata.AES_256_SERVER_SIDE_ENCRYPTION); } else if (serverSideEncryption != null && serverSideEncryption.toString().equalsIgnoreCase("AWSKMS")) { objectMetadata.setSSEAlgorithm(SSEAlgorithm.KMS.getAlgorithm()); } amazonS3.putObject( bucket, buildTypedFolder(rootFolder, group) + "/last-modified.json", new ByteArrayInputStream(bytes), objectMetadata); } catch (JsonProcessingException e) { throw new IllegalStateException(e); } }</code><technical_language>serverSideEncryption is instance of Enum simply do serverSideEncryption.equals(ServerSideEncryption.AES256)</technical_language>

Target:
private void writeLastModified(String group) { if (readOnlyMode) { throw new ReadOnlyModeException(); } try { byte[] bytes = objectMapper.writeValueAsBytes( Collections.singletonMap("lastModified", System.currentTimeMillis())); ObjectMetadata objectMetadata = new ObjectMetadata(); objectMetadata.setContentLength(bytes.length); objectMetadata.setContentMD5( new String(org.apache.commons.codec.binary.Base64.encodeBase64(DigestUtils.md5(bytes)))); if (serverSideEncryption != null && serverSideEncryption.equals(ServerSideEncryption.AES256)) { objectMetadata.setSSEAlgorithm(ObjectMetadata.AES_256_SERVER_SIDE_ENCRYPTION); } else if (serverSideEncryption != null && serverSideEncryption.equals(ServerSideEncryption.AWSKMS)) { objectMetadata.setSSEAlgorithm(SSEAlgorithm.KMS.getAlgorithm()); } amazonS3.putObject( bucket, buildTypedFolder(rootFolder, group) + "/last-modified.json", new ByteArrayInputStream(bytes), objectMetadata); } catch (JsonProcessingException e) { throw new IllegalStateException(e); } }
Source:
<code>protected HttpConnection httpOpen(String method, URL u) throws IOException { final Proxy proxy = HttpSupport.proxyFor(proxySelector, u); HttpConnection conn = connectionFactory.create(u, proxy); if (!http.sslVerify && "https".equals(u.getProtocol())) { disableSslVerify(conn); } conn.setRequestMethod(method); conn.setUseCaches(false); conn.setRequestProperty(HDR_ACCEPT_ENCODING, ENCODING_GZIP); conn.setRequestProperty(HDR_PRAGMA, "no-cache"); conn.setRequestProperty(HDR_USER_AGENT, userAgent); int timeOut = getTimeout(); if (timeOut != -1) { int effTimeOut = timeOut * 1000; conn.setConnectTimeout(effTimeOut); conn.setReadTimeout(effTimeOut); } if (this.headers != null && !this.headers.isEmpty()) { <START> for (Iterator iterator = this.headers.keySet().iterator(); iterator <END> .hasNext();) { String key = (String) iterator.next(); String value = this.headers.get(key); conn.setRequestProperty(key, value); } } authMethod.configureRequest(conn); return conn; }</code><technical_language>for(Map.Entry<String, String> entry : this.headers.entrySet()) need additional map lookup for</technical_language>

Target:
protected HttpConnection httpOpen(String method, URL u) throws IOException { final Proxy proxy = HttpSupport.proxyFor(proxySelector, u); HttpConnection conn = connectionFactory.create(u, proxy); if (!http.sslVerify && "https".equals(u.getProtocol())) { disableSslVerify(conn); } conn.setRequestMethod(method); conn.setUseCaches(false); conn.setRequestProperty(HDR_ACCEPT_ENCODING, ENCODING_GZIP); conn.setRequestProperty(HDR_PRAGMA, "no-cache"); conn.setRequestProperty(HDR_USER_AGENT, userAgent); int timeOut = getTimeout(); if (timeOut != -1) { int effTimeOut = timeOut * 1000; conn.setConnectTimeout(effTimeOut); conn.setReadTimeout(effTimeOut); } if (this.headers != null && !this.headers.isEmpty()) { for (Map.Entry<String, String> entry : this.headers.entrySet()) { conn.setRequestProperty(entry.getKey(), entry.getValue()); } } authMethod.configureRequest(conn); return conn; }
Source:
<code>private long readLong() { try { long val = dataInput.readLong(); <START> totalBytesRead += Long.SIZE >> 3; <END> return val; } catch (IOException e) { throw new ClientConnectionException(e); } }</code><technical_language>a constant Long.BYTES fit here</technical_language>

Target:
private long readLong() { try { long val = dataInput.readLong(); totalBytesRead += Long.BYTES; return val; } catch (IOException e) { throw handleIOError(e); } }
Source:
<code>public boolean isExpired(Date invocationDate) { if (getExpires() != null) { Date currentInvocationDate = invocationDate == null ? new Date() : invocationDate; <START> return getExpires().before(currentInvocationDate); <END> } return false; }</code><technical_language>Statement rewritten inline</technical_language>

Target:
public boolean isExpired(Date invocationDate) { if (getExpires() != null) { return getExpires().before(invocationDate == null ? new Date() : invocationDate); } return false; }
Source:
<code>protected void validateJob() { if( validateJob != null ) { validateJob.cancel(); } <START> validateJob = new Job("Validate Wizard"){ END> protected IStatus run(IProgressMonitor monitor) { Display.getDefault().asyncExec(new Runnable(){ @Override public void run() { validate(); }}); return Status.OK_STATUS; } }; validateJob.setSystem(true); validateJob.schedule(1200); }</code><technical_language>wizard is validation in name, do think</technical_language>

Target:
protected void validateJob() { if (validateJob != null) { validateJob.cancel(); } setComplete(false); handle.update(); validateJob = new Job("Validate JMX Connection Wizard") { protected IStatus run(IProgressMonitor monitor) { Display.getDefault().asyncExec(new Runnable() { @Override public void run() { validate(); } }); return Status.OK_STATUS; } }; validateJob.setSystem(true); validateJob.schedule(750); }
Source:
<code>private void saveWorkflowTask(final WorkflowProcessor processor) throws DotDataException { WorkflowTask task = processor.getTask(); if (null == task) { task = new WorkflowTask(); } <START> Role r = roleAPI.getUserRole(processor.getUser()); <END> if (task.isNew()) { DotPreconditions.isTrue(UtilMethods.isSet(processor.getContentlet().getIdentifier()), () -> getWorkflowContentNeedsBeSaveMessage(processor.getUser()), DotWorkflowException.class); task.setCreatedBy(r.getId()); task.setWebasset(processor.getContentlet().getIdentifier()); task.setLanguageId(processor.getContentlet().getLanguageId()); if (processor.getWorkflowMessage() != null) { task.setDescription(processor.getWorkflowMessage()); } } task.setTitle(processor.getContentlet().getTitle()); task.setModDate(new Date()); if (processor.getNextAssign() != null) { task.setAssignedTo(processor.getNextAssign().getId()); } task.setStatus(processor.getNextStep().getId()); saveWorkflowTask(task, processor); if (processor.getWorkflowMessage() != null) { WorkflowComment comment = new WorkflowComment(); comment.setComment(processor.getWorkflowMessage()); comment.setWorkflowtaskId(task.getId()); comment.setCreationDate(new Date()); comment.setPostedBy(r.getId()); saveComment(comment); } }</code><technical_language>rename role set final</technical_language>

Target:
private void saveWorkflowTask(final WorkflowProcessor processor) throws DotDataException { WorkflowTask task = processor.getTask(); if (null == task) { task = new WorkflowTask(); } final Role r = roleAPI.getUserRole(processor.getUser()); if (task.isNew()) { DotPreconditions.isTrue(UtilMethods.isSet(processor.getContentlet().getIdentifier()), () -> getWorkflowContentNeedsBeSaveMessage(processor.getUser()), DotWorkflowException.class); task.setCreatedBy(r.getId()); task.setWebasset(processor.getContentlet().getIdentifier()); task.setLanguageId(processor.getContentlet().getLanguageId()); if (processor.getWorkflowMessage() != null) { task.setDescription(processor.getWorkflowMessage()); } } task.setTitle(processor.getContentlet().getTitle()); task.setModDate(new Date()); if (processor.getNextAssign() != null) { task.setAssignedTo(processor.getNextAssign().getId()); } task.setStatus(processor.getNextStep().getId()); saveWorkflowTask(task, processor); if (processor.getWorkflowMessage() != null) { WorkflowComment comment = new WorkflowComment(); comment.setComment(processor.getWorkflowMessage()); comment.setWorkflowtaskId(task.getId()); comment.setCreationDate(new Date()); comment.setPostedBy(r.getId()); saveComment(comment); } }
Source:
<code>void init() { assignColors(); channelTabScrollPaneVBox.setMinWidth(preferencesService.getPreferences().getChatPrefs().getChannelTabScrollPaneWidth()); channelTabScrollPaneVBox.setPrefWidth(preferencesService.getPreferences().getChatPrefs().getChannelTabScrollPaneWidth()); <START> } <END></code><technical_language>If I a listener splitpane updates this setting split position is remembred, I say: Cool! I if this is unfinished if useless :P</technical_language>

Target:
void init() { channelTabScrollPaneVBox.setMinWidth(preferencesService.getPreferences().getChat().getChannelTabScrollPaneWidth()); channelTabScrollPaneVBox.setPrefWidth(preferencesService.getPreferences().getChat().getChannelTabScrollPaneWidth()); addChatColorListener(); }
Source:
<code><START> public ExclusionListFilter(Iterable<String> excludedUris, Iterable<String> excludedIds) { <END> this.excludedUris = ImmutableSet.copyOf(excludedUris); this.excludedIds = ImmutableSet.copyOf(excludedIds); this.codec = SubstitutionTableNumberCodec.lowerCaseOnly(); }</code><technical_language>convert private constructor a static create method</technical_language>

Target:
private ExclusionListFilter(Iterable<String> excludedUris, Iterable<String> excludedIds) { this.excludedUris = ImmutableSet.copyOf(excludedUris); this.excludedIds = ImmutableSet.copyOf(excludedIds); this.codec = SubstitutionTableNumberCodec.lowerCaseOnly(); }
Source:
<code>public List<LinkAddress> getInternalAddresses() { return <START> mInternalAddressList; <END> }</code><technical_language>I done "return Collections.unmodifiableList(mInternalAddressList)". applies #getInternalDnsServers</technical_language>

Target:
public List<LinkAddress> getInternalAddresses() { return Collections.unmodifiableList(mInternalAddressList); }
Source:
<code>public void makeCatalog(TabInfoImpl ti,SchemaDescriptor sd, TransactionController tc,ColumnOrdering[] columnOrder, String version) throws StandardException{ DataDescriptorGenerator ddg=getDataDescriptorGenerator(); Properties heapProperties=new Properties(); heapProperties.setProperty("tableDisplayName", ti.getTableName()); if (version != null) { heapProperties.setProperty("catalogVersion", version); } ti.setHeapConglomerate( createConglomerate( tc, ti.getCatalogRowFactory().makeEmptyRowForLatestVersion(), heapProperties, columnOrder, <START> 100) <END> ); if(ti.getNumberOfIndexes()>0){ bootStrapSystemIndexes(sd,tc,ddg,ti); } addSystemTableToDictionary(ti,sd,tc,ddg); }</code><technical_language>Constant enum instead</technical_language>

Target:
public void makeCatalog(TabInfoImpl ti,SchemaDescriptor sd, TransactionController tc,ColumnOrdering[] columnOrder, String version) throws StandardException{ DataDescriptorGenerator ddg=getDataDescriptorGenerator(); Properties heapProperties=new Properties(); heapProperties.setProperty("tableDisplayName", ti.getTableName()); if (version != null) { heapProperties.setProperty("catalogVersion", version); } ti.setHeapConglomerate( createConglomerate( tc, ti.getCatalogRowFactory().makeEmptyRowForLatestVersion(), heapProperties, columnOrder, Conglomerate.Priority.HIGH) ); if(ti.getNumberOfIndexes()>0){ bootStrapSystemIndexes(sd,tc,ddg,ti); } addSystemTableToDictionary(ti,sd,tc,ddg); }
Source:
<code>private Metacard getWorkspaceMetacard(String queryId) { Filter filter = filterBuilder.allOf(getWorkspaceQueryFilters(queryId)); <START> Query query = new QueryImpl(filter); <END> QueryRequest queryRequest = new QueryRequestImpl(query); Metacard workspaceMetacard = null; try { QueryResponse queryResponse = catalogFramework.query(queryRequest); workspaceMetacard = queryResponse .getResults() .stream() .map(Result::getMetacard) .filter(Objects::nonNull) .findFirst() .orElse(null); } catch (UnsupportedQueryException | SourceUnavailableException | FederationException e) { LOGGER.debug("Error querying for query id: {}.", queryId, e); } return workspaceMetacard; }</code><technical_language>this return 250 default</technical_language>

Target:
private Metacard getWorkspaceMetacard(String queryId) { Query query = new QueryImpl(getWorkspaceQueryFilters(queryId)); QueryRequest queryRequest = new QueryRequestImpl(query); List<Result> resultList = ResultIterable.resultIterable(catalogFramework::query, queryRequest) .stream() .collect(Collectors.toList()); return resultList .stream() .map(Result::getMetacard) .filter(Objects::nonNull) .findFirst() .orElse(null); }
Source:
<code>private void evalState() { if (done) { txtInteractiveMessages.setText(Localization.get("mult.install.state.done")); this.transplantStyle(txtInteractiveMessages, R.layout.template_text_notification); btnInstallMultimedia.setEnabled(false); return; } String location = editFileLocation.getText().toString(); if ("".equals(location)) { txtInteractiveMessages.setText(Localization.get("mult.install.state.empty")); this.transplantStyle(txtInteractiveMessages, R.layout.template_text_notification); btnInstallMultimedia.setEnabled(false); return; } <START> if (!(location.startsWith("content://") || (new File(location)).exists())) { <END> txtInteractiveMessages.setText(Localization.get("mult.install.state.invalid.path")); this.transplantStyle(txtInteractiveMessages, R.layout.template_text_notification_problem); btnInstallMultimedia.setEnabled(false); } else { txtInteractiveMessages.setText(Localization.get("mult.install.state.ready")); this.transplantStyle(txtInteractiveMessages, R.layout.template_text_notification); btnInstallMultimedia.setEnabled(true); } }</code><technical_language>request distribute negation</technical_language>

Target:
private void evalState() { if (done) { txtInteractiveMessages.setText(Localization.get("mult.install.state.done")); this.transplantStyle(txtInteractiveMessages, R.layout.template_text_notification); btnInstallMultimedia.setEnabled(false); return; } String location = editFileLocation.getText().toString(); if ("".equals(location)) { txtInteractiveMessages.setText(Localization.get("mult.install.state.empty")); this.transplantStyle(txtInteractiveMessages, R.layout.template_text_notification); btnInstallMultimedia.setEnabled(false); return; } if (!location.startsWith("content://") && !(new File(location)).exists()) { txtInteractiveMessages.setText(Localization.get("mult.install.state.invalid.path")); this.transplantStyle(txtInteractiveMessages, R.layout.template_text_notification_problem); btnInstallMultimedia.setEnabled(false); } else { txtInteractiveMessages.setText(Localization.get("mult.install.state.ready")); this.transplantStyle(txtInteractiveMessages, R.layout.template_text_notification); btnInstallMultimedia.setEnabled(true); } }
Source:
<code>public boolean isAlive() { return this == <START> HostJobStatus.running <END> || this == HostJobStatus.pending; }</code><technical_language>qualify HostJobStatus: return this == running || this == pending</technical_language>

Target:
public boolean isAlive() { return this == running || this == pending; }
Source:
<code>public void testWaitForEventsTimesOutIfMasterBusy() { final AtomicBoolean keepSubmittingTasks = new AtomicBoolean(true); final ClusterService clusterService = internalCluster().getInstance(ClusterService.class, internalCluster().getMasterName()); <START> clusterService.submitStateUpdateTask("looping task", new ClusterStateUpdateTask(Priority.LOW) { <END> @Override public ClusterState execute(ClusterState currentState) { return currentState; } @Override public void onFailure(String source, Exception e) { throw new AssertionError(source, e); } @Override public void clusterStateProcessed(String source, ClusterState oldState, ClusterState newState) { if (keepSubmittingTasks.get()) { clusterService.submitStateUpdateTask("looping task", this); } } }); final ClusterHealthResponse clusterHealthResponse = client().admin().cluster().prepareHealth() .setWaitForEvents(Priority.LANGUID) .setTimeout(TimeValue.timeValueSeconds(1)).get(TimeValue.timeValueSeconds(30)); assertTrue(clusterHealthResponse.isTimedOut()); keepSubmittingTasks.set(false); }</code><technical_language>a PlainActionFuture<Void> resolve if keepSubmittingTasks.get() is false failure. .get() end of test leak update task test time? (also I get some strange test failures that, set false for submitting, leak task, get onFailure shut cluster test?)</technical_language>

Target:
public void testWaitForEventsTimesOutIfMasterBusy() { final AtomicBoolean keepSubmittingTasks = new AtomicBoolean(true); final ClusterService clusterService = internalCluster().getInstance(ClusterService.class, internalCluster().getMasterName()); final PlainActionFuture<Void> completionFuture = new PlainActionFuture<>(); clusterService.submitStateUpdateTask("looping task", new ClusterStateUpdateTask(Priority.LOW) { @Override public ClusterState execute(ClusterState currentState) { return currentState; } @Override public void onFailure(String source, Exception e) { completionFuture.onFailure(e); throw new AssertionError(source, e); } @Override public void clusterStateProcessed(String source, ClusterState oldState, ClusterState newState) { if (keepSubmittingTasks.get()) { clusterService.submitStateUpdateTask("looping task", this); } else { completionFuture.onResponse(null); } } }); try { final ClusterHealthResponse clusterHealthResponse = client().admin().cluster().prepareHealth() .setWaitForEvents(Priority.LANGUID) .setTimeout(TimeValue.timeValueSeconds(1)) .get(TimeValue.timeValueSeconds(30)); assertTrue(clusterHealthResponse.isTimedOut()); } finally { keepSubmittingTasks.set(false); completionFuture.actionGet(TimeValue.timeValueSeconds(30)); } }
Source:
<code>public void loadNextPage() { <START> if (currentPage == 0 && objects.size() == 0 && runningQueries.size() == 0) { <END> loadObjects(0, false); } else { loadObjects(currentPage + 1, false); } }</code><technical_language>Is chance for conditions, some of true others false</technical_language>

Target:
public void loadNextPage() { if (objects.size() == 0 && runningQueries.size() == 0) { loadObjects(0, false); } else { loadObjects(currentPage + 1, false); } }
Source:
<code><START> private Service createService() { <END> return new Service() { @Override public String getId() { return "serviceid"; } }; }</code><technical_language>remove, similar functionality in CoreAuthenticationTestUtils</technical_language>

Target:
private Service createService() { return CoreAuthenticationTestUtils.getService("serviceid"); }
Source:
<code>public LightblueHttpClient(LightblueClientConfiguration configuration) { this(configuration, DEFAULT_MAPPER); <START> } <END></code><technical_language>In #64 I moved this constant LightblueResponse thinking a single default mapper defined individual classes defining own. a more centralized location better? Thoughts</technical_language>

Target:
public LightblueHttpClient(LightblueClientConfiguration configuration) { this(configuration, JSON.getDefaultObjectMapper()); }
Source:
<code>public void test303(Scenario scenario) throws Exception { start(scenario, new RedirectHandler()); Response response = client.newRequest("localhost", connector.getLocalPort()) .scheme(scenario.getScheme()) .path("/303/localhost/done") .timeout(5, TimeUnit.SECONDS) .send(); assertNotNull(response); assertEquals(200, response.getStatus()); <START> assertFalse(response.getHeaders().contains(HttpHeader.LOCATION.asString())); <END> }</code><technical_language>replaced containsKey() contains(), remove .asString() in this class, contains() takes a HttpHeader</technical_language>

Target:
public void test303(Scenario scenario) throws Exception { start(scenario, new RedirectHandler()); Response response = client.newRequest("localhost", connector.getLocalPort()) .scheme(scenario.getScheme()) .path("/303/localhost/done") .timeout(5, TimeUnit.SECONDS) .send(); assertNotNull(response); assertEquals(200, response.getStatus()); assertFalse(response.getHeaders().contains(HttpHeader.LOCATION)); }
Source:
<code>public FeatureTypeStyle transform(MBStyle styleContext, Double minScaleDenominator, Double maxScaleDenominator) { <START> FeatureTypeStyle style = transform(styleContext); <END> for (Rule rule : style.rules()) { if (minScaleDenominator != null) { rule.setMinScaleDenominator(minScaleDenominator); } if (maxScaleDenominator != null) { rule.setMaxScaleDenominator(maxScaleDenominator); } } return style; }</code><technical_language>This return null if layer visibility = false</technical_language>

Target:
public FeatureTypeStyle transform(MBStyle styleContext, Double minScaleDenominator, Double maxScaleDenominator) { FeatureTypeStyle style = transform(styleContext); if (style == null) { return null; } for (Rule rule : style.rules()) { if (minScaleDenominator != null) { rule.setMinScaleDenominator(minScaleDenominator); } if (maxScaleDenominator != null) { rule.setMaxScaleDenominator(maxScaleDenominator); } } return style; }
Source:
<code>public Iterable<Edge> getEdges(Direction direction, String label, FetchHints fetchHints, Authorizations authorizations) { <START> getFetchHints().validateHasEdgeFetchHints(direction); <END> return getGraph().getEdges(getEdgeIds(direction, labelToArrayOrNull(label), authorizations), fetchHints, authorizations); }</code><technical_language>need a new method FetchHints.validateHasEdgeFetchHints(Direction, Label...)</technical_language>

Target:
public Iterable<Edge> getEdges(Direction direction, String label, FetchHints fetchHints, Authorizations authorizations) { getFetchHints().validateHasEdgeFetchHints(direction, label); return getGraph().getEdges(getEdgeIds(direction, labelToArrayOrNull(label), authorizations), fetchHints, authorizations); }
Source:
<code>private Set<Integer> segmentsToProcess(IteratorSupplier<R> supplier, KeyTrackingConsumer<Object, R> results, Set<Integer> segmentsToProcess, UUID id) { <START> String strId = id == null ? "local" : "identifier " + id; <END> if (!results.lostSegments.isEmpty()) { segmentsToProcess = new HashSet<>(results.lostSegments); results.lostSegments.clear(); log.tracef("Found %s lost segments for %s", segmentsToProcess, strId); } else { supplier.close(); log.tracef("Finished rehash aware operation for %s", strId); } return segmentsToProcess; }</code><technical_language>I if avoid string concat, leave id some of if (log.traceEnabled())</technical_language>

Target:
private Set<Integer> segmentsToProcess(IteratorSupplier<R> supplier, KeyTrackingConsumer<Object, R> results, Set<Integer> segmentsToProcess, UUID id) { String strId = id == null ? "local" : id.toString(); if (!results.lostSegments.isEmpty()) { segmentsToProcess = new HashSet<>(results.lostSegments); results.lostSegments.clear(); log.tracef("Found %s lost segments for %s", segmentsToProcess, strId); } else { supplier.close(); log.tracef("Finished rehash aware operation for %s", strId); } return segmentsToProcess; }
Source:
<code>protected String getAuthenticationMethod(final HttpServletRequest request, final WebApplicationService targetService) { logger.debug("Attempting to extract multifactor authentication method from registered service attribute..."); final RegisteredService registeredService = this.servicesManager.findServiceBy(targetService); if (registeredService == null) { logger.debug("No registered service is found. Delegating to the next argument extractor in the chain..."); return null; } if (!(registeredService instanceof RegisteredServiceWithAttributes)) { logger.debug("Registered service is not capable of defining an mfa attribute. "); return determineDefaultAuthenticationMethod(); } final Map<String, Object> extraAttributes = RegisteredServiceWithAttributes.class.cast(registeredService) .getExtraAttributes(); <START> if (extraAttributes != null && extraAttributes.containsKey("mfa_role")) { <END> logger.debug("Deferring mfa authn method for Principal Attribute Resolver"); return null; } final String authenticationMethod = String.class.cast(extraAttributes.get(this.authenticationMethodAttribute)); if (!StringUtils.hasText(authenticationMethod)) { logger.debug("Registered service does not define authentication method attribute [{}]. ", this.authenticationMethodAttribute); return determineDefaultAuthenticationMethod(); } return authenticationMethod; }</code><technical_language>extract out a const</technical_language>

Target:
protected String getAuthenticationMethod(final HttpServletRequest request, final WebApplicationService targetService) { logger.debug("Attempting to extract multifactor authentication method from registered service attribute..."); if (mfaRoleProcessor != null) { final String mfaRolesResult = checkMfaRoles(targetService); if (!StringUtils.isEmpty(mfaRolesResult)) { return mfaRolesResult; } } final RegisteredService registeredService = this.servicesManager.findServiceBy(targetService); if (registeredService == null) { logger.debug("No registered service is found. Delegating to the next argument extractor in the chain..."); return null; } if (!(registeredService instanceof RegisteredServiceWithAttributes)) { logger.debug("Registered service is not capable of defining an mfa attribute. "); return determineDefaultAuthenticationMethod(); } final Map<String, Object> extraAttributes = RegisteredServiceWithAttributes.class.cast(registeredService) .getExtraAttributes(); if (extraAttributes != null && extraAttributes.containsKey("mfa_role")) { logger.debug("Deferring mfa authn method for Principal Attribute Resolver"); return null; } final String authenticationMethod = String.class.cast(extraAttributes.get(this.authenticationMethodAttribute)); if (!StringUtils.hasText(authenticationMethod)) { logger.debug("Registered service does not define authentication method attribute [{}]. ", this.authenticationMethodAttribute); return determineDefaultAuthenticationMethod(); } return authenticationMethod; }
Source:
<code><START> private static int inversePremultipliedColor(int color, int alpha) { <END> return (255*color + alpha-1) / alpha; }</code><technical_language>this non-static non-private. a function useful line</technical_language>

Target:
static int inversePremultipliedColor(int color, int alpha) { return (255*color + alpha-1) / alpha; }
Source:
<code><START> private boolean isQueryAnnotationPresentOn(Method method) { <END> Annotation[] annotations = method.getDeclaredAnnotations(); if (annotations.length == 0) { return false; } for (Annotation annotation : annotations) { if (annotation.annotationType().isAnnotationPresent(QueryAnnotation.class)) { return true; } } return false; }</code><technical_language>Do consider redeclarations potentially detect method a supertype declaration? If so, AnnotationUtils.findAnnotation( ) this logic. If not, AnnotationUtils.getAnnotation( )</technical_language>

Target:
private boolean isQueryAnnotationPresentOn(Method method) { return AnnotationUtils.findAnnotation(method, QueryAnnotation.class) != null; }
Source:
<code>public void CardinalityOfFilterComparisonSimplification() { MaterializedResult result = computeActual("" + <START> "SELECT cardinality(filter(array_agg(orderkey), x -> x < 3)) = 2 " + <END> "FROM orders " + "WHERE orderkey < 20"); assertEquals(result.getRowCount(), 1); assertEquals(result.getMaterializedRows().get(0).getField(0), true); }</code><technical_language>If optimized cardinality(filter(array_agg(orderkey), x -> x < 3)), optimizing cardinality(filter(array_agg(orderkey), x -> x < 3)) = 2 overkill? =2 cost operations. Also, sense add some benchmark similar BenchmarkArrayFilter, do a comparison run Tpch query runner add result part of commit message</technical_language>

Target:
public void CardinalityOfFilterComparisonSimplification() { MaterializedResult result = computeActual("" + "SELECT cardinality(filter(array_agg(orderkey), x -> x % 3 = 0)) = 1 " + "FROM orders " + "WHERE orderkey < 20"); assertEquals(result.getRowCount(), 1); Assert.assertEquals(result.getMaterializedRows().get(0).getField(0), true); }
Source:
<code>private TaskExecution invokeOnTaskStartup(TaskExecution taskExecution){ TaskExecution listenerTaskExecution = getTaskExecutionCopy(taskExecution); if (this.taskExecutionListeners != null) { try { for (TaskExecutionListener taskExecutionListener : this.taskExecutionListeners) { taskExecutionListener.onTaskStartup(listenerTaskExecution); } } catch (Throwable listenerException) { logger.warn(listenerException); this.listenerFailed = true; this.taskExecution.setErrorMessage(listenerException.getMessage()); this.listenerException = listenerException; <START> throw listenerException; <END> } } return listenerTaskExecution; }</code><technical_language>Bad practice duplicate variable names. Please different</technical_language>

Target:
private TaskExecution invokeOnTaskStartup(TaskExecution taskExecution){ TaskExecution listenerTaskExecution = getTaskExecutionCopy(taskExecution); if (this.taskExecutionListeners != null) { try { for (TaskExecutionListener taskExecutionListener : this.taskExecutionListeners) { taskExecutionListener.onTaskStartup(listenerTaskExecution); } } catch (Throwable currentListenerException) { logger.error(currentListenerException); this.listenerFailed = true; this.taskExecution.setErrorMessage(currentListenerException.getMessage()); this.listenerException = currentListenerException; throw currentListenerException; } } return listenerTaskExecution; }
Source:
<code>protected List<AbstractNode> createChildren() { DetailAST currentChild = detailAst; final List<AbstractNode> result = new ArrayList<>(); while (currentChild != null) { final int index = result.size(); final ElementNode child = new ElementNode(this, this, currentChild, 0, index); <START> result.add(child); <END> currentChild = currentChild.getNextSibling(); } return result; }</code><technical_language>I this code in this xpath group of classes, is reasonable move util</technical_language>

Target:
protected List<AbstractNode> createChildren() { return XpathUtil.createChildren(this, this, detailAst); }
Source:
<code>public void visitNode(Tree tree) { MethodInvocationTree methodInvTree = (MethodInvocationTree) tree; MethodTree methodDeclaration = (MethodTree) methodInvTree.symbol().declaration(); if (methodDeclaration == null) { return; } ParametersList formalParameterList = parametersByMethod.computeIfAbsent(methodInvTree.symbol(), m -> new ParametersList(methodDeclaration)); List<IdentifierTree> argumentsList = methodInvTree.arguments().stream().map(this::argumentToIdentifier).collect(Collectors.toList()); if (matchingNames(formalParameterList, argumentsList)) { List<VariableTree> matchingTypesWrongOrder = matchingTypesWrongOrder(formalParameterList, argumentsList); if (!matchingTypesWrongOrder.isEmpty()) { <START> List<JavaFileScannerContext.Location> flow = matchingTypesWrongOrder.stream().map(param -> new JavaFileScannerContext.Location("Formal Parameters", param)) <END> .collect(Collectors.toList()); reportIssue(methodInvTree.arguments(), "Parameters to " + methodInvTree.symbol().name() + " have the same names but not the same order as the method arguments.", flow, null); } } }</code><technical_language>this causing some trouble, I for change previously did: replacing strange Formal parameters Misplaced parameter</technical_language>

Target:
public void visitNode(Tree tree) { MethodInvocationTree methodInvTree = (MethodInvocationTree) tree; MethodTree methodDeclaration = (MethodTree) methodInvTree.symbol().declaration(); if (methodDeclaration == null) { return; } ParametersList formalParameterList = parametersByMethod.computeIfAbsent(methodInvTree.symbol(), m -> new ParametersList(methodDeclaration)); List<IdentifierTree> argumentsList = methodInvTree.arguments().stream().map(this::argumentToIdentifier).collect(Collectors.toList()); if (matchingNames(formalParameterList, argumentsList)) { List<VariableTree> matchingTypesWrongOrder = matchingTypesWrongOrder(formalParameterList, argumentsList); if (!matchingTypesWrongOrder.isEmpty()) { List<JavaFileScannerContext.Location> flow = matchingTypesWrongOrder.stream().map(param -> new JavaFileScannerContext.Location("Misplaced Parameter", param)) .collect(Collectors.toList()); reportIssue(methodInvTree.arguments(), "Parameters to " + methodInvTree.symbol().name() + " have the same names but not the same order as the method arguments.", flow, null); } } }
Source:
<code>public GetRecordsRetrievalStrategy createGetRecordsRetrievalStrategy(@NonNull final ShardInfo shardInfo, @NonNull final MetricsFactory metricsFactory) { return new SynchronousGetRecordsRetrievalStrategy( <START> new KinesisDataFetcher(kinesisClient, shardInfo.streamName().orElse(streamName), shardInfo.shardId(), maxRecords, metricsFactory, kinesisRequestTimeout)); <END> }</code><technical_language>shardInfo streamName</technical_language>

Target:
public GetRecordsRetrievalStrategy createGetRecordsRetrievalStrategy(@NonNull final ShardInfo shardInfo, @NonNull final MetricsFactory metricsFactory) { final StreamIdentifier streamIdentifier = shardInfo.streamIdentifierSerOpt().isPresent() ? StreamIdentifier.multiStreamInstance(shardInfo.streamIdentifierSerOpt().get()) : StreamIdentifier.singleStreamInstance(streamName); return new SynchronousGetRecordsRetrievalStrategy( new KinesisDataFetcher(kinesisClient, streamIdentifier, shardInfo.shardId(), maxRecords, metricsFactory, kinesisRequestTimeout)); }
Source:
<code>public Response update(@PathParam("id") long id, AttributeAlias entity) throws SQLException { Context.getPermissionsManager().checkReadonly(getUserId()); if (!Context.getPermissionsManager().isAdmin(getUserId())) { AttributeAlias oldAttrbuteAlias = Context.getAliasesManager().getAttributeAliasById(entity.getId()); <START> if (oldAttrbuteAlias != null && oldAttrbuteAlias.getDeviceId() != entity.getDeviceId()) { <END> Context.getPermissionsManager().checkDevice(getUserId(), oldAttrbuteAlias.getDeviceId()); } Context.getPermissionsManager().checkDevice(getUserId(), entity.getDeviceId()); } Context.getAliasesManager().updateAttributeAlias(entity); return Response.ok(entity).build(); }</code><technical_language>here. I need check. crash if exist. I check if device id is same, check both. code</technical_language>

Target:
public Response update(@PathParam("id") long id, AttributeAlias entity) throws SQLException { Context.getPermissionsManager().checkReadonly(getUserId()); if (!Context.getPermissionsManager().isAdmin(getUserId())) { AttributeAlias oldEntity = Context.getAliasesManager().getAttributeAlias(entity.getId()); Context.getPermissionsManager().checkDevice(getUserId(), oldEntity.getDeviceId()); Context.getPermissionsManager().checkDevice(getUserId(), entity.getDeviceId()); } Context.getAliasesManager().updateAttributeAlias(entity); return Response.ok(entity).build(); }
Source:
<code>public void testResolvingIgnoreCaseOrderIsUnsupported() { <START> HazelcastSortAccessor hazelcastSortAccessor = new HazelcastSortAccessor(); RevisionSort revisionSort = RevisionSort.asc(); KeyValueQuery<Object> keyValueQuery = new KeyValueQuery<Object>((Sort) revisionSort); Sort.Order[] sortOrderArray = new Sort.Order[4]; Sort.Order sortOrderA = Sort.Order.asc("Cannot resolve nest mates of a latent type description: "); sortOrderArray[0] = sortOrderA; Sort.Order sortOrderB = sortOrderA.ignoreCase(); sortOrderArray[1] = sortOrderB; Sort sort = Sort.by(sortOrderArray); keyValueQuery.setSort(sort); <END> hazelcastSortAccessor.resolve(keyValueQuery); }</code><technical_language>suggestion HazelcastSortAccessor hazelcastSortAccessor = new HazelcastSortAccessor(); KeyValueQuery<Object> keyValueQuery = new KeyValueQuery<>(RevisionSort.asc()); Sort.Order sortOrderA = Sort.Order.asc("Cannot resolve nest mates of a latent type description: "); Sort.Order sortOrderB = sortOrderA.ignoreCase(); keyValueQuery.setSort(Sort.by(sortOrderA, sortOrderB));</technical_language>

Target:
public void testResolvingIgnoreCaseOrderIsUnsupported() { HazelcastSortAccessor hazelcastSortAccessor = new HazelcastSortAccessor(); KeyValueQuery<Object> keyValueQuery = new KeyValueQuery<>(RevisionSort.asc()); Sort.Order sortOrderA = Sort.Order.asc("Cannot resolve nest mates of a latent type description: "); Sort.Order sortOrderB = sortOrderA.ignoreCase(); keyValueQuery.setSort(Sort.by(sortOrderA, sortOrderB)); hazelcastSortAccessor.resolve(keyValueQuery); }
Source:
<code>public String choose(VolumeChooserEnvironment env, String[] options) { final String choice; try { choice = chooser.choose(env, options); if (!(ArrayUtils.contains(options, choice))) { String msg = "The configured volume chooser, '" + chooser.getClass() + "', or one of its delegates returned a volume not in the set of options provided"; <START> log.error(msg); <END> throw new RuntimeException(msg); } } catch (AccumuloException e) { log.error("Failure occurred in the configured chooser.", e); throw new RuntimeException(e); } return choice; }</code><technical_language>fair point....ok</technical_language>

Target:
public String choose(VolumeChooserEnvironment env, String[] options) { final String choice; choice = chooser.choose(env, options); if (!(ArrayUtils.contains(options, choice))) { String msg = "The configured volume chooser, '" + chooser.getClass() + "', or one of its delegates returned a volume not in the set of options provided"; throw new VolumeChooserException(msg); } return choice; }
Source:
<code>public void testBCFKS() throws CertificateException, NoSuchAlgorithmException, KeyStoreException, IOException { System.out.println("Testing BCFKS..."); <START> Certificate jkscert = generateCertificate(); <END> String filename = "testks.bcfks"; String alias = "alias"; char[] password = "password".toCharArray(); boolean bcfailed = false; try { generateKeyStoreWithKey(filename, "bcfks", alias, password, jkscert); generateKeyStoreWithKey(filename+"b", "bcfks", alias, password, jkscert); generateKeyStoreWithKey(filename+"c", "bcfks", alias, password, jkscert); } catch (Exception e) { bcfailed = true; } Assume.assumeFalse("BC provider not found, skipping BC keystore recognition", bcfailed); KeyStore loadedStore = KeyStoreUtil.loadKeyStore(providerSupplier, null, new FileInputStream(new File(workingDir, filename)), filename, password); Assert.assertNotNull(loadedStore); Certificate loadedCert = loadedStore.getCertificate(alias); Assert.assertEquals(jkscert, loadedCert); }</code><technical_language>I run bc fips java passes</technical_language>

Target:
public void testBCFKS() throws CertificateException, KeyStoreException, IOException { System.out.println("Testing BCFKS..."); Certificate jkscert = generateCertificate(); String filename = "testks.bcfks"; String alias = "alias"; char[] password = "password".toCharArray(); boolean bcfailed = false; try { generateKeyStoreWithKey(filename, "bcfks", alias, password, jkscert); } catch (Exception e) { bcfailed = true; } Assume.assumeFalse("BC elytronProvider not found, skipping BC keystore recognition", bcfailed); KeyStore loadedStore = KeyStoreUtil.loadKeyStore(providerSupplier, null, new FileInputStream(new File(workingDir, filename)), filename, password); Assert.assertNotNull(loadedStore); Certificate loadedCert = loadedStore.getCertificate(alias); Assert.assertEquals(jkscert, loadedCert); }
Source:
<code>long gtk_draw (long widget, long cairo) { if ((state & OBSCURED) != 0) return 0; if (!hooksPaint ()) return 0; GdkRectangle rect = new GdkRectangle (); GDK.gdk_cairo_get_clip_rectangle (cairo, rect); Event event = new Event (); event.count = 1; Rectangle eventBounds = DPIUtil.autoScaleDown (new Rectangle (rect.x, rect.y, rect.width, rect.height)); if ((style & SWT.MIRRORED) != 0) eventBounds.x = DPIUtil.autoScaleDown (getClientWidth ()) - eventBounds.width - eventBounds.x; event.setBounds (eventBounds); GCData data = new GCData (); <START> if (GTK.GTK_VERSION <= OS.VERSION (3, 9, 0) || GTK.GTK_VERSION >= OS.VERSION (3, 14, 13)) { <END> data.cairo = cairo; } GC gc = event.gc = GC.gtk_new (this, data); gc.setClipping (eventBounds.x, eventBounds.y, eventBounds.width, eventBounds.height); drawWidget (gc); sendEvent (SWT.Paint, event); gc.dispose (); event.gc = null; return 0; }</code><technical_language>reason for specific guard? I.e. GTK3.14.13 instead of 3.14.0. If is specific reason please change this to: if (GTK.GTK_VERSION >= OS.VERSION (3, 14, 0)) {</technical_language>

Target:
long gtk_draw (long widget, long cairo) { if ((state & OBSCURED) != 0) return 0; if (!hooksPaint ()) return 0; GdkRectangle rect = new GdkRectangle (); GDK.gdk_cairo_get_clip_rectangle (cairo, rect); Event event = new Event (); event.count = 1; Rectangle eventBounds = DPIUtil.autoScaleDown (new Rectangle (rect.x, rect.y, rect.width, rect.height)); if ((style & SWT.MIRRORED) != 0) eventBounds.x = DPIUtil.autoScaleDown (getClientWidth ()) - eventBounds.width - eventBounds.x; event.setBounds (eventBounds); GCData data = new GCData (); if (GTK.GTK_VERSION <= OS.VERSION (3, 9, 0) || GTK.GTK_VERSION >= OS.VERSION (3, 14, 0)) { data.cairo = cairo; } GC gc = event.gc = GC.gtk_new (this, data); gc.setClipping (eventBounds.x, eventBounds.y, eventBounds.width, eventBounds.height); drawWidget (gc); sendEvent (SWT.Paint, event); gc.dispose (); event.gc = null; return 0; }
Source:
<code>public Mono<Boolean> releaseInitializationLock() { String lockId = this.getStoreLockName(); CosmosItemProperties doc = new CosmosItemProperties(); doc.id(lockId); CosmosItemRequestOptions requestOptions = this.requestOptionsFactory.createRequestOptions( ServiceItemLease.fromDocument(doc)); if (requestOptions == null) { requestOptions = new CosmosItemRequestOptions(); } AccessCondition accessCondition = new AccessCondition(); accessCondition.type(AccessConditionType.IF_MATCH); accessCondition.condition(this.lockETag); requestOptions.accessCondition(accessCondition); CosmosItem docItem = this.client.getContainerClient().getItem(lockId, lockId); return this.client.deleteItem(docItem, requestOptions) .map(documentResourceResponse -> { if (documentResourceResponse.item() != null) { this.lockETag = null; return true; } else { return false; } }) .onErrorResume(throwable -> { if (throwable instanceof CosmosClientException) { CosmosClientException e = (CosmosClientException) throwable; if (e.statusCode() == ChangeFeedHelper.HTTP_STATUS_CODE_CONFLICT) { logger.info("Lease synchronization document was acquired by a different instance"); return Mono.just(false); } } <START> logger.warn("Unexpected exception thrown", throwable); <END> return Mono.error(throwable); }); }</code><technical_language>discussed, change this error</technical_language>

Target:
public Mono<Boolean> releaseInitializationLock() { String lockId = this.getStoreLockName(); CosmosItemProperties doc = new CosmosItemProperties(); doc.id(lockId); CosmosItemRequestOptions requestOptions = this.requestOptionsFactory.createRequestOptions( ServiceItemLease.fromDocument(doc)); if (requestOptions == null) { requestOptions = new CosmosItemRequestOptions(); } AccessCondition accessCondition = new AccessCondition(); accessCondition.type(AccessConditionType.IF_MATCH); accessCondition.condition(this.lockETag); requestOptions.accessCondition(accessCondition); CosmosItem docItem = this.client.getContainerClient().getItem(lockId, lockId); return this.client.deleteItem(docItem, requestOptions) .map(documentResourceResponse -> { if (documentResourceResponse.item() != null) { this.lockETag = null; return true; } else { return false; } }) .onErrorResume(throwable -> { if (throwable instanceof CosmosClientException) { CosmosClientException e = (CosmosClientException) throwable; if (e.statusCode() == ChangeFeedHelper.HTTP_STATUS_CODE_CONFLICT) { logger.info("Lease synchronization document was acquired by a different instance"); return Mono.just(false); } } logger.error("Unexpected exception thrown", throwable); return Mono.error(throwable); }); }
Source:
<code>public Notification get(final int number) { <START> return new MkNotification(number); <END> }</code><technical_language>@prondzyn return numberth element of collection</technical_language>

Target:
public Notification get(final int number) { return this.notifications.get(number); }
Source:
<code>protected String getSubsystemXsdPath() throws IOException { <START> return "schema/wildfly-remoting_3_0.xsd"; <END> }</code><technical_language>I curious test this default schemas need present in "schema/" directory. load of based schema xml reference test default. Overriding is fine for corner cases default needed</technical_language>

Target:
protected String getSubsystemXsdPath() throws Exception { return "schema/wildfly-remoting_3_0.xsd"; }