auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public void unsubscribe_synchronous() throws InterruptedException { SyncUser user = UserFactory.createUniqueUser(Constants.AUTH_URL); createServerData(user, Constants.SYNC_SERVER_URL); final SyncConfiguration partialSyncConfig = configurationFactory.createSyncConfigurationBuilder(user, Constants.SYNC_SERVER_URL) .name("partialSync") .initialData(r -> { r.where(PartialSyncObjectA.class).greaterThan("number", 5).subscribe("my-sub"); }) .waitForInitialRemoteData() .addModule(new PartialSyncModule()) .build(); Realm realm = Realm.getInstance(partialSyncConfig); looperThread.closeAfterTest(realm); realm.executeTransaction(r -> { Subscription sub = r.getSubscription("my-sub"); assertEquals(Subscription.State.ACTIVE, sub.getState()); <START> sub.unsubscribe(); <END> }); RealmResults<PartialSyncObjectA> results = realm.where(PartialSyncObjectA.class).findAll(); results.addChangeListener((objects, changeSet) -> { if (objects.isEmpty()) { looperThread.testComplete(); } }); }</code><technical_language>test deleting subscription unsubscribe & objects disappear locally</technical_language>

Target:
public void unsubscribe_synchronous() throws InterruptedException { SyncUser user = UserFactory.createUniqueUser(Constants.AUTH_URL); createServerData(user, Constants.SYNC_SERVER_URL); final SyncConfiguration partialSyncConfig = configurationFactory.createSyncConfigurationBuilder(user, Constants.SYNC_SERVER_URL) .name("partialSync") .initialData(r -> { r.where(PartialSyncObjectA.class).greaterThan("number", 5).subscribe("my-sub"); }) .waitForInitialRemoteData() .addModule(new PartialSyncModule()) .build(); Realm realm = Realm.getInstance(partialSyncConfig); looperThread.closeAfterTest(realm); realm.executeTransaction(r -> { Subscription sub = r.getSubscription("my-sub"); assertEquals(Subscription.State.ACTIVE, sub.getState()); sub.unsubscribe(); assertEquals(Subscription.State.INVALIDATED, sub.getState()); }); RealmResults<PartialSyncObjectA> results = realm.where(PartialSyncObjectA.class).findAll(); results.addChangeListener((objects, changeSet) -> { if (objects.isEmpty()) { looperThread.testComplete(); } }); }
Source:
<code>public void load() { ScenarioSimulationModel model = service.load(path); assertEquals(Type.DMN, model.getSimulation().getSimulationDescriptor().getType()); verify(dmnTypeServiceMock, times(1)).initializeNameAndNamespace(any(), any(), anyString()); when(dmnTypeServiceMock.initializeNameAndNamespace(any(), any(), anyString())).thenThrow(new ImpossibleToFindDMNException("")); try { service.load(path); } catch (Exception e) { fail(); <START> } <END> }</code><technical_language>I miss something, this test invoked method load twice? assert loaded model content</technical_language>

Target:
public void load() { ScenarioSimulationModel model = service.load(path); assertEquals(Type.DMN, model.getSimulation().getSimulationDescriptor().getType()); verify(dmnTypeServiceMock, times(1)).initializeNameAndNamespace(any(), any(), anyString()); doThrow(new ImpossibleToFindDMNException("")).when(dmnTypeServiceMock).initializeNameAndNamespace(any(), any(), anyString()); try { service.load(path); } catch (Exception e) { fail(); } }
Source:
<code>public void handle(Callback[] callbacks) throws UnsupportedCallbackException { Callback unsupportedCallback = null; for (Callback callback : callbacks) { if (callback instanceof NameCallback) { ((NameCallback) callback).setName(username); } else if (callback instanceof PasswordCallback) { ((PasswordCallback) callback).setPassword(password.toCharArray()); } else { log.warn( "Asked to handle unsupported callback '{}' of type {}; request authentication will fail", callback, callback.getClass() ); <START> if (unsupportedCallback == null) <END> unsupportedCallback = callback; } } if (unsupportedCallback != null) throw new UnsupportedCallbackException( unsupportedCallback, "Supports only NameCallback and PasswordCallback"); }</code><technical_language>reason want iterate call backs throw exception</technical_language>

Target:
public void handle(Callback[] callbacks) throws UnsupportedCallbackException { List<Callback> unsupportedCallbacks = new ArrayList<>(); for (Callback callback : callbacks) { if (callback instanceof NameCallback) { ((NameCallback) callback).setName(username); } else if (callback instanceof PasswordCallback) { ((PasswordCallback) callback).setPassword(password != null ? password.toCharArray() : null ); } else { unsupportedCallbacks.add(callback); } } if (!unsupportedCallbacks.isEmpty()) throw new ConnectException(String.format( "Unsupported callbacks %s; request authentication will fail. " + "This indicates the Connect worker was configured with a JAAS " + "LoginModule that is incompatible with the %s, and will need to be " + "corrected and restarted.", unsupportedCallbacks, BasicAuthSecurityRestExtension.class.getSimpleName() )); }
Source:
<code>private void showNewUserListDialog(CategoryListItem categoryListItem, List<UserList> projectUserList, List<UserList> spriteUserList, FragmentActivity activity, TextInputDialog.Builder builder) { builder.setHint(activity.getString(R.string.data_label)) .setPositiveButton(activity.getString(R.string.ok), (TextInputDialog.OnClickListener) (dialog, textInput) -> { if (textInput.isEmpty()) { activity.onBackPressed(); return; } UserList userList = new UserList(textInput); RadioButton addToProjectListsRadioButton = ((Dialog) dialog).findViewById(R.id.global); boolean addToProjectLists = addToProjectListsRadioButton.isChecked(); <START> if (addToProjectLists) { <END> projectUserList.add(userList); } else { spriteUserList.add(userList); } addResourceToActiveFormulaInFormulaEditor(categoryListItem, userList); }) .setTitle(R.string.formula_editor_list_dialog_title) .setView(R.layout.dialog_new_user_data) .setNegativeButton(R.string.cancel, (dialogInterface, index) -> activity.onBackPressed()); builder.show(); }</code><technical_language>Please a util method/class, else for this task. places user-list is added project</technical_language>

