auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public HttpEntity<CategoriesResource> getRelevantCategories() { <START> CategoriesDTO categories = new CategoriesDTO(goalService.getAllCategories()); <END> return new ResponseEntity<CategoriesResource>( new CategoriesResource(categories), HttpStatus.OK); }</code><technical_language>Instead of this method getAllCategories in GoalService, I statements: Set<String> allCategories = goalService.getAllGoals().stream().flatMap(g -> g.getCategories().stream()) .collect(Collectors.toSet()); CategoriesDTO categories = new CategoriesDTO(allCategories);</technical_language>

Target:
public HttpEntity<CategoriesResource> getRelevantCategories() { CategoriesDTO categories = new CategoriesDTO(analysisEngineService.getRelevantCategories()); return new ResponseEntity<CategoriesResource>( new CategoriesResource(categories), HttpStatus.OK); }
Source:
<code>private boolean isAssignQuotaAllowed() { List<Disk> disks = getSelectedItems(); return disks != null && <START> disks.size() != 0; <END> }</code><technical_language>!disks.isEmpty()</technical_language>

Target:
private boolean isAssignQuotaAllowed() { List<Disk> disks = getSelectedItems(); return disks != null && !disks.isEmpty(); }
Source:
<code>NodeLevelMetrics getDataNodeBasedMetrics(DataNodeId dataNodeId) { <START> return dataNodeToMetrics.containsKey(dataNodeId) ? dataNodeToMetrics.get(dataNodeId) : dataNodeToMetrics.get(null); <END> }</code><technical_language>a default case? is point in updating metrics for "unknown" datanode</technical_language>

Target:
NodeLevelMetrics getDataNodeBasedMetrics(DataNodeId dataNodeId) { return dataNodeToMetrics.get(dataNodeId); }
Source:
<code>public void verifyAddEmptyCollectionMessage() { validationResult.addMessage(TEST_STRING_ONE); <START> validationResult.addMessages(new ArrayList()); <END> assertEquals("There should only be one line", 1, validationResult.getMessages().size()); }</code><technical_language>Missing generics ArrayList. Adding empty "<>" allow compiler derive correct generic type, provided addMessages() method signature enough information</technical_language>

Target:
public void verifyAddEmptyCollectionMessage() { validationResult.addMessage(TEST_STRING_ONE); validationResult.addMessages(new ArrayList<String>()); assertEquals("There should only be one line", 1, validationResult.getMessages().size()); }
Source:
<code>public void run() throws SQLException { <START> rs = statement.executeQuery(); <END> }</code><technical_language>if save return close result set immediately that</technical_language>

Target:
public void run() throws SQLException { try (ResultSet rs = statement.executeQuery()) { rs.next(); returnValue = rs.getObject(1); } }
Source:
<code>public String docs() { <START> return "boolean {char} Determines if the character provided is uppercase or not."; <END> }</code><technical_language>Change this "boolean {char} Determines if character provided is uppercase not. string 1 character long a letter, a FormatException is thrown."</technical_language>

Target:
public String docs() { return "boolean {char} Determines if the character provided is uppercase or not. The string must be exactly 1 character long and" + " a letter, otherwise a FormatException is thrown."; }
Source:
<code>private static void warn(String func, Exception ex) { <START> logger.warn(String.format("Unexpected exception in ActivityHelper.%s: %s", func, ex)); <END> }</code><technical_language>want pass exception argument logger. If is in message get is result of ex.message() if is argument get message full stack. message is worse useless for some exception types is null</technical_language>

Target:
private static void warn(String func, Exception ex) { logger.warn(String.format("Unexpected exception in ActivityHelper.%s", func), ex); }
Source:
<code>protected boolean set(IMixinMobSpawner container, Short value) { <START> container.getSpawnerBaseLogic().maxNearbyEntities = Preconditions.checkNotNull(value); <END> return true; }</code><technical_language>Preconditions methods imported statically</technical_language>

Target:
protected boolean set(IMixinMobSpawner container, Short value) { container.getSpawnerBaseLogic().maxNearbyEntities = value; return true; }
Source:
<code>public void testLogin() { runOnMainSync(new Runnable() { <START> public void run() { <END> new AMLoginInfoTask() { @Override public void onCatch(Throwable caught) { L.e("AMLoginInfoTask failed: " + caught.getMessage()); } @Override public void onFinish(AMLoginInfoResult result) { if (result.getEnabled()) { amLoginTestTask.execute(); } else { legacyLoginTestTask.execute(); } } }.execute(); } }); completionLatch.await(); }</code><technical_language>Missing @Override</technical_language>

Target:
public void testLogin() { runOnMainSync(new Runnable() { @Override public void run() { new AMLoginInfoTask() { @Override public void onCatch(Throwable caught) { L.e(caught); fail(); } @Override public void onFinish(AMLoginInfoResult result) { if (result.getEnabled()) { amLoginTestTask.execute(); } else { legacyLoginTestTask.execute(); } } }.execute(); } }); completionLatch.await(); }
Source:
<code>public void handleData(final ITmfEvent event) { super.handleData(event); if (isCancelled()) { return; } try { if (fFilter == null || fFilter.matches(event)) { fWriter.write(event.getTimestamp().toString()); fWriter.write('\t'); fWriter.write(event.getSource()); fWriter.write('\t'); fWriter.write(event.getType().getName()); fWriter.write('\t'); fWriter.write(event.getReference()); fWriter.write('\t'); ITmfEventField content = event.getContent(); <START> String value = content.getFormattedValue(); <END> fWriter.write(value); fWriter.write('\n'); } } catch (IOException _) { fIOException = _; fail(); } }</code><technical_language>event.getContent().toString() instead of content.getFromattedValue(). content.getFromattedValue() NullPointerExceptions for some trace implementations. For example, CTF traces parsed TMF event.getContent() returns a "root" field a a (event.getContent() == null), sub-fields. Sub-fields accessed wit iTmfEventFields[] subFields = content.getFields(); toString() method (i.e. event.getContent().toString()) getFormattedValue() for of values for pretty-printing</technical_language>

