auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public ITmfStateInterval getAggregatedState(long timestamp) { List<ITmfStateInterval> potentialIntervals = getQuarkStream() .map(quark -> { try { return getStateSystem().querySingleState(timestamp, quark.intValue()); } catch (AttributeNotFoundException | StateSystemDisposedException e) { throw new IllegalStateException("Bad aggregation rule"); } }) .collect(Collectors.toList()); for (ITmfStateInterval interval : potentialIntervals) { if (!interval.getStateValue().isNull()) { <START> return interval; <END> } } return potentialIntervals.get(0); }</code><technical_language>appears this method return intervals overlap for attribute</technical_language>

Target:
public ITmfStateInterval getAggregatedState(long timestamp) { ITmfStateSystemBuilder ss = getStateSystem(); List<Integer> quarks = getQuarkStream().collect(Collectors.toList()); List<ITmfStateInterval> intervalsToUse = new ArrayList<>(); ITmfStateValue value = TmfStateValue.nullValue(); try { for (Integer quark : quarks) { ITmfStateInterval interval = ss.querySingleState(timestamp, quark); intervalsToUse.add(interval); ITmfStateValue sv = interval.getStateValue(); if (!sv.isNull()) { value = sv; break; } } long start = intervalsToUse.stream() .mapToLong(ITmfStateInterval::getStartTime) .max().orElse(ss.getStartTime()); long end = intervalsToUse.stream() .mapToLong(ITmfStateInterval::getEndTime) .min().orElse(ss.getCurrentEndTime()); return new TmfStateInterval(start, end, getTargetQuark(), value); } catch (AttributeNotFoundException | StateSystemDisposedException e) { throw new IllegalStateException("Bad aggregation rule"); } }
Source:
<code>static void saveUniqueOutcomeNotifications(JSONArray notificationIds, String outcomeName, OneSignalDbHelper dbHelper) { if (notificationIds == null) return; <START> synchronized (lock) { <END> SQLiteDatabase writableDb = dbHelper.getWritableDbWithRetries(); try { for (int i = 0; i < notificationIds.length(); i++) { ContentValues values = new ContentValues(); String notificationId = notificationIds.getString(i); values.put(CachedUniqueOutcomeNotificationTable.COLUMN_NAME_NOTIFICATION_ID, notificationId); values.put(CachedUniqueOutcomeNotificationTable.COLUMN_NAME_NAME, outcomeName); writableDb.insert(CachedUniqueOutcomeNotificationTable.TABLE_NAME, null, values); } } catch (JSONException e) { e.printStackTrace(); } writableDb.close(); } }</code><technical_language>add synchronized method signature instead of this block</technical_language>