Target:
private void showNewUserListDialog(CategoryListItem categoryListItem, List<UserList> projectUserList, List<UserList> spriteUserList, FragmentActivity activity, TextInputDialog.Builder builder) { AddUserListDialog userListDialog = new AddUserListDialog(builder); userListDialog.show(activity.getString(R.string.data_label), activity.getString(R.string.ok), new AddUserListDialog.Callback(){ @Override public void onPositiveButton(DialogInterface dialog, String textInput) { UserList userList = new UserList(textInput); userListDialog.addUserList(dialog, userList, projectUserList, spriteUserList); addResourceToActiveFormulaInFormulaEditor(categoryListItem, userList); } @Override public void onNegativeButton() { activity.onBackPressed(); } }); }
Source:
<code>private Diagnostic validate(PreSetValidator validator, EStructuralFeature eStructuralFeature, Object value, Map<Object, Object> context) { final EClassifier eType = eStructuralFeature.getEType(); BasicDiagnostic diagnostics = new BasicDiagnostic(); if (eType instanceof EDataType && EDataType.class.cast(eType).getEPackage() == EcorePackage.eINSTANCE) { final EDataType eDataType = EDataType.class.cast(eType); diagnostics = Diagnostician.INSTANCE.createDefaultDiagnostic(eDataType, value); if (eDataType instanceof EEnum && value instanceof String) { if (validateEEnum((EEnum) eDataType, (String) value)) { return new BasicDiagnostic(); } } else if (eDataType instanceof EEnum && value instanceof List<?>) { try { if (validateEEnum((EEnum) eDataType, (List<Enumerator>) value)) { return new BasicDiagnostic(); } } catch (final ClassCastException ex) { } } if (validator != null) { validator.validate(eDataType, value, diagnostics, context); } final Set<IFeatureConstraint> dataTypeConstraints = eDataTypeConstraints.get(eType); if (dataTypeConstraints != null) { <START> for (final IFeatureConstraint constraint : dataTypeConstraints) { <END> final Diagnostic result = constraint.validate(eStructuralFeature, value, context); if (result.getSeverity() == Diagnostic.OK) { continue; } diagnostics.add(result); } } } final Set<IFeatureConstraint> featureConstraints = eStructuralFeatureConstraints.get(eStructuralFeature); if (featureConstraints != null) { for (final IFeatureConstraint constraint : featureConstraints) { final Diagnostic result = constraint.validate(eStructuralFeature, value, context); if (result.getSeverity() == Diagnostic.OK) { continue; } diagnostics.add(result); } } return diagnostics; }</code><technical_language>This is code block below, right? extract a common method, maybe</technical_language>

Target:
private Diagnostic validate(PreSetValidator validator, EStructuralFeature eStructuralFeature, Object value, Map<Object, Object> context) { final EClassifier eType = eStructuralFeature.getEType(); BasicDiagnostic diagnostics = new BasicDiagnostic(); if (eType instanceof EDataType && EDataType.class.cast(eType).getEPackage() == EcorePackage.eINSTANCE) { final EDataType eDataType = EDataType.class.cast(eType); diagnostics = Diagnostician.INSTANCE.createDefaultDiagnostic(eDataType, value); if (eDataType instanceof EEnum && value instanceof String) { if (validateEEnum((EEnum) eDataType, (String) value)) { return new BasicDiagnostic(); } } else if (eDataType instanceof EEnum && value instanceof List<?>) { try { if (validateEEnum((EEnum) eDataType, (List<Enumerator>) value)) { return new BasicDiagnostic(); } } catch (final ClassCastException ex) { } } if (validator != null) { validator.validate(eDataType, value, diagnostics, context); } executeValidators(diagnostics, constraints.get(eType), eStructuralFeature, value, context); } executeValidators(diagnostics, constraints.get(eStructuralFeature), eStructuralFeature, value, context); return diagnostics; }
Source:
<code>public Table getTable() { ReadableTable table; if (this.recordWriter == null) { <START> table = new RemoteTable(tableSpec.getId(), recordReader); <END> } else { table = new RemoteReadWriteTable(tableSpec.getId(), recordReader, recordWriter); } table.init(containerContext, taskContext); return table; }</code><technical_language>s/RemoteTable/RemoteReadableTable</technical_language>

Target:
public Table getTable() { RemoteReadableTable table; TableReadFunction<?, ?> readFn = getReadFn(); RateLimiter rateLimiter = deserializeObject(RATE_LIMITER); if (rateLimiter != null) { rateLimiter.init(containerContext.config, taskContext); } CreditFunction<?, ?> readCreditFn = deserializeObject(READ_CREDIT_FN); if (readOnly) { table = new RemoteReadableTable(tableSpec.getId(), readFn, rateLimiter, readCreditFn); } else { CreditFunction<?, ?> writeCreditFn = deserializeObject(WRITE_CREDIT_FN); table = new RemoteReadWriteTable(tableSpec.getId(), readFn, getWriteFn(), rateLimiter, readCreditFn, writeCreditFn); } table.init(containerContext, taskContext); tables.add(table); return table; }
Source:
<code>public QueryBuilder setLong(String name, long value) throws SQLException { for (int i : indexes(name)) { try { if (value == 0) { statement.setNull(i, Types.INTEGER); } else { <START> statement.setLong(i, value); <END> } } catch (SQLException error) { statement.close(); connection.close(); throw error; } } return this; }</code><technical_language>Replace tab spaces</technical_language>

Target:
public QueryBuilder setLong(String name, long value) throws SQLException { return setLong(name, value, false); }
Source:
<code>private ConvertVmVDSParameters buildConvertParameters() { ConvertVmVDSParameters parameters = new ConvertVmVDSParameters(getVdsId()); parameters.setUrl(getParameters().getUrl()); parameters.setDisks(getParameters().getDisks()); parameters.setVmId(getVmId()); parameters.setVmName(getVmName()); parameters.setStoragePoolId(getStoragePoolId()); parameters.setStorageDomainId(getStorageDomainId()); parameters.setVirtioIsoPath(getVirtioIsoPath()); switch(getParameters().getOriginType()) { case VMWARE: default: parameters.setUsername(getParameters().getUsername()); parameters.setPassword(getParameters().getPassword()); break; <START> } <END> return parameters; }</code><technical_language>I set for external systems (for xen null empty) in vdsbroker command did, no</technical_language>

