auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public void testIterator(Item expectedItem) { final TreasureChest chest = new TreasureChest(); final TreasureChestItemIterator iterator = chest.iterator(expectedItem.getType()); assertNotNull(iterator); while (iterator.hasNext()) { final Item item = iterator.next(); assertNotNull(item); assertEquals(expectedItem.getType(), item.getType()); final String name = item.toString(); assertNotNull(name); if (expectedItem.toString().equals(name)) { return; } } fail("Expected to find item [" + expectedItem + "] using iterator, but we didn't."); }

Target:
public void testIterator(Item expectedItem) { final TreasureChest chest = new TreasureChest(); final Iterator<Item> iterator = chest.iterator(expectedItem.getType()); assertNotNull(iterator); while (iterator.hasNext()) { final Item item = iterator.next(); assertNotNull(item); assertEquals(expectedItem.getType(), item.getType()); final String name = item.toString(); assertNotNull(name); if (expectedItem.toString().equals(name)) { return; } } fail("Expected to find item [" + expectedItem + "] using iterator, but we didn't."); }
Source:
public List<String> getFiles() { return filesToCheckout == null ? Collections.emptyList() : filesToCheckout; }

Target:
public List<String> getFiles() { return filesToCheckout == null ? new ArrayList<>() : filesToCheckout; }
Source:
public void clearVm(VmStatic vm) { Set<Guid> modifiedHosts; synchronized (this) { if (!resourcesByVm.containsKey(vm.getId())) { return; } log.debug("Clearing pending resources for VM {}", vm.getId()); modifiedHosts = new HashSet<>(); resourcesByVm.compute(vm.getId(), (vmId, resources) -> { for (PendingResource resource : resources) { resourcesByHost.computeIfPresent(resource.getHost(), (hostId, hostResources) -> { modifiedHosts.add(hostId); hostResources.remove(resource); return hostResources; }); pendingResources.remove(resource); } resources.clear(); return resources; }); } for (Guid hostId: modifiedHosts) { notifyHostManagers(hostId); } }

Target:
public void clearVm(VmStatic vm) { Set<Guid> modifiedHosts; synchronized (this) { if (!resourcesByVm.containsKey(vm.getId())) { return; } log.debug("Clearing pending resources for VM {}", vm.getId()); modifiedHosts = new HashSet<>(); resourcesByVm.compute(vm.getId(), (vmId, resources) -> { for (PendingResource resource : resources) { if(resourcesByHost.containsKey(resource.getHost())){ modifiedHosts.add(resource.getHost()); } removeFromSetMap(resourcesByHost, resource.getHost(), resource); pendingResources.remove(resource); } resources.clear(); return resources; }); } for (Guid hostId: modifiedHosts) { notifyHostManagers(hostId); } }
Source:
private boolean sessionHasStarted(InputStream responseStream){ JSONHelper jsonHelper = new JSONHelper(); Map<String,Object> jsonResponse = jsonHelper.fromJson(new InputStreamReader(responseStream)); boolean responseLooksOkay = true; responseLooksOkay = jsonResponse.containsKey("ok") && responseLooksOkay; if(responseLooksOkay) { responseLooksOkay = (Boolean) jsonResponse.get("ok") && responseLooksOkay; } return responseLooksOkay; }

Target:
private boolean sessionHasStarted(InputStream responseStream){ JSONHelper jsonHelper = new JSONHelper(); Map<String,Object> jsonResponse = jsonHelper.fromJson(new InputStreamReader(responseStream)); return jsonResponse.containsKey("ok") && (Boolean) jsonResponse.get("ok"); }
Source:
private void updateInstanceStatus(final WorkflowExecutionContext context) throws FalconException { if (context.getContextType() == WorkflowExecutionContext.Type.COORDINATOR_ACTION) { return; } WorkflowExecutionContext.EntityOperations entityOperation = context.getOperation(); switch (entityOperation) { case GENERATE: updateProcessInstance(context); break; case REPLICATE: updateReplicatedFeedInstance(context); break; case DELETE: updateEvictedFeedInstance(context); break; case IMPORT: updateImportedFeedInstance(context); break; case EXPORT: onFeedInstanceExported(context); break; default: throw new IllegalArgumentException("Invalid EntityOperation - " + entityOperation); } }

Target:
private void updateInstanceStatus(final WorkflowExecutionContext context) throws FalconException { if (context.getContextType() == WorkflowExecutionContext.Type.COORDINATOR_ACTION) { return; } WorkflowExecutionContext.EntityOperations entityOperation = context.getOperation(); switch (entityOperation) { case GENERATE: updateProcessInstance(context); break; case REPLICATE: updateReplicatedFeedInstance(context); break; case DELETE: updateEvictedFeedInstance(context); break; case IMPORT: updateImportedFeedInstance(context); break; case EXPORT: updateExportedFeedInstance(context); break; default: throw new IllegalArgumentException("Invalid EntityOperation - " + entityOperation); } }
Source:
@Test public void testWindowFunctionsWithoutOver() { winSql( "select sum(empno) \n" + "from emp \n" + "group by deptno \n" + "order by ^row_number()^") .fails("OVER clause is necessary for window functions"); winSql( "select ^rank()^ \n" + "from emp") .fails("OVER clause is necessary for window functions"); winSql( "select cume_dist() over w , ^rank()^\n" + "from emp group by deptno\n" + "window w as (partition by deptno order by deptno)") .fails("OVER clause is necessary for window functions"); }

Target:
@Test public void testWindowFunctionsWithoutOver() { winSql( "select sum(empno) \n" + "from emp \n" + "group by deptno \n" + "order by ^row_number()^") .fails("OVER clause is necessary for window functions"); winSql( "select ^rank()^ \n" + "from emp") .fails("OVER clause is necessary for window functions"); winSql( "select cume_dist() over w , ^rank()^\n" + "from emp \n" + "window w as (partition by deptno order by deptno)") .fails("OVER clause is necessary for window functions"); }
Source:
public void getBuilderTest() { SAMLAssertionBuilderFactoryImpl builderFactory = new SAMLAssertionBuilderFactoryImpl(); SAMLAssertionBuilder hokBuilder = builderFactory.getBuilder(SAMLAssertionBuilderConstants.HOK_ASSERTION_TYPE); assertTrue(hokBuilder instanceof HOKSAMLAssertionBuilder); SAMLAssertionBuilder svBuilder = builderFactory.getBuilder(SAMLAssertionBuilderConstants.SV_ASSERTION_TYPE); assertTrue(svBuilder instanceof SVSAMLAssertionBuilder); }