Target:
public void handleData(final ITmfEvent event) { super.handleData(event); if (isCancelled()) { return; } try { if (fFilter == null || fFilter.matches(event)) { if (fTable != null) { ITmfEventField[] fields = fTable.extractItemFields(event); boolean needTab = false; for (ITmfEventField field: fields) { if (needTab) { fWriter.write('\t'); } fWriter.write(field.getValue().toString()); needTab = true; } } else { fWriter.write(event.getTimestamp().toString()); fWriter.write('\t'); fWriter.write(event.getSource()); fWriter.write('\t'); fWriter.write(event.getType().getName()); fWriter.write('\t'); fWriter.write(event.getReference()); fWriter.write('\t'); ITmfEventField content = event.getContent(); String value = content.getFormattedValue(); fWriter.write(value); } fWriter.write('\n'); } } catch (IOException ex) { fIOException = ex; fail(); } }
Source:
<code>public RuntimeContext prepare(RuntimeIdentity id, InternalEnvironment environment) throws ValidationException, InfrastructureException { final KubernetesEnvironment kubernetesEnvironment = asKubernetesEnv(environment); <START> workspaceNext.provision(id, kubernetesEnvironment); <END> return super.prepare(id, kubernetesEnvironment); }</code><technical_language>I sense change variable name toolingProvisioner instead of workspaceNext</technical_language>

Target:
public RuntimeContext prepare(RuntimeIdentity id, InternalEnvironment environment) throws ValidationException, InfrastructureException { final KubernetesEnvironment kubernetesEnvironment = asKubernetesEnv(environment); toolingProvisioner.provision(id, kubernetesEnvironment); return super.prepare(id, kubernetesEnvironment); }
Source:
<code>private ClientBuilder(URL url) { int port = url.getPort(); if (port < 0) { port = url.getDefaultPort(); } if (url.getUserInfo() != null) { this.username = url.getUserInfo().substring(0, url .getUserInfo() .indexOf(":")); this.password = url.getUserInfo().substring(url .getUserInfo() .indexOf(":")); } try { this.url = URIBuilder.buildUri() .scheme(url.getProtocol()) .host(url.getHost()) .port(port) .build().toURL(); } catch (MalformedURLException e) { <START> throw new CouchDbException(e); <END> } }</code><technical_language>part of bigger picture eventually checked exceptions, I this specifically a runtime exception. hit MalformedURLException, url is provided us, user info. I throw a RuntimeException directly</technical_language>

Target:
private ClientBuilder(URL url) { int port = url.getPort(); if (port < 0) { port = url.getDefaultPort(); } if (url.getUserInfo() != null) { this.username = url.getUserInfo().substring(0, url .getUserInfo() .indexOf(":")); this.password = url.getUserInfo().substring(url .getUserInfo() .indexOf(":") + 1); } try { this.url = URIBuilder.buildUri() .scheme(url.getProtocol()) .host(url.getHost()) .port(port) .build().toURL(); } catch (MalformedURLException e) { throw new RuntimeException(e); } }
Source:
<code>public synchronized void rollback() throws SQLException { if (activeConnection != null && activeConnection.isValid(5)) { activeConnection.rollback(); } else { <START> logger.debug("Connection to MySql DB is not available"); <END> } }</code><technical_language>Minor: I feel line 136, 148 160 logger.warn</technical_language>

Target:
public synchronized void rollback() throws SQLException { activeConnection.rollback(); }
Source:
<code>private Optional<VirtualObject> findFile(String key) { <START> Optional<StoredObject> file = storage.findByKey(tenants.getRequiredTenant(), "jobs", key); <END> if (!file.isPresent() && Strings.isFilled(defaultFilePath)) { file = storage.findByPath(tenants.getRequiredTenant(), "jobs", defaultFilePath); } return file.map(storedObject -> { if (storedObject instanceof VirtualObject) { return (VirtualObject) storedObject; } return null; }); }</code><technical_language>bucket a parameter "work" default</technical_language>

Target:
private Optional<VirtualObject> findFile(String key) { Optional<StoredObject> file = storage.findByKey(tenants.getRequiredTenant(), getBucketName(), key); if (!file.isPresent() && Strings.isFilled(defaultFilePath)) { file = storage.findByPath(tenants.getRequiredTenant(), getBucketName(), defaultFilePath); } return file.map(storedObject -> { if (storedObject instanceof VirtualObject) { return (VirtualObject) storedObject; } return null; }); }
Source:
<code>protected List<LUNs> getDeviceList(Set<String> lunsIds) { if (getParameters().getDeviceList() == null) { return runGetDeviceList(lunsIds); } if (lunsIds == null) { return getParameters().getDeviceList(); } <START> Set<String> lunsIdsSet = new HashSet<>(lunsIds); <END> return getParameters().getDeviceList().stream() .filter(lun -> lunsIdsSet.contains(lun.getId())) .collect(Collectors.toList()); }</code><technical_language>This is redundant - lunsIds</technical_language>

Target:
protected List<LUNs> getDeviceList(Set<String> lunsIds) { if (getParameters().getDeviceList() == null) { return runGetDeviceList(lunsIds); } if (lunsIds == null) { return getParameters().getDeviceList(); } return getParameters().getDeviceList().stream() .filter(lun -> lunsIds.contains(lun.getId())) .collect(Collectors.toList()); }
Source:
<code><START> private ConnectionSettings providersXmlDiscoveryDiscover(String email, DiscoveryTarget discoveryTarget) { <END> DiscoveryResults discoveryResults = providersXmlDiscovery.discover(email, DiscoveryTarget.INCOMING_AND_OUTGOING); if (discoveryResults == null || (discoveryResults.getIncoming().size() != 1 || discoveryResults.getOutgoing().size() != 1)) { return null; } DiscoveredServerSettings incoming = discoveryResults.getIncoming().get(0); DiscoveredServerSettings outgoing = discoveryResults.getOutgoing().get(0); return new ConnectionSettings(new ServerSettings( incoming.getProtocol(), incoming.getHost(), incoming.getPort(), incoming.getSecurity(), incoming.getAuthType(), incoming.getUsername(), null, null ), new ServerSettings( outgoing.getProtocol(), outgoing.getHost(), outgoing.getPort(), outgoing.getSecurity(), outgoing.getAuthType(), outgoing.getUsername(), null, null )); }</code><technical_language>I try modify current setup UI work plan proposed in #4721. create a new Activity. I expect a while new setup experience is complete, I good support UIs time. UI for releases new is ready. I set this next week. means this code for a while. works before, can</technical_language>