Target:
synchronized static void saveUniqueOutcomeNotifications(JSONArray notificationIds, String outcomeName, OneSignalDbHelper dbHelper) { if (notificationIds == null) return; SQLiteDatabase writableDb = dbHelper.getWritableDbWithRetries(); try { for (int i = 0; i < notificationIds.length(); i++) { ContentValues values = new ContentValues(); String notificationId = notificationIds.getString(i); values.put(CachedUniqueOutcomeNotificationTable.COLUMN_NAME_NOTIFICATION_ID, notificationId); values.put(CachedUniqueOutcomeNotificationTable.COLUMN_NAME_NAME, outcomeName); writableDb.insert(CachedUniqueOutcomeNotificationTable.TABLE_NAME, null, values); } } catch (JSONException e) { e.printStackTrace(); } writableDb.close(); }
Source:
<code>public Response add(Storage storage) { <START> validateParameters(storage, "address", "type", "host.id|name"); <END> StorageServerConnections storageConnection = getMapper(Storage.class, StorageServerConnections.class).map(storage, null); Guid hostId = getHostId(storage.getHost()); switch (storageConnection.getstorage_type()) { case ISCSI: validateParameters(storage, "iqn", "port"); break; case NFS: case LOCALFS: validateParameters(storage, "path"); break; case POSIXFS: case GLUSTERFS: validateParameters(storage, "path", "vfsType"); break; default: break; } return performCreate(VdcActionType.AddStorageServerConnection, getAddParams(storageConnection, hostId), ENTITY_RETRIEVER); }</code><technical_language>out in 3.3 (any chance won't?), i want exposing redundant constraint</technical_language>

Target:
public Response add(Storage storage) { validateParameters(storage, "address", "type"); StorageServerConnections storageConnection = getMapper(Storage.class, StorageServerConnections.class).map(storage, null); Guid hostId = Guid.Empty; if (storage.getHost() != null) { hostId = getHostId(storage.getHost()); } switch (storageConnection.getstorage_type()) { case ISCSI: validateParameters(storage, "target", "port"); break; case NFS: case LOCALFS: validateParameters(storage, "path"); break; case POSIXFS: case GLUSTERFS: validateParameters(storage, "path", "vfsType"); break; default: break; } return performCreate(VdcActionType.AddStorageServerConnection, getAddParams(storageConnection, hostId), ENTITY_RETRIEVER); }
Source:
<code>public void empty_list_should_not_diff_with_empty_table() { try { List<List<String>> emptyList = new ArrayList<List<String>>(); DataTable emptyTable = DataTable.create(Collections.emptyList()); emptyTable.diff(emptyList); <START> } catch (IndexOutOfBoundsException e) { <END> String expected = "" + "Tables were not identical:\n" + " - | Aslak | aslak@email.com | 123 |\n" + " - | Joe | joe@email.com | 234 |\n" + " - | Bryan | bryan@email.org | 456 |\n" + " - | Ni | ni@email.com | 654 |\n"; assertEquals(expected, e.getMessage()); throw e; } }</code><technical_language>In this test case want compare empty table another another empty table. This result in exception</technical_language>

Target:
public void empty_list_should_not_diff_with_empty_table() { List<List<String>> emptyList = new ArrayList<List<String>>(); DataTable emptyTable = DataTable.create(Collections.emptyList()); assertEquals(emptyTable.raw(), emptyList); }
Source:
<code>public static CuratorFramework newCurator(Map conf, List<String> servers, Object port, String root, ZookeeperAuthInfo auth) { List<String> serverPorts = new ArrayList<String>(); for(String zkServer: (List<String>) servers) { serverPorts.add(zkServer + ":" + Utils.getInt(port)); } String zkStr = StringUtils.join(serverPorts, ",") + root; try { CuratorFrameworkFactory.Builder builder = CuratorFrameworkFactory.builder() .connectString(zkStr) .connectionTimeoutMs(Utils.getInt(conf.get(Config.STORM_ZOOKEEPER_CONNECTION_TIMEOUT))) .sessionTimeoutMs(Utils.getInt(conf.get(Config.STORM_ZOOKEEPER_SESSION_TIMEOUT))) <START> .retryPolicy(new ExponentialBackoffRetry(Utils.getInt(conf.get(Config.STORM_ZOOKEEPER_RETRY_TIMES)), Utils.getInt(conf.get(Config.STORM_ZOOKEEPER_RETRY_INTERVAL)))); <END> if(auth!=null && auth.scheme!=null) { builder = builder.authorization(auth.scheme, auth.payload); } return builder.build(); } catch (IOException e) { throw new RuntimeException(e); } }</code><technical_language><LINK_0>, arguments reversed here</technical_language>

Target:
public static CuratorFramework newCurator(Map conf, List<String> servers, Object port, String root, ZookeeperAuthInfo auth) { List<String> serverPorts = new ArrayList<String>(); for(String zkServer: (List<String>) servers) { serverPorts.add(zkServer + ":" + Utils.getInt(port)); } String zkStr = StringUtils.join(serverPorts, ",") + root; try { CuratorFrameworkFactory.Builder builder = CuratorFrameworkFactory.builder() .connectString(zkStr) .connectionTimeoutMs(Utils.getInt(conf.get(Config.STORM_ZOOKEEPER_CONNECTION_TIMEOUT))) .sessionTimeoutMs(Utils.getInt(conf.get(Config.STORM_ZOOKEEPER_SESSION_TIMEOUT))) .retryPolicy(new BoundedExponentialBackoffRetry( Utils.getInt(conf.get(Config.STORM_ZOOKEEPER_RETRY_INTERVAL)), Utils.getInt(conf.get(Config.STORM_ZOOKEEPER_RETRY_TIMES)), Utils.getInt(conf.get(Config.STORM_ZOOKEEPER_RETRY_INTERVAL_CEILING)))); if(auth!=null && auth.scheme!=null) { builder = builder.authorization(auth.scheme, auth.payload); } return builder.build(); } catch (IOException e) { throw new RuntimeException(e); } }
Source:
<code>private void setAzureCloudIdentityMapping(SdxCluster sdxCluster, Map<String, String> azureUserMapping, Map<String, String> azureGroupMapping) { String stackCrn = sdxCluster.getStackCrn(); LOGGER.info("Updating azure cloud id mappings for datalake stack crn = {}", stackCrn); try { clouderaManagerRangerUtil.setAzureCloudIdentityMapping(stackCrn, azureUserMapping, azureGroupMapping); } catch (ApiException e) { throw new RangerCloudIdentitySyncException("Encountered api exception", e); <START> } <END> }</code><technical_language>log nice</technical_language>

Target:
private void setAzureCloudIdentityMapping(SdxCluster sdxCluster, Map<String, String> azureUserMapping, Map<String, String> azureGroupMapping) { String stackCrn = sdxCluster.getStackCrn(); LOGGER.info("Updating azure cloud id mappings for datalake stack crn = {}", stackCrn); try { clouderaManagerRangerUtil.setAzureCloudIdentityMapping(stackCrn, azureUserMapping, azureGroupMapping); } catch (ApiException e) { LOGGER.error("Encountered api exception", e); throw new RangerCloudIdentitySyncException("Encountered api exception", e); } }
Source:
<code>void initializeRangeForQuery( StringSchemaKey treeKeyFrom, StringSchemaKey treeKeyTo, IndexQuery[] predicates ) { IndexQuery predicate = predicates[0]; switch ( predicate.type() ) { case exists: treeKeyFrom.initAsLowest(); <START> treeKeyTo.initAsHighest(); <END> break; case exact: ExactPredicate exactPredicate = (ExactPredicate) predicate; treeKeyFrom.from( Long.MIN_VALUE, exactPredicate.value() ); treeKeyTo.bytes = treeKeyFrom.bytes; treeKeyTo.setEntityIdIsSpecialTieBreaker( false ); treeKeyTo.setEntityId( Long.MAX_VALUE ); break; case rangeString: StringRangePredicate rangePredicate = (StringRangePredicate)predicate; initFromForRange( rangePredicate, treeKeyFrom ); initToForRange( rangePredicate, treeKeyTo ); break; default: throw new IllegalArgumentException( "IndexQuery of type " + predicate.type() + " is not supported." ); } }</code><technical_language>i find predicates level this point: key.initAsLowest key.initAsHighest good examples keys initialized this level I prefer helper methods instead perform initialisations for exact range cases</technical_language>

Target:
void initializeRangeForQuery( StringSchemaKey treeKeyFrom, StringSchemaKey treeKeyTo, IndexQuery[] predicates ) { IndexQuery predicate = predicates[0]; switch ( predicate.type() ) { case exists: treeKeyFrom.initAsLowest(); treeKeyTo.initAsHighest(); break; case exact: ExactPredicate exactPredicate = (ExactPredicate) predicate; treeKeyFrom.from( Long.MIN_VALUE, exactPredicate.value() ); treeKeyTo.from( Long.MAX_VALUE, exactPredicate.value() ); break; case rangeString: StringRangePredicate rangePredicate = (StringRangePredicate)predicate; initFromForRange( rangePredicate, treeKeyFrom ); initToForRange( rangePredicate, treeKeyTo ); break; default: throw new IllegalArgumentException( "IndexQuery of type " + predicate.type() + " is not supported." ); } }
Source:
<code>default AdminClient getAdminClient(final Map<String, Object> config) { throw new UnsupportedOperationException("Direct use of this method is deprecated. " + <START> "Implementations of KafkaClientSupplier should implement the getAdmin method instead. " + <END> "The method will be removed in a future release."); }</code><technical_language>nit: getAdmin method -> getAdmin() method</technical_language>

Target:
default AdminClient getAdminClient(final Map<String, Object> config) { throw new UnsupportedOperationException("Direct use of this method is deprecated. " + "Implementations of KafkaClientSupplier should implement the getAdmin() method instead. " + "The method will be removed in a future release."); }
Source:
<code><START> default KeyValueFilterConverter getFilterConverter() { <END> return getFilterConverter(null); }</code><technical_language>This return KeyValueFilterConverter<K, V, C></technical_language>

Target:
default KeyValueFilterConverter<K, V, C> getFilterConverter() { return getFilterConverter(null); }
Source:
<code>public RawIterator<Object[],ProcedureException> apply( Context ctx, Object[] input, ResourceTracker resourceTracker ) throws ProcedureException { @SuppressWarnings( "unchecked" ) String dbName = (String) input[0]; List<Endpoint> routers = routeEndpoints( dbName ); <START> long ttl = config.get( CausalClusteringSettings.cluster_routing_ttl ).toMillis(); <END> HashMap<String,List<Endpoint>> routerMap = new HashMap<>(); routerMap.put( dbName, routers ); MultiClusterRoutingResult result = new MultiClusterRoutingResult( routerMap, ttl ); return RawIterator.<Object[], ProcedureException>of( MultiClusterRoutingResultFormat.build( result ) ); }</code><technical_language>extract this in constructor? for other procedure</technical_language>

Target:
public RawIterator<Object[],ProcedureException> apply( Context ctx, Object[] input, ResourceTracker resourceTracker ) throws ProcedureException { @SuppressWarnings( "unchecked" ) String dbName = (String) input[0]; List<Endpoint> routers = routeEndpoints( dbName ); HashMap<String,List<Endpoint>> routerMap = new HashMap<>(); routerMap.put( dbName, routers ); MultiClusterRoutingResult result = new MultiClusterRoutingResult( routerMap, timeToLiveMillis ); return RawIterator.<Object[], ProcedureException>of( MultiClusterRoutingResultFormat.build( result ) ); }
Source:
<code>private static void testSymbolAPI(RecordMetadata metadata, RecordCursor cursor) { IntList symbolIndexes = null; for (int i = 0, n = metadata.getColumnCount(); i < n; i++) { if (metadata.getColumnType(i) == ColumnType.SYMBOL) { if (symbolIndexes == null) { symbolIndexes = new IntList(); } symbolIndexes.add(i); } } if (symbolIndexes != null) { cursor.toTop(); final Record record = cursor.getRecord(); while (cursor.hasNext()) { for (int i = 0, n = symbolIndexes.size(); i < n; i++) { int column = symbolIndexes.getQuick(i); SymbolTable symbolTable = cursor.getSymbolTable(column); if (symbolTable instanceof StaticSymbolTable) { CharSequence sym = record.getSym(column); int value = record.getInt(column); <START> if (symbolTable instanceof SymbolMapReader && ((SymbolMapReader) symbolTable).containsNullValue() && value == ((StaticSymbolTable) symbolTable).size()) { <END> Assert.assertEquals(Integer.MIN_VALUE, ((SymbolMapReader) symbolTable).keyOf(sym)); } else { Assert.assertEquals(value, ((StaticSymbolTable) symbolTable).keyOf(sym)); } TestUtils.assertEquals(sym, symbolTable.valueOf(value)); } else { final int value = record.getInt(column); TestUtils.assertEquals(record.getSym(column), symbolTable.valueOf(value)); } } } } }</code><technical_language>I follow this condition. comparing int of symbol size of symbol map</technical_language>

Target:
private static void testSymbolAPI(RecordMetadata metadata, RecordCursor cursor) { IntList symbolIndexes = null; for (int i = 0, n = metadata.getColumnCount(); i < n; i++) { if (metadata.getColumnType(i) == ColumnType.SYMBOL) { if (symbolIndexes == null) { symbolIndexes = new IntList(); } symbolIndexes.add(i); } } if (symbolIndexes != null) { cursor.toTop(); final Record record = cursor.getRecord(); while (cursor.hasNext()) { for (int i = 0, n = symbolIndexes.size(); i < n; i++) { int column = symbolIndexes.getQuick(i); SymbolTable symbolTable = cursor.getSymbolTable(column); if (symbolTable instanceof StaticSymbolTable) { CharSequence sym = record.getSym(column); int value = record.getInt(column); if (((StaticSymbolTable) symbolTable).containsNullValue() && value == ((StaticSymbolTable) symbolTable).size()) { Assert.assertEquals(Integer.MIN_VALUE, ((StaticSymbolTable) symbolTable).keyOf(sym)); } else { Assert.assertEquals(value, ((StaticSymbolTable) symbolTable).keyOf(sym)); } TestUtils.assertEquals(sym, symbolTable.valueOf(value)); } else { final int value = record.getInt(column); TestUtils.assertEquals(record.getSym(column), symbolTable.valueOf(value)); } } } } }
Source:
<code>public void store(IFrontendActionAsyncCallback callback) { if (getProgress() != null || !validate()) { return; } ArrayList<VdcActionType> actionTypes = new ArrayList<VdcActionType>(); ArrayList<VdcActionParametersBase> paramerterList = new ArrayList<VdcActionParametersBase>(); ArrayList<IFrontendActionAsyncCallback> callbacks = new ArrayList<IFrontendActionAsyncCallback>(); IFrontendActionAsyncCallback onFinishCallback = callback != null ? callback : new IFrontendActionAsyncCallback() { @Override public void executed(FrontendActionAsyncResult result) { NewDiskModel diskModel = (NewDiskModel) result.getState(); diskModel.stopProgress(); diskModel.cancel(); } }; List<EntityModel<DiskModel>> disksToAttach = getSelectedDisks(); for (int i = 0; i < disksToAttach.size(); i++) { DiskModel disk = disksToAttach.get(i).getEntity(); boolean activate = false; if (getIsPlugged().getEntity()) { <START> if (disk.getDisk().getDiskInterface() == DiskInterface.IDE) { <END> activate = getVm().getStatus() == VMStatus.Down; } else { activate = true; } } AttachDetachVmDiskParameters parameters = new AttachDetachVmDiskParameters( getVm().getId(), disk.getDisk().getId(), activate, Boolean.TRUE.equals(disk.getDisk().getReadOnly())); actionTypes.add(VdcActionType.AttachDiskToVm); paramerterList.add(parameters); callbacks.add(i == disksToAttach.size() - 1 ? onFinishCallback : null); } startProgress(null); Frontend.getInstance().runMultipleActions(actionTypes, paramerterList, callbacks, null, this); }</code><technical_language>please change to: "activate = disk.getDisk().getDiskInterface() == DiskInterface.IDE ? getVm().getStatus() == VMStatus.Down : true"</technical_language>

Target:
public void store(IFrontendActionAsyncCallback callback) { if (getProgress() != null || !validate()) { return; } ArrayList<VdcActionType> actionTypes = new ArrayList<VdcActionType>(); ArrayList<VdcActionParametersBase> paramerterList = new ArrayList<VdcActionParametersBase>(); ArrayList<IFrontendActionAsyncCallback> callbacks = new ArrayList<IFrontendActionAsyncCallback>(); IFrontendActionAsyncCallback onFinishCallback = callback != null ? callback : new IFrontendActionAsyncCallback() { @Override public void executed(FrontendActionAsyncResult result) { NewDiskModel diskModel = (NewDiskModel) result.getState(); diskModel.stopProgress(); diskModel.cancel(); } }; List<EntityModel<DiskModel>> disksToAttach = getSelectedDisks(); for (int i = 0; i < disksToAttach.size(); i++) { DiskModel disk = disksToAttach.get(i).getEntity(); boolean activate = false; if (getIsPlugged().getEntity()) { activate = disk.getDisk().getDiskInterface() == DiskInterface.IDE ? getVm().getStatus() == VMStatus.Down : true; } AttachDetachVmDiskParameters parameters = new AttachDetachVmDiskParameters( getVm().getId(), disk.getDisk().getId(), activate, Boolean.TRUE.equals(disk.getDisk().getReadOnly())); actionTypes.add(VdcActionType.AttachDiskToVm); paramerterList.add(parameters); callbacks.add(i == disksToAttach.size() - 1 ? onFinishCallback : null); } startProgress(null); Frontend.getInstance().runMultipleActions(actionTypes, paramerterList, callbacks, null, this); }
Source:
<code>public void testStatusWhenInitializing() throws <START> Exception { <END> TestContext testContext = createTestContext(Dispatcher.ExecutionType.SUBMISSION); DispatcherJob dispatcherJob = testContext.getDispatcherJob(); Assert.assertThat(dispatcherJob.isInitialized(), is(false)); Assert.assertThat(dispatcherJob.getResultFuture().isDone(), is(false)); assertJobStatus(dispatcherJob, JobStatus.INITIALIZING); }</code><technical_language>nit: this is a personal question of taste: I I leave Exception line throws</technical_language>

Target:
public void testStatusWhenInitializing() throws Exception { TestContext testContext = createTestContext(); DispatcherJob dispatcherJob = testContext.getDispatcherJob(); assertThat(dispatcherJob.isInitialized(), is(false)); assertThat(dispatcherJob.getResultFuture().isDone(), is(false)); assertJobStatus(dispatcherJob, JobStatus.INITIALIZING); }
Source:
<code>private String generateJSON(boolean preserveReports) { ConcurrentLinkedQueue<MLSJSONObject> jsonCollector = new ConcurrentLinkedQueue<MLSJSONObject>(); MLSJSONObject report = null; final String kPrefix = "{\"items\":["; StringBuilder reportString = new StringBuilder(kPrefix); report = reportList.poll(); if (report != null) { if (preserveReports) { jsonCollector.add(report); } reportString.append(report.toString()); } report = reportList.poll(); while (report != null) { if (preserveReports) { jsonCollector.add(report); } reportString.append("," + report.toString()); report = reportList.poll(); } if (preserveReports) { report = jsonCollector.poll(); while (report != null) { <START> reportList.add(report); <END> report = jsonCollector.poll(); } } return reportString.toString() + "]}"; }</code><technical_language>mReportList instead? I know, annoying. I m\* in code base I code seriously confused reading this function understanding is local is global</technical_language>

Target:
private String generateJSON(boolean preserveReports) { ConcurrentLinkedQueue<MLSJSONObject> jsonCollector = new ConcurrentLinkedQueue<MLSJSONObject>(); MLSJSONObject report = null; final String kPrefix = "{\"items\":["; StringBuilder reportString = new StringBuilder(kPrefix); String jsonSep = ""; report = mReportList.poll(); while (report != null) { if (preserveReports) { jsonCollector.add(report); } reportString.append(jsonSep + report.toString()); report = mReportList.poll(); jsonSep = ","; } if (preserveReports) { report = jsonCollector.poll(); while (report != null) { mReportList.add(report); report = jsonCollector.poll(); } } return reportString.toString() + "]}"; }
Source:
<code>public void shouldCreateTransactionalDatabaseTemplate_withDatabaseTemplate() { <START> final DatabaseTemplate dynamoDbTemplate = mock(DatabaseTemplate.class); <END> final TransactionalDatabaseTemplate transactionalDatabaseTemplate = new TransactionalDatabaseTemplate( dynamoDbTemplate); assertNotNull(transactionalDatabaseTemplate); }</code><technical_language>This local variable appears shadowing field variable</technical_language>

Target:
public void shouldCreateTransactionalDatabaseTemplate_withDatabaseTemplate() { final DatabaseTemplate databaseTemplate = mock(DatabaseTemplate.class); final TransactionalDatabaseTemplate transactionalDatabaseTemplate = new TransactionalDatabaseTemplate( databaseTemplate); assertNotNull(transactionalDatabaseTemplate); }
Source:
<code>private TerrainFacing determineFacing() { Terrain terrain = getTerrain(); <START> TerrainFacingDeterminer facingDeterminer = new TerrainFacingDeterminer(); <END> facingDeterminer.setTopSame(terrain.isSame(topTerrain())); facingDeterminer.setRightSame(terrain.isSame(rightTerrain())); facingDeterminer.setBottomSame(terrain.isSame(bottomTerrain())); facingDeterminer.setLeftSame(terrain.isSame(leftTerrain())); return facingDeterminer.getFacing(); }</code><technical_language>I feel a factory approach coming here: factory.getFacingDeterminer(type) etc. abstract it. Renaming is nice (now) btw, is explicit for terrain! :)</technical_language>

