auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code><START> public Class<?> getTraceClass() { <END> return fTraceClass; }</code><technical_language>? extends ITmfTrace</technical_language>

Target:
public Class<? extends ITmfTrace> getTraceClass() { return fTraceClass; }
Source:
<code>private ImmutableSet<String> topLevelContainerIds(ImmutableSet<ModelWithPayload<Item>> items) { return items.stream() .map(item -> { if (item.getModel().getContainer() != null) { return item.getModel().getContainer().getUri(); } return null; } ) <START> .filter(java.util.Objects::nonNull) <END> .collect(MoreCollectors.toImmutableSet()); }</code><technical_language>import package</technical_language>

Target:
private ImmutableSet<String> topLevelContainerIds(ImmutableSet<ModelWithPayload<Item>> items) { return items.stream().map(ModelWithPayload::getModel) .map(Item::getContainer) .filter(java.util.Objects::nonNull) .map(ParentRef::getUri) .filter(java.util.Objects::nonNull) .collect(MoreCollectors.toImmutableSet()); }
Source:
<code>public void refreshPaginator() { FacesContext facesContext = FacesContext.getCurrentInstance(); <START> org.primefaces.component.datatable.DataTable dt = (org.primefaces.component.datatable.DataTable) facesContext.getViewRoot().findComponent("datasetForm:tabView:filesTable"); <END> int rows = dt.getRowsToRender(); setRowsPerPage(rows); }</code><technical_language>importing DataTable this line clearer. ie. DataTable dt = (DataTable) facesContext.getViewRoot().findComponent("datasetForm:tabView:filesTable");</technical_language>

Target:
public void refreshPaginator() { FacesContext facesContext = FacesContext.getCurrentInstance(); org.primefaces.component.datatable.DataTable dt = (org.primefaces.component.datatable.DataTable) facesContext.getViewRoot().findComponent("datasetForm:tabView:filesTable"); setFilePaginatorPage(dt.getPage()); setRowsPerPage(dt.getRowsToRender()); }
Source:
<code>public int checkMaxWriteSize(int limit) { if (serializedCache == null) { throw new IllegalStateException("checkMaxWriteSize requires serialized form"); } int payloadSize = getSizeEstimate(); <START> if (limit != 0 && payloadSize > limit) { <END> throw new WriteSizeException(payloadSize, limit); } return payloadSize; }</code><technical_language>remove clause if change maxWriteSize Integer.MAX_VALUE</technical_language>

Target:
public int checkMaxWriteSize(int limit) { Preconditions.checkState(serializedCache != null, "checkMaxWriteSize requires serialized form"); int payloadSize = getSizeEstimate(); if (log.isTraceEnabled()) { log.trace("checkMaxWriteSize: payload size is bytes.", payloadSize); } if (payloadSize > limit) { throw new WriteSizeException(payloadSize, limit); } return payloadSize; }
Source:
<code>public boolean matches(ConditionContext context, AnnotatedTypeMetadata metadata) { <START> return context.getClassLoader().getResource("org/springframework/web/servlet") != null; <END> }</code><technical_language>context.getClassLoader() return null</technical_language>

Target:
public boolean matches(ConditionContext context, AnnotatedTypeMetadata metadata) { return context.getClassLoader() != null && context.getClassLoader().getResource("org/springframework/web/servlet") != null; }
Source:
<code>public void retrievesFileCreationTime() throws IOException { final File file = new File(this.folder.newFolder(), "time"); final String content = "some content"; <START> final Date before = new Date(); <END> final Doc doc = new MkDoc(file, "", ""); doc.write( new ByteArrayInputStream(content.getBytes(StandardCharsets.UTF_8)) ); final Date after = new Date(); MatcherAssert.assertThat( TimeUnit.MILLISECONDS.toSeconds(doc.created().getTime()), Matchers.allOf( Matchers.greaterThanOrEqualTo( TimeUnit.MILLISECONDS.toSeconds(before.getTime()) ), Matchers.lessThanOrEqualTo( TimeUnit.MILLISECONDS.toSeconds(after.getTime()) ) ) ); }</code><technical_language>System.currentTimeMillis() instead</technical_language>

Target:
public void retrievesFileCreationTime() throws IOException { final File file = new File(this.folder.newFolder(), "time"); final String content = "some content"; final long before = System.currentTimeMillis(); final Doc doc = new MkDoc(file, "", ""); doc.write( new ByteArrayInputStream(content.getBytes(StandardCharsets.UTF_8)) ); final long after = System.currentTimeMillis(); MatcherAssert.assertThat( TimeUnit.MILLISECONDS.toSeconds(doc.created().getTime()), Matchers.allOf( Matchers.greaterThanOrEqualTo( TimeUnit.MILLISECONDS.toSeconds(before) ), Matchers.lessThanOrEqualTo( TimeUnit.MILLISECONDS.toSeconds(after) ) ) ); }
Source:
<code>private boolean slingQueryWasNotUsed() { <START> return slingQueries.getOrDefault(slingQueryName, slingQueryStates.NOTUSED).equals(slingQueryStates.NOTUSED); <END> }</code><technical_language>Please check equals == for Enum</technical_language>

Target:
private boolean slingQueryWasNotUsed() { return slingQueries.getOrDefault(currentSlingQueryVariableName, SlingQueryStates.NOT_USED) == SlingQueryStates.NOT_USED; }
Source:
<code>public Object applyValueToMap(Object value, Map target) { <START> if (value instanceof Collection) { <END> for (Object v: (Collection)value) applyValueToMap(v, target); } else { target.put(subKey(), value); } return null; }</code><technical_language>Do want do that? I is surprising behaviour. I want a is a collection, me. Changing behaviour in method based instanceof is expect, guessing lots of other developers expect. a separate method for applyValuesToMap if want this convenience</technical_language>