Target:
private ConnectionSettings providersXmlDiscoveryDiscover(String email, DiscoveryTarget discoveryTarget) { DiscoveryResults discoveryResults = providersXmlDiscovery.discover(email, DiscoveryTarget.INCOMING_AND_OUTGOING); if (discoveryResults == null || (discoveryResults.getIncoming().size() < 1 || discoveryResults.getOutgoing().size() < 1)) { return null; } DiscoveredServerSettings incoming = discoveryResults.getIncoming().get(0); DiscoveredServerSettings outgoing = discoveryResults.getOutgoing().get(0); return new ConnectionSettings(new ServerSettings( incoming.getProtocol(), incoming.getHost(), incoming.getPort(), incoming.getSecurity(), incoming.getAuthType(), incoming.getUsername(), null, null ), new ServerSettings( outgoing.getProtocol(), outgoing.getHost(), outgoing.getPort(), outgoing.getSecurity(), outgoing.getAuthType(), outgoing.getUsername(), null, null )); }
Source:
<code>public void visitNode(Tree tree) { if(!hasSemantic()) { return; } ClassTree classTree = (ClassTree) tree; <START> if(classTree.symbol().isPrivate() && classTree.symbol().usages().isEmpty()) { <END> reportIssue(classTree.simpleName(), "Remove this unused private \""+classTree.symbol().name()+"\" class."); } }</code><technical_language>Extract classTree.symbol() a dedicated variable calling thrice</technical_language>

Target:
public void visitNode(Tree tree) { if(!hasSemantic()) { return; } ClassTree classTree = (ClassTree) tree; Symbol.TypeSymbol classSymbol = classTree.symbol(); if(classSymbol.isPrivate() && classSymbol.usages().isEmpty()) { reportIssue(classTree.simpleName(), "Remove this unused private \""+ classSymbol.name()+"\" class."); } }
Source:
<code>private String generateContinuationTokenForXns(final String firstEntryName) { <START> if (firstEntryName == null || firstEntryName.isEmpty() || firstEntryName.startsWith(AbfsHttpConstants.ROOT_PATH)) { <END> throw new IllegalArgumentException("startFrom must be a dir/file name and it can not be a full path"); } StringBuilder sb = new StringBuilder(); sb.append(firstEntryName).append("#$").append("0"); CRC64 crc64 = new CRC64(); StringBuilder token = new StringBuilder(); token.append(crc64.compute(sb.toString().getBytes(StandardCharsets.UTF_8))) .append(SINGLE_WHITE_SPACE) .append("0") .append(SINGLE_WHITE_SPACE) .append(firstEntryName); return Base64.encode(token.toString().getBytes(StandardCharsets.UTF_8)); }</code><technical_language>generally done in Preconditions.checkArgument() code days</technical_language>

Target:
private String generateContinuationTokenForXns(final String firstEntryName) { Preconditions.checkArgument(!Strings.isNullOrEmpty(firstEntryName) && !firstEntryName.startsWith(AbfsHttpConstants.ROOT_PATH), "startFrom must be a dir/file name and it can not be a full path"); StringBuilder sb = new StringBuilder(); sb.append(firstEntryName).append("#$").append("0"); CRC64 crc64 = new CRC64(); StringBuilder token = new StringBuilder(); token.append(crc64.compute(sb.toString().getBytes(StandardCharsets.UTF_8))) .append(SINGLE_WHITE_SPACE) .append("0") .append(SINGLE_WHITE_SPACE) .append(firstEntryName); return Base64.encode(token.toString().getBytes(StandardCharsets.UTF_8)); }
Source:
<code>public Construct execs(Target t, Environment env, Script parent, ParseTree... nodes) { ParseTree syncObjectTree = nodes[0]; ParseTree code = nodes[1]; Construct cSyncObject = parent.seval(syncObjectTree, env); if(cSyncObject instanceof CNull) { throw new CRENullPointerException("Synchronization object may not be null in " + getName() + "().", t); } Object syncObject; if(cSyncObject instanceof CArray) { syncObject = cSyncObject; } else { syncObject = cSyncObject.val(); } if(syncObject instanceof String) { synchronized(syncObjectMap) { searchLabel: { for(Entry<Object, Integer> entry : syncObjectMap.entrySet()) { Object key = entry.getKey(); if(key instanceof String && key.equals(syncObject)) { syncObject = key; entry.setValue(entry.getValue() + 1); break searchLabel; } } syncObjectMap.put(syncObject, 1); } } } Construct ret; try { synchronized(syncObject) { ret = parent.seval(code, env); } } catch(RuntimeException e) { throw e; } finally { if(syncObject instanceof String) { synchronized(syncObjectMap) { int count = syncObjectMap.get(syncObject); if(count <= 1) { syncObjectMap.remove(syncObject); } else { for(Entry<Object, Integer> entry : syncObjectMap.entrySet()) { if(entry.getKey() == syncObject) { entry.setValue(count - 1); break; } } } } } } <START> return ret; <END> }</code><technical_language>I reason return void</technical_language>

Target:
public Construct execs(Target t, Environment env, Script parent, ParseTree... nodes) { ParseTree syncObjectTree = nodes[0]; ParseTree code = nodes[1]; Construct cSyncObject = parent.seval(syncObjectTree, env); if(cSyncObject instanceof CNull) { throw new CRENullPointerException("Synchronization object may not be null in " + getName() + "().", t); } Object syncObject; if(cSyncObject instanceof CArray) { syncObject = cSyncObject; } else { syncObject = cSyncObject.val(); } if(syncObject instanceof String) { synchronized(syncObjectMap) { searchLabel: { for(Entry<Object, Integer> entry : syncObjectMap.entrySet()) { Object key = entry.getKey(); if(key instanceof String && key.equals(syncObject)) { syncObject = key; entry.setValue(entry.getValue() + 1); break searchLabel; } } syncObjectMap.put(syncObject, 1); } } } try { synchronized(syncObject) { parent.seval(code, env); } } catch(RuntimeException e) { throw e; } finally { if(syncObject instanceof String) { synchronized(syncObjectMap) { int count = syncObjectMap.get(syncObject); if(count <= 1) { syncObjectMap.remove(syncObject); } else { for(Entry<Object, Integer> entry : syncObjectMap.entrySet()) { if(entry.getKey() == syncObject) { entry.setValue(count - 1); break; } } } } } } return CVoid.VOID; }
Source:
<code>static String typeString(Collector.Type t) { switch (t) { case GAUGE: return "gauge"; case COUNTER: return "counter"; case SUMMARY: return "summary"; default: <START> return "uptyped"; <END> } }</code><technical_language>uptyped -> untyped</technical_language>