Target:
private TerrainFacing determineFacing() { Terrain terrain = getTerrain(); return TerrainFacingDeterminer.getFacing( terrain.isSame(topTerrain()), terrain.isSame(rightTerrain()), terrain.isSame(bottomTerrain()), terrain.isSame(leftTerrain()) ); }
Source:
<code><START> public Transform hydrateTransform( ChainrEntry entry ) { <END> final Class<? extends Transform> transformClass = entry.getTransformClass(); final Object transformSpec = entry.getSpec(); if ( entry.isSpecDriven() ) { Injector injector; try { injector = Guice.createInjector( new AbstractModule() { @Override protected void configure() { install( parentModule ); bind( Object.class ).toInstance( transformSpec ); } } ); } catch ( CreationException creationException ) { throw new SpecException( "Exception using Guice to initialize class:" + transformClass.getCanonicalName(), creationException ); } return injector.getInstance( transformClass ); } else { return nonSpecInjector.getInstance( transformClass ); } }</code><technical_language>this of jolt? If change public</technical_language>

Target:
public Transform hydrateTransform( ChainrEntry entry ) { final Class<? extends Transform> transformClass = entry.getTransformClass(); final Object transformSpec = entry.getSpec(); try { if ( entry.isSpecDriven() ) { Injector injector; injector = Guice.createInjector( new AbstractModule() { @Override protected void configure() { install( parentModule ); bind( Object.class ).toInstance( transformSpec ); } } ); return injector.getInstance( transformClass ); } else { return nonSpecInjector.getInstance( transformClass ); } } catch ( Exception creationException ) { throw new SpecException( "Exception using Guice to initialize class:" + transformClass.getCanonicalName(), creationException ); } }
Source:
<code>public void munge(String entityId, Collection<Statement> statements, Collection<String> existingValues, Collection<String> existingRefs) throws ContainedException { <START> if(existingValues == null) { <END> existingValues = new HashSet<String>(); } if(existingRefs == null) { existingRefs = new HashSet<String>(); } if (statements.isEmpty()) { return; } MungeOperation op = new MungeOperation(entityId, statements, existingValues, existingRefs); op.munge(); existingValues.removeAll(op.extraValidSubjects); existingRefs.removeAll(op.extraValidSubjects); return; }</code><technical_language>Remove null check - people pass in Collections.emptySet</technical_language>