Target:
public void getBuilderTest() { SAMLAssertionBuilderFactoryImpl builderFactory = new SAMLAssertionBuilderFactoryImpl(); SAMLAssertionBuilder hokBuilder = builderFactory.getBuilder(NhincConstants.HOK_ASSERTION_TYPE); assertTrue(hokBuilder instanceof HOKSAMLAssertionBuilder); SAMLAssertionBuilder svBuilder = builderFactory.getBuilder(NhincConstants.SV_ASSERTION_TYPE); assertTrue(svBuilder instanceof SVSAMLAssertionBuilder); }
Source:
public ValidatorFactoryImpl(ConfigurationState configurationState) { this.messageInterpolator = configurationState.getMessageInterpolator(); this.constraintValidatorFactory = configurationState.getConstraintValidatorFactory(); this.traversableResolver = configurationState.getTraversableResolver(); ConstraintHelper constraintHelper = new ConstraintHelper(); boolean tmpFailFast = false; List<MetaDataProvider> metaDataProviders = newArrayList(); if ( !configurationState.getMappingStreams().isEmpty() ) { metaDataProviders.add( new MetaDataProviderXmlSource( constraintHelper, configurationState.getMappingStreams() ) ); } if ( configurationState instanceof ConfigurationImpl ) { ConfigurationImpl hibernateSpecificConfig = (ConfigurationImpl) configurationState; if ( hibernateSpecificConfig.getProgrammaticMappings().size() > 0 ) { metaDataProviders.add( new MetaDataProviderProgrammaticSource( constraintHelper, hibernateSpecificConfig.getProgrammaticMappings() ) ); } tmpFailFast = hibernateSpecificConfig.getFailFast(); } tmpFailFast = checkPropertiesForFailFast( configurationState, tmpFailFast ); this.failFast = tmpFailFast; metaDataManager = new BeanMetaDataManager( constraintHelper, metaDataProviders ); }

Target:
public ValidatorFactoryImpl(ConfigurationState configurationState) { this.messageInterpolator = configurationState.getMessageInterpolator(); this.constraintValidatorFactory = configurationState.getConstraintValidatorFactory(); this.traversableResolver = configurationState.getTraversableResolver(); ConstraintHelper constraintHelper = new ConstraintHelper(); boolean tmpFailFast = false; List<MetaDataProvider> metaDataProviders = newArrayList(); if ( !configurationState.getMappingStreams().isEmpty() ) { metaDataProviders.add( new XmlMetaDataProvider( constraintHelper, configurationState.getMappingStreams() ) ); } if ( configurationState instanceof ConfigurationImpl ) { ConfigurationImpl hibernateSpecificConfig = (ConfigurationImpl) configurationState; if ( hibernateSpecificConfig.getProgrammaticMappings().size() > 0 ) { metaDataProviders.add( new ProgrammaticMetaDataProvider( constraintHelper, hibernateSpecificConfig.getProgrammaticMappings() ) ); } tmpFailFast = hibernateSpecificConfig.getFailFast(); } tmpFailFast = checkPropertiesForFailFast( configurationState, tmpFailFast ); this.failFast = tmpFailFast; metaDataManager = new BeanMetaDataManager( constraintHelper, metaDataProviders ); }
Source:
private void autoRegisterChoiceAuthorityFromInputReader() { try { DCInputsReader dcInputsReader = new DCInputsReader(); for (DCInputSet dcinputSet : dcInputsReader.getAllInputs(Integer.MAX_VALUE, 0)) { DCInput[] dcinputs = dcinputSet.getFields(); for (DCInput dcinput : dcinputs) { if (StringUtils.isNotBlank(dcinput.getPairsType()) || StringUtils.isNotBlank(dcinput.getVocabulary())) { String authorityName = dcinput.getPairsType(); if(StringUtils.isBlank(authorityName)) { authorityName = dcinput.getVocabulary(); } if (!StringUtils.equals(dcinput.getInputType(), "qualdrop_value")) { String fieldKey = makeFieldKey(dcinput.getSchema(), dcinput.getElement(), dcinput.getQualifier()); ChoiceAuthority ca = controller.get(authorityName); if (ca == null) { InputFormSelfRegisterWrapperAuthority ifa = new InputFormSelfRegisterWrapperAuthority(); if(controller.containsKey(fieldKey)) { ifa = (InputFormSelfRegisterWrapperAuthority)controller.get(fieldKey); } ChoiceAuthority ma = (ChoiceAuthority)pluginService.getNamedPlugin(ChoiceAuthority.class, authorityName); if (ma == null) { log.warn("Skipping invalid configuration for " + fieldKey + " because named plugin not found: " + authorityName); continue; } ifa.getDelegates().put(dcinputSet.getFormName(), ma); controller.put(fieldKey, ifa); } if (!authorities.containsKey(authorityName)) { authorityNames.add(authorityName); authorities.put(authorityName, fieldKey); } } } } } } catch (DCInputsReaderException e) { throw new IllegalStateException(e.getMessage(), e); } }

Target:
private void autoRegisterChoiceAuthorityFromInputReader() { try { DCInputsReader dcInputsReader = new DCInputsReader(); for (DCInputSet dcinputSet : dcInputsReader.getAllInputs(Integer.MAX_VALUE, 0)) { DCInput[] dcinputs = dcinputSet.getFields(); for (DCInput dcinput : dcinputs) { if (StringUtils.isNotBlank(dcinput.getPairsType()) || StringUtils.isNotBlank(dcinput.getVocabulary())) { String authorityName = dcinput.getPairsType(); if(StringUtils.isBlank(authorityName)) { authorityName = dcinput.getVocabulary(); } if (!StringUtils.equals(dcinput.getInputType(), "qualdrop_value")) { String fieldKey = makeFieldKey(dcinput.getSchema(), dcinput.getElement(), dcinput.getQualifier()); ChoiceAuthority ca = controller.get(authorityName); if (ca == null) { InputFormSelfRegisterWrapperAuthority ifa = new InputFormSelfRegisterWrapperAuthority(); if(controller.containsKey(fieldKey)) { ifa = (InputFormSelfRegisterWrapperAuthority)controller.get(fieldKey); } ChoiceAuthority ma = (ChoiceAuthority)pluginService.getNamedPlugin(ChoiceAuthority.class, authorityName); if (ma == null) { log.warn("Skipping invalid configuration for " + fieldKey + " because named plugin not found: " + authorityName); continue; } ifa.getDelegates().put(dcinputSet.getFormName(), ma); controller.put(fieldKey, ifa); } if (!authorities.containsKey(authorityName)) { authorities.put(authorityName, fieldKey); } } } } } } catch (DCInputsReaderException e) { throw new IllegalStateException(e.getMessage(), e); } }
Source:
public String convert(Object tuple) { if (tuple == null) { return null; } try { return writer.writeValueAsString(tuple); } catch (JsonProcessingException e) { logger.error("Error while converting tuple {}", tuple, e.getMessage()); } return null; }