Target:
static String typeString(Collector.Type t) { switch (t) { case GAUGE: return "gauge"; case COUNTER: return "counter"; case SUMMARY: return "summary"; default: return "untyped"; } }
Source:
<code>private LegacyLDAPSecuritySettingPlugin populateSecurityRoles() { ActiveMQServerLogger.LOGGER.populatingSecurityRolesFromLDAP(connectionURL); try { open(); } catch (Exception e) { ActiveMQServerLogger.LOGGER.errorOpeningContextForLDAP(e); return this; } SearchControls searchControls = new SearchControls(); searchControls.setReturningAttributes(new String[]{roleAttribute}); searchControls.setSearchScope(SearchControls.SUBTREE_SCOPE); securityRoles = new HashMap<>(); try { if (logger.isDebugEnabled()) { <START> logger.debug("Performing LDAP search: " + destinationBase); <END> logger.debug("\tfilter: " + filter); logger.debug("\tcontrols:"); logger.debug("\t\treturningAttributes: " + roleAttribute); logger.debug("\t\tsearchScope: SUBTREE_SCOPE"); } NamingEnumeration<SearchResult> searchResults = context.search(destinationBase, filter, searchControls); while (searchResults.hasMore()) { processSearchResult(securityRoles, searchResults.next()); } } catch (Exception e) { ActiveMQServerLogger.LOGGER.errorPopulatingSecurityRolesFromLDAP(e); } return this; }</code><technical_language>I annoying, I deal big loggers.. a lot easier if this a single logger.debug call easier identify logger output... user's environments more. A lot of users logger aggregators (e.g. splunk).. a lot easier a single call here</technical_language>

Target:
private LegacyLDAPSecuritySettingPlugin populateSecurityRoles() { ActiveMQServerLogger.LOGGER.populatingSecurityRolesFromLDAP(connectionURL); try { open(); } catch (Exception e) { ActiveMQServerLogger.LOGGER.errorOpeningContextForLDAP(e); return this; } SearchControls searchControls = new SearchControls(); searchControls.setReturningAttributes(new String[]{roleAttribute}); searchControls.setSearchScope(SearchControls.SUBTREE_SCOPE); securityRoles = new HashMap<>(); try { if (logger.isDebugEnabled()) { logger.debug(new StringBuilder().append("Performing LDAP search: ").append(destinationBase) .append("\tfilter: ").append(filter) .append("\tcontrols:") .append("\t\treturningAttributes: ").append(roleAttribute) .append("\t\tsearchScope: SUBTREE_SCOPE")); } NamingEnumeration<SearchResult> searchResults = context.search(destinationBase, filter, searchControls); while (searchResults.hasMore()) { processSearchResult(securityRoles, searchResults.next()); } } catch (Exception e) { ActiveMQServerLogger.LOGGER.errorPopulatingSecurityRolesFromLDAP(e); } return this; }
Source:
<code>public void invoke(String[] cmd) throws Exception { context.getOutput().println("bye!"); <START> context.getOutput().flush(); <END> System.exit(0); }</code><technical_language>flush() flushes content of buffer destination. write stream. close() flushes content destination closes stream. execute command for terminating TSql, write anymore. Thus, need close() instead of flush()</technical_language>

Target:
public void invoke(String[] cmd) throws Exception { context.getOutput().println("bye!"); context.getOutput().close(); System.exit(0); }
Source:
<code>AggregationBuilder<?> metricAgg(final QueryFilter filter) { QueryFilter metric_only_filter = null; if (filter instanceof ChainFilter) { BoolFilterBuilder builder = FilterBuilders.boolFilter(); <START> for (final QueryFilter sub_filter : ((ChainFilter) filter).getFilters()) { <END> if (sub_filter instanceof MetricFilter) { metric_only_filter = ChainFilter.newBuilder().addFilter(sub_filter).build(); } } } FilterBuilder pair_filter = getTagPairFilter(metric_only_filter); return AggregationBuilders.nested(METRIC_AGG) .path(METRIC_PATH) .subAggregation(AggregationBuilders.filter(METRIC_AGG) .filter(pair_filter) .subAggregation(AggregationBuilders.terms(METRIC_UNIQUE) .field(RESULT_METRIC) .size(0) .order(query.order() == MetaQuery.Order.ASCENDING ? Order.term(true) : Order.term(false)))); }</code><technical_language>This pick metric filter. if a query chain { metric1, metric2, chain { tags1, tags2 } }</technical_language>

Target:
AggregationBuilder<?> metricAgg(final QueryFilter filter) { ChainFilter.Builder metric_only_filter = ChainFilter.newBuilder(); if (filter instanceof ChainFilter) { for (final QueryFilter sub_filter : ((ChainFilter) filter).getFilters()) { if (sub_filter instanceof MetricFilter) { metric_only_filter.addFilter(sub_filter); } } } FilterBuilder pair_filter = getTagPairFilter(metric_only_filter.build(), false); return AggregationBuilders.nested(METRIC_AGG) .path(METRIC_PATH) .subAggregation(AggregationBuilders.filter(METRIC_AGG) .filter(pair_filter) .subAggregation(AggregationBuilders.terms(METRIC_UNIQUE) .field(RESULT_METRIC) .size(0) .order(query.order() == MetaQuery.Order.ASCENDING ? Order.term(true) : Order.term(false)))); }
Source:
<code>public void testMatchesWithStatistics() <START> throws Exception <END> { RichColumnDescriptor tableColumn = getTableColumn(); String value = "Test"; TupleDomain<ColumnDescriptor> effectivePredicate = getEffectivePredicate(tableColumn, VarcharType.createVarcharType(255), value); List<RichColumnDescriptor> tableColumns = Collections.singletonList(tableColumn); TupleDomainParquetPredicate predicate = new TupleDomainParquetPredicate(effectivePredicate, tableColumns); Statistics stats = BinaryStatistics.getStatsBasedOnType(tableColumn.getType()); stats.setNumNulls(1L); stats.setMinMaxFromBytes(value.getBytes(), value.getBytes()); assertTrue(predicate.matches(2, Collections.singletonMap(tableColumn, stats))); }</code><technical_language>Unnecessary throws clause</technical_language>