Target:
public void munge(String entityId, Collection<Statement> statements, Collection<String> existingValues, Collection<String> existingRefs) throws ContainedException { if (statements.isEmpty()) { return; } MungeOperation op = new MungeOperation(entityId, statements, existingValues, existingRefs); op.munge(); existingValues.removeAll(op.extraValidSubjects); existingRefs.removeAll(op.extraValidSubjects); return; }
Source:
<code>public void testImportPackageCanContainJavaPackages() throws Exception { File config = OSGiTestsActivator.getContext().getDataFile(getName()); Map<String, String> headers = new HashMap<String, String>(); headers.put(Constants.BUNDLE_MANIFESTVERSION, "2"); headers.put(Constants.BUNDLE_SYMBOLICNAME, getName()); headers.put(Constants.IMPORT_PACKAGE, JAVA_LANG); config.mkdirs(); File bundle = SystemBundleTests.createBundle(config, getName(), headers); Equinox equinox = new Equinox(Collections.singletonMap(Constants.FRAMEWORK_STORAGE, config.getAbsolutePath())); try { equinox.start(); BundleContext systemContext = equinox.getBundleContext(); Bundle testBundle = systemContext.installBundle(bundle.toURI().toString()); testBundle.start(); Dictionary<String, String> testHeaders = testBundle.getHeaders(); <START> assertTrue(Constants.IMPORT_PACKAGE + " does not contain the java.* package", testHeaders.get(Constants.IMPORT_PACKAGE).contains(JAVA_LANG)); <END> } catch (BundleException e) { fail("Failed to test Import-Package header"); } finally { try { equinox.stop(); equinox.waitForStop(10000); } catch (Exception e) { } } }</code><technical_language>Check BundleWiring of bundle osgi.wiring.package wire is wired java.lang osgi.wiring.package capability system bundle. BundleWiring of bundle: BundleWiring wiring = testBundle.adapt(BundleWiring.class);</technical_language>