Target:
private ConvertVmVDSParameters buildConvertParameters() { ConvertVmVDSParameters parameters = new ConvertVmVDSParameters(getVdsId()); parameters.setUrl(getParameters().getUrl()); parameters.setUsername(getParameters().getUsername()); parameters.setPassword(getParameters().getPassword()); parameters.setDisks(getParameters().getDisks()); parameters.setVmId(getVmId()); parameters.setVmName(getVmName()); parameters.setStoragePoolId(getStoragePoolId()); parameters.setStorageDomainId(getStorageDomainId()); parameters.setVirtioIsoPath(getVirtioIsoPath()); parameters.setOriginType(getParameters().getOriginType()); return parameters; }
Source:
<code>public UUID createSecret111(boolean isPrivate) { ExperimentDTO mtab = ExperimentDTO.createNew(SECRET_111, TYPE_MICROARRAY, "cow", Sets.newHashSet("1"), "diff", isPrivate); <START> return subject.addExperiment(mtab, Optional.<String>absent()); <END> }</code><technical_language>need <String> here, Java 8 infer for you</technical_language>

Target:
public UUID createSecret111(boolean isPrivate) { ExperimentDTO mtab = ExperimentDTO.createNew(SECRET_111, TYPE_MICROARRAY, "cow", Sets.newHashSet("1"), "diff", isPrivate); return subject.addExperiment(mtab, Optional.absent()); }
Source:
<code>protected List<Attribute> getGlobalAttributesToUpdate(NetcdfFile nc) throws Exception{ List<Attribute> newAttributeList = new ArrayList<>(); String title = profile; try { title = nc.findGlobalAttribute("title").getStringValue(); title = title.substring(0, title.lastIndexOf(",")); } catch (Exception e) { logger.warn("Could not find 'title' attribute in result file"); } newAttributeList.add(new Attribute("title", String.format("%s, %s, %s", title, subset.get("TIME").start, subset.get("TIME").end))); <START> newAttributeList.add(new Attribute(goGoDuckConfig.getLatitudeStart(profile), subset.get("LATITUDE").start)); <END> newAttributeList.add(new Attribute(goGoDuckConfig.getLatitudeEnd(profile), subset.get("LATITUDE").end)); newAttributeList.add(new Attribute(goGoDuckConfig.getLongitudeStart(profile), subset.get("LONGITUDE").start)); newAttributeList.add(new Attribute(goGoDuckConfig.getLongitudeEnd(profile), subset.get("LONGITUDE").end)); newAttributeList.add(new Attribute(goGoDuckConfig.getTimeStart(profile), subset.get("TIME").start)); newAttributeList.add(new Attribute(goGoDuckConfig.getTimeEnd(profile), subset.get("TIME").end)); return newAttributeList; }</code><technical_language>default geospatial_lat_min, geospatial_lat_max on. if configured - lets configure default values</technical_language>

Target:
protected List<Attribute> getGlobalAttributesToUpdate(NetcdfFile nc) throws Exception{ List<Attribute> newAttributeList = new ArrayList<>(); String title = profile; try { title = nc.findGlobalAttribute("title").getStringValue(); title = title.substring(0, title.lastIndexOf(",")); } catch (Exception e) { logger.warn("Could not find 'title' attribute in result file"); } newAttributeList.add(new Attribute(goGoDuckConfig.getTitle(profile), String.format("%s, %s, %s", title, subset.get("TIME").start, subset.get("TIME").end))); newAttributeList.add(new Attribute(goGoDuckConfig.getLatitudeStart(profile), subset.get("LATITUDE").start)); newAttributeList.add(new Attribute(goGoDuckConfig.getLatitudeEnd(profile), subset.get("LATITUDE").end)); newAttributeList.add(new Attribute(goGoDuckConfig.getLongitudeStart(profile), subset.get("LONGITUDE").start)); newAttributeList.add(new Attribute(goGoDuckConfig.getLongitudeEnd(profile), subset.get("LONGITUDE").end)); newAttributeList.add(new Attribute(goGoDuckConfig.getTimeStart(profile), subset.get("TIME").start)); newAttributeList.add(new Attribute(goGoDuckConfig.getTimeEnd(profile), subset.get("TIME").end)); return newAttributeList; }
Source:
<code>public void doOnTerminateSuccess() { final AtomicBoolean atomicBoolean = new AtomicBoolean(); Maybe.just(1).doOnTerminate(new Action() { @Override public void run() { atomicBoolean.set(true); } <START> }).subscribe(); <END> assertTrue(atomicBoolean.get()); }</code><technical_language>test().assertResult(1); instead of subscribing blindly</technical_language>

Target:
public void doOnTerminateSuccess() { final AtomicBoolean atomicBoolean = new AtomicBoolean(); Maybe.just(1).doOnTerminate(new Action() { @Override public void run() { atomicBoolean.set(true); } }) .test() .assertResult(1); assertTrue(atomicBoolean.get()); }
Source:
<code>public void testCreateWithNotNullColumns() { metadata.setConnectorCapabilities(NOT_NULL_COLUMNS); <START> ImmutableList<ColumnDefinition> inputColumns = ImmutableList.of( <END> new ColumnDefinition(identifier("a"), "DATE", emptyList(), Optional.empty(), true), new ColumnDefinition(identifier("b"), "VARCHAR", emptyList(), Optional.empty(), false), new ColumnDefinition(identifier("c"), "VARBINARY", emptyList(), Optional.empty(), false)); CreateTable statement = new CreateTable(QualifiedName.of("test_table"), inputColumns, true, ImmutableList.of(), Optional.empty()); getFutureValue(new CreateTableTask().internalExecute(statement, metadata, new AllowAllAccessControl(), testSession, emptyList())); assertEquals(metadata.getCreateTableCallCount(), 1); List<ColumnMetadata> columns = metadata.getReceivedTableMetadata().get(0).getColumns(); assertEquals(columns.size(), 3); assertEquals(columns.get(0).getName(), inputColumns.get(0).getName().getValue()); assertEquals(columns.get(0).getType().getDisplayName().toUpperCase(ENGLISH), inputColumns.get(0).getType()); assertEquals(columns.get(0).isNullable(), inputColumns.get(0).isNullable()); assertEquals(columns.get(1).getName(), inputColumns.get(1).getName().getValue()); assertEquals(columns.get(1).getType().getDisplayName().toUpperCase(ENGLISH), inputColumns.get(1).getType()); assertEquals(columns.get(1).isNullable(), inputColumns.get(1).isNullable()); assertEquals(columns.get(2).getName(), inputColumns.get(2).getName().getValue()); assertEquals(columns.get(2).getType().getDisplayName().toUpperCase(ENGLISH), inputColumns.get(2).getType()); assertEquals(columns.get(2).isNullable(), inputColumns.get(2).isNullable()); }</code><technical_language>Nit: declare List</technical_language>