Target:
public Object applyValueToMap(Object value, Map target) { if (value instanceof StructuredModification) { return ((StructuredModification)value).applyToKeyInMap(this, target); } else if (value instanceof Collection) { String warning = "Discouraged undecorated setting of a collection to ListConfigKey "+this+": use ListModification.{set,add}. " + "Defaulting to 'add'. Look at debug logging for call stack."; log.warn(warning); if (log.isDebugEnabled()) log.debug("Trace for: "+warning, new Throwable("Trace for: "+warning)); for (Object v: (Collection)value) applyValueToMap(v, target); return null; } else { target.put(subKey(), value); return null; } }
Source:
<code>public void addChangeListener_throwInsiderTransaction() { Realm realm = looperThread.realm; realm.beginTransaction(); <START> Dog dog =realm.createObject(Dog.class); <END> try { dog.addChangeListener(new RealmChangeListener<Dog>() { @Override public void onChange(Dog element) { } }); } catch (IllegalStateException ignored) { } try { dog.addChangeListener(new RealmObjectChangeListener<Dog>() { @Override public void onChange(Dog object, ObjectChangeSet changeSet) { } }); } catch (IllegalStateException ignored) { } realm.cancelTransaction(); looperThread.testComplete(); }</code><technical_language>space =</technical_language>

Target:
public void addChangeListener_throwInsiderTransaction() { Realm realm = looperThread.realm; realm.beginTransaction(); Dog dog = realm.createObject(Dog.class); try { dog.addChangeListener(new RealmChangeListener<Dog>() { @Override public void onChange(Dog element) { fail(); } }); } catch (IllegalStateException ignored) { } try { dog.addChangeListener(new RealmObjectChangeListener<Dog>() { @Override public void onChange(Dog object, ObjectChangeSet changeSet) { fail(); } }); } catch (IllegalStateException ignored) { } realm.cancelTransaction(); looperThread.testComplete(); }
Source:
<code><START> public void testLocalTimestampFuncWithCurrentTime() { <END> testLocalTimestampFunc(currentTimeString(LOCAL_TZ)); }</code><technical_language>annotations in line ? a Calcite coding style</technical_language>

Target:
@Test public void testLocalTimestampFuncWithCurrentTime() { testLocalTimestampFunc(currentTimeString(LOCAL_TZ)); }
Source:
<code>public boolean isValid(final CurrentUser user, final ApprovalType at, final FunctionState state) { <START> return isProjectStateValid(user, at, state) <END> && isRefStateValid(user, at, state); }</code><technical_language>testing both? want RefRight if more specific? (See remarks in FunctionState.)</technical_language>

Target:
public boolean isValid(final CurrentUser user, final ApprovalType at, final FunctionState state) { if (state.getRefRights(at).isEmpty()) { return isProjectStateValid(user, at, state); } else { return isRefStateValid(user, at, state); } }
Source:
<code>private void checkEndOfRowGroup() throws IOException { if (rowsReturned != totalCountLoadedSoFar) { return; } PageReadStore pages = reader.readNextRowGroup(); if (pages == null) { throw new IOException("expecting more rows but reached last block. Read " + rowsReturned + " out of " + totalRowCount); } List<ColumnDescriptor> columns = requestedSchema.getColumns(); List<Type> types = requestedSchema.getFields(); columnReaders = new VectorizedColumnReader[columns.size()]; for (int i = 0; i < types.size(); ++i) { columnReaders[i] = <START> buildVectorizedParquetReader(columnTypesList.get(indexColumnsWanted.get(i)), types.get(i), <END> pages, requestedSchema, skipTimestampConversion); } totalCountLoadedSoFar += pages.getRowCount(); }</code><technical_language>is indexColumnsWanted empty</technical_language>

Target:
private void checkEndOfRowGroup() throws IOException { if (rowsReturned != totalCountLoadedSoFar) { return; } PageReadStore pages = reader.readNextRowGroup(); if (pages == null) { throw new IOException("expecting more rows but reached last block. Read " + rowsReturned + " out of " + totalRowCount); } List<ColumnDescriptor> columns = requestedSchema.getColumns(); List<Type> types = requestedSchema.getFields(); columnReaders = new VectorizedColumnReader[columns.size()]; if (!ColumnProjectionUtils.isReadAllColumns(jobConf) && !indexColumnsWanted.isEmpty()) { for (int i = 0; i < types.size(); ++i) { columnReaders[i] = buildVectorizedParquetReader(columnTypesList.get(indexColumnsWanted.get(i)), types.get(i), pages, requestedSchema.getColumns(), skipTimestampConversion, 0); } } else { for (int i = 0; i < types.size(); ++i) { columnReaders[i] = buildVectorizedParquetReader(columnTypesList.get(i), types.get(i), pages, requestedSchema.getColumns(), skipTimestampConversion, 0); } } totalCountLoadedSoFar += pages.getRowCount(); }
Source:
<code>public ResourceID(String resourceId, String metadata) { Preconditions.checkNotNull(resourceId, "ResourceID must not be null"); <START> Preconditions.checkNotNull(metadata, "ResourceID must not be null"); <END> this.resourceId = resourceId; this.metadata = metadata; }</code><technical_language>Unclear error messages</technical_language>

Target:
public ResourceID(String resourceId, String metadata) { Preconditions.checkNotNull(resourceId, "The identifier must not be null"); Preconditions.checkNotNull(metadata, "The metadata must not be null"); this.resourceId = resourceId; this.metadata = metadata; }
Source:
<code>public AmazonS3Target(S3TargetConfigBean s3TargetConfigBean) { this.s3TargetConfigBean = s3TargetConfigBean; this.partitionTemplate = s3TargetConfigBean.partitionTemplate == null ? "" : s3TargetConfigBean.partitionTemplate; <START> this.fileNameSuffix = s3TargetConfigBean.fileNameSuffix == null ? "" : s3TargetConfigBean.fileNameSuffix; <END> }</code><technical_language>eliminate this null check if simply initialize filenameSuffix in S3TargetConfigBean.java line 86</technical_language>

Target:
public AmazonS3Target(S3TargetConfigBean s3TargetConfigBean) { this.s3TargetConfigBean = s3TargetConfigBean; this.partitionTemplate = s3TargetConfigBean.partitionTemplate == null ? "" : s3TargetConfigBean.partitionTemplate; }
Source:
<code>private void prefixNumaPinningIfApplicable(String numaId, List<String> commandList) { if (numaId != null) { if (isOnLinux()) { commandList.add("numactl"); commandList.add("--i=" + numaId); return; } else { throw new RuntimeException("numactl pinning currently not supported on non-Linux hosts"); } <START> } <END> }</code><technical_language>UnsupportedOperationException is a option. I fine this</technical_language>