Target:
public void testImportPackageCanContainJavaPackages() throws Exception { File config = OSGiTestsActivator.getContext().getDataFile(getName()); Map<String, String> headers = new HashMap<String, String>(); headers.put(Constants.BUNDLE_MANIFESTVERSION, "2"); headers.put(Constants.BUNDLE_SYMBOLICNAME, getName()); headers.put(Constants.IMPORT_PACKAGE, JAVA_LANG); config.mkdirs(); File bundle = SystemBundleTests.createBundle(config, getName(), headers); Equinox equinox = new Equinox(Collections.singletonMap(Constants.FRAMEWORK_STORAGE, config.getAbsolutePath())); try { equinox.start(); BundleContext systemContext = equinox.getBundleContext(); Bundle testBundle = systemContext.installBundle(bundle.toURI().toString()); testBundle.start(); Dictionary<String, String> testHeaders = testBundle.getHeaders(); assertTrue(Constants.IMPORT_PACKAGE + " does not contain the java.* package", testHeaders.get(Constants.IMPORT_PACKAGE).contains(JAVA_LANG)); List<BundleWire> pkgWires = testBundle.adapt(BundleWiring.class).getRequiredWires(PackageNamespace.PACKAGE_NAMESPACE); assertEquals("Wrong number of package requiremens: ", 1, pkgWires.size()); assertEquals("Wrong package found: " + pkgWires.get(0), JAVA_LANG, pkgWires.get(0).getCapability().getAttributes().get(PackageNamespace.PACKAGE_NAMESPACE)); } catch (BundleException e) { fail("Failed to test Import-Package header"); } finally { try { equinox.stop(); equinox.waitForStop(10000); } catch (Exception e) { } } }
Source:
<code>public boolean canFlipToNextPage() { boolean canFlip = true; <START> IProject[] projects = ResourcesPlugin.getWorkspace().getRoot().getProjects(); <END> if (canFlip != false) { for (IProject iproject : projects) { if (this.getProjectName().equalsIgnoreCase(iproject.getName())) { canFlip = false; this.setErrorMessage("There already is a project with this name: " + iproject.getName()); break; } } } if (!validatePage()) { canFlip = false; } return canFlip; }</code><technical_language>final</technical_language>