Target:
public void testCreateWithNotNullColumns() { metadata.setConnectorCapabilities(NOT_NULL_COLUMN_CONSTRAINT); List<TableElement> inputColumns = ImmutableList.of( new ColumnDefinition(identifier("a"), "DATE", true, emptyList(), Optional.empty()), new ColumnDefinition(identifier("b"), "VARCHAR", false, emptyList(), Optional.empty()), new ColumnDefinition(identifier("c"), "VARBINARY", false, emptyList(), Optional.empty())); CreateTable statement = new CreateTable(QualifiedName.of("test_table"), inputColumns, true, ImmutableList.of(), Optional.empty()); getFutureValue(new CreateTableTask().internalExecute(statement, metadata, new AllowAllAccessControl(), testSession, emptyList())); assertEquals(metadata.getCreateTableCallCount(), 1); List<ColumnMetadata> columns = metadata.getReceivedTableMetadata().get(0).getColumns(); assertEquals(columns.size(), 3); assertEquals(columns.get(0).getName(), "a"); assertEquals(columns.get(0).getType().getDisplayName().toUpperCase(ENGLISH), "DATE"); assertTrue(columns.get(0).isNullable()); assertEquals(columns.get(1).getName(), "b"); assertEquals(columns.get(1).getType().getDisplayName().toUpperCase(ENGLISH), "VARCHAR"); assertFalse(columns.get(1).isNullable()); assertEquals(columns.get(2).getName(), "c"); assertEquals(columns.get(2).getType().getDisplayName().toUpperCase(ENGLISH), "VARBINARY"); assertFalse(columns.get(2).isNullable()); }
Source:
<code>public void onBackPressed() { if (onBackPressedListener != null) { onBackPressedListener.doBack(); } else { super.onBackPressed(); } <START> Intent intent = new Intent(); <END> setResult(ApplicationConstants.RequestCodes.FONT_SIZE_MATCHER, intent); }</code><technical_language>right set a specific result leaving PreferencesActivity. This happen in UserInterfacePreferences fragment font size changes. call set result a Fragment's host Activity calling getActivity(). nice write a test for Fragement (probably Robolectric) check sets result parent Activity</technical_language>

Target:
public void onBackPressed() { if (onBackPressedListener != null) { onBackPressedListener.doBack(); } else { super.onBackPressed(); } Intent intent = new Intent(); setResult(ApplicationConstants.RequestCodes.PREFERENCES, intent); }
Source:
<code><START> public static boolean isJobBlacklisted(final String jobName) { <END> Boolean useJobRegex = DatadogUtilities.getDatadogDescriptor().getJobRegex(); logger.fine(String.format("JobRegex is " + useJobRegex)); if(useJobRegex) { final List<List<String>> blacklistRegexes = DatadogUtilities.regexJoblistStringtoList( DatadogUtilities.getBlacklist() ); for(List<String> regexPatternAndTags: blacklistRegexes) { if(regexPatternAndTags.isEmpty()) { return false; } Pattern p = Pattern.compile(regexPatternAndTags.get(0)); Matcher m = p.matcher(jobName); if(m.matches()) { logger.fine(String.format("We are blacklisted")); return true; } } return false; } else { final List<String> blacklist = DatadogUtilities.joblistStringtoList( DatadogUtilities.getBlacklist() ); return blacklist.contains(jobName.toLowerCase()); } }</code><technical_language>ditto else :)</technical_language>

Target:
public static boolean isJobBlacklisted(final String jobName) { final List<String> blacklist = DatadogUtilities.joblistStringtoList( DatadogUtilities.getBlacklist() ); return blacklist.contains(jobName.toLowerCase()); }
Source:
<code>public void handleReconnect(ClientDescriptor clientDescriptor, byte[] extendedReconnectData) { if (inflightInvalidations == null) { throw new AssertionError("Load existing was not invoked before handleReconnect"); } if (!connectedClients.replace(clientDescriptor, false, true)) { throw new AssertionError("Client "+ clientDescriptor +" trying to reconnect is not connected to entity"); } ClusterTierReconnectMessage reconnectMessage = reconnectMessageCodec.decode(extendedReconnectData); ServerSideServerStore serverStore = stateService.getStore(storeIdentifier); addInflightInvalidationsForStrongCache(clientDescriptor, reconnectMessage, serverStore); <START> attachStore(clientDescriptor, reconnectMessage.getClientId(), storeIdentifier); <END> LOGGER.info("Client '{}' successfully reconnected to newly promoted ACTIVE after failover.", clientDescriptor); management.clientReconnected(clientDescriptor); }</code><technical_language>discussed, more cleanup done in attach store</technical_language>

Target:
public void handleReconnect(ClientDescriptor clientDescriptor, byte[] extendedReconnectData) { if (inflightInvalidations == null) { throw new AssertionError("Load existing was not invoked before handleReconnect"); } if (connectedClients.get(clientDescriptor) == null) { throw new AssertionError("Client "+ clientDescriptor +" trying to reconnect is not connected to entity"); } ClusterTierReconnectMessage reconnectMessage = reconnectMessageCodec.decode(extendedReconnectData); ServerSideServerStore serverStore = stateService.getStore(storeIdentifier); addInflightInvalidationsForStrongCache(clientDescriptor, reconnectMessage, serverStore); attachStore(clientDescriptor, reconnectMessage.getClientId()); LOGGER.info("Client '{}' successfully reconnected to newly promoted ACTIVE after failover.", clientDescriptor); management.clientReconnected(clientDescriptor, connectedClients.get(clientDescriptor)); }
Source:
<code>public IAnswerData getAnswer() { String stringAnswer = binding.barcodeAnswerText.getText().toString(); <START> return stringAnswer.equals("") ? null : new StringData(stringAnswer); <END> }</code><technical_language>isEmpty() here</technical_language>