Target:
public void testMatchesWithStatistics() { RichColumnDescriptor column = getColumn(); String value = "Test"; TupleDomain<ColumnDescriptor> effectivePredicate = getEffectivePredicate(column, createVarcharType(255), value); List<RichColumnDescriptor> columns = singletonList(column); TupleDomainParquetPredicate predicate = new TupleDomainParquetPredicate(effectivePredicate, columns); Statistics stats = getStatsBasedOnType(column.getType()); stats.setNumNulls(1L); stats.setMinMaxFromBytes(value.getBytes(), value.getBytes()); assertTrue(predicate.matches(2, singletonMap(column, stats))); }
Source:
<code>protected String renderDryRunResponse(SubmitDryRunResponse resp) { SubmitDryRunRender render = new SubmitDryRunRender(resp); DryRunFormatType formatType = Context.dryRunFormatType(config); <START> switch (formatType) { <END> case RAW : return render.renderRaw(); case TABLE: return render.renderTable(); default: throw new IllegalArgumentException( String.format("Unexpected rendering format: %s", formatType)); } }</code><technical_language>main classes leverage DryRunRender interface. more flexibility binding DryRunRender impls parent class instead this: DryRunRender render = null; switch (formatType) { case RAW : render = new SubmitRawDryRunRenderer(resp); case TABLE: render = new SubmitTableDryRunRenderer(resp); default: throw new IllegalArgumentException( String.format("Unexpected rendering format: %s", formatType)); } return render.render(); If renderers need share code, inheritance composition</technical_language>

Target:
protected String renderDryRunResponse(SubmitDryRunResponse resp) { DryRunFormatType formatType = Context.dryRunFormatType(config); switch (formatType) { case RAW : return new SubmitRawDryRunRenderer(resp).render(); case TABLE: return new SubmitTableDryRunRenderer(resp).render(); default: throw new IllegalArgumentException( String.format("Unexpected rendering format: %s", formatType)); } }
Source:
<code>public void begin(EntityId eid) { <START> Preconditions.checkArgument(mPut == null, <END> "There is already a Put object in use by this Putter." + " Call commit() or rollback() to clear the Put."); if (mPut == null) { mEntityId = eid; mId = eid.getHBaseRowKey(); mHopper = new ArrayList<KeyValue>(); mPut = new Put(mId); } }</code><technical_language>checkState instead of checkArgument</technical_language>

Target:
public synchronized void begin(EntityId eid) { Preconditions.checkState(mPut == null, "There is already a transaction in progress on row: " + mEntityId + ". Call commit(), checkAndCommit(), or rollback() to clear the Put."); if (mPut == null) { mEntityId = eid; mId = eid.getHBaseRowKey(); mHopper = new ArrayList<KeyValue>(); mPut = new Put(mId); } }
Source:
<code>void customContextClassLoader() { var thread = Thread.currentThread(); ClassLoader old = thread.getContextClassLoader(); ClassLoader tccl = new URLClassLoader("(-:", new URL[0], ClassLoader.getSystemClassLoader()); try { thread.setContextClassLoader(tccl); List<ExecutionEvent> executionEvents = execute(3, SuccessfulWithMethodLockTestCase.class); assertThat(executionEvents.stream().filter(event(test(), finishedSuccessfully())::matches)).hasSize(3); assertThat(ThreadReporter.getThreadNames(executionEvents)).hasSize(3); assertThat(ThreadReporter.getLoaderNames(executionEvents).collect(toList())).containsExactly("(-:"); } finally { thread.setContextClassLoader(old); } <START> <END> }</code><technical_language>nit: extra blank line</technical_language>

Target:
void customContextClassLoader() { var currentThread = Thread.currentThread(); var currentLoader = currentThread.getContextClassLoader(); var smilingLoader = new URLClassLoader("(-:", new URL[0], ClassLoader.getSystemClassLoader()); currentThread.setContextClassLoader(smilingLoader); try { var executionEvents = execute(3, SuccessfulWithMethodLockTestCase.class); assertThat(executionEvents.stream().filter(event(test(), finishedSuccessfully())::matches)).hasSize(3); assertThat(ThreadReporter.getThreadNames(executionEvents)).hasSize(3); assertThat(ThreadReporter.getLoaderNames(executionEvents)).containsExactly("(-:"); } finally { currentThread.setContextClassLoader(currentLoader); } }
Source:
<code>public void testGet() { Vault vaultFound = api().getVault(vaultName); <START> assertTrue(!vaultFound.name().isEmpty()); <END> }</code><technical_language>assertNotNull(vaultFound) avoid unexpected NPE</technical_language>

Target:
public void testGet() { Vault vaultFound = api().getVault(vaultName); assertNotNull(vaultFound); }
Source:
<code>@Override protected <T extends APIEntity> void clone(T from) { <START> <END> }</code><technical_language>Empty method</technical_language>

Target:
protected <T extends APIEntity> void clone(T from) { cloneBase(from); APIBasicJiraIssue jiraIssueType = (APIBasicJiraIssue) from; this.self = jiraIssueType.self; this.key = jiraIssueType.key; }
Source:
<code>public static double getHoursSpentFromStateTasks(IAtsObject atsObject, IStateToken relatedToState) throws OseeCoreException { <START> double spent = 0; <END> if (atsObject instanceof IAtsTeamWorkflow) { for (IAtsTask taskArt : AtsCore.getWorkItemService().getTaskArtifacts((IAtsTeamWorkflow) atsObject, relatedToState)) { spent += HoursSpentUtil.getHoursSpentTotal(taskArt); } } return spent; }</code><technical_language>important, change variable name hours spent</technical_language>