Target:
public String convert(Object tuple) { if (tuple == null) { return null; } try { return objMapper.writeValueAsString(tuple); } catch (JsonProcessingException e) { logger.error("Error while converting tuple {}", tuple, e); } return null; }
Source:
private JsonObject getFindByIndexBody(String selectorJson, FindByIndexOptions options) { JsonObject fieldsObject = new JsonObject(); if (options.getFields().size() > 0) { JsonElement fieldsArray = getGson().toJsonTree(options.getFields()); fieldsObject.add("fields", fieldsArray.getAsJsonArray()); } if (options.getSort().size() > 0) { JsonElement sortArray = getGson().toJsonTree(options.getSort()); fieldsObject.add("sort", sortArray.getAsJsonArray()); } JsonObject indexObject = new JsonObject(); indexObject.addProperty("selector", selectorJson); if (options.getLimit() != null) { indexObject.addProperty("limit", options.getLimit()); } if (options.getSkip() != null) { indexObject.addProperty("skip", options.getSkip()); } if (options.getReadQuorum() != null) { indexObject.addProperty("r", options.getReadQuorum()); } if (options.getUseIndex() != null) { indexObject.addProperty("use_index", options.getUseIndex()); } return indexObject; }

Target:
private JsonObject getFindByIndexBody(String selectorJson, FindByIndexOptions options) { JsonArray fieldsArray = new JsonArray(); if (options.getFields().size() > 0) { for(String field : options.getFields()) { JsonPrimitive jsonField = client.getGson().fromJson(field, JsonPrimitive.class); fieldsArray.add(jsonField); } } JsonArray sortArray = new JsonArray(); if (options.getSort().size() > 0) { for(IndexField sort : options.getSort()) { JsonObject sortObject = new JsonObject(); sortObject.addProperty(sort.getName(), sort.getOrder().toString()); sortArray.add(sortObject); } } JsonObject indexObject = new JsonObject(); JsonObject selectorObject = null; boolean isObject = true; try { selectorObject = getGson().fromJson(selectorJson, JsonObject.class); } catch (JsonParseException e) { isObject = false; } if(!isObject) { if(selectorJson.startsWith("\"selector\"")) { selectorJson = selectorJson.substring(selectorJson.indexOf(":") + 1, selectorJson.length()).trim(); selectorObject = getGson().fromJson(selectorJson, JsonObject.class); } else { throw new JsonParseException("selectorJson should be valid json or like " + "\"selector\": {...} "); } } if(selectorObject.has("selector")) { indexObject.add("selector", selectorObject.get("selector")); } else { indexObject.add("selector", selectorObject); } if(fieldsArray.size() > 0) { indexObject.add("fields", fieldsArray); } if(sortArray.size() > 0) { indexObject.add("sort", sortArray); } if (options.getLimit() != null) { indexObject.addProperty("limit", options.getLimit()); } if (options.getSkip() != null) { indexObject.addProperty("skip", options.getSkip()); } if (options.getReadQuorum() != null) { indexObject.addProperty("r", options.getReadQuorum()); } if (options.getUseIndex() != null) { indexObject.add("use_index", getGson().fromJson(options.getUseIndex(), JsonArray.class)); } return indexObject; }
Source:
public void setContributions(List<Contribution> contributionList) { this.contributions=contributionList; adapter.setContributions(contributionList); }

Target:
public void setContributions(List<Contribution> contributionList) { this.contributions.clear(); this.contributions.addAll(contributionList); adapter.setContributions(contributions); }
Source:
IndexDescriptor( IndexDescriptor indexDescriptor ) { schema = indexDescriptor.schema; type = indexDescriptor.type; userSuppliedName = indexDescriptor.userSuppliedName; providerDescriptor = indexDescriptor.providerDescriptor; }

Target:
IndexDescriptor( IndexDescriptor indexDescriptor ) { this( indexDescriptor.schema, indexDescriptor.type, indexDescriptor.userSuppliedName, indexDescriptor.providerDescriptor ); }
Source:
private void addSmsApplicationsSelector(SharedPreferences prefs) { ListPreference smsAppList = (ListPreference) findPreference("sms-apps"); Intent intent = new Intent(Intent.ACTION_SENDTO); intent.setType("text/plain"); intent.setData(Uri.parse("sms:")); final PackageManager pm = getPackageManager(); List<ResolveInfo> availableSmsApps = pm.queryIntentActivities(intent, PackageManager.MATCH_DEFAULT_ONLY); CharSequence[] entries = new CharSequence[availableSmsApps.size() + 1]; CharSequence[] entryValues = new CharSequence[availableSmsApps.size() + 1]; entries[0] = this.getString(R.string.sms_apps_default); entryValues[0] = "defaultSmsApp"; int i = 1; for (ResolveInfo info : availableSmsApps) { String appName = (String) (info.activityInfo.applicationInfo != null ? pm.getApplicationLabel(info.activityInfo.applicationInfo) : "(unknown)"); entries[i] = appName; entryValues[i++] = info.activityInfo.packageName+"|"+info.activityInfo.name; } smsAppList.setEntries(entries); smsAppList.setEntryValues(entryValues); }