Target:
public IAnswerData getAnswer() { String answer = binding.barcodeAnswerText.getText().toString(); return answer.isEmpty() ? null : new StringData(answer); }
Source:
<code>public void commit() throws PersistException { if (m_declarations.size() == 0) { return; } try { final String ownerName = m_resource.getOwnerName(); final String absolutePath = getResourceDir(m_resource).getAbsolutePath(); List<RrdDataSource> dataSources = getDataSources(); if (dataSources != null && dataSources.size() > 0) { createRRD(m_rrdStrategy, ownerName, absolutePath, m_rrdName, getRepository().getStep(), dataSources, getRepository().getRraList(), m_metaData); long rrdTime = Boolean.getBoolean("org.opennms.netmgt.collection.persistence.rrd.useCollectionStartTime") <START> ? m_collectionTime : m_timeKeeper.getCurrentTime(); <END> updateRRD(m_rrdStrategy, ownerName, absolutePath, m_rrdName, rrdTime, getValues()); } } catch (FileNotFoundException e) { LoggerFactory.getLogger(getClass()).warn("Could not get resource directory: " + e.getMessage(), e); return; } catch (RrdException e) { throw new PersistException(e); } }</code><technical_language>I opt for overriding TimeKeeper for CollectionResource objects in CollectionSet instead of explicitly passing time persistence layers performing this logic here</technical_language>

Target:
public void commit() throws PersistException { if (m_declarations.size() == 0) { return; } try { final String ownerName = m_resource.getOwnerName(); final String absolutePath = getResourceDir(m_resource).getAbsolutePath(); List<RrdDataSource> dataSources = getDataSources(); if (dataSources != null && dataSources.size() > 0) { createRRD(m_rrdStrategy, ownerName, absolutePath, m_rrdName, getRepository().getStep(), dataSources, getRepository().getRraList(), m_metaData); updateRRD(m_rrdStrategy, ownerName, absolutePath, m_rrdName, m_timeKeeper.getCurrentTime(), getValues()); } } catch (FileNotFoundException e) { LoggerFactory.getLogger(getClass()).warn("Could not get resource directory: " + e.getMessage(), e); return; } catch (RrdException e) { throw new PersistException(e); } }
Source:
<code>private BundleDescription[] loadBundlesFromSite(IProgressMonitor monitor) { SiteBundle[] siteBundles = site.getBundles(); Map<String, BundleDescription> tmpBundleCache = new HashMap<>(siteBundles.length); for (SiteBundle <START> siteBundle1 : <END> siteBundles) { if (monitor.isCanceled()) { throw new OperationCanceledException(); } SiteBundle siteBundle = siteBundle1; String key = null; if (siteBundle.getBundleIdentifier() != null && siteBundle.getBundleVersion() != null) { key = siteBundle.getBundleIdentifier() + VERSION_SEPARATOR + siteBundle.getBundleVersion(); if (tmpBundleCache.containsKey(key)) continue; } URI bundleURI = getSiteBundleURI(siteBundle); BundleDescription bundle = parseBundleDescription(bundleURI, monitor); if (bundle == null) { LogHelper.log(new Status(IStatus.ERROR, Activator.ID, NLS.bind(Messages.ErrorReadingBundle, bundleURI))); } else { if (key == null) { siteBundle.setBundleIdentifier(bundle.getSymbolicName()); siteBundle.setBundleVersion(bundle.getVersion().toString()); key = siteBundle.getBundleIdentifier() + VERSION_SEPARATOR + siteBundle.getBundleVersion().toString(); } tmpBundleCache.put(key, bundle); } } bundleCache = tmpBundleCache; return bundleCache.values().toArray(new BundleDescription[bundleCache.size()]); }</code><technical_language>This siteBundle skip assignment 2 lines below</technical_language>

Target:
private BundleDescription[] loadBundlesFromSite(IProgressMonitor monitor) { SiteBundle[] siteBundles = site.getBundles(); Map<String, BundleDescription> tmpBundleCache = new HashMap<>(siteBundles.length); for (SiteBundle siteBundle : siteBundles) { if (monitor.isCanceled()) { throw new OperationCanceledException(); } String key = null; if (siteBundle.getBundleIdentifier() != null && siteBundle.getBundleVersion() != null) { key = siteBundle.getBundleIdentifier() + VERSION_SEPARATOR + siteBundle.getBundleVersion(); if (tmpBundleCache.containsKey(key)) continue; } URI bundleURI = getSiteBundleURI(siteBundle); BundleDescription bundle = parseBundleDescription(bundleURI, monitor); if (bundle == null) { LogHelper .log(new Status(IStatus.ERROR, Activator.ID, NLS.bind(Messages.ErrorReadingBundle, bundleURI))); } else { if (key == null) { siteBundle.setBundleIdentifier(bundle.getSymbolicName()); siteBundle.setBundleVersion(bundle.getVersion().toString()); key = siteBundle.getBundleIdentifier() + VERSION_SEPARATOR + siteBundle.getBundleVersion().toString(); } tmpBundleCache.put(key, bundle); } } bundleCache = tmpBundleCache; return bundleCache.values().toArray(new BundleDescription[bundleCache.size()]); }
Source:
<code>public BugzillaRestConfiguration getRepositoryConfiguration(TaskRepository repository) throws CoreException { if (clientCache.getIfPresent(repository.getId()) == null) { getClient(repository); } try { return configurationCache.get(repository.getId()); } catch (UncheckedExecutionException e) { if (!e.getMessage().startsWith( <START> "com.google.common.cache.CacheLoader$InvalidCacheLoadException: CacheLoader returned null for key")) { <END> throw new CoreException(new Status(IStatus.ERROR, BugzillaRestCore.ID_PLUGIN, e.getMessage(), e)); } } catch (ExecutionException e) { if (!e.getMessage().startsWith("CacheLoader returned null for key")) { throw new CoreException(new Status(IStatus.ERROR, BugzillaRestCore.ID_PLUGIN, e.getMessage(), e)); } } return null; }</code><technical_language>do want ignore exceptions? I acting exception's message this, message change on</technical_language>

Target:
public BugzillaRestConfiguration getRepositoryConfiguration(TaskRepository repository) throws CoreException { if (clientCache.getIfPresent(repository.getId()) == null) { getClient(repository); } try { return configurationCache.get(repository.getId()); } catch (UncheckedExecutionException e) { if (!e.getMessage().startsWith( "com.google.common.cache.CacheLoader$InvalidCacheLoadException: CacheLoader returned null for key")) { throw new CoreException(new Status(IStatus.ERROR, BugzillaRestCore.ID_PLUGIN, e.getMessage(), e)); } else { return null; } } catch (ExecutionException e) { if (!e.getMessage().startsWith("CacheLoader returned null for key")) { throw new CoreException(new Status(IStatus.ERROR, BugzillaRestCore.ID_PLUGIN, e.getMessage(), e)); } } return null; }
Source:
<code>public void onBindViewHolder(SurahAudioManager.SurahViewHolder holder, int position) { <START> holder.name.setText((position+1) + ""); <END> QariDownloadInfo info = getSheikhInfoForPosition(sheikhPosition); if(info == null) { return; } boolean fullyDownloaded = info.downloadedSuras.get(position + 1); holder.quantity.setText(fullyDownloaded? "Downloaded" : "Not downloaded"); }</code><technical_language>show sura name instead of number</technical_language>