Target:
public boolean canFlipToNextPage() { boolean canFlip = true; final IProject[] projects = ResourcesPlugin.getWorkspace().getRoot().getProjects(); if (canFlip) { for (IProject iproject : projects) { if (this.getProjectName().equalsIgnoreCase(iproject.getName())) { canFlip = false; this.setErrorMessage("There already is a project with this name: " + iproject.getName()); break; } } } if (!validatePage()) { canFlip = false; } return canFlip; }
Source:
<code>public static StackTraceResponse create(final int startFrame, final int levels, final Suspension suspension, final int requestId) { ArrayList<DebugStackFrame> frames = suspension.getStackFrames(); int skipFrames = 0; <START> if (suspension.isHaltPrimitive()) { <END> skipFrames = Suspension.FRAMES_SKIPPED_FOR_HALT; } else if (suspension.isSuspendExecutionNode()) { skipFrames = suspension.skipFrames(); } if (startFrame > skipFrames) { skipFrames = startFrame; } int numFrames = levels; if (numFrames == 0) { numFrames = Integer.MAX_VALUE; } numFrames = Math.min(frames.size(), numFrames); numFrames -= skipFrames; StackFrame[] arr = new StackFrame[numFrames]; for (int i = 0; i < numFrames; i += 1) { int frameId = i + skipFrames; StackFrame f = createFrame(suspension, frameId, frames.get(frameId)); arr[i] = f; } return new StackTraceResponse(suspension.activityId, arr, frames.size(), requestId); }</code><technical_language>a general getFrameSkipCount() method in suspension? this Suspension need expose details</technical_language>

Target:
public static StackTraceResponse create(final int startFrame, final int levels, final Suspension suspension, final int requestId) { ArrayList<DebugStackFrame> frames = suspension.getStackFrames(); int skipFrames = suspension.getFrameSkipCount(); if (startFrame > skipFrames) { skipFrames = startFrame; } int numFrames = levels; if (numFrames == 0) { numFrames = Integer.MAX_VALUE; } numFrames = Math.min(frames.size(), numFrames); numFrames -= skipFrames; StackFrame[] arr = new StackFrame[numFrames]; for (int i = 0; i < numFrames; i += 1) { int frameId = i + skipFrames; StackFrame f = createFrame(suspension, frameId, frames.get(frameId)); arr[i] = f; } return new StackTraceResponse(suspension.activityId, arr, frames.size(), requestId); }
Source:
<code>public List<Connection> addInternalLinks(EObject investigatedElement, List<String> selectedRelationshipTypes) { List<Connection> connections = new ArrayList<Connection>(); if (investigatedElement instanceof INamed) { INamed named = (INamed) investigatedElement; List<EObject> refs = named.eCrossReferences(); for (EObject ref : refs) { if (selectedRelationshipTypes.size() == 0 <START> || selectedRelationshipTypes.contains(ref.eClass().getName())) { <END> List<EObject> target = new ArrayList<>(); target.add(ref); connections.add(new Connection(investigatedElement, target, ref)); } } } return connections; }</code><technical_language>Again, a null check for selectedRelationshipTypes</technical_language>

Target:
public List<Connection> addInternalLinks(EObject investigatedElement, List<String> selectedRelationshipTypes) { List<Connection> connections = new ArrayList<Connection>(); if (investigatedElement instanceof INamed) { INamed named = (INamed) investigatedElement; if (!named.eCrossReferences().isEmpty()) { List<EObject> refs = named.eCrossReferences(); for (EObject ref : refs) { if (selectedRelationshipTypes.size() == 0 || selectedRelationshipTypes.contains(ref.eClass().getName())) { connections.add(new Connection(investigatedElement, Arrays.asList(ref), ref)); } } } } return connections; }
Source:
<code><START> private void updateBiggestArmyOwner(GameUserBean gameUser, GameBean game) { <END> int totalUsedKnights = gameUser.getAchievements().getTotalUsedKnights(); if (totalUsedKnights < 3) { return; } Integer biggestArmyOwnerId = game.getBiggestArmyOwner(); if (biggestArmyOwnerId != null) { for (GameUserBean currentGameUser : game.getGameUsers()) { if (!currentGameUser.getGameUserId().equals(biggestArmyOwnerId)) { continue; } if (currentGameUser.getAchievements().getTotalUsedKnights() >= totalUsedKnights) { return; } break; } } game.setBiggestArmyOwner(gameUser.getGameUserId()); }</code><technical_language>I reorganize logic in this method, is wired</technical_language>

Target:
private void updateBiggestArmyOwner(GameUserBean gameUser, GameBean game) { int totalUsedKnights = gameUser.getAchievements().getTotalUsedKnights(); if (totalUsedKnights >= 3 && gameUsersUsedKnightsIsTheBiggestArmy(totalUsedKnights, game)) { game.setBiggestArmyOwner(gameUser); } }
Source:
<code>@Override public BufferedSink valueSink() throws IOException { if (promoteValueToName) { throw new IllegalStateException( "BufferedSink cannot be used as a map key in JSON at path " + getPath()); } writeDeferredName(); beforeValue(); pushScope(STREAMING_VALUE); return Okio.buffer(new Sink() { @Override public void write(Buffer source, long byteCount) throws IOException { sink.write(source, byteCount); } @Override public void close() { if (peekScope() != STREAMING_VALUE) { throw new AssertionError(); } stackSize--; pathIndices[stackSize - 1]++; } @Override public void flush() { } @Override public Timeout timeout() { return Timeout.NONE; <START> } <END> }); }</code><technical_language>this sink's timeout</technical_language>

Target:
@Override public BufferedSink valueSink() throws IOException { if (promoteValueToName) { throw new IllegalStateException( "BufferedSink cannot be used as a map key in JSON at path " + getPath()); } writeDeferredName(); beforeValue(); pushScope(STREAMING_VALUE); return Okio.buffer(new Sink() { @Override public void write(Buffer source, long byteCount) throws IOException { sink.write(source, byteCount); } @Override public void close() { if (peekScope() != STREAMING_VALUE) { throw new AssertionError(); } stackSize--; pathIndices[stackSize - 1]++; } @Override public void flush() throws IOException { sink.flush(); } @Override public Timeout timeout() { return Timeout.NONE; } }); }
Source:
<code>protected boolean changedDisplayName() { final String savedDisplayName = mAccount.getAccount().getDisplayName(); final String initialDisplayName = getArguments().getString(ARG_DISPLAY_NAME); return !TextUtils.equals(!TextUtils.isEmpty(savedDisplayName) <START> ? savedDisplayName : initialDisplayName, mDisplayName); <END> }</code><technical_language>Thanks for investigation! > If confirm stored display name empty, I simplify logic of changedDisplayName() simply compares of text field stored one. do think? Sounds good me, I checked AccountModel is initialized, I guess done user creation POST call (after email confirmation)</technical_language>