Target:
private void addSmsApplicationsSelector(SharedPreferences prefs) { ListPreference smsAppList = (ListPreference) findPreference("sms-apps"); Intent intent = new Intent(Intent.ACTION_SENDTO); intent.setType("text/plain"); intent.setData(Uri.parse("sms:")); final PackageManager pm = getPackageManager(); List<ResolveInfo> availableSmsApps = pm.queryIntentActivities(intent, PackageManager.MATCH_DEFAULT_ONLY); CharSequence[] entries = new CharSequence[availableSmsApps.size() + 1]; CharSequence[] entryValues = new CharSequence[availableSmsApps.size() + 1]; entries[0] = this.getString(R.string.sms_apps_default); entryValues[0] = "defaultSmsApp"; int i = 1; for (ResolveInfo info : availableSmsApps) { String appName = (String) (info.activityInfo.applicationInfo != null ? pm.getApplicationLabel(info.activityInfo.applicationInfo) : getString(R.string.sms_apps_unknown)); entries[i] = appName; entryValues[i++] = info.activityInfo.packageName+"|"+info.activityInfo.name; } smsAppList.setEntries(entries); smsAppList.setEntryValues(entryValues); }
Source:
private void clearCompletedTasks() { final ProgressDialog pd = new ProgressDialog(this); final TodorooCursor<Task> tasks = taskService.fetchFiltered(filter.sqlQuery, null, Task.ID, Task.COMPLETION_DATE); pd.setProgressStyle(ProgressDialog.STYLE_HORIZONTAL); pd.setMessage(this.getString(R.string.gtasks_GLA_clearing));pd.setMax(tasks.getCount()); pd.show(); new Thread() { @Override public void run() { String listId = null; try { for (tasks.moveToFirst(); !tasks.isAfterLast(); tasks.moveToNext()) { Task t = new Task(tasks); if (t.isCompleted()) { if (listId == null) { listId = gtasksMetadataService.getTaskMetadata(t.getId()).getValue(GtasksMetadata.LIST_ID); } t.setValue(Task.DELETION_DATE, DateUtilities.now()); taskService.save(t); } pd.incrementProgressBy(1); } } finally { tasks.close(); pd.dismiss(); } if (listId != null) { gtasksTaskListUpdater.correctMetadataForList(listId); } GtasksListActivity.this.runOnUiThread(new Runnable() { public void run() { loadTaskListContent(true); } }); } }.start(); }

Target:
private void clearCompletedTasks() { final ProgressDialog pd = new ProgressDialog(this); final TodorooCursor<Task> tasks = taskService.fetchFiltered(filter.sqlQuery, null, Task.ID, Task.COMPLETION_DATE); pd.setMessage(this.getString(R.string.gtasks_GTA_clearing)); pd.show(); new Thread() { @Override public void run() { String listId = null; try { for (tasks.moveToFirst(); !tasks.isAfterLast(); tasks.moveToNext()) { Task t = new Task(tasks); if (t.isCompleted()) { if (listId == null) { listId = gtasksMetadataService.getTaskMetadata(t.getId()).getValue(GtasksMetadata.LIST_ID); } t.setValue(Task.DELETION_DATE, DateUtilities.now()); taskService.save(t); } } } finally { tasks.close(); DialogUtilities.dismissDialog(GtasksListActivity.this, pd); } if (listId != null) { gtasksTaskListUpdater.correctMetadataForList(listId); } GtasksListActivity.this.runOnUiThread(new Runnable() { public void run() { loadTaskListContent(true); } }); } }.start(); }
Source:
public ReactorConnection(String connectionId, ConnectionOptions connectionOptions, ReactorProvider reactorProvider, ReactorHandlerProvider handlerProvider, TokenManagerProvider tokenManagerProvider, MessageSerializer messageSerializer, String product, String clientVersion, SenderSettleMode senderSettleMode, ReceiverSettleMode receiverSettleMode) { this.connectionOptions = connectionOptions; this.reactorProvider = reactorProvider; this.connectionId = connectionId; this.handlerProvider = handlerProvider; this.tokenManagerProvider = Objects.requireNonNull(tokenManagerProvider, "'tokenManagerProvider' cannot be null."); this.messageSerializer = messageSerializer; this.handler = handlerProvider.createConnectionHandler(connectionId, connectionOptions.getFullyQualifiedNamespace(), connectionOptions.getTransportType(), connectionOptions.getProxyOptions(), product, clientVersion); this.retryPolicy = RetryUtil.getRetryPolicy(connectionOptions.getRetry()); this.senderSettleMode = senderSettleMode; this.receiverSettleMode = receiverSettleMode; this.connectionMono = Mono.fromCallable(this::getOrCreateConnection) .doOnSubscribe(c -> hasConnection.set(true)); this.endpointStates = this.handler.getEndpointStates() .takeUntilOther(shutdownSignals) .map(state -> { logger.verbose("connectionId[{}]: State {}", connectionId, state); return AmqpEndpointStateUtil.getConnectionState(state); }).subscribeWith(ReplayProcessor.cacheLastOrDefault(AmqpEndpointState.UNINITIALIZED)); }

Target:
public ReactorConnection(String connectionId, ConnectionOptions connectionOptions, ReactorProvider reactorProvider, ReactorHandlerProvider handlerProvider, TokenManagerProvider tokenManagerProvider, MessageSerializer messageSerializer, String product, String clientVersion, SenderSettleMode senderSettleMode, ReceiverSettleMode receiverSettleMode) { this.connectionOptions = connectionOptions; this.reactorProvider = reactorProvider; this.connectionId = connectionId; this.handlerProvider = handlerProvider; this.tokenManagerProvider = Objects.requireNonNull(tokenManagerProvider, "'tokenManagerProvider' cannot be null."); this.messageSerializer = messageSerializer; this.handler = handlerProvider.createConnectionHandler(connectionId, connectionOptions.getFullyQualifiedNamespace(), connectionOptions.getTransportType(), connectionOptions.getProxyOptions(), product, clientVersion); this.retryPolicy = RetryUtil.getRetryPolicy(connectionOptions.getRetry()); this.senderSettleMode = senderSettleMode; this.receiverSettleMode = receiverSettleMode; this.connectionMono = Mono.fromCallable(this::getOrCreateConnection); this.endpointStates = this.handler.getEndpointStates() .takeUntilOther(shutdownSignals) .map(state -> { logger.verbose("connectionId[{}]: State {}", connectionId, state); return AmqpEndpointStateUtil.getConnectionState(state); }).subscribeWith(ReplayProcessor.cacheLastOrDefault(AmqpEndpointState.UNINITIALIZED)); }
Source:
public void validateSectionsAndTeams(List<StudentAttributes> studentList, String courseId) throws EntityDoesNotExistException, EnrollException { List<StudentAttributes> mergedList = getMergedList(studentList, courseId); if(mergedList.size() < 2){ return; } String errorMessage = ""; errorMessage += getSectionInvalidityInfo(mergedList); errorMessage += getTeamInvalidityInfo(mergedList); if(!errorMessage.equals("")){ throw new EnrollException(errorMessage); } }