Target:
public static double getHoursSpentFromStateTasks(IAtsObject atsObject, IStateToken relatedToState) throws OseeCoreException { double hours = 0.0; if (atsObject instanceof IAtsTeamWorkflow) { for (IAtsTask taskArt : AtsCore.getWorkItemService().getTasks((IAtsTeamWorkflow) atsObject, relatedToState)) { hours += HoursSpentUtil.getHoursSpentTotal(taskArt); } } return hours; }
Source:
<code>public void setInheritFrom(@CheckForNull String inheritFrom) { if (inheritFrom != null && inheritFrom.equals(",default,")) { <START> this.inheritFrom = ""; <END> } else { this.inheritFrom = Util.fixEmpty(inheritFrom); } }</code><technical_language>No, this backwards. "" means do inherit. Null means inherit in default way. suggestion this.inheritFrom = null;</technical_language>

Target:
public void setInheritFrom(@CheckForNull String inheritFrom) { if (DescriptorImpl.defaultInheritFrom.equals(inheritFrom)) { this.inheritFrom = null; } else { this.inheritFrom = inheritFrom; } }
Source:
<code>private INewAsyncCallback createGetVmsFromExportDomainCallback() { return new INewAsyncCallback() { @Override public void onSuccess(Object model, Object returnValue) { List<VM> <START> vmsInExportDomain; <END> VdcQueryReturnValue retVal = (VdcQueryReturnValue) returnValue; if (retVal == null || retVal.getReturnValue() == null || !retVal.getSucceeded()) { return; } vmsInExportDomain = retVal.getReturnValue(); if ((vmsInExportDomain.size() > 0)) { TemplateBackupModel templateBackupModel = (TemplateBackupModel) model; HashMap<String, List<String>> problematicVmNames = getDependentVMsForTemplate(vmsInExportDomain, templateBackupModel); if (!problematicVmNames.isEmpty()) { showRemoveTemplateWithDependentVMConfirmationWindow(problematicVmNames); } else { removeTemplateBackup(); } } else { removeTemplateBackup(); } } }; }</code><technical_language>define line 131 instead of</technical_language>

Target:
private INewAsyncCallback createGetVmsFromExportDomainCallback() { return new INewAsyncCallback() { @Override public void onSuccess(Object model, Object returnValue) { VdcQueryReturnValue retVal = (VdcQueryReturnValue) returnValue; if (retVal == null || retVal.getReturnValue() == null || !retVal.getSucceeded()) { return; } List<VM> vmsInExportDomain = retVal.getReturnValue(); List<VmTemplate> templates = Linq.<VmTemplate> cast(getSelectedItems()); HashMap<String, List<String>> problematicVmNames = getDependentVMsForTemplates(vmsInExportDomain, templates); if (!problematicVmNames.isEmpty()) { showRemoveTemplateWithDependentVMConfirmationWindow(problematicVmNames); } else { removeTemplateBackup(); } } }; }
Source:
<code>default boolean actSecondary(Platform server, LocalConfiguration config, Player player, LocalSession session, Location clicked) { <START> return false; <END> }</code><technical_language>This throw</technical_language>

Target:
default boolean actSecondary(Platform server, LocalConfiguration config, Player player, LocalSession session, Location clicked) { throw new AssertionError("actPrimary must be overridden"); }
Source:
<code>private static ExpressionAnalysis analyzeExpressions( Session session, Metadata metadata, SqlParser sqlParser, RelationType tupleDescriptor, Map<Symbol, Type> types, Iterable<? extends Expression> expressions, List<Expression> parameters, boolean isDescribe) { Analysis analysis = new Analysis(null, parameters, isDescribe); ExpressionAnalyzer analyzer = create(analysis, session, metadata, sqlParser, new DenyAllAccessControl(), types); for (Expression expression : expressions) { analyzer.analyze(expression, Scope.builder().withRelationType(RelationId.anonymous(), tupleDescriptor).build()); } return new ExpressionAnalysis( <START> NodeRefCollections.toIdentityMap(analyzer.getExpressionTypes()), <END> NodeRefCollections.toIdentityMap(analyzer.getExpressionCoercions()), NodeRefCollections.toIdentitySet(analyzer.getSubqueryInPredicates()), NodeRefCollections.toIdentitySet(analyzer.getScalarSubqueries()), NodeRefCollections.toIdentitySet(analyzer.getExistsSubqueries()), NodeRefCollections.toIdentityMap(analyzer.getColumnReferences()), NodeRefCollections.toIdentitySet(analyzer.getTypeOnlyCoercions()), NodeRefCollections.toIdentitySet(analyzer.getQuantifiedComparisons()), NodeRefCollections.toIdentityMap(analyzer.getLambdaArgumentReferences())); }</code><technical_language>is required convert from/to IdentityLinkedHashMap forth? expose Map<NodeRef<...>, T></technical_language>

Target:
private static ExpressionAnalysis analyzeExpressions( Session session, Metadata metadata, SqlParser sqlParser, RelationType tupleDescriptor, Map<Symbol, Type> types, Iterable<? extends Expression> expressions, List<Expression> parameters, boolean isDescribe) { Analysis analysis = new Analysis(null, parameters, isDescribe); ExpressionAnalyzer analyzer = create(analysis, session, metadata, sqlParser, new DenyAllAccessControl(), types); for (Expression expression : expressions) { analyzer.analyze(expression, Scope.builder().withRelationType(RelationId.anonymous(), tupleDescriptor).build()); } return new ExpressionAnalysis( analyzer.getExpressionTypes(), analyzer.getExpressionCoercions(), analyzer.getSubqueryInPredicates(), analyzer.getScalarSubqueries(), analyzer.getExistsSubqueries(), analyzer.getColumnReferences(), analyzer.getTypeOnlyCoercions(), analyzer.getQuantifiedComparisons(), analyzer.getLambdaArgumentReferences()); }
Source:
<code>public void install(TierInstance tierInstance, ClaudiaData claudiaData, String envName,String vdc, <START> ProductRelease productRelease, Set<Attribute> attributes, Task task, String callback) throws EntityNotFoundException { <END> EnvironmentInstance environmentInstance = environmentInstanceManager.load(vdc,envName); try { ProductInstance productInstance = productInstanceManager.install(tierInstance, claudiaData, environmentInstance, productRelease, attributes); log.info("Product " + productRelease.getProduct() + '-' + productRelease.getVersion() + " installed successfully"); } catch (InvalidProductInstanceRequestException e) { String errorMsg = e.getMessage(); ProductInstance instance = getInstalledProduct(productRelease, tierInstance.getVM()); if (instance != null) { updateErrorTask(instance, task, errorMsg, e); } else { updateErrorTask(task, errorMsg, e); } } catch (Exception e) { String errorMsg = "The product " + productRelease.getProduct() + "-" + productRelease.getVersion() + " can not be installed in" + tierInstance.getVM(); ProductInstance instance = getInstalledProduct(productRelease, tierInstance.getVM()); if (instance != null) { updateErrorTask(instance, task, errorMsg, e); } else { updateErrorTask(task, errorMsg, e); } } finally { notifyTask(callback, task); } }</code><technical_language>More 120 characters</technical_language>