Target:
private void prefixNumaPinningIfApplicable(String numaId, List<String> commandList) { if (numaId != null) { if (isOnLinux()) { commandList.add(0, "numactl"); commandList.add(1, "--cpunodebind=" + numaId); commandList.add(2, "--membind=" + numaId); return; } else { throw new RuntimeException("numactl pinning currently not supported on non-Linux hosts"); } } }
Source:
<code>public long getNumPendingCompletionRequests() { long numPending = 0; for (PerChannelBookieClient pcbc : clients) { numPending += pcbc.getNumPendingCompletionRequests(); } <START> if (null != clientsV3) { <END> for (PerChannelBookieClient pcbc : clientsV3) { numPending += pcbc.getNumPendingCompletionRequests(); } } return numPending; }</code><technical_language>suggestion if (clients != clientsV3) {</technical_language>

Target:
public long getNumPendingCompletionRequests() { long numPending = 0; for (PerChannelBookieClient pcbc : clients) { numPending += pcbc.getNumPendingCompletionRequests(); } if (clients != clientsV3Enforced) { for (PerChannelBookieClient pcbc : clientsV3Enforced) { numPending += pcbc.getNumPendingCompletionRequests(); } } return numPending; }
Source:
<code><START> public File getAliasKeyStore(String alias) { <END> File storePath = null; for (int i = 0; i < 3; i++) { switch (i) { case 0: storePath = TRUSTED; case 1: storePath = EXCEPTIONS; case 2: storePath = BLACKLIST; } try (FileInputStream input = new FileInputStream(storePath)) { trustStore = KeyStore.getInstance("JKS"); trustStore.load(input, passwd); Enumeration store = trustStore.aliases(); while (store.hasMoreElements()) { String searchAlias = (String) store.nextElement(); X509Certificate certificate = (X509Certificate) trustStore.getCertificate(alias); if (alias.equals(alias)) { return storePath; } } } catch (IOException | KeyStoreException | NoSuchAlgorithmException | CertificateException e) { Log.error("Cannot access Keystore", e); } } return storePath; }</code><technical_language>alias identify a certificate is a good idea, alias is set, is a unique value. Certificates unique values - those</technical_language>

Target:
private File getAliasKeyStore(String alias) { for (CertificateModel model : exemptedCertificates) { if (model.getAlias().equals(alias)) { return EXCEPTIONS; } } for (CertificateModel model : blackListedCertificates) { if (model.getAlias().equals(alias)) { return BLACKLIST; } } for (CertificateModel model : certificates) { if (model.getAlias().equals(alias)) { return TRUSTED; } } return null; }
Source:
<code>protected IMIBackend createBackendGDBService(DsfSession session, ILaunchConfiguration lc) { <START> if (compareVersionWith(GDB_7_12_VERSION) >= 0) { <END> return new GDBBackend_7_12(session, lc); } return new GDBBackend(session, lc); }</code><technical_language>Avoid unrelated cleanup a patch. This change own. In fact, review 84541 this. If patch is committed reverted, this change lost</technical_language>

Target:
protected IMIBackend createBackendGDBService(DsfSession session, ILaunchConfiguration lc) { if (compareVersionWith(GDB_7_12_VERSION) >= 0 || compareVersionWith("7.11.50") >= 0 ) { return new GDBBackend_7_12(session, lc); } return new GDBBackend(session, lc); }
Source:
<code>private void printShape(String fullName) { String shape = fullName.contains("bond") ? "invtrapezium" : fullName.contains("net") ? "circle" : fullName.contains("mgmt") ? "circle" : fullName.contains("eth") ? "component" : fullName.contains("vlan") ? "diamond" : "missing shape. you have an error"; String color = fullName.contains("bond") ? "cyan" : fullName.contains("net") ? "pink" : fullName.contains("mgmt") ? "red" : fullName.contains("eth") ? "grey" : fullName.contains("vlan") ? "sienna" : "missing color. you have an error"; <START> System.out.println(" <END> " + prefix() + fullName + "[shape=" + "\"" + shape + "\",color=\"" + color + "\"]"); }</code><technical_language>this code is written console? point of view, check if this is allowed</technical_language>

Target:
private void printShape(String fullName) { String shape = fullName.contains("bond") ? "invtrapezium" : fullName.contains("net") ? "circle" : fullName.contains("mgmt") ? "circle" : fullName.contains("eth") ? "component" : fullName.contains("vlan") ? "diamond" : "missing shape. you have an error"; String color = fullName.contains("bond") ? "cyan" : fullName.contains("net") ? "pink" : fullName.contains("mgmt") ? "red" : fullName.contains("eth") ? "grey" : fullName.contains("vlan") ? "sienna" : "missing color. you have an error"; printout.append(" " + prefix() + fullName + "[shape=" + "\"" + shape + "\",color=\"" + color + "\"]"); }
Source:
<code><START> protected void execute() <END></code><technical_language>this method check motor.checkMCException()</technical_language>

Target:
protected void execute() { Exception potentialSensorException = motor.checkSensorException(); if (potentialSensorException != null) { cancel(); if (fallbackCommand != null && !fallbackCommand.isRunning()) { fallbackCommand.start(); } } }
Source:
<code>private void savePreferences() { try { List<String> groupUUIDS = new ArrayList<>(); for (RepositoryGroup group : groupMap.values()) { UUID uuid = group.getUuid(); String uuidString = uuid.toString(); groupUUIDS.add(uuidString); String name = group.getName(); preferences.put(PREFS_GROUP_NAME_PREFIX + uuidString, name); List<String> repos = group.getRepositories(); preferences.put(PREFS_GROUP_PREFIX + uuidString, StringUtils.join(repos, SEPARATOR)); } preferences.put(PREFS_GROUPS, StringUtils.join(groupUUIDS, SEPARATOR)); preferences.flush(); } catch (BackingStoreException e) { <START> Activator.error("error <END> saving repository group state", e); } }</code><technical_language>This reminds deprecate this method in favor of logError. Error message localized</technical_language>

Target:
private void savePreferences() { try { List<String> groupIds = new ArrayList<>(); for (RepositoryGroup group : groupMap.values()) { String groupId = group.getGroupId().toString(); groupIds.add(groupId); String name = group.getName(); preferences.put(PREFS_GROUP_NAME_PREFIX + groupId, name); List<String> repos = group.getRepositoryDirectories(); preferences.put(PREFS_GROUP_PREFIX + groupId, StringUtils.join(repos, SEPARATOR)); } preferences.put(PREFS_GROUPS, StringUtils.join(groupIds, SEPARATOR)); preferences.flush(); } catch (BackingStoreException e) { Activator.logError( UIText.RepositoriesView_RepoGroup_ErrorSavePreferences, e); } }
Source:
<code>private boolean configureConfigDriveData(final VirtualMachineProfile profile, final NicProfile nic) { final UserVmVO vm = _userVmDao.findById(profile.getId()); if (vm.getType() != VirtualMachine.Type.User) { return false; } final Nic defaultNic = _networkModel.getDefaultNic(vm.getId()); if (defaultNic != null) { final String sshPublicKey = getSshKey(profile); final String serviceOffering = _serviceOfferingDao.findByIdIncludingRemoved(vm.getId(), vm.getServiceOfferingId()).getDisplayText(); boolean isWindows = _guestOSCategoryDao.findById(_guestOSDao.findById(vm.getGuestOSId()).getCategoryId()).getName().equalsIgnoreCase("Windows"); String hostname = _hostDao.findById(vm.getHostId()).getName(); final Account caller = CallContext.current().getCallingAccount(); <START> String destHostname = (VirtualMachineManager.AllowExposeHypervisorHostname.value() && VirtualMachineManager.AllowExposeHypervisorHostnameAccountLevel.valueIn(caller.getId())) ? hostname : null; <END> final List<String[]> vmData = _networkModel.generateVmData(vm.getUserData(), serviceOffering, vm.getDataCenterId(), vm.getInstanceName(), vm.getHostName(), vm.getId(), vm.getUuid(), nic.getIPv4Address(), sshPublicKey, (String) profile.getParameter(VirtualMachineProfile.Param.VmPassword), isWindows, destHostname); profile.setVmData(vmData); profile.setConfigDriveLabel(VirtualMachineManager.VmConfigDriveLabel.value()); } return true; }</code><technical_language>quadruple code..</technical_language>

Target:
private boolean configureConfigDriveData(final VirtualMachineProfile profile, final NicProfile nic) { final UserVmVO vm = _userVmDao.findById(profile.getId()); if (vm.getType() != VirtualMachine.Type.User) { return false; } final Nic defaultNic = _networkModel.getDefaultNic(vm.getId()); if (defaultNic != null) { final String sshPublicKey = getSshKey(profile); final String serviceOffering = _serviceOfferingDao.findByIdIncludingRemoved(vm.getId(), vm.getServiceOfferingId()).getDisplayText(); boolean isWindows = _guestOSCategoryDao.findById(_guestOSDao.findById(vm.getGuestOSId()).getCategoryId()).getName().equalsIgnoreCase("Windows"); String hostname = _hostDao.findById(vm.getHostId()).getName(); String destHostname = VirtualMachineManager.getHypervisorHostname(hostname); final List<String[]> vmData = _networkModel.generateVmData(vm.getUserData(), serviceOffering, vm.getDataCenterId(), vm.getInstanceName(), vm.getHostName(), vm.getId(), vm.getUuid(), nic.getIPv4Address(), sshPublicKey, (String) profile.getParameter(VirtualMachineProfile.Param.VmPassword), isWindows, destHostname); profile.setVmData(vmData); profile.setConfigDriveLabel(VirtualMachineManager.VmConfigDriveLabel.value()); } return true; }
Source:
<code>public boolean equals(final Object o) { System.out.println("here"); if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; if (!super.equals(o)) { System.out.println("super"); return false; } final HAClusterConfig haconfig = (HAClusterConfig) o; final boolean result = Objects.equal(merge_aggregator, haconfig.getMergeAggregator()) && Objects.equal(original_secondary_timeout, haconfig.getOriginalsecondarytimeout()) && Objects.equal(original_primary_timeout, haconfig.getOriginalprimarytimeout()); if (!result) { <START> System.out.println("result"); <END> return false; } if (!Comparators.ListComparison.equalLists(data_sources, haconfig.getDataSources())) { System.out.println("datasources"); return false; } if (!Comparators.ListComparison.equalLists(data_source_configs, haconfig.getDataSourceConfigs())) { System.out.println("configs"); return false; } return true; }</code><technical_language>sysout</technical_language>

Target:
public boolean equals(final Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; if (!super.equals(o)) { return false; } final HAClusterConfig haconfig = (HAClusterConfig) o; final boolean result = Objects.equal(merge_aggregator, haconfig.getMergeAggregator()) && Objects.equal(primary_timeout, haconfig.getPrimaryTimeout()) && Objects.equal(secondary_timeout, haconfig.getSecondaryTimeout()); if (!result) { return false; } if (!Comparators.ListComparison.equalLists(data_sources, haconfig.getDataSources())) { return false; } if (!Comparators.ListComparison.equalLists(data_source_configs, haconfig.getDataSourceConfigs())) { return false; } return true; }
Source:
<code>public static XmlForm parse(String xml, boolean strict) throws IOException { ObjectMapper objectMapper = new XmlMapper(); if (!strict) { objectMapper.disable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES); } XmlForm form = objectMapper.readValue(xml, XmlForm.class); <START> System.out.println(form); END> return form; }</code><technical_language>incorportate debug logging instead? log.fine</technical_language>