Target:
public void validateSectionsAndTeams(List<StudentAttributes> studentList, String courseId) throws EntityDoesNotExistException, EnrollException { List<StudentAttributes> mergedList = getMergedList(studentList, courseId); if (mergedList.size() < 2) { return; } String errorMessage = ""; errorMessage += getSectionInvalidityInfo(mergedList); errorMessage += getTeamInvalidityInfo(mergedList); if (!errorMessage.isEmpty()) { throw new EnrollException(errorMessage); } }
Source:
private <X> Iterator<X> chooseIterator(K from, K to, boolean forEntries) { switch (transaction.isolationLevel) { case READ_UNCOMMITTED: return new UncommittedIterator<>(this, from, to, false, forEntries); case REPEATABLE_READ: case SERIALIZABLE: return transaction.hasChanges() ? new RepeatableIterator<K, X>(this, from, to, forEntries) : new CommittedIterator<K, X>(this, from, to, forEntries); case READ_COMMITTED: default: return new CommittedIterator<>(this, from, to, forEntries); } }

Target:
private <X> Iterator<X> chooseIterator(K from, K to, boolean forEntries) { switch (transaction.isolationLevel) { case READ_UNCOMMITTED: return new UncommittedIterator<>(this, from, to, forEntries); case REPEATABLE_READ: case SERIALIZABLE: if (transaction.hasChanges()) { return new RepeatableIterator<>(this, from, to, forEntries); } case READ_COMMITTED: default: return new CommittedIterator<>(this, from, to, forEntries); } }
Source:
public static Filter[] getActiveFilters(IPreferenceStore store) { Filter[] filters = null; String[] activefilters; activefilters = ScriptDebugOptionsManager .parseList(store .getString(IDLTKDebugUIPreferenceConstants.PREF_ACTIVE_FILTERS_LIST)); filters = new Filter[activefilters.length]; for (int i = 0; i < activefilters.length; i++) { String[] split = activefilters[i].split(":"); if (split.length == 1) { filters[i] = new Filter(split[0], true, 0); } else { filters[i] = new Filter(split[0], true, (Integer.valueOf(split[1])) .intValue()); } } return filters; }

Target:
public static Filter[] getActiveFilters(IPreferenceStore store) { Filter[] filters = null; String[] activefilters; activefilters = ScriptDebugOptionsManager.parseList(store.getString( IDLTKDebugUIPreferenceConstants.PREF_ACTIVE_FILTERS_LIST)); filters = new Filter[activefilters.length]; for (int i = 0; i < activefilters.length; i++) { String[] split = activefilters[i].split(":"); if (split.length == 1) { filters[i] = new Filter(split[0], true, 0); } else { filters[i] = new Filter(split[0], true, Integer.parseInt(split[1])); } } return filters; }
Source:
public boolean equals(Object obj) { if (obj == null) { return false; } if (!(obj instanceof IpServiceEdgeRequestDTO)) { return false; } if (!super.equals(obj)) { return false; } return java.util.Objects.equals(applicationId, ((ApplicationEdgeRequestDTO) obj).applicationId); }

Target:
public boolean equals(Object obj) { if (obj == null) { return false; } if (!(obj instanceof ApplicationEdgeRequestDTO)) { return false; } if (!super.equals(obj)) { return false; } return java.util.Objects.equals(applicationId, ((ApplicationEdgeRequestDTO) obj).applicationId); }
Source:
private static <T> void load(Class<T> targetClass) { ServiceLoader.load(targetClass, ServiceLoaderTestCase.class.getClassLoader()) .forEach(object -> System.out.println("\t" + object.getClass().getName())); }

Target:
private static <T> void load(Class<T> targetClass) { ServiceLoader.load(targetClass, ServiceLoaderTestCase.class.getClassLoader()) .forEach(object -> LOGGER.tracef("\t" + object.getClass().getName())); }
Source:
private List<LUNs> getLunsFromVgInfo() { GetVGInfoVDSCommandParameters params = new GetVGInfoVDSCommandParameters( Optional.ofNullable(getVds()).map(VDS::getId).orElse(null), getStorageDomain().getStorage()); if (getVds() == null) { return (List<LUNs>) VdsCommandsHelper.runVdsCommandWithoutFailover( VDSCommandType.GetVGInfo, params, getStoragePoolId(), null).getReturnValue(); } return (List<LUNs>) runVdsCommand(VDSCommandType.GetVGInfo, params).getReturnValue(); }

Target:
private List<LUNs> getLunsFromVgInfo() { GetVGInfoVDSCommandParameters params = new GetVGInfoVDSCommandParameters(getParameters().getVdsId(), getStorageDomain().getStorage()); if (getParameters().getVdsId() == null) { return (List<LUNs>) VdsCommandsHelper.runVdsCommandWithoutFailover( VDSCommandType.GetVGInfo, params, getStoragePoolId(), null).getReturnValue(); } return (List<LUNs>) runVdsCommand(VDSCommandType.GetVGInfo, params).getReturnValue(); }
Source:
private Set<PersistentResource> getRelationWithSortingAndPagination(String relationName, boolean checked) { if (checked && !checkRelation(relationName)) { return Collections.emptySet(); } final Class<?> relationClass = dictionary.getParameterizedType(obj, relationName); boolean isAnyToMany = dictionary.isMappedInterface(relationClass) && dictionary.getAttributeOrRelationAnnotation(obj.getClass(), ToMany.class, relationName) != null; if (isAnyToMany || (! requestScope.getPagination().isDefaultInstance() && !CanPaginateVisitor.canPaginate(relationClass, dictionary, requestScope))) { throw new InvalidPredicateException(String.format("Cannot paginate %s", dictionary.getJsonAliasFor(relationClass))); } Optional<FilterExpression> filterExpression = getExpressionForRelation(relationName); return getRelationUnchecked(relationName, filterExpression, true); }