Target:
public void install(TierInstance tierInstance, ClaudiaData claudiaData, String envName, String vdc, ProductRelease productRelease, Set<Attribute> attributes, Task task, String callback) throws EntityNotFoundException { EnvironmentInstance environmentInstance = environmentInstanceManager.load(vdc, envName); try { ProductInstance productInstance = productInstanceManager.install(tierInstance, claudiaData, environmentInstance, productRelease); log.info("Product " + productRelease.getProduct() + '-' + productRelease.getVersion() + " installed successfully"); } catch (InvalidProductInstanceRequestException e) { String errorMsg = e.getMessage(); ProductInstance instance = getInstalledProduct(productRelease, tierInstance.getVM()); if (instance != null) { updateErrorTask(instance, task, errorMsg, e); } else { updateErrorTask(task, errorMsg, e); } } catch (Exception e) { String errorMsg = "The product " + productRelease.getProduct() + "-" + productRelease.getVersion() + " can not be installed in" + tierInstance.getVM(); ProductInstance instance = getInstalledProduct(productRelease, tierInstance.getVM()); if (instance != null) { updateErrorTask(instance, task, errorMsg, e); } else { updateErrorTask(task, errorMsg, e); } } finally { notifyTask(callback, task); } }
Source:
<code>public DefaultInterpretedExpressionTargetSwitch(EStructuralFeature feature, IInterpretedExpressionTargetSwitch globalSwitch) { IInterpretedExpressionTargetSwitch theGlobalSwitch = Objects.firstNonNull(globalSwitch, this); <START> this.firstRelevantContainerFinder = new FirstRelevantContainerDefaultFunction(); <END> this.descriptionSwitch = new DescriptionInterpretedExpressionTargetSwitch(feature, theGlobalSwitch); this.styleSwitch = new StyleInterpretedExpressionTargetSwitch(feature, theGlobalSwitch); this.toolSwitch = new ToolInterpretedExpressionTargetSwitch(feature, theGlobalSwitch); this.validationSwitch = new ValidationInterpretedExpressionTargetSwitch(feature, theGlobalSwitch); }</code><technical_language>remove field create function in getFirstRelevantContainer method</technical_language>

Target:
public DefaultInterpretedExpressionTargetSwitch(EStructuralFeature feature, IInterpretedExpressionTargetSwitch globalSwitch) { IInterpretedExpressionTargetSwitch theGlobalSwitch = Objects.firstNonNull(globalSwitch, this); this.descriptionSwitch = new DescriptionInterpretedExpressionTargetSwitch(feature, theGlobalSwitch); this.styleSwitch = new StyleInterpretedExpressionTargetSwitch(feature, theGlobalSwitch); this.toolSwitch = new ToolInterpretedExpressionTargetSwitch(feature, theGlobalSwitch); this.validationSwitch = new ValidationInterpretedExpressionTargetSwitch(feature, theGlobalSwitch); }
Source:
<code><START> public static String getStringFromBundleNoMissingCheck(String key, List<String> arguments, ResourceBundle bundle) throws MissingResourceException { <END> if (key == null || key.isEmpty()) { return null; } String stringFromBundle = null; stringFromBundle = bundle.getString(key); logger.fine("string found: " + stringFromBundle); if (arguments != null) { Object[] argArray = new String[arguments.size()]; argArray = arguments.toArray(argArray); return MessageFormat.format(stringFromBundle, argArray); } else { return stringFromBundle; } }</code><technical_language>suggestion private static String getStringFromBundleNoMissingCheck(String key, List<String> arguments, ResourceBundle bundle) throws MissingResourceException { In addition making new method private, do for getResourceBundle below</technical_language>

Target:
private static String getStringFromBundleNoMissingCheck(String key, List<String> arguments, ResourceBundle bundle) throws MissingResourceException { if (key == null || key.isEmpty()) { return null; } String stringFromBundle = null; stringFromBundle = bundle.getString(key); logger.fine("string found: " + stringFromBundle); if (arguments != null) { Object[] argArray = new String[arguments.size()]; argArray = arguments.toArray(argArray); return MessageFormat.format(stringFromBundle, argArray); } else { return stringFromBundle; } }
Source:
<code>OpenSslKeyMaterial chooseKeyMaterial(ByteBufAllocator allocator, String alias) throws Exception { OpenSslKeyMaterial material = cache.get(alias); if (material == null) { material = super.chooseKeyMaterial(allocator, alias); if (material == null) { return null; } <START> if (cache.size() > maxCachedEntries) { <END> return material; } OpenSslKeyMaterial old = cache.putIfAbsent(alias, material); if (old != null) { material.release(); material = old; } } return material.retain(); }</code><technical_language>actual cache size larger maxCachedEntries this check is thread-safe, fine me. LRU caching overkilled, implement if necessary in future. update doc of this class newly added max cached entries behavior</technical_language>

Target:
OpenSslKeyMaterial chooseKeyMaterial(ByteBufAllocator allocator, String alias) throws Exception { OpenSslKeyMaterial material = cache.get(alias); if (material == null) { material = super.chooseKeyMaterial(allocator, alias); if (material == null) { return null; } if (full) { return material; } if (cache.size() > maxCachedEntries) { full = true; return material; } OpenSslKeyMaterial old = cache.putIfAbsent(alias, material); if (old != null) { material.release(); material = old; } } return material.retain(); }
Source:
<code>public ColumnSortList reloadColumnSortList() { ColumnSortList columnSortList = getListGrid().getColumnSortList(); GridPreferencesStore gridPreferencesStore = listTable.getGridPreferencesStore(); GridSortedColumnPreference gridSortedColumnPreference = gridPreferencesStore.getGridSortedColumnPreference(); if (gridPreferencesStore != null && gridSortedColumnPreference != null && columnSortList.size() <= 1) { <START> Column<T, String> col = new Column<T, String>(new TextCell()) { <END> @Override public String getValue(T domain) { return null; } }; col.setDataStoreName(gridSortedColumnPreference.getDataStoreName()); columnSortList.push(new ColumnSortList.ColumnSortInfo(col, gridSortedColumnPreference.isAscending())); } return columnSortList; }</code><technical_language>suggestion retrieve actual column table</technical_language>

Target:
public ColumnSortList reloadColumnSortList() { ColumnSortList columnSortList = getListGrid().getColumnSortList(); GridPreferencesStore gridPreferencesStore = getListGrid().getGridPreferencesStore(); if (gridPreferencesStore != null) { GridSortedColumnPreference gridSortedColumnPreference = gridPreferencesStore.getGridSortedColumnPreference(); if (gridSortedColumnPreference != null && columnSortList.size() <= 1) { Optional<ColumnMeta<T>> optional = getListGrid().getColumnMetaList().stream().filter( tColumnMeta -> tColumnMeta.getColumn().getDataStoreName().equals(gridSortedColumnPreference.getDataStoreName())) .findFirst(); if (optional.isPresent()) { Column col = optional.get().getColumn(); col.setDataStoreName(gridSortedColumnPreference.getDataStoreName()); columnSortList.push(new ColumnSortList.ColumnSortInfo(col, gridSortedColumnPreference.isAscending())); } } } return columnSortList; }
Source:
<code>private JFreeChart createDebugEventGanttChart() { eventStatistics = new EventStatistics( InitializationManager.getInstance(WatchDogUtils.getProject()).getDebugEventManager(), selectedDebugInterval); <START> final GanttCategoryDataset dataset = eventStatistics.createDebugEventGanttChartDataset(); <END> final JFreeChart chart = ChartFactory.createGanttChart( "Debug Events During Selected Debug Interval", "Event", "Time", dataset, false, true, false); CategoryPlot plot = chart.getCategoryPlot(); ValueAxis axis = plot.getRangeAxis(); axis.setRangeWithMargins(selectedDebugInterval.getStart().getTime(), selectedDebugInterval.getEnd().getTime()); plot.setRenderer(new WatchDogGanttRenderer()); return chart; }</code><technical_language>final variable? :-)</technical_language>