Target:
protected boolean changedDisplayName() { return !TextUtils.equals(mAccount.getAccount().getDisplayName(), mDisplayName); }
Source:
<code>private void sendGroupStateChangedEvent(String memberName, State newState, State oldState) { <START> if (eventPublisher != null && !oldGroupState.equals(this.state)) { <END> eventPublisher.post( ItemEventFactory.createGroupStateChangedEvent(this.getName(), memberName, newState, oldState)); } }</code><technical_language>oldState instead of oldGroupState newState instead of this.state here? nicer refer passed parameters instance variables</technical_language>

Target:
private void sendGroupStateChangedEvent(String memberName, State newState, State oldState) { if (eventPublisher != null) { eventPublisher.post( ItemEventFactory.createGroupStateChangedEvent(this.getName(), memberName, newState, oldState)); } }
Source:
<code>private ZapMenuItem getMenuItemJsonReport() { if (menuItemJsonReport == null) { menuItemJsonReport = new ZapMenuItem("menu.report.json.generate"); <START> menuItemJsonReport.addActionListener(new java.awt.event.ActionListener() { <END> @Override public void actionPerformed(java.awt.event.ActionEvent e) { ReportLastScan report = new ReportLastScan(); report.generateReport(getView(), getModel(), ReportLastScan.ReportType.JSON); } }); } return menuItemMdReport; }</code><technical_language>a lambda, code</technical_language>

Target:
private ZapMenuItem getMenuItemJsonReport() { if (menuItemJsonReport == null) { menuItemJsonReport = new ZapMenuItem("menu.report.json.generate"); menuItemJsonReport.addActionListener(e -> new ReportLastScan().generateReport(getView(), getModel(), ReportLastScan.ReportType.JSON)); } return menuItemJsonReport; }
Source:
<code>public <T> IBean<T> getRegisteredBean(Class<?> beanClazz) { m_lock.readLock().lock(); try { <START> if (m_beanHierarchies.containsKey(beanClazz)) { <END> return m_beanHierarchies.get(beanClazz).getExactBean(beanClazz); } return null; } finally { m_lock.readLock().unlock(); } }</code><technical_language>get() contains</technical_language>