Target:
private Set<PersistentResource> getRelationWithSortingAndPagination(String relationName, boolean checked) { if (checked && !checkRelation(relationName)) { return Collections.emptySet(); } final Class<?> relationClass = dictionary.getParameterizedType(obj, relationName); if (dictionary.isMappedInterface(relationClass) || (! requestScope.getPagination().isDefaultInstance() && !CanPaginateVisitor.canPaginate(relationClass, dictionary, requestScope))) { throw new InvalidPredicateException(String.format("Cannot paginate %s", dictionary.getJsonAliasFor(relationClass))); } Optional<FilterExpression> filterExpression = getExpressionForRelation(relationName); return getRelationUnchecked(relationName, filterExpression, true); }
Source:
public void validate() throws IllegalAlgorithmArgumentException { boolean queryServiceSet = false; if (null != getExecution().getQueryServiceClasses() && !getExecution().getQueryServiceClasses().isEmpty()) { queryServiceSet = true; } if (null != getExecution().getQueryServices() && !getExecution().getQueryServices().isEmpty()) { queryServiceSet = true; } if (!queryServiceSet) { throw new IllegalAlgorithmArgumentException(getClass(), "queryService", "Required parameter 'query services' is missing!"); } if (null == getExecution().getSearchResultLinkerClass()) { throw new IllegalAlgorithmArgumentException(getClass(), "searchResultLinkerClass", "Required parameter 'SearchResultLinkerClass' is missing!"); } }

Target:
public void validate() throws IllegalAlgorithmArgumentException { boolean queryServiceSet = false; if (null != getExecution().getQueryServiceClasses() && !getExecution().getQueryServiceClasses().isEmpty()) { queryServiceSet = true; } if (null != getExecution().getQueryServices() && !getExecution().getQueryServices().isEmpty()) { queryServiceSet = true; } if (null == getExecution().getTextualReferences()) { throw new IllegalAlgorithmArgumentException(getClass(), "TextualReference", "Required parameter 'textual references' is missing!"); } if (!queryServiceSet) { throw new IllegalAlgorithmArgumentException(getClass(), "queryService", "Required parameter 'query services' is missing!"); } if (null == getExecution().getSearchResultLinkerClass()) { throw new IllegalAlgorithmArgumentException(getClass(), "searchResultLinkerClass", "Required parameter 'SearchResultLinkerClass' is missing!"); } }
Source:
public void theGetDebugInformationRequestIsReceived(final Map<String, String> requestData) throws Throwable { final FindMessageLogsRequest request = FindMessageLogsRequestFactory.fromParameterMap(requestData); final FindMessageLogsAsyncResponse asyncResponse = this.requestClient.doRequest(request); assertNotNull("asyncResponse should not be null", asyncResponse); ScenarioContext.current().put(PlatformSmartmeteringKeys.KEY_CORRELATION_UID, asyncResponse.getCorrelationUid()); }

Target:
public void theGetDebugInformationRequestIsReceived(final Map<String, String> requestData) throws Throwable { final FindMessageLogsRequest findMessageLogsRequest = FindMessageLogsRequestFactory .fromParameterMap(requestData); final FindMessageLogsAsyncResponse findMessageLogsAsyncResponse = this.smartMeteringManagementRequestClient .doRequest(findMessageLogsRequest); assertNotNull("AsyncResponse should not be null", findMessageLogsAsyncResponse); ScenarioContext.current().put(PlatformSmartmeteringKeys.KEY_CORRELATION_UID, findMessageLogsAsyncResponse.getCorrelationUid()); }
Source:
public void visitLiteral(JCLiteral literal) { String s = literal.toString(); switch (literal.typetag) { case FLOAT: if (s.endsWith("F")) { s = s.substring(0, s.length() - 1); } break; case LONG: if (s.endsWith("L")) { s = s.substring(0, s.length() - 1); } break; default: } if (s.startsWith("\"") && context.options.isUseSingleQuotesForStringLiterals()) { s = "'" + s.substring(1, s.length() - 1).replace("'", "\\\"") + "'"; } print(s); }

Target:
public void visitLiteral(JCLiteral literal) { String s = literal.toString(); switch (literal.typetag) { case FLOAT: if (s.endsWith("F")) { s = s.substring(0, s.length() - 1); } break; case LONG: if (s.endsWith("L")) { s = s.substring(0, s.length() - 1); } break; default: } if (s.startsWith("\"") && context.options.isUseSingleQuotesForStringLiterals()) { s = "'" + s.substring(1, s.length() - 1).replace("'", "\'") + "'"; } print(s); }
Source:
public void hdfsSink(Object payload) { if (payload != null) { try { dataStoreWriter.write(payload.toString()); } catch (IOException e) { throw new IllegalStateException("Error while writing to HDFS", e); } } }

Target:
public void hdfsSink(Object payload) { try { dataStoreWriter.write(payload.toString()); } catch (IOException e) { throw new IllegalStateException("Error while writing to HDFS", e); } }
Source:
public static void removeStatusCookie(HttpServletRequest req, HttpServletResponse resp) { Cookie[] cookies = req.getCookies(); if (cookies != null) { for (Cookie cookie : cookies) { if (cookie.getName().equals(OAuthConstants.STATUSCOOKIE)) { cookie.setMaxAge(0); resp.addCookie(cookie); break; } } } }

Target:
public static void removeStatusCookie(HttpServletRequest req, HttpServletResponse resp) { Cookie[] cookies = req.getCookies(); if (cookies != null) { for (Cookie cookie : cookies) { if (OAuthConstants.STATUSCOOKIE.equals(cookie.getName())) { cookie.setMaxAge(0); resp.addCookie(cookie); break; } } } }
Source:
public void environmentVariablesSubstitutionInThemeProperties() { testingClient.server().run(session -> { try { ThemeProvider extending = session.getProvider(ThemeProvider.class, "extending"); Theme theme = extending.getTheme(THEME_NAME, Theme.Type.LOGIN); Assert.assertEquals("", theme.getProperties().getProperty("env.missing")); Assert.assertEquals("defaultValue", theme.getProperties().getProperty("env.missingWithDefault")); if (System.getenv().containsKey("HOMEPATH")) { Assert.assertEquals(System.getenv().get("HOMEPATH"), theme.getProperties().getProperty("env.windowsHome")); } else if (System.getenv().containsKey("HOME")) { Assert.assertEquals(System.getenv().get("HOME"), theme.getProperties().getProperty("env.linuxHome")); } else { Assert.fail("No default env variable found, can't verify"); } } catch (IOException e) { Assert.fail(e.getMessage()); } }); }