Target:
public void onBindViewHolder(SurahAudioManager.SurahViewHolder holder, int position) { holder.name.setText(quranInfo.getSuraName(context, position+1, true)); int surahStatus, surahStatusImage; if(isItemFullyDownloaded(position)) { surahStatus = R.string.audio_manager_surah_delete; surahStatusImage = R.drawable.ic_cancel; } else { surahStatus = R.string.audio_manager_surah_download; surahStatusImage = R.drawable.ic_download; } holder.status.setText(getString(surahStatus)); holder.image.setImageResource(surahStatusImage); holder.setChecked(isItemChecked(position)); }
Source:
<code>public Collection<Device> get( @QueryParam("all") boolean all, @QueryParam("userId") long userId, @QueryParam("uniqueId") List<String> uniqueIds, @QueryParam("id") List<Long> deviceIds) throws SQLException { if (all) { if (Context.getPermissionsManager().isAdmin(getUserId())) { return Context.getDeviceManager().getAllDevices(); } else { Context.getPermissionsManager().checkManager(getUserId()); return Context.getDeviceManager().getManagedDevices(getUserId()); } } if (uniqueIds.isEmpty() && deviceIds.isEmpty()) { if (userId == 0) { userId = getUserId(); } Context.getPermissionsManager().checkUser(getUserId(), userId); return Context.getDeviceManager().getDevices(userId); } ArrayList<Device> devices = new ArrayList<>(); <START> if (!uniqueIds.isEmpty()) { <END> for (String uniqueId : uniqueIds) { Device device = Context.getDeviceManager().getDeviceByUniqueId(uniqueId); Context.getPermissionsManager().checkDevice(getUserId(), device.getId()); devices.add(device); } } if (!deviceIds.isEmpty()) { for (Long deviceId : deviceIds) { Context.getPermissionsManager().checkDevice(getUserId(), deviceId); devices.add(Context.getDeviceManager().getDeviceById(deviceId)); } } return devices; }</code><technical_language>Redundant check</technical_language>

Target:
public Collection<Device> get( @QueryParam("all") boolean all, @QueryParam("userId") long userId, @QueryParam("uniqueId") List<String> uniqueIds, @QueryParam("id") List<Long> deviceIds) throws SQLException { if (all) { if (Context.getPermissionsManager().isAdmin(getUserId())) { return Context.getDeviceManager().getAllDevices(); } else { Context.getPermissionsManager().checkManager(getUserId()); return Context.getDeviceManager().getManagedDevices(getUserId()); } } if (uniqueIds.isEmpty() && deviceIds.isEmpty()) { if (userId == 0) { userId = getUserId(); } Context.getPermissionsManager().checkUser(getUserId(), userId); return Context.getDeviceManager().getDevices(userId); } ArrayList<Device> devices = new ArrayList<>(); for (String uniqueId : uniqueIds) { Device device = Context.getDeviceManager().getDeviceByUniqueId(uniqueId); Context.getPermissionsManager().checkDevice(getUserId(), device.getId()); devices.add(device); } for (Long deviceId : deviceIds) { Context.getPermissionsManager().checkDevice(getUserId(), deviceId); devices.add(Context.getDeviceManager().getDeviceById(deviceId)); } return devices; }
Source:
<code>public List<QuotaCreditsVO> findCredits(final long accountId, final long domainId, final Date startDate, final Date endDate) { final short opendb = TransactionLegacy.currentTxn().getDatabaseId(); List<QuotaCreditsVO> qc = new ArrayList<>(); try { TransactionLegacy.open(TransactionLegacy.USAGE_DB); Filter filter = new Filter(QuotaCreditsVO.class, "updatedOn", true, 0L, Long.MAX_VALUE); SearchCriteria<QuotaCreditsVO> sc = createSearchCriteria(); sc.addAnd("accountId", SearchCriteria.Op.EQ, accountId); sc.addAnd("domainId", SearchCriteria.Op.EQ, domainId); if ((startDate != null) && (endDate != null) && startDate.before(endDate)) { sc.addAnd("updatedOn", SearchCriteria.Op.BETWEEN, startDate, endDate); } else { return new ArrayList<QuotaCreditsVO>(); } qc = search(sc, filter); } catch (Exception e) { <START> s_logger.error("QuotaCreditsDaoImpl::findCredits() failed due to: " + e.getMessage()); <END> throw new CloudRuntimeException("Unable to find quota credits"); } finally { TransactionLegacy.open(opendb).close(); } return qc; }</code><technical_language>exception caused error logged? stack trace extremely valuable for diagnosing production issues</technical_language>

Target:
public List<QuotaCreditsVO> findCredits(final long accountId, final long domainId, final Date startDate, final Date endDate) { return Transaction.execute(TransactionLegacy.USAGE_DB, new TransactionCallback<List<QuotaCreditsVO>>() { @Override public List<QuotaCreditsVO> doInTransaction(final TransactionStatus status) { if ((startDate != null) && (endDate != null) && startDate.before(endDate)) { Filter filter = new Filter(QuotaCreditsVO.class, "updatedOn", true, 0L, Long.MAX_VALUE); QueryBuilder<QuotaCreditsVO> qb = QueryBuilder.create(QuotaCreditsVO.class); qb.and(qb.entity().getAccountId(), SearchCriteria.Op.EQ, accountId); qb.and(qb.entity().getDomainId(), SearchCriteria.Op.EQ, domainId); qb.and(qb.entity().getUpdatedOn(), SearchCriteria.Op.BETWEEN, startDate, endDate); return search(qb.create(), filter); } else { return Collections.<QuotaCreditsVO> emptyList(); } } }); }
Source:
<code>protected Supplier<String> internalGetAttribute(String attr) { if ("type".equals(attr)) { return () -> <START> attributeType; <END> } return super.internalGetAttribute(attr); }</code><technical_language>This is unsafe, attributeType is protected set null, contract is return supplier null values. This rewritten check for null first</technical_language>