Target:
public <T> IBean<T> getRegisteredBean(Class<?> beanClazz) { m_lock.readLock().lock(); try { BeanHierarchy h = m_beanHierarchies.get(beanClazz); if (h != null) { return h.getExactBean(beanClazz); } return null; } finally { m_lock.readLock().unlock(); } }
Source:
<code><START> void checkCanEdit(QualityGateDto qualityGate) { <END> checkNotBuiltInt(qualityGate); userSession.checkPermission(ADMINISTER_QUALITY_GATES, defaultOrganizationProvider.get().getUuid()); }</code><technical_language>![INFO](<LINK_0> 'Severity: INFO') Do forget remove this deprecated code someday. [![rule](<LINK_1>](<LINK_2></technical_language>

Target:
void checkCanEdit(QualityGateDto qualityGate) { checkNotBuiltIn(qualityGate); userSession.checkPermission(ADMINISTER_QUALITY_GATES, defaultOrganizationProvider.get().getUuid()); }
Source:
<code>public static boolean UploadPersonalNotes(final OCApiConnector connector, final Geocache cache) { Log.d("Uploading personal note for opencaching"); <START> final Parameters notesparam = new Parameters("cache_code", cache.getGeocode(), "fields", getFullFields(connector)); <END> final ObjectNode notesdata = request(connector, OkapiService.SERVICE_CACHE, notesparam).data; String prevnote = ""; if (notesdata != null) { prevnote = notesdata.get(CACHE_MY_NOTES).asText(); } String currentnote = ""; if (cache.getPersonalNote() != null) { currentnote = cache.getPersonalNote(); } final Parameters params = new Parameters("cache_code", cache.getGeocode(), "new_value", currentnote, "old_value", prevnote); final ObjectNode data = request(connector, OkapiService.SERVICE_UPLOAD_PERSONAL_NOTE, params).data; if (data == null) { return false; } if (data.get("replaced").asBoolean()) { Log.d("Successfully uploaded"); return true; } return false; }</code><technical_language>Reading this line again, I do need request fields retrieve of note, personal note suffice</technical_language>

Target:
public static boolean UploadPersonalNotes(final OCApiConnector connector, final Geocache cache) { Log.d("Uploading personal note for opencaching"); final Parameters notesparam = new Parameters("cache_code", cache.getGeocode(), "fields", CACHE_MY_NOTES); final ObjectNode notesdata = request(connector, OkapiService.SERVICE_CACHE, notesparam).data; String prevnote = ""; if (notesdata != null && notesdata.get(CACHE_MY_NOTES) != null) { prevnote = notesdata.get(CACHE_MY_NOTES).asText(); } String currentnote = ""; if (cache.getPersonalNote() != null) { currentnote = cache.getPersonalNote(); } final Parameters params = new Parameters("cache_code", cache.getGeocode(), "new_value", currentnote, "old_value", prevnote); final ObjectNode data = request(connector, OkapiService.SERVICE_UPLOAD_PERSONAL_NOTE, params).data; if (data == null) { return false; } if (data.get("replaced").asBoolean()) { Log.d("Successfully uploaded"); return true; } return false; }
Source:
<code>public <T> List<T> multiGet(Query query, Class<T> clazz, IndexCoordinates index) { Assert.notNull(index, "index must not be null"); <START> Assert.notEmpty(query.getIds(), "No Id defined for Query"); <END> MultiGetRequestBuilder builder = requestFactory.multiGetRequestBuilder(client, query, index); DocumentCallback<T> callback = new ReadDocumentCallback<>(elasticsearchConverter, clazz, index); List<Document> documents = DocumentAdapters.from(builder.execute().actionGet()); return documents.stream().map(callback::doWith).collect(Collectors.toList()); }</code><technical_language>suggestion Assert.notEmpty(query.getIds(), "No Ids defined for Query");</technical_language>

Target:
public <T> List<T> multiGet(Query query, Class<T> clazz, IndexCoordinates index) { Assert.notNull(index, "index must not be null"); Assert.notEmpty(query.getIds(), "No Ids defined for Query"); MultiGetRequestBuilder builder = requestFactory.multiGetRequestBuilder(client, query, index); DocumentCallback<T> callback = new ReadDocumentCallback<>(elasticsearchConverter, clazz, index); List<Document> documents = DocumentAdapters.from(builder.execute().actionGet()); return documents.stream().map(callback::doWith).collect(Collectors.toList()); }
Source:
<code>public static Collection<Object[]> data() { Object[][] data = new Object[][] { {"sync", (Function<Transaction, Transaction>) GetSynchronousDelegate::new}, {"async", (Function<Transaction, Transaction>) GetAsyncDelegate::new} <START> }; <END> return Arrays.asList(data); }</code><technical_language>nit: keys constants, for consistency other tests? Alternative is changing this style, I tests keys a maps constants</technical_language>

Target:
public static Collection<Object[]> data() { Object[][] data = new Object[][] { {SYNC, (UnaryOperator<Transaction>) GetSynchronousDelegate::new}, {ASYNC, (UnaryOperator<Transaction>) GetAsyncDelegate::new} }; return Arrays.asList(data); }
Source:
<code>public Where<Message, Object> modWhere(Where<Message, Object> where) throws SQLException { <START> DateUtils.truncate(new Date(), java.util.Calendar.DAY_OF_MONTH); <END> Calendar calendar = Calendar.getInstance(); calendar.setTime(date); calendar.set(Calendar.HOUR_OF_DAY,0); calendar.set(Calendar.MINUTE,0); calendar.set(Calendar.SECOND,0); calendar.set(Calendar.MILLISECOND, 0); where.between(Message.TIMESTAMP_FIELD,calendar.getTime().getTime(),calendar.getTime().getTime()+86400000); return where; }</code><technical_language>DateUtils.truncate returns rounded date this is this here? <LINK_0>, int)</technical_language>

Target:
public Where<Message, Object> modWhere(Where<Message, Object> where) throws SQLException { Calendar calendar = Calendar.getInstance(); calendar.setTime(date); calendar.set(Calendar.HOUR_OF_DAY, 0); calendar.set(Calendar.MINUTE, 0); calendar.set(Calendar.SECOND, 0); calendar.set(Calendar.MILLISECOND, 0); Date fromDate = calendar.getTime(); calendar.add(Calendar.DAY_OF_MONTH, 1); Date toDate = calendar.getTime(); where.between(Message.TIMESTAMP_FIELD, fromDate, toDate); return where; }
Source:
<code>public void testDifferentUsedCapacities() throws StoreException { blobStore.validLogSegments = generateRandomString(2); Long[] usedCapacities = <START> new Long[]{CAPACITY_IN_BYTES * 2 / 10, (CAPACITY_IN_BYTES * 4 / 10), CAPACITY_IN_BYTES * 5 / 10}; <END> for (Long usedCapacity : usedCapacities) { blobStore.usedCapacity = usedCapacity; verifyCompactionDetails(null); } usedCapacities = new Long[]{ CAPACITY_IN_BYTES * 51 / 100, (CAPACITY_IN_BYTES * 6 / 10), CAPACITY_IN_BYTES * 7 / 10, CAPACITY_IN_BYTES * 9 / 10}; for (Long usedCapacity : usedCapacities) { blobStore.usedCapacity = usedCapacity; verifyCompactionDetails(new CompactionDetails(blobStore.getTime().milliseconds() - messageRetentionTimeInMs, blobStore.validLogSegments)); } }</code><technical_language>this is repeated code. test do a check reference (null otherwise). a prepopulated capacity-> expected details is good</technical_language>

Target:
public void testDifferentUsedCapacities() throws StoreException { blobStore.validLogSegments = generateRandomStrings(2); Long[] usedCapacities = new Long[]{ CAPACITY_IN_BYTES * 2 / 10, (CAPACITY_IN_BYTES * 4 / 10), CAPACITY_IN_BYTES * 5 / 10, CAPACITY_IN_BYTES * 51 / 100, (CAPACITY_IN_BYTES * 6 / 10), CAPACITY_IN_BYTES * 7 / 10, CAPACITY_IN_BYTES * 9 / 10}; for (Long usedCapacity : usedCapacities) { blobStore.usedCapacity = usedCapacity; if (blobStore.usedCapacity < (config.storeMinUsedCapacityToTriggerCompactionInPercentage / 100.0 * blobStore.capacityInBytes)) { verifyCompactionDetails(null); } else { verifyCompactionDetails( new CompactionDetails(time.milliseconds() - messageRetentionTimeInMs, blobStore.validLogSegments)); } } }
Source:
<code>protected void internalGenerateCpuQuota(long elapsedSeconds) { checkState(Thread.holdsLock(root), "Must hold lock to generate cpu quota"); synchronized (root) { long newQuota = saturatedMultiply(elapsedSeconds, cpuQuotaGenerationMillisPerSecond); <START> long oldUsageMillis = cachedResourceUsage.getCpuUsageMillis(); <END> long newCpuUsageMillis = saturatedSubtract(oldUsageMillis, newQuota); if (newCpuUsageMillis < 0 || newCpuUsageMillis == Long.MAX_VALUE) { newCpuUsageMillis = 0; } cachedResourceUsage = new ResourceUsage(newCpuUsageMillis, cachedResourceUsage.getMemoryUsageBytes()); if ((newCpuUsageMillis < hardCpuLimitMillis && oldUsageMillis >= hardCpuLimitMillis) || (newCpuUsageMillis < softCpuLimitMillis && oldUsageMillis >= softCpuLimitMillis)) { updateEligibility(); } for (InternalResourceGroup group : subGroups.values()) { group.internalGenerateCpuQuota(elapsedSeconds); } } }</code><technical_language>oldCpuUsageMillis? strange new named differently</technical_language>

Target:
protected void internalGenerateCpuQuota(long elapsedSeconds) { checkState(Thread.holdsLock(root), "Must hold lock to generate cpu quota"); synchronized (root) { long newQuota = saturatedMultiply(elapsedSeconds, cpuQuotaGenerationMillisPerSecond); long oldCpuUsageMillis = cachedResourceUsage.getCpuUsageMillis(); long newCpuUsageMillis = saturatedSubtract(oldCpuUsageMillis, newQuota); if (newCpuUsageMillis < 0 || newCpuUsageMillis == Long.MAX_VALUE) { newCpuUsageMillis = 0; } cachedResourceUsage = new ResourceUsage(newCpuUsageMillis, cachedResourceUsage.getMemoryUsageBytes()); if ((newCpuUsageMillis < hardCpuLimitMillis && oldCpuUsageMillis >= hardCpuLimitMillis) || (newCpuUsageMillis < softCpuLimitMillis && oldCpuUsageMillis >= softCpuLimitMillis)) { updateEligibility(); } for (InternalResourceGroup group : subGroups.values()) { group.internalGenerateCpuQuota(elapsedSeconds); } } }