Target:
public void environmentVariablesSubstitutionInThemeProperties() { testingClient.server().run(session -> { try { ThemeProvider extending = session.getProvider(ThemeProvider.class, "extending"); Theme theme = extending.getTheme(THEME_NAME, Theme.Type.LOGIN); Assert.assertEquals("${env.MISSING_ENVIRONMENT_VARIABLE}", theme.getProperties().getProperty("env.missing")); Assert.assertEquals("defaultValue", theme.getProperties().getProperty("env.missingWithDefault")); if (System.getenv().containsKey("HOMEPATH")) { Assert.assertEquals(System.getenv().get("HOMEPATH"), theme.getProperties().getProperty("env.windowsHome")); } else if (System.getenv().containsKey("HOME")) { Assert.assertEquals(System.getenv().get("HOME"), theme.getProperties().getProperty("env.unixHome")); } else { Assert.fail("No default env variable found, can't verify"); } } catch (IOException e) { Assert.fail(e.getMessage()); } }); }
Source:
public void sendMessageAsync(final String destAddress, final String message, final boolean command) { new Thread(new Runnable() { public void run() { try { sendMessageSync(destAddress, message, command); } catch (MessageException | InterruptedException error) { Log.warning(error); } } }).start(); }

Target:
public void sendMessageAsync(final String destAddress, final String message, final boolean command) { getRequestBuilder().async().post(Entity.json(preparePayload(destAddress, message))); }
Source:
private Severity errorLevel(Level level) { if (level.name().equals(Level.Error())) { return Severity.ERROR; } else if (level.name().equals(Level.Info())) { return Severity.INFO; } else if (level.name().equals(Level.Warning())) { return Severity.WARNING; } else { LOG.warn("Got unrecognized severity level: {}", level); return Severity.IGNORE; } }

Target:
private Severity errorLevel(Level level) { if (level.name().equals(Level.Error())) { return Severity.ERROR; } else if (level.name().equals(Level.Info())) { return Severity.INFO; } else if (level.name().equals(Level.Warning())) { return Severity.WARNING; } LOG.warn("Got unrecognized severity level: {}", level); return Severity.IGNORE; }
Source:
Mono<PagedResponse<ModelData>> listModelsSinglePageAsync(ListModelOptions listModelOptions, Context context){ return protocolLayer.getDigitalTwinModels().listSinglePageAsync( listModelOptions.getDependenciesFor(), listModelOptions.getIncludeModelDefinition(), new DigitalTwinModelsListOptions().setMaxItemCount(listModelOptions.getMaxItemCount()), context) .map( objectPagedResponse -> { List<ModelData> convertedList = objectPagedResponse.getValue().stream() .map(object -> ModelDataConverter.map(object)) .filter(Objects::nonNull) .collect(Collectors.toList()); return new PagedResponseBase<>( objectPagedResponse.getRequest(), objectPagedResponse.getStatusCode(), objectPagedResponse.getHeaders(), convertedList, null, ((PagedResponseBase) objectPagedResponse).getDeserializedHeaders()); } ); }

Target:
Mono<PagedResponse<ModelData>> listModelsSinglePageAsync(ListModelOptions listModelOptions, Context context){ return protocolLayer.getDigitalTwinModels().listSinglePageAsync( listModelOptions.getDependenciesFor(), listModelOptions.getIncludeModelDefinition(), new DigitalTwinModelsListOptions().setMaxItemCount(listModelOptions.getMaxItemCount()), context) .map( objectPagedResponse -> { List<ModelData> convertedList = objectPagedResponse.getValue().stream() .map(ModelDataConverter::map) .filter(Objects::nonNull) .collect(Collectors.toList()); return new PagedResponseBase<>( objectPagedResponse.getRequest(), objectPagedResponse.getStatusCode(), objectPagedResponse.getHeaders(), convertedList, null, ((PagedResponseBase) objectPagedResponse).getDeserializedHeaders()); } ); }
Source:
protected void run() { try (Git git = new Git(db)) { CommitCommand commitCmd = git.commit(); if (author != null) commitCmd.setAuthor(RawParseUtils.parsePersonIdent(author)); if (message != null) { commitCmd.setMessage(message); } if (noGpgSign) { commitCmd.setSign(Boolean.FALSE); } else if (gpgSigningKey != null) { commitCmd.setSign(Boolean.TRUE); if (!gpgSigningKey.equals(GpgSignHandler.DEFAULT)) { commitCmd.setSigningKey(gpgSigningKey); } } if (only && paths.isEmpty()) { throw die(CLIText.get().pathsRequired); } if (only && all) { throw die(CLIText.get().onlyOneOfIncludeOnlyAllInteractiveCanBeUsed); } if (!paths.isEmpty()) { for (String p : paths) { commitCmd.setOnly(p); } } commitCmd.setAmend(amend); commitCmd.setAll(all); Ref head = db.exactRef(Constants.HEAD); if (head == null) { throw die(CLIText.get().onBranchToBeBorn); } RevCommit commit; try { commit = commitCmd.call(); } catch (JGitInternalException | GitAPIException e) { throw die(e.getMessage(), e); } String branchName; if (!head.isSymbolic()) { branchName = CLIText.get().branchDetachedHEAD; } else { branchName = head.getTarget().getName(); if (branchName.startsWith(Constants.R_HEADS)) { branchName = branchName.substring(Constants.R_HEADS.length()); } } outw.println("[" + branchName + " " + commit.name() + "] " + commit.getShortMessage()); } catch (IOException e) { throw die(e.getMessage(), e); } }

Target:
protected void run() { try (Git git = new Git(db)) { CommitCommand commitCmd = git.commit(); if (author != null) commitCmd.setAuthor(RawParseUtils.parsePersonIdent(author)); if (message != null) commitCmd.setMessage(message); if (noGpgSign) { commitCmd.setSign(Boolean.FALSE); } else if (gpgSigningKey != null) { commitCmd.setSign(Boolean.TRUE); if (!gpgSigningKey.equals(GpgSignHandler.DEFAULT)) { commitCmd.setSigningKey(gpgSigningKey); } } if (only && paths.isEmpty()) throw die(CLIText.get().pathsRequired); if (only && all) throw die(CLIText.get().onlyOneOfIncludeOnlyAllInteractiveCanBeUsed); if (!paths.isEmpty()) for (String p : paths) commitCmd.setOnly(p); commitCmd.setAmend(amend); commitCmd.setAll(all); Ref head = db.exactRef(Constants.HEAD); if (head == null) { throw die(CLIText.get().onBranchToBeBorn); } RevCommit commit; try { commit = commitCmd.call(); } catch (JGitInternalException | GitAPIException e) { throw die(e.getMessage(), e); } String branchName; if (!head.isSymbolic()) branchName = CLIText.get().branchDetachedHEAD; else { branchName = head.getTarget().getName(); if (branchName.startsWith(Constants.R_HEADS)) branchName = branchName.substring(Constants.R_HEADS.length()); } outw.println("[" + branchName + " " + commit.name() + "] " + commit.getShortMessage()); } catch (IOException e) { throw die(e.getMessage(), e); } }
Source:
public BlobProperties downloadToFile(String filePath) { downloadToFileWithResponse(filePath, null, null, null, null, false, null, Context.NONE); return getProperties(); }