Target:
protected Supplier<String> internalGetAttribute(String attr) { if ("type".equals(attr)) { return () -> attributeType != null ? attributeType : ""; } return super.internalGetAttribute(attr); }
Source:
<code>public PagedFluxBase(Supplier<Mono<P>> firstPageRetriever, Function<String, Mono<P>> nextPageRetriever) { <START> Objects.requireNonNull(firstPageRetriever, "First page supplier cannot be null."); <END> Objects.requireNonNull(nextPageRetriever, "Next page retriever function cannot be null."); this.firstPageRetriever = firstPageRetriever; this.nextPageRetriever = nextPageRetriever; }</code><technical_language>nit: This consistent rest variable name instead of description. suggestion Objects.requireNonNull(firstPageRetriever, "'firstPageRetriever' null.");</technical_language>

Target:
public PagedFluxBase(Supplier<Mono<P>> firstPageRetriever, Function<String, Mono<P>> nextPageRetriever) { Objects.requireNonNull(firstPageRetriever, "'firstPageRetriever' cannot be null."); Objects.requireNonNull(nextPageRetriever, "'nextPageRetriever' function cannot be null."); this.firstPageRetriever = firstPageRetriever; this.nextPageRetriever = nextPageRetriever; }
Source:
<code>public GroupBySubscriber( Func1<? super T, ? extends K> keySelector, Func1<? super T, ? extends R> elementSelector, Subscriber<? super GroupedObservable<K, R>> child) { super(); this.keySelector = keySelector; this.elementSelector = elementSelector; this.child = child; child.add(Subscriptions.create(new Action0() { @Override public void call() { <START> if (groups.isEmpty()) { <END> parentSubscription.unsubscribe(); } } })); }</code><technical_language>correct do here. If multiple groups in flight outer observable is unsubscribed, do want unsubscribe open groups, enqueue onCompleted elements run, else? Window this anomaly unsubscribed outer deliver onCompleted windows stall</technical_language>

Target:
public GroupBySubscriber( Func1<? super T, ? extends K> keySelector, Func1<? super T, ? extends R> elementSelector, Subscriber<? super GroupedObservable<K, R>> child) { super(); this.keySelector = keySelector; this.elementSelector = elementSelector; this.child = child; child.add(Subscriptions.create(new Action0() { @Override public void call() { if (WIP_FOR_UNSUBSCRIBE_UPDATER.decrementAndGet(self) == 0) { self.unsubscribe(); } } })); }
Source:
<code>public static Class<?> loadClass(ClassLoader classLoader, String className) { <START> try { <END> if (classLoader != null) { return Class.forName(className, true, classLoader); } else { return Class.forName(className); } } catch (ClassNotFoundException e) { return null; } }</code><technical_language>isAssignableFrom fails classloaders classes is I understand, this is a built-in policy implementation right? types belong JAR get loaded classloaders? Dynamic-ImportPackage: *, I understand this is nuclear option, I a in allowing users pass classloader builder</technical_language>

Target:
public static Class<?> loadClass(ClassLoader classLoader, String className) { try { ClassLoader cl = classLoader != null ? classLoader : Thread.currentThread().getContextClassLoader(); if (cl != null) { return Class.forName(className, true, cl); } else { return Class.forName(className); } } catch (ClassNotFoundException e) { return null; } }
Source:
<code>public String nextAvailableColumn(Field field) throws DotDataException { DotConnect dc = new DotConnect(); if (field instanceof HostFolderField || field instanceof TagField) { dc.setSQL(this.sql.selectCountOfType); dc.addParam(field.contentTypeId()); dc.addParam(LegacyFieldTypes.getLegacyName(field.type() + "%")); dc.addParam(LegacyFieldTypes.getImplClass(field.type() + "%")); int x = dc.getInt("test"); if (x > 0) { throw new OverFieldLimitException("Only one " + field.type() + " per ContentType"); } } if (field.dataType() == DataTypes.SYSTEM) { return field.dataType().toString(); } <START> String dbColumn = field.dbColumn().replaceAll("[0-9]", ""); <END> dc.setSQL(this.sql.selectFieldOfDbType); dc.addParam(field.contentTypeId()); dc.addParam(dbColumn + "%"); List<Map<String, Object>> rows = dc.loadObjectResults(); Set<String> columns = new TreeSet<String>(); for (int i = 0; i < rows.size(); i++) { columns.add((String) rows.get(i).get("field_contentlet")); } for (int i = 0; i < Config.getIntProperty("db.number.of.contentlet.columns.per.datatype", 25); i++) { if (!columns.contains(dbColumn + (i + 1))) { return dbColumn + (i + 1); } } throw new OverFieldLimitException("No more columns for datatype:" + dbColumn); }</code><technical_language>this UtilsMethod some escape utility</technical_language>

Target:
public String nextAvailableColumn(Field field) throws DotDataException { DotConnect dc = new DotConnect(); if (field instanceof HostFolderField || field instanceof TagField) { dc.setSQL(this.sql.selectCountOfType); dc.addParam(field.contentTypeId()); dc.addParam(LegacyFieldTypes.getLegacyName(field.type() + "%")); dc.addParam(LegacyFieldTypes.getImplClass(field.type() + "%")); int x = dc.getInt("test"); if (x > 0) { throw new OverFieldLimitException("Only one " + field.type() + " per ContentType"); } } if (field.dataType() == DataTypes.SYSTEM) { return field.dataType().toString(); } final String dbColumn = field.dbColumn().replaceAll("[0-9]", com.dotcms.repackage.org.apache.commons.lang.StringUtils.EMPTY); dc.setSQL(this.sql.selectFieldOfDbType); dc.addParam(field.contentTypeId()); dc.addParam(dbColumn + "%"); List<Map<String, Object>> rows = dc.loadObjectResults(); Set<String> columns = new TreeSet<String>(); for (int i = 0; i < rows.size(); i++) { columns.add((String) rows.get(i).get("field_contentlet")); } for (int i = 0; i < Config.getIntProperty("db.number.of.contentlet.columns.per.datatype", 25); i++) { if (!columns.contains(dbColumn + (i + 1))) { return dbColumn + (i + 1); } } throw new OverFieldLimitException("No more columns for datatype:" + dbColumn); }
Source:
<code>private Object deserialize(ByteArrayInputStream inputStream, Deserializer<Object> deserializer) throws IOException { ClassLoader classLoader = null; try { <START> classLoader = (ClassLoader) new DirectFieldAccessor(deserializer).getPropertyValue("classLoader"); <END> } catch (Exception e) { } try { ObjectInputStream objectInputStream = new ConfigurableObjectInputStream(inputStream, classLoader) { @Override protected Class<?> resolveClass(ObjectStreamClass classDesc) throws IOException, ClassNotFoundException { Class<?> clazz = super.resolveClass(classDesc); checkWhiteList(clazz); return clazz; } }; return objectInputStream.readObject(); } catch (ClassNotFoundException ex) { throw new NestedIOException("Failed to deserialize object type", ex); } }</code><technical_language>do this once, if DFA way. Or. do pollute code reflection rely classload do checkWhiteList() if deserializer injection. provide WhiteListDeserializer impl instead..</technical_language>