Target:
public static XmlForm parse(String xml, boolean strict) throws IOException { ObjectMapper objectMapper = new XmlMapper(); if (!strict) { objectMapper.disable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES); } XmlForm form = objectMapper.readValue(xml, XmlForm.class); return form; }
Source:
<code>public <T> void setSilently(DataParameter<T> key, T value) { <START> EntityDataManager.DataEntry<T> dataentry = this.getEntry(key); <END> if (ObjectUtils.notEqual(value, dataentry.getValue())) { dataentry.setValue(value); this.entity.notifyDataManagerChange(key); dataentry.setDirty(true); this.dirty = true; } }</code><technical_language>final</technical_language>

Target:
public <T> void bridge$setSilently(DataParameter<T> key, T value) { final EntityDataManager.DataEntry<T> dataentry = this.getEntry(key); if (ObjectUtils.notEqual(value, dataentry.getValue())) { dataentry.setValue(value); this.entity.notifyDataManagerChange(key); dataentry.setDirty(true); this.dirty = true; } }
Source:
<code>private Optional<String> getTabbarPath(String documentationOptions) { <START> try { Properties docProps = new Properties(); docProps.load(new StringReader(documentationOptions)); String path = docProps.getProperty(TABBAR_PATH_PREFIX); if (path != null) { return Optional.of(path); } } catch (IOException e) { } return Optional.empty(); <END> }</code><technical_language>code factorized change I guess ok</technical_language>