Target:
public BlobProperties downloadToFile(String filePath) { return downloadToFileWithResponse(filePath, null, null, null, null, false, null, Context.NONE).getValue(); }
Source:
protected void setupGrid() { GridPane grid = new GridPane(); setupGridPane(grid); setTitle("Save board as"); HBox nameArea = new HBox(); Text prompt = new Text("New board name: "); nameField = new TextField(DEFAULT_NAME); nameField.setPrefWidth(300); Platform.runLater(() -> { nameField.requestFocus(); }); nameField.setId("boardnameinput"); nameArea.getChildren().addAll(prompt, nameField); grid.add(nameArea, 0, 0); errorText = new Text(""); grid.add(errorText, 0, 1); getDialogPane().setContent(grid); }

Target:
protected void setupGrid() { GridPane grid = new GridPane(); setupGridPane(grid); setTitle(BOARD_DIALOG_NAME); HBox nameArea = new HBox(); Text prompt = new Text("New board name: "); nameField = new TextField(DEFAULT_NAME); nameField.setPrefWidth(300); Platform.runLater(() -> { nameField.requestFocus(); }); nameField.setId("boardnameinput"); nameArea.getChildren().addAll(prompt, nameField); grid.add(nameArea, 0, 0); errorText = new Text(""); errorText.getStyleClass().add("text-red"); grid.add(errorText, 0, 1); getDialogPane().setContent(grid); }
Source:
protected synchronized void executeFunctionsUponCommit() { if (uponCommitFunctions != null) { executeFunctions(uponCommitFunctions); uponCommitFunctions = null; } }

Target:
protected void executeFunctionsUponCommit() { if (uponCommitFunctions != null) { executeFunctions(uponCommitFunctions); uponCommitFunctions = null; } }
Source:
RefUpdate newUpdate(final String name, boolean detach) throws IOException { refreshPackedRefs(); Ref r = readRefBasic(name, 0); if (detach) { if (r == null) r = new Ref(Ref.Storage.NEW, name, null); else { r = peel(r); r = new Ref(Ref.Storage.NEW, name, r.getPeeledObjectId()); } } else { if (r == null) r = new Ref(Ref.Storage.NEW, name, null); } return new RefUpdate(this, r, fileForRef(r.getName())); }

Target:
RefUpdate newUpdate(final String name, boolean detach) throws IOException { refreshPackedRefs(); Ref r = readRefBasic(name, 0); if (r == null) r = new Ref(Ref.Storage.NEW, name, null); else if (detach) r = new Ref(Ref.Storage.NEW, name, r.getObjectId()); return new RefUpdate(this, r, fileForRef(r.getName())); }
Source:
private boolean isSameHosts(final String name1, final String name2) { String hostname1 = name1 == null ? "" : name1.trim(); String hostname2 = name2 == null ? "" : name2.trim(); if (hostname1.equals(hostname2)) { return true; } String localHost = "localhost"; String localHostName = localHost; try { localHostName = InetAddress.getLocalHost().getHostName(); } catch (UnknownHostException ex) { } if (hostname1.length() == 0) { hostname1 = localHostName; } if (hostname2.length() == 0) { hostname2 = localHostName; } if (hostname1.equals(hostname2)) { return true; } if ((hostname1.equals(localHost) && hostname2.equals(localHostName)) || (hostname1.equals(localHostName) && hostname2.equals(localHost))) { return true; } try { String ipAddress1 = InetAddress.getByName(hostname1).getHostAddress(); String ipAddress2 = InetAddress.getByName(hostname2).getHostAddress(); return ipAddress1.equals(ipAddress2); } catch (UnknownHostException ex) { } return false; }

Target:
private boolean isSameHosts(final String name1, final String name2) { String hostname1 = name1 == null ? "" : name1.trim(); String hostname2 = name2 == null ? "" : name2.trim(); if (hostname1.equals(hostname2)) return true; String localHost = "localhost"; String resolvedHostName; try { resolvedHostName = InetAddress.getLocalHost().getHostName(); } catch (UnknownHostException ex) { resolvedHostName = localHost; } if (hostname1.length() == 0) hostname1 = resolvedHostName; if (hostname2.length() == 0) hostname2 = resolvedHostName; if (hostname1.equals(hostname2)) return true; if ((hostname1.equals(localHost) && hostname2.equals(resolvedHostName)) || (hostname1.equals(resolvedHostName) && hostname2.equals(localHost))) return true; try { String ipAddress1 = InetAddress.getByName(hostname1).getHostAddress(); String ipAddress2 = InetAddress.getByName(hostname2).getHostAddress(); return ipAddress1.equals(ipAddress2); } catch (UnknownHostException ex) { } return false; }
Source:
public void onEventMainThread(DiscussionThreadPostedEvent event) { DiscussionThread newThread = event.getDiscussionThread(); if (discussionTopic.containsThread(newThread)) { if (postsFilter == DiscussionPostsFilter.UNANSWERED && newThread.getType() != DiscussionThread.ThreadType.QUESTION) { return; } discussionPostsAdapter.insert(newThread, 0); ((TaskProcessCallback) getActivity()).onMessage(MessageType.EMPTY, ""); } }

Target:
public void onEventMainThread(DiscussionThreadPostedEvent event) { DiscussionThread newThread = event.getDiscussionThread(); if (discussionTopic.containsThread(newThread)) { if (postsFilter == DiscussionPostsFilter.UNANSWERED && newThread.getType() != DiscussionThread.ThreadType.QUESTION) { return; } int i = 0; for (; i < discussionPostsAdapter.getCount(); ++i) { if (!discussionPostsAdapter.getItem(i).isPinned()) { break; } } discussionPostsAdapter.insert(newThread, i); discussionPostsListView.setSelection(i); ((TaskProcessCallback) getActivity()).onMessage(MessageType.EMPTY, ""); } }