Target:
private JFreeChart createDebugEventGanttChart() { eventStatistics = new EventStatistics( InitializationManager.getInstance(WatchDogUtils.getProject()).getDebugEventManager(), selectedDebugInterval); GanttCategoryDataset dataset = eventStatistics.createDebugEventGanttChartDataset(); JFreeChart chart = ChartFactory.createGanttChart( "Debug Events During Selected Debug Interval", "Event", "Time", dataset, false, true, false); CategoryPlot plot = chart.getCategoryPlot(); ValueAxis axis = plot.getRangeAxis(); axis.setRangeWithMargins(selectedDebugInterval.getStart().getTime(), selectedDebugInterval.getEnd().getTime()); plot.setRenderer(new WatchDogGanttRenderer()); return chart; }
Source:
<code>public boolean equals(Object obj) { if (obj == this) { return true; } if (!(obj instanceof ChunkImpl)) { return false; } ChunkImpl that = (ChunkImpl) obj; <START> return Objects.equal(this.chunkPos, that.chunkPos); <END> }</code><technical_language>This wonder. regular circumstances expect chunks location equal other. setting for potential bugs here? cases mind: * a issue duplicate chunks loaded (#2590) - this affect that? If a dupe chunk loads a system interaction changes of them. I if dupe chunks persist a timing issue causing load requests issued. * In future a *valid* chunks in location? Imagine related dimensions somehow, completely separate worlds (why compare chunks I .. MC relate position of Nether chunks Overworld chunks knows) in-place chunks a weird bizarro world shows players chunks. phasing (like bits of world progression locked individual players) add in hashing some additional stuff chunk compare well? I frequently this method is (or a parent implementation)</technical_language>

Target:
public boolean equals(Object obj) { return super.equals(obj); }
Source:
<code>private static PackIndex writePack(FileRepository repo, Set<? extends ObjectId> want, Set<ObjectIdSet> excludeObjects) throws IOException { try (PackWriter pw = new PackWriter(repo)) { pw.setDeltaBaseAsOffset(true); pw.setReuseDeltaCommits(false); for (ObjectIdSet idx : excludeObjects) pw.excludeObjects(idx); pw.preparePack(NullProgressMonitor.INSTANCE, want, <START> PackWriter.NONE); <END> String id = pw.computeName().getName(); File packdir = new File(repo.getObjectsDirectory(), "pack"); File packFile = new File(packdir, "pack-" + id + ".pack"); FileOutputStream packOS = new FileOutputStream(packFile); pw.writePack(NullProgressMonitor.INSTANCE, NullProgressMonitor.INSTANCE, packOS); packOS.close(); File idxFile = new File(packdir, "pack-" + id + ".idx"); FileOutputStream idxOS = new FileOutputStream(idxFile); pw.writeIndex(idxOS); idxOS.close(); return PackIndex.open(idxFile); } }</code><technical_language>s/PackWriter.NONE/NONE/ imported statically</technical_language>

Target:
private static PackIndex writePack(FileRepository repo, Set<? extends ObjectId> want, Set<ObjectIdSet> excludeObjects) throws IOException { try (PackWriter pw = new PackWriter(repo)) { pw.setDeltaBaseAsOffset(true); pw.setReuseDeltaCommits(false); for (ObjectIdSet idx : excludeObjects) pw.excludeObjects(idx); pw.preparePack(NullProgressMonitor.INSTANCE, want, NONE); String id = pw.computeName().getName(); File packdir = new File(repo.getObjectsDirectory(), "pack"); File packFile = new File(packdir, "pack-" + id + ".pack"); FileOutputStream packOS = new FileOutputStream(packFile); pw.writePack(NullProgressMonitor.INSTANCE, NullProgressMonitor.INSTANCE, packOS); packOS.close(); File idxFile = new File(packdir, "pack-" + id + ".idx"); FileOutputStream idxOS = new FileOutputStream(idxFile); pw.writeIndex(idxOS); idxOS.close(); return PackIndex.open(idxFile); } }