Target:
private Object deserialize(ByteArrayInputStream inputStream, Deserializer<Object> deserializer) throws IOException { try { ObjectInputStream objectInputStream = new ConfigurableObjectInputStream(inputStream, this.defaultDeserializerClassLoader) { @Override protected Class<?> resolveClass(ObjectStreamClass classDesc) throws IOException, ClassNotFoundException { Class<?> clazz = super.resolveClass(classDesc); checkWhiteList(clazz); return clazz; } }; return objectInputStream.readObject(); } catch (ClassNotFoundException ex) { throw new NestedIOException("Failed to deserialize object type", ex); } }
Source:
<code>public ASTNode visit(MapBuiltin map, Void _) { Map result = new Map(); for (java.util.Map.Entry<Term, Term> entry : map.elements().entrySet()) { result.add(new MapItem((Term)this.visitNode(entry.getKey()), (Term)this.visitNode(entry.getValue()))); } Collections.sort(result.getContents(), unparserLexicalComparator); <START> if (map.hasViewBase()) { <END> result.add((Term)this.visitNode(map.viewBase())); } return result; }</code><technical_language>Iterate terms in map.baseTerms</technical_language>

Target:
public ASTNode visit(MapBuiltin map, Void _) { Map result = new Map(); for (java.util.Map.Entry<Term, Term> entry : map.elements().entrySet()) { result.add(new MapItem((Term)this.visitNode(entry.getKey()), (Term)this.visitNode(entry.getValue()))); } Collections.sort(result.getContents(), unparserLexicalComparator); for (Term base : map.baseTerms()) { result.add((Term)this.visitNode(base)); } return result; }
Source:
<code>public int hashCode() { int h = parent == null ? 0 : parent.hashCode(); <START> for (char c : label) { <END> h = 31 * h + c; } assert toString().hashCode() == h; return h; }</code><technical_language>replace this h = 31 * h + Arrays.hashCode(label)</technical_language>

Target:
public int hashCode() { int h = parent == null ? 0 : parent.hashCode(); h = 31 * h + ArrayUtils.hashCode(label); assert toString().hashCode() == h; return h; }
Source:
<code>public static Type extractConstraintValidatorTypeArgumentType(Class<? extends ConstraintValidator<?, ?>> validator, int typeArgumentIndex) { Map<Type, Type> resolvedTypes = new HashMap<>(); Type constraintValidatorType = resolveTypes( resolvedTypes, validator ); <START> Type constraintType = ( (ParameterizedType) constraintValidatorType ).getActualTypeArguments()[typeArgumentIndex]; <END> if ( constraintType == null ) { throw LOG.getNullIsAnInvalidTypeForAConstraintValidatorException(); } else if ( constraintType instanceof GenericArrayType ) { constraintType = TypeHelper.getArrayType( TypeHelper.getComponentType( constraintType ) ); } while ( resolvedTypes.containsKey( constraintType ) ) { constraintType = resolvedTypes.get( constraintType ); } return constraintType; }</code><technical_language>type here? extractedType. all, constraint type _or_ validator type</technical_language>

Target:
public static Type extractConstraintValidatorTypeArgumentType(Class<? extends ConstraintValidator<?, ?>> validator, int typeArgumentIndex) { Map<Type, Type> resolvedTypes = new HashMap<>(); Type constraintValidatorType = resolveTypes( resolvedTypes, validator ); Type type = ( (ParameterizedType) constraintValidatorType ).getActualTypeArguments()[typeArgumentIndex]; if ( type == null ) { throw LOG.getNullIsAnInvalidTypeForAConstraintValidatorException(); } else if ( type instanceof GenericArrayType ) { type = TypeHelper.getArrayType( TypeHelper.getComponentType( type ) ); } while ( resolvedTypes.containsKey( type ) ) { type = resolvedTypes.get( type ); } return type; }
Source:
<code>private boolean verifyDisksIfNeeded() { boolean verified = true; if (!getParameters().isImportAsNewEntity() && !isImagesAlreadyOnTarget()) { verified = checkIfDisksExist(imageList); } <START> return verified; <END> }</code><technical_language>ok, if this method, please remove 'verified' variable? is needed, people add more logic this method end-up complicated methods canDoAction methods.</technical_language>

Target:
private boolean verifyDisksIfNeeded() { if (!getParameters().isImportAsNewEntity() && !isImagesAlreadyOnTarget()) { return checkIfDisksExist(imageList); } return true; }
Source:
<code>public int compareTo(TemplateBundle other) { if(other == null) { return -1; } if (this.getBundleId().equals((long) FRAMEWORK_BUNDLE_ID)) { return Integer.MIN_VALUE; } else if (other.getBundleId().equals((long) FRAMEWORK_BUNDLE_ID)) { return Integer.MAX_VALUE; } int compare = this.getName().compareToIgnoreCase(other.getName()); if (compare == 0) { <START> return other.getVersion().compareTo(this.getVersion()); <END> } return compare; }</code><technical_language>Original line: return this.version.compareTo(other.version) this match</technical_language>

Target:
public int compareTo(TemplateBundle other) { if(other == null) { return -1; } if (this.getBundleId().equals((long) FRAMEWORK_BUNDLE_ID)) { return Integer.MIN_VALUE; } else if (other.getBundleId().equals((long) FRAMEWORK_BUNDLE_ID)) { return Integer.MAX_VALUE; } int compare = this.getName().compareToIgnoreCase(other.getName()); if (compare == 0) { return this.getVersion().compareTo(other.getVersion()); } return compare; }