Target:
private Optional<String> getTabbarPath(String documentationOptions) { try { Properties docProps = new Properties(); StringReader docReader = new StringReader(documentationOptions); try { docProps.load(docReader); } finally { docReader.close(); } String path = docProps.getProperty(TABBAR_PATH_PREFIX); if (path != null) { return Optional.of(path); } } catch (IOException e) { } return Optional.empty(); }
Source:
<code>public IOpResponse execute(GetTokensByCodeParams params) throws Exception { validate(params); final Rp site = getRp(); OpenIdConfigurationResponse discoveryResponse = getDiscoveryService().getConnectDiscoveryResponse(site); final TokenRequest tokenRequest = new TokenRequest(GrantType.AUTHORIZATION_CODE); tokenRequest.setCode(params.getCode()); tokenRequest.setRedirectUri(site.getAuthorizationRedirectUri()); tokenRequest.setAuthUsername(site.getClientId()); tokenRequest.setAuthPassword(site.getClientSecret()); tokenRequest.setAuthenticationMethod(AuthenticationMethod.CLIENT_SECRET_BASIC); final TokenClient tokenClient = new TokenClient(discoveryResponse.getTokenEndpoint()); tokenClient.setExecutor(getHttpService().getClientExecutor()); tokenClient.setRequest(tokenRequest); final TokenResponse response = tokenClient.exec(); ClientUtils.showClient(tokenClient); if (response.getStatus() == 200 || response.getStatus() == 302) { <START> return handleSuccess(params, site, discoveryResponse, response); <END> } else if (response.getStatus() == 400 ){ return handleBadRequest(response); } else { LOG.error("Failed to get tokens because response code is: " + response.getScope()); } return null; }</code><technical_language>lets remove if, hard read code. Simply do public void validateResponse(TokenResponse response) { if (response.getStatus() == 400) { throw new HttpException(INVALID_AUTHORIZATION_CODE_BAD_CODE); } } in execute @Override public IOpResponse execute(GetTokensByCodeParams params) throws Exception { public IOpResponse execute(GetTokensByCodeParams params) throws Exception { ... validateResponse(tokenResponse) ... final Jwt idToken = Jwt.parse(response.getIdToken()); ... } end liner handleBadRequest, handleSuccess on</technical_language>

Target:
public IOpResponse execute(GetTokensByCodeParams params) throws Exception { validate(params); final Rp site = getRp(); OpenIdConfigurationResponse discoveryResponse = getDiscoveryService().getConnectDiscoveryResponse(site); final TokenRequest tokenRequest = new TokenRequest(GrantType.AUTHORIZATION_CODE); tokenRequest.setCode(params.getCode()); tokenRequest.setRedirectUri(site.getAuthorizationRedirectUri()); tokenRequest.setAuthUsername(site.getClientId()); tokenRequest.setAuthPassword(site.getClientSecret()); tokenRequest.setAuthenticationMethod(AuthenticationMethod.CLIENT_SECRET_BASIC); final TokenClient tokenClient = new TokenClient(discoveryResponse.getTokenEndpoint()); tokenClient.setExecutor(getHttpService().getClientExecutor()); tokenClient.setRequest(tokenRequest); final TokenResponse response = tokenClient.exec(); ClientUtils.showClient(tokenClient); return validateResponse(params, site, discoveryResponse, response); }
Source:
<code>private void initBiosType() { ListModel<BiosType> biosType = getBiosType(); biosType.setItems(AsyncDataProvider.getInstance().getBiosTypeList()); <START> biosType.setIsChangeable(true); biosType.setSelectedItem(BiosType.I440FX_SEA_BIOS); <END> }</code><technical_language>call updateBiosType() logic of "defaulting" place</technical_language>

Target:
private void initBiosType() { ListModel<BiosType> biosType = getBiosType(); List<BiosType> biosTypeList = AsyncDataProvider.getInstance() .getBiosTypeList() .stream() .filter(bt -> bt != BiosType.CLUSTER_DEFAULT) .collect(Collectors.toList()); biosType.setItems(biosTypeList); biosType.setIsChangeable(true); biosType.setSelectedItem(BiosType.I440FX_SEA_BIOS); }
Source:
<code>private QueryTemplate toQueryTemplate(Pagination pagination) { QueryTemplate queryTemplate = new QueryTemplate(); queryTemplate.setPageNumber(new PageNumberTemplate(pagination.getPageNumber())); <START> queryTemplate.setPageSize(new PageSizeTemplate(pagination.getPageSize(), parametersExtractor.getMinPageSize(), parametersExtractor.getMaxPageSize())); <END> return queryTemplate; }</code><technical_language>a sort of a QueryTemplateFactory avoid duplication of lines in places. This factory whould min max page params injected</technical_language>

Target:
private QueryTemplate toQueryTemplate(Pagination pagination) { QueryTemplate queryTemplate = new QueryTemplate(); queryTemplate.setPageNumber(paginationTemplateFactory.createPageNumberTemplate(pagination)); queryTemplate.setPageSize(paginationTemplateFactory.createPageSizeTemplate(pagination)); return queryTemplate; }
Source:
<code>public void continue_in_try_finally() { final CFG cfg = buildCFG("void fun() { while (foo()) {\n" + " try {\n" + " bar(\"try\");\n" + " continue;\n" + " } finally {\n" + " qix(\"finally\");\n" + " }\n" + " }}"); final CFGChecker cfgChecker = checker( block( element(IDENTIFIER, "foo"), element(METHOD_INVOCATION) ).terminator(WHILE_STATEMENT).successors(0, 4), block(element(TRY_STATEMENT)).successors(3), block( element(Tree.Kind.IDENTIFIER, "bar"), element(STRING_LITERAL, "try"), element(METHOD_INVOCATION) ).successors(2).exceptions(1), <START> new BlockChecker(CONTINUE_STATEMENT, 1).hasNoExitBlock(), <END> block(element(IDENTIFIER, "qix"), element(STRING_LITERAL, "finally"), element(METHOD_INVOCATION) ).successors(0, 5) ); cfgChecker.check(cfg); }</code><technical_language>I prefer terminator(CONTINUE_STATEMENT, 1).hasNoExitBlock() instead, in order stay closer syntax in other tests</technical_language>

Target:
public void continue_in_try_finally() { final CFG cfg = buildCFG("void fun() { while (foo()) {\n" + " try {\n" + " bar(\"try\");\n" + " continue;\n" + " } finally {\n" + " qix(\"finally\");\n" + " }\n" + " }}"); final CFGChecker cfgChecker = checker( block( element(IDENTIFIER, "foo"), element(METHOD_INVOCATION) ).terminator(WHILE_STATEMENT).successors(0, 4), block(element(TRY_STATEMENT)).successors(3), block( element(Tree.Kind.IDENTIFIER, "bar"), element(STRING_LITERAL, "try"), element(METHOD_INVOCATION) ).successors(2).exceptions(1), terminator(CONTINUE_STATEMENT, 1).hasNoExitBlock(), block(element(IDENTIFIER, "qix"), element(STRING_LITERAL, "finally"), element(METHOD_INVOCATION) ).successors(0, 5) ); cfgChecker.check(cfg); }
Source:
<code>private int sampleFromTerms(final double randomVar, final double[] terms) { double val = randomVar; for (int i = 0; i < terms.length; i++) { if (val < terms[i]) { return i; } val -= terms[i]; } <START> throw new RuntimeException("randomVar have to be smaller than summation of all terms"); <END> }</code><technical_language>typo</technical_language>

Target:
private int sampleFromTerms(final double randomVar, final double[] terms) { double val = randomVar; for (int i = 0; i < terms.length; i++) { if (val < terms[i]) { return i; } val -= terms[i]; } throw new RuntimeException("randomVar has to be smaller than summation of all terms"); }
Source:
<code>public void changeEvent(int type) { String currUri = null; int currIndex = 0; IDockerConnection[] connections = DockerConnectionManager.getInstance() .getConnections(); if (connection != null) { currUri = connection.getUri(); } int index = 0; for (int i = 0; i < connections.length; ++i) { if <START> (connections[i].getUri() <END> != null && connections[i].getUri().equals(currUri)) index = i; } if (type == IDockerConnectionManagerListener.RENAME_EVENT) { index = currIndex; } if (connections.length > 0 && type != IDockerConnectionManagerListener.REMOVE_EVENT) { setConnection(connections[index]); } else { setConnection(null); } }</code><technical_language>describe a case URI null Connection Wizard correct allow this ? I if user enters some location, connection URI non-null</technical_language>

Target:
public void changeEvent(int type) { String currUri = null; int currIndex = 0; IDockerConnection[] connections = DockerConnectionManager.getInstance() .getConnections(); if (connection != null) { currUri = connection.getUri(); } int index = 0; for (int i = 0; i < connections.length; ++i) { if (currUri.equals(connections[i].getUri())) { index = i; } } if (type == IDockerConnectionManagerListener.RENAME_EVENT) { index = currIndex; } if (connections.length > 0 && type != IDockerConnectionManagerListener.REMOVE_EVENT) { setConnection(connections[index]); } else { setConnection(null); } }
Source:
<code><START> public List<Attribute> getAttributes(PerunSession sess, Group group, Member member, Resource resource, List<String> attrNames, boolean workWithUserAttributes) throws InternalErrorException, MemberResourceMismatchException, GroupResourceMismatchException, MemberGroupMismatchException { <END> checkGroupIsFromTheSameVoLikeResource(sess, group, resource); List<Attribute> attributes = getAttributes(sess, member, resource, attrNames, workWithUserAttributes); if (attrNames.isEmpty()) { attributes.addAll(getAttributes(sess, member, group)); return attributes; } List<String> memberGroupAttributeNames = new ArrayList<>(); for (String attributeName : attrNames) { if (attributeName.startsWith(AttributesManager.NS_MEMBER_GROUP_ATTR)) { memberGroupAttributeNames.add(attributeName); } } if (!memberGroupAttributeNames.isEmpty()) { attributes.addAll(getAttributesManagerImpl().getAttributes(sess, member, group, memberGroupAttributeNames)); } return attributes; }</code><technical_language>adding exception MemberGroupMismatchException methods, is control of it</technical_language>

Target:
public List<Attribute> getAttributes(PerunSession sess, Group group, Member member, Resource resource, List<String> attrNames, boolean workWithUserAttributes) throws InternalErrorException, MemberResourceMismatchException, GroupResourceMismatchException, MemberGroupMismatchException { checkGroupIsFromTheSameVoLikeResource(sess, group, resource); checkMemberIsFromTheSameVoLikeGroup(sess, member, group); List<Attribute> attributes = getAttributes(sess, member, resource, attrNames, workWithUserAttributes); if (attrNames.isEmpty()) { attributes.addAll(getAttributes(sess, member, group)); return attributes; } List<String> memberGroupAttributeNames = new ArrayList<>(); for (String attributeName : attrNames) { if (attributeName.startsWith(AttributesManager.NS_MEMBER_GROUP_ATTR)) { memberGroupAttributeNames.add(attributeName); } } if (!memberGroupAttributeNames.isEmpty()) { attributes.addAll(getAttributesManagerImpl().getAttributes(sess, member, group, memberGroupAttributeNames)); } return attributes; }
Source:
<code>public TimeView() { Span text = new Span("Time view " + LocalDateTime.now().toString()); Button back = new Button("Return", event -> UI.getCurrent().navigate("")); Button remove = new Button("Remove time view", event -> SessionRouteRegistry.getSessionRegistry(VaadinSession.getCurrent()) .removeRoute(TimeView.class)); Button reload = new Button("Reload page", event -> UI.getCurrent().getPage().reload()); <START> add(text, back, remove, reload); <END> }</code><technical_language>![MAJOR](<LINK_0> 'Severity: MAJOR') Remove this call a constructor overridable "add" method. [![rule](<LINK_1>](<LINK_2></technical_language>

Target:
public TimeView() { Span text = new Span("Time view " + LocalDateTime.now().toString()); Button back = new Button("Return", event -> UI.getCurrent().navigate("")); back.setId("time-return"); Button remove = new Button("Remove time view", event -> RouteConfiguration.forSessionScope() .removeRoute(TimeView.class)); remove.setId("time-remove"); Button reload = new Button("Reload page", event -> UI.getCurrent().getPage().reload()); reload.setId("time-reload"); add(text, back, remove, reload); }
Source:
<code>public static InputStream teeInputWithDecompression( NetworkPeerManager peerManager, String requestId, InputStream availableInputStream, OutputStream decompressedOutput, @Nullable String contentEncoding, ResponseHandler responseHandler) throws IOException { OutputStream output = decompressedOutput; CountingOutputStream decompressedCounter = null; if (contentEncoding != null) { <START> boolean gzipEncoding = "gzip".equals(contentEncoding); <END> boolean deflateEncoding = "deflate".equals(contentEncoding); if (gzipEncoding || deflateEncoding) { decompressedCounter = new CountingOutputStream(decompressedOutput); if (gzipEncoding) { output = GunzippingOutputStream.create(decompressedCounter); } else if (deflateEncoding) { output = new InflaterOutputStream(decompressedCounter); } } else { CLog.writeToConsole( peerManager, Console.MessageLevel.WARNING, Console.MessageSource.NETWORK, "Unsupported Content-Encoding in response for request #" + requestId + ": " + contentEncoding); } } return new ResponseHandlingInputStream( availableInputStream, requestId, output, decompressedCounter, peerManager, responseHandler); }</code><technical_language>this a static constant</technical_language>

Target:
public static InputStream teeInputWithDecompression( NetworkPeerManager peerManager, String requestId, InputStream availableInputStream, OutputStream decompressedOutput, @Nullable String contentEncoding, ResponseHandler responseHandler) throws IOException { OutputStream output = decompressedOutput; CountingOutputStream decompressedCounter = null; if (contentEncoding != null) { boolean gzipEncoding = GZIP_ENCODING.equals(contentEncoding); boolean deflateEncoding = DEFLATE_ENCODING.equals(contentEncoding); if (gzipEncoding || deflateEncoding) { decompressedCounter = new CountingOutputStream(decompressedOutput); if (gzipEncoding) { output = GunzippingOutputStream.create(decompressedCounter); } else if (deflateEncoding) { output = new InflaterOutputStream(decompressedCounter); } } else { CLog.writeToConsole( peerManager, Console.MessageLevel.WARNING, Console.MessageSource.NETWORK, "Unsupported Content-Encoding in response for request #" + requestId + ": " + contentEncoding); } } return new ResponseHandlingInputStream( availableInputStream, requestId, output, decompressedCounter, peerManager, responseHandler); }
Source:
<code>private static synchronized Map<Integer, String> getTrace(String filePath, int recordCount) throws WorkloadException { <START> Map<Integer, String> urlMap = new ConcurrentHashMap<Integer, String>(); <END> int count = 0; String line; try { FileReader inputFile = new FileReader(filePath); BufferedReader bufferReader = new BufferedReader(inputFile); while ((line = bufferReader.readLine()) != null) { urlMap.put(count++, line.trim()); if (count >= recordCount) break; } bufferReader.close(); } catch (IOException e) { throw new WorkloadException( "Error while reading the trace. Please make sure the trace file path is correct. " + e.getLocalizedMessage()); } return urlMap; }</code><technical_language>this is a synchronized method this need ConcurrentHashMap</technical_language>

Target:
private static Map<Integer, String> getTrace(String filePath, int recordCount) throws WorkloadException { Map<Integer, String> urlMap = new HashMap<Integer, String>(); int count = 0; String line; try { FileReader inputFile = new FileReader(filePath); BufferedReader bufferReader = new BufferedReader(inputFile); while ((line = bufferReader.readLine()) != null) { urlMap.put(count++, line.trim()); if (count >= recordCount) break; } bufferReader.close(); } catch (IOException e) { throw new WorkloadException( "Error while reading the trace. Please make sure the trace file path is correct. " + e.getLocalizedMessage()); } return urlMap; }
Source:
<code>protected Object doInBackground() throws Exception { Timer updateViewTime = new Timer(DELAY_DRAWING, this); try { beginDrawing = System.currentTimeMillis(); renderer = new ImageRenderer(); renderer.setRsProvider(resultSetProviderFactory); updateViewTime.start(); rendererImage = mapControl.getMapTransform().getImage(); renderer.draw(mapControl.getMapTransform(), mapContext.getLayerModel(), this.getProgressMonitor()); LOGGER.info(I18N.tr("Rendering done in {0} seconds", (System.currentTimeMillis() - beginDrawing) / 1000.0)); } catch (Exception ex) { LOGGER.error(ex.getLocalizedMessage(), ex); } finally { <START> if(!isCancelled()) { <END> mapControl.getMapTransform().setImage(rendererImage); intermediateDrawing.set(false); awaitingDrawing.set(false); updateViewTime.stop(); mapControl.repaint(); } } return null; }</code><technical_language>Warning, if cancel is ongoing awaitingDrawing is true drawing done</technical_language>

Target:
protected Object doInBackground() throws Exception { Timer updateViewTime = new Timer(DELAY_DRAWING, this); try { beginDrawing = System.currentTimeMillis(); renderer = new ImageRenderer(); renderer.setRsProvider(resultSetProviderFactory); updateViewTime.start(); rendererImage = mapControl.getMapTransform().getImage(); renderer.draw(mapControl.getMapTransform(), mapContext.getLayerModel(), this.getProgressMonitor()); LOGGER.info(I18N.tr("Rendering done in {0} seconds", (System.currentTimeMillis() - beginDrawing) / 1000.0)); } catch (Exception ex) { LOGGER.error(ex.getLocalizedMessage(), ex); } finally { mapControl.getMapTransform().setImage(rendererImage); intermediateDrawing.set(false); awaitingDrawing.set(false); updateViewTime.stop(); mapControl.repaint(); } return null; }
Source:
<code>public static PhantomJSDriverService createDefaultService(Capabilities desiredCapabilities) { Proxy proxy = null; if (desiredCapabilities != null) { proxy = (Proxy) desiredCapabilities.getCapability(CapabilityType.PROXY); } File phantomjsfile = findPhantomJS(desiredCapabilities, PHANTOMJS_DOC_LINK, PHANTOMJS_DOWNLOAD_LINK); File ghostDriverfile = findGhostDriver(desiredCapabilities, GHOSTDRIVER_DOC_LINK, GHOSTDRIVER_DOWNLOAD_LINK); return new Builder().usingPhantomJSExecutable(phantomjsfile) .usingGhostDriver(ghostDriverfile) .usingAnyFreePort() .withProxy(proxy) <START> .usingCommandLineArguments(findCommandLineArguments(desiredCapabilities)) <END> .build(); }</code><technical_language>Mmm, please call findCommandLineArguments method I do for ghostDriverFile? add a line of doc? maintain consistency in code</technical_language>

Target:
public static PhantomJSDriverService createDefaultService(Capabilities desiredCapabilities) { Proxy proxy = null; if (desiredCapabilities != null) { proxy = (Proxy) desiredCapabilities.getCapability(CapabilityType.PROXY); } File phantomjsfile = findPhantomJS(desiredCapabilities, PHANTOMJS_DOC_LINK, PHANTOMJS_DOWNLOAD_LINK); File ghostDriverfile = findGhostDriver(desiredCapabilities, GHOSTDRIVER_DOC_LINK, GHOSTDRIVER_DOWNLOAD_LINK); String[] commandLineArguments = findCommandLineArguments(desiredCapabilities); return new Builder().usingPhantomJSExecutable(phantomjsfile) .usingGhostDriver(ghostDriverfile) .usingAnyFreePort() .withProxy(proxy) .usingCommandLineArguments(commandLineArguments) .build(); }
Source:
<code>public static void create(EGVRecord egvRecord, long addativeOffset, Context context) { BgReading bgReading = BgReading.getForTimestamp(egvRecord.getSystemTime().getTime() + addativeOffset); Log.i(TAG, "create: Looking for BG reading to tag this thing to: " + egvRecord.getBGValue()); if(bgReading != null) { bgReading.calculated_value = egvRecord.getBGValue(); if (egvRecord.getBGValue() <= 13) { Calibration calibration = bgReading.calibration; double firstAdjSlope = calibration.first_slope + (calibration.first_decay * (Math.ceil(new Date().getTime() - calibration.timestamp)/(1000 * 60 * 10))); double calSlope = (calibration.first_scale / firstAdjSlope)*1000; double calIntercept = ((calibration.first_scale * calibration.first_intercept) / firstAdjSlope)*-1; bgReading.raw_calculated = (((calSlope * bgReading.raw_data) + calIntercept) - 5); } Log.i(TAG, "create: NEW VALUE CALCULATED AT: " + bgReading.calculated_value); AtomicBoolean hide = new AtomicBoolean(); <START> bgReading.calculated_value_slope = bgReading.slopefromName(egvRecord.getTrend().friendlyTrendName(), hide); <END> bgReading.noise = egvRecord.noiseValue(); bgReading.hide_slope = hide.get(); bgReading.save(); bgReading.find_new_curve(); bgReading.find_new_raw_curve(); context.startService(new Intent(context, Notifications.class)); BgSendQueue.handleNewBgReading(bgReading, "create", context); } }</code><technical_language>'hide' a parameter passed function is a return parameter. Is this a wanted side-effect? prefer real return if is a return value. (class bundling a double a boolean)</technical_language>

Target:
public static void create(EGVRecord egvRecord, long addativeOffset, Context context) { BgReading bgReading = BgReading.getForTimestamp(egvRecord.getSystemTime().getTime() + addativeOffset); Log.i(TAG, "create: Looking for BG reading to tag this thing to: " + egvRecord.getBGValue()); if(bgReading != null) { bgReading.calculated_value = egvRecord.getBGValue(); if (egvRecord.getBGValue() <= 13) { Calibration calibration = bgReading.calibration; double firstAdjSlope = calibration.first_slope + (calibration.first_decay * (Math.ceil(new Date().getTime() - calibration.timestamp)/(1000 * 60 * 10))); double calSlope = (calibration.first_scale / firstAdjSlope)*1000; double calIntercept = ((calibration.first_scale * calibration.first_intercept) / firstAdjSlope)*-1; bgReading.raw_calculated = (((calSlope * bgReading.raw_data) + calIntercept) - 5); } Log.i(TAG, "create: NEW VALUE CALCULATED AT: " + bgReading.calculated_value); Pair<Double, Boolean> slopePair = BgReading.slopefromName(egvRecord.getTrend().friendlyTrendName()); bgReading.calculated_value_slope = slopePair.first; bgReading.hide_slope = slopePair.second; bgReading.noise = egvRecord.noiseValue(); bgReading.save(); bgReading.find_new_curve(); bgReading.find_new_raw_curve(); context.startService(new Intent(context, Notifications.class)); BgSendQueue.handleNewBgReading(bgReading, "create", context); } }
Source:
<code>public void aggregate() { long time = timeSelector.getLong(); if (time >= lastTime) { lastTime = time; Object value = valueSelector.getObject(); if (value instanceof String) { lastValue = (String) value; } else if (value instanceof SerializablePairLongString) { lastValue = ((SerializablePairLongString) value).rhs; } else if (value != null) { throw new IllegalStateException( "Try to aggregate unsuported class type [" <START> + value.getClass().getName() + <END> "]. Supported class types: String or SerializablePairLongString" ); } if (lastValue != null && lastValue.length() > maxStringBytes) { lastValue = lastValue.substring(0, maxStringBytes); } } }</code><technical_language>call getCanonicalName()</technical_language>

Target:
public void aggregate() { long time = timeSelector.getLong(); if (time >= lastTime) { lastTime = time; Object value = valueSelector.getObject(); if (value != null) { if (value instanceof String) { lastValue = (String) value; } else if (value instanceof SerializablePairLongString) { lastValue = ((SerializablePairLongString) value).rhs; } else { throw new ISE( "Try to aggregate unsuported class type [%s].Supported class types: String or SerializablePairLongString", value.getClass().getCanonicalName() ); } if (lastValue != null && lastValue.length() > maxStringBytes) { lastValue = lastValue.substring(0, maxStringBytes); } } else { lastValue = null; } } }
Source:
<code>public List<CourseDetailsBundle> extractArchivedCourses(List<CourseDetailsBundle> courseBundles, String googleId) { CourseDetailsBundle.sortDetailedCoursesByCourseId(courseBundles); <START> List<CourseDetailsBundle> result = new ArrayList<CourseDetailsBundle>(); <END> for (CourseDetailsBundle courseBundle : courseBundles) { if (isCourseArchived(courseBundle.course.id, googleId)) { result.add(courseBundle); } } return result; }</code><technical_language>methods in CourseLogic instead of *PageAction? multiple classes requesting separated active archived</technical_language>

Target:
public List<CourseDetailsBundle> extractArchivedCourses(List<CourseDetailsBundle> courseBundles, String googleId) { List<CourseDetailsBundle> result = new ArrayList<CourseDetailsBundle>(); for (CourseDetailsBundle courseBundle : courseBundles) { if (isCourseArchived(courseBundle.course.id, googleId)) { result.add(courseBundle); } } return result; }