auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>private static int lengthOfSoftClipping(Iterator<CigarElement> iterator) { int clipped = 0; while (iterator.hasNext()) { final CigarElement elem = iterator.next(); <START> if (elem.getOperator() != CigarOperator.SOFT_CLIP) break; <END> clipped = elem.getLength(); } return clipped; }</code><technical_language>I this do wrong if hard clips (ex. 120M12S8H), break early. I though</technical_language>

Target:
private static int lengthOfSoftClipping(Iterator<CigarElement> iterator) { int clipped = 0; while (iterator.hasNext()) { final CigarElement elem = iterator.next(); if (elem.getOperator() != CigarOperator.SOFT_CLIP && elem.getOperator() != CigarOperator.HARD_CLIP) break; if (elem.getOperator() == CigarOperator.SOFT_CLIP) clipped = elem.getLength(); } return clipped; }
Source:
<code>public void handleGetMbusEncryptionKeyStatusByChannelResponse(final DeviceMessageMetadata deviceMessageMetadata, final ResponseMessageResultType resultType, final OsgpException exception, final GetMbusEncryptionKeyStatusByChannelResponseDto getMbusEncryptionKeyStatusByChannelResponseDto) { <START> LOGGER.info("handleGetMbusEncryptionKeyStatusResponse for MessageType: {}", <END> deviceMessageMetadata.getMessageType()); final String gatewayDeviceIdentification = deviceMessageMetadata.getDeviceIdentification(); final EncryptionKeyStatusType encryptionKeyStatusType = EncryptionKeyStatusType .valueOf(getMbusEncryptionKeyStatusByChannelResponseDto.getEncryptionKeyStatus().name()); this.webServiceResponseMessageSender.send( new ResponseMessage(deviceMessageMetadata.getCorrelationUid(), deviceMessageMetadata.getOrganisationIdentification(), gatewayDeviceIdentification, resultType, exception, encryptionKeyStatusType, deviceMessageMetadata.getMessagePriority()), deviceMessageMetadata.getMessageType()); }</code><technical_language>info line logged confusing, include "ByChannel" in method name</technical_language>

Target:
public void handleGetMbusEncryptionKeyStatusByChannelResponse(final DeviceMessageMetadata deviceMessageMetadata, final ResponseMessageResultType resultType, final OsgpException exception, final GetMbusEncryptionKeyStatusByChannelResponseDto getMbusEncryptionKeyStatusByChannelResponseDto) { LOGGER.info("handleGetMbusEncryptionKeyStatusByChannelResponse for MessageType: {}", deviceMessageMetadata.getMessageType()); final String gatewayDeviceIdentification = deviceMessageMetadata.getDeviceIdentification(); final EncryptionKeyStatusType encryptionKeyStatusType = EncryptionKeyStatusType .valueOf(getMbusEncryptionKeyStatusByChannelResponseDto.getEncryptionKeyStatus().name()); this.webServiceResponseMessageSender.send( new ResponseMessage(deviceMessageMetadata.getCorrelationUid(), deviceMessageMetadata.getOrganisationIdentification(), gatewayDeviceIdentification, resultType, exception, encryptionKeyStatusType, deviceMessageMetadata.getMessagePriority()), deviceMessageMetadata.getMessageType()); }
Source:
<code>protected URI createTableURI(final EObject sourceElement, final TableConfiguration tableConfiguration) { <START> if (sourceElement != null) { <END> setRegisterTableConfigurationByEClass(sourceElement.eClass() instanceof EClass); } IPath preferencePath = Activator.getDefault().getStateLocation(); preferencePath = preferencePath.append(TABLES_PREFERENCES_FOLDER_NAME).append(tableConfiguration.getType()); final StringBuilder b = new StringBuilder().append(preferencePath.toPortableString()); if (this.registerTableConfigurationByEClass) { final ModelElement modelElement = input.getModelElement(propertyPath); EClass eClass = null; if (modelElement instanceof CompositeModelElement) { CompositeModelElement compoModelElement = (CompositeModelElement) modelElement; Iterator<ModelElement> iter = compoModelElement.getSubElements().iterator(); while (eClass == null && iter.hasNext()) { ModelElement tmp = iter.next(); if (tmp instanceof UMLNotationModelElement) { EditPart part = ((UMLNotationModelElement) tmp).getEditPart(); eClass = EMFHelper.getEObject(part).eClass(); } else if (tmp instanceof EMFModelElement) { eClass = ((EMFModelElement) tmp).getSource().eClass(); } } } if (modelElement instanceof UMLNotationModelElement) { EditPart part = ((UMLNotationModelElement) modelElement).getEditPart(); eClass = EMFHelper.getEObject(part).eClass(); } b.append("_"); b.append(eClass.getName()); } URI newURI = URI.createFileURI(b.toString()).appendFileExtension(FILE_EXTENSION); return newURI; }</code><technical_language>null != please</technical_language>

Target:
protected URI createTableURI(final EObject sourceElement, final TableConfiguration tableConfiguration) { if (null != sourceElement) { setRegisterTableConfigurationByEClass(sourceElement.eClass() instanceof EClass); } IPath preferencePath = Activator.getDefault().getStateLocation(); preferencePath = preferencePath.append(TABLES_PREFERENCES_FOLDER_NAME).append(tableConfiguration.getType()); final StringBuilder b = new StringBuilder().append(preferencePath.toPortableString()); if (this.registerTableConfigurationByEClass) { final ModelElement modelElement = input.getModelElement(propertyPath); EClass eClass = null; if (modelElement instanceof CompositeModelElement) { CompositeModelElement compoModelElement = (CompositeModelElement) modelElement; Iterator<ModelElement> iter = compoModelElement.getSubElements().iterator(); while (eClass == null && iter.hasNext()) { ModelElement tmp = iter.next(); if (tmp instanceof UMLNotationModelElement) { EditPart part = ((UMLNotationModelElement) tmp).getEditPart(); eClass = EMFHelper.getEObject(part).eClass(); } else if (tmp instanceof EMFModelElement) { eClass = ((EMFModelElement) tmp).getSource().eClass(); } } } if (modelElement instanceof UMLNotationModelElement) { EditPart part = ((UMLNotationModelElement) modelElement).getEditPart(); eClass = EMFHelper.getEObject(part).eClass(); } b.append("_"); b.append(eClass.getName()); } URI newURI = URI.createFileURI(b.toString()).appendFileExtension(FILE_EXTENSION); return newURI; }
Source:
<code>private void addUserChanges(final Map<String, User> usersById, final List<AddUserProblemFactChange> newUserChanges, final List<ProblemFactChange<TaskAssigningSolution>> updateUserChanges) { final List<User> updatedUserList = filterDuplicates(externalUserList) .filter(externalUser -> !IS_PLANNING_USER.test(externalUser.getId())) .map(UserUtil::fromExternalUser) <START> .collect(Collectors.toList()); <END> final Set<String> updatedUserIds = new HashSet<>(); for (User user : updatedUserList) { final User previousUser = usersById.get(user.getEntityId()); updatedUserIds.add(user.getEntityId()); if (previousUser == null) { newUserChanges.add(new AddUserProblemFactChange(user)); } else if (!equalsByProperties(previousUser, user)) { updateUserChanges.add(new UserPropertyChangeProblemFactChange(previousUser, true, user.getAttributes(), user.getAllLabelValues(), user.getGroups())); } } usersById.values().stream() .filter(user -> !IS_PLANNING_USER.test(user.getEntityId())) .filter(user -> !updatedUserIds.contains(user.getEntityId())) .filter(User::isEnabled) .forEach(user -> updateUserChanges.add(new DisableUserProblemFactChange(user))); }</code><technical_language>avoid creating updatedUserList if move for cycle a forEach() here</technical_language>

Target:
private void addUserChanges(final Map<String, User> usersById, final List<AddUserProblemFactChange> newUserChanges, final List<ProblemFactChange<TaskAssigningSolution>> updateUserChanges) { final Set<String> updatedUserIds = new HashSet<>(); filterDuplicates(externalUserList) .filter(externalUser -> !IS_PLANNING_USER.test(externalUser.getId())) .map(UserUtil::fromExternalUser) .forEach(user -> { final User previousUser = usersById.get(user.getEntityId()); updatedUserIds.add(user.getEntityId()); if (previousUser == null) { newUserChanges.add(new AddUserProblemFactChange(user)); } else if (!equalsByProperties(previousUser, user)) { updateUserChanges.add(new UserPropertyChangeProblemFactChange(previousUser, true, user.getAttributes(), user.getAllLabelValues(), user.getGroups())); } } ); usersById.values().stream() .filter(user -> !IS_PLANNING_USER.test(user.getEntityId())) .filter(user -> !updatedUserIds.contains(user.getEntityId())) .filter(User::isEnabled) .forEach(user -> updateUserChanges.add(new DisableUserProblemFactChange(user))); }
Source:
<code>public boolean accepts(Photograph photograph) { if (getState() != null && photograph.getState() != getState()) { return false; } if (getType() != null && photograph.getPhotoType() != getType()) { return false; } if (processDates(photograph)) { return false; } Person person = photograph.getPerson(); if (person != null) { if (getPersonType() != null && !getPersonType().isMember(person.getUser())) { return false; } <START> if (!getUserName().equals("") && !getUserName().equals(person.getUsername())) { <END> return false; } } else { return false; } return true; }</code><technical_language>Strings.isNullOrEmpty</technical_language>

Target:
public boolean accepts(Photograph photograph) { if (getState() != null && photograph.getState() != getState()) { return false; } if (getType() != null && photograph.getPhotoType() != getType()) { return false; } if (processDates(photograph)) { return false; } Person person = photograph.getPerson(); if (person != null) { if (getPersonType() != null && !getPersonType().isMember(person.getUser())) { return false; } if (!Strings.isNullOrEmpty(getUserName()) && !getUserName().equals(person.getUsername())) { return false; } } else { return false; } return true; }
Source:
<code>private static File profileName( File file, long count ) { String name = file.getName(); File dir = file.getParentFile(); <START> return new File( dir, "." + name + "." + Long.toHexString( count ) + SUFFIX_CACHEPROF ); <END> }</code><technical_language>simpler base 10</technical_language>

Target:
private static File profileName( File file, long count ) { String name = file.getName(); File dir = new File( file.getParentFile(), PROFILE_DIR ); return new File( dir, name + "." + Long.toString( count ) + SUFFIX_CACHEPROF ); }
Source:
<code>private void moveFirstAndLastNodes(final LGraph layeredGraph, final Layer firstLayer, final Layer lastLayer, final Layer firstLabelLayer, final Layer lastLabelLayer) { for (Layer layer : layeredGraph) { <START> LNode nodes = LGraphUtil.toNodeArray(layer.getNodes()); <END> for (LNode node : nodes) { switch (node.getProperty(LayeredOptions.LAYERING_LAYER_CONSTRAINT)) { case FIRST: node.setLayer(firstLayer); throwUpUnlessNoIncomingEdges(node); moveLabelsToLabelLayer(node, true, firstLabelLayer); break; case LAST: node.setLayer(lastLayer); throwUpUnlessNoOutgoingEdges(node); moveLabelsToLabelLayer(node, false, lastLabelLayer); break; } } } ListIterator<Layer> layerIter = layeredGraph.getLayers().listIterator(); while (layerIter.hasNext()) { if (layerIter.next().getNodes().isEmpty()) { layerIter.remove(); } } }</code><technical_language>A space LNode</technical_language>

Target:
private void moveFirstAndLastNodes(final LGraph layeredGraph, final Layer firstLayer, final Layer lastLayer, final Layer firstLabelLayer, final Layer lastLabelLayer) { for (Layer layer : layeredGraph) { LNode[] nodes = LGraphUtil.toNodeArray(layer.getNodes()); for (LNode node : nodes) { switch (node.getProperty(LayeredOptions.LAYERING_LAYER_CONSTRAINT)) { case FIRST: throwUpUnlessNoIncomingEdges(node); node.setLayer(firstLayer); moveLabelsToLabelLayer(node, true, firstLabelLayer); break; case LAST: throwUpUnlessNoOutgoingEdges(node); node.setLayer(lastLayer); moveLabelsToLabelLayer(node, false, lastLabelLayer); break; } } } ListIterator<Layer> layerIter = layeredGraph.getLayers().listIterator(); while (layerIter.hasNext()) { if (layerIter.next().getNodes().isEmpty()) { layerIter.remove(); } } }
Source:
<code><START> private Set<String> getUsageArguments(Properties properties) { <END> SortedSet<String> args = new TreeSet<>(new Comparator<String>() { @Override public int compare(String o, String t1) { return o.compareTo(t1); } }); for (String argName : properties.stringPropertyNames()) { String[] param = argName.split("\\."); if (param.length < 3) { throw new IllegalArgumentException( String.format("Invalid option '%1$s'", argName) ); } args.add(param[1]); } return args; }</code><technical_language>return a list of String, String avoid 2nd parsing in parseArgument other solution avoid multiple here... for example array of maps in key value</technical_language>

Target:
private Set<String[]> getUsageArguments(Properties properties) { SortedSet<String[]> args = new TreeSet<>(new Comparator<String[]>() { @Override public int compare(String[] o, String[] t1) { return o[2].compareTo(t1[2]); } }); for (String argName : properties.stringPropertyNames()) { String[] param = argName.split("\\."); if (param.length < 4) { throw new IllegalArgumentException( String.format("Invalid option '%1$s'", argName) ); } args.add(param); } return args; }
Source:
<code>public TypeMapper() { <START> try { <END> final Ds3TypeMapperParser parser = new Ds3TypeMapperParserImpl(); final Ds3TypeMapper ds3TypeMapper = parser.getMap(); this.typeMapper = ds3TypeMapper.getTypeMapper(); } catch (final ParserException|IOException e) { LOG.error("Attempted to create Type Mapper", e); } }</code><technical_language>I pull of this logic a private static function, instead of catching exception, throw a runtime exception. This happen, if is a bad condition want fail for. moved of this static function, constructor java public TypeMapper() { this.typeMapper = initTypeMapper(); }</technical_language>

Target:
private TypeMapper() throws IOException, ParserException { ds3TypeMapper = initTypeMapper(); }
Source:
<code>public boolean isApplicable(MessageBeans beans, String msg) { int presentMask = beans.getPresentBeansMask(); <START> return ((requiredBeans & presentMask) == requiredBeans && (requiredBeans | presentMask) == requiredBeans); <END> }</code><technical_language>requiredBeans == presentMask</technical_language>

Target:
public boolean isApplicable(MessageBeans beans, String msg) { int presentMask = beans.getPresentBeansMask(); return requiredBeans == presentMask; }
Source:
<code>private static boolean isTransparencyAttestationUpdated(final DeveloperDTO original, final DeveloperDTO changed) { <START> if ((original.getTransparencyAttestationMappings() != null <END> && changed.getTransparencyAttestationMappings() == null) || (original.getTransparencyAttestationMappings() == null && changed.getTransparencyAttestationMappings() != null) || (original.getTransparencyAttestationMappings().size() != changed.getTransparencyAttestationMappings() .size())) { return true; } else { for (DeveloperACBMapDTO originalMapping : original.getTransparencyAttestationMappings()) { for (DeveloperACBMapDTO changedMapping : changed.getTransparencyAttestationMappings()) { if (!Objects.equals(originalMapping.getAcbName(), changedMapping.getAcbName()) || !Objects.equals(originalMapping.getTransparencyAttestation(), changedMapping.getTransparencyAttestation())) { return true; } } } } return false; }</code><technical_language>if changed "getTransparencyAttestationMappings" return a list empty if any, instead of null? this entire set of reduced if (original.getmaps.size != changed.getmaps.size) worry null checks</technical_language>

Target:
private boolean isTransparencyAttestationUpdated(final DeveloperDTO original, final DeveloperDTO changed) { if ((original.getTransparencyAttestationMappings() != null && changed.getTransparencyAttestationMappings() == null) || (original.getTransparencyAttestationMappings() == null && changed.getTransparencyAttestationMappings() != null) || (original.getTransparencyAttestationMappings().size() != changed.getTransparencyAttestationMappings() .size())) { return true; } else { for (DeveloperACBMapDTO originalMapping : original.getTransparencyAttestationMappings()) { Optional<DeveloperACBMapDTO> matchingMapping = changed.getTransparencyAttestationMappings().stream() .filter(changedMapping -> StringUtils.equals(originalMapping.getAcbName(), changedMapping.getAcbName())) .findFirst(); if (!matchingMapping.isPresent() || !StringUtils.equals(originalMapping.getTransparencyAttestation(), matchingMapping.get().getTransparencyAttestation())) { return true; } } } return false; }
Source:
<code>public void testGetNonExistingDataCenter() throws Exception { MockWebServer server = mockWebServer(); server.enqueue(new MockResponse().setResponseCode(500).setBody(payloadFromResource("/fault-404.xml"))); ProfitBricksApi pbApi = api(server.getUrl(rootUrl)); DataCenterApi api = pbApi.dataCenterApi(); String id = "random-non-existing-id"; try { DataCenter dataCenter = api.getDataCenter(id); assertRequestHasCommonProperties(server.takeRequest()); assertNull(dataCenter); <START> } catch (Exception ex) { <END> fail("Should've just thrown null"); } finally { pbApi.close(); server.shutdown(); } }</code><technical_language>[minor] This is redundant. Test fail if method throws exception</technical_language>

Target:
public void testGetNonExistingDataCenter() throws Exception { MockWebServer server = mockWebServer(); server.enqueue(new MockResponse().setResponseCode(500).setBody(payloadFromResource("/fault-404.xml"))); ProfitBricksApi pbApi = api(server.getUrl(rootUrl)); DataCenterApi api = pbApi.dataCenterApi(); String id = "random-non-existing-id"; try { DataCenter dataCenter = api.getDataCenter(id); assertRequestHasCommonProperties(server.takeRequest()); assertNull(dataCenter); } finally { pbApi.close(); server.shutdown(); } }
Source:
<code>public void testTypeInfoTestCoverage() { Reflections reflections = new Reflections("org.apache.flink"); Set<Class<? extends TypeInformation>> typeInfos = reflections.getSubTypesOf(TypeInformation.class); Set<String> typeInfoTestNames = reflections.getSubTypesOf(TypeInformationTestBase.class) .stream().map(Class::getName).collect(Collectors.toSet()); for (Class<? extends TypeInformation> typeInfo : typeInfos) { if (Modifier.isAbstract(typeInfo.getModifiers()) || Modifier.isPrivate(typeInfo.getModifiers()) || typeInfo.getName().contains("test") || typeInfo.getName().contains("Test") || typeInfo.getName().contains("ITCase") || <START> typeInfo.getName().contains("$") || <END> typeInfo.getName().contains("scala") || typeInfo.getName().contains("queryablestate")) { continue; } final String testToFind = typeInfo.getName() + "Test"; if (!typeInfoTestNames.contains(testToFind)) { fail("Could not find test '" + testToFind + "' that covers '" + typeInfo.getName() + "'."); } } }</code><technical_language>I exclude internal classes</technical_language>

Target:
public void testTypeInfoTestCoverage() { Reflections reflections = new Reflections("org.apache.flink"); Set<Class<? extends TypeInformation>> typeInfos = reflections.getSubTypesOf(TypeInformation.class); Set<String> typeInfoTestNames = reflections.getSubTypesOf(TypeInformationTestBase.class) .stream().map(Class::getName).collect(Collectors.toSet()); for (Class<? extends TypeInformation> typeInfo : typeInfos) { if (Modifier.isAbstract(typeInfo.getModifiers()) || Modifier.isPrivate(typeInfo.getModifiers()) || typeInfo.getName().contains("Test$") || typeInfo.getName().contains("TestBase$") || typeInfo.getName().contains("ITCase$") || typeInfo.getName().contains("$$anon") || typeInfo.getName().contains("queryablestate")) { continue; } final String testToFind = typeInfo.getName() + "Test"; if (!typeInfoTestNames.contains(testToFind)) { fail("Could not find test '" + testToFind + "' that covers '" + typeInfo.getName() + "'."); } } }
Source:
<code>private void visitRequireCall(NodeTraversal t, Node require, Node parent) { <START> String requireName = getCommonJsImportPath(require); <END> String moduleName = getImportedModuleName(t, require); Node moduleRef = NodeUtil.newQName(compiler, getBasePropertyImport(moduleName)) .useSourceInfoFromForTree(require); parent.replaceChild(require, moduleRef); t.reportCodeChange(); }</code><technical_language>requireName is unused</technical_language>

Target:
private void visitRequireCall(NodeTraversal t, Node require, Node parent) { String moduleName = getImportedModuleName(t, require); Node moduleRef = NodeUtil.newQName(compiler, getBasePropertyImport(moduleName)) .useSourceInfoFromForTree(require); parent.replaceChild(require, moduleRef); t.reportCodeChange(); }
Source:
<code>public void initialize() { super.initialize(); userSearchTextField.textProperty().addListener((observable, oldValue, newValue) -> filterChatUsers(newValue)); channelTabScrollPaneVBox.setMinWidth(preferencesService.getPreferences().getChat().getChannelTabScrollPaneWidth()); channelTabScrollPaneVBox.setPrefWidth(preferencesService.getPreferences().getChat().getChannelTabScrollPaneWidth()); JavaFxUtil.addListener(preferencesService.getPreferences().getChat().chatColorModeProperty(), chatColorModeChangeListener); addUserFilterPopup(); chatUserListView.setItems(filteredChatUserList); chatUserListView.setCellFactory(param -> new ChatUserListCell(uiService)); autoCompletionHelper.bindTo(messageTextField()); <START> splitPane.widthProperty().addListener((observable, oldValue, newValue) -> { <END> splitPane.setDividerPositions((splitPane.widthProperty().doubleValue() - (double) USER_LIST_WIDTH_PX) / splitPane.widthProperty().doubleValue()); System.out.println((newValue.doubleValue() - (double) USER_LIST_WIDTH_PX) / newValue.doubleValue()); }); }</code><technical_language>this fix I is a clean for this</technical_language>

Target:
public void initialize() { super.initialize(); userSearchTextField.textProperty().addListener((observable, oldValue, newValue) -> filterChatUsers(newValue)); channelTabScrollPaneVBox.setMinWidth(preferencesService.getPreferences().getChat().getChannelTabScrollPaneWidth()); channelTabScrollPaneVBox.setPrefWidth(preferencesService.getPreferences().getChat().getChannelTabScrollPaneWidth()); JavaFxUtil.addListener(preferencesService.getPreferences().getChat().chatColorModeProperty(), chatColorModeChangeListener); addUserFilterPopup(); chatUserListView.setItems(filteredChatUserList); chatUserListView.setCellFactory(param -> new ChatUserListCell(uiService)); autoCompletionHelper.bindTo(messageTextField()); }
Source:
<code>public void start(BundleContext bc) throws Exception { context = bc; logger.debug("Core bundle has been started."); <START> DateExpression de = new DateExpression("2016-01-31T16:45:46+00:00"); <END> logger.debug("stop"); }</code><technical_language>intention of this line</technical_language>

Target:
public void start(BundleContext bc) throws Exception { context = bc; logger.debug("Core bundle has been started."); }
Source:
<code>protected Pair<Boolean, VdcFault> runConnectionStorageToDomain(StorageDomain storageDomain, Guid vdsId, int type) { Provider provider = getProviderDao().get(Guid.createGuidFromString(storageDomain.getStorage())); VDS vds = getVdsDao().get(vdsId); List<LibvirtSecret> libvirtSecrets = getLibvirtSecretDao().getAllByProviderId(provider.getId()); if (!libvirtSecrets.isEmpty()) { VDSReturnValue returnValue = Backend.getInstance().getResourceManager().RunVdsCommand( VDSCommandType.RegisterLibvirtSecrets, <START> new RegisterLibvirtSecretsVDSParameters(vdsId, libvirtSecrets)); <END> if (!returnValue.getSucceeded()) { addMessageToAuditLog(AuditLogType.FAILED_TO_REGISTER_LIBVIRT_SECRET, storageDomain.getName(), vds.getName()); log.error("Failed to register libvirt secret for storage domain on vds {}.", storageDomain.getName(), vds.getName()); VdcFault vdcFault = new VdcFault(); vdcFault.setError(returnValue.getVdsError().getCode()); return new Pair<>(false, vdcFault); } } return new Pair<>(true, null); }</code><technical_language>need add try/catch here? IIRM runVdsCommand throw exception. please runVdsCommand instead Backend.getInstance().getResourceManager().RunVdsCommand</technical_language>

Target:
protected Pair<Boolean, VdcFault> runConnectionStorageToDomain(StorageDomain storageDomain, Guid vdsId, int type) { Provider provider = getProviderDao().get(Guid.createGuidFromString(storageDomain.getStorage())); VDS vds = getVdsDao().get(vdsId); List<LibvirtSecret> libvirtSecrets = getLibvirtSecretDao().getAllByProviderId(provider.getId()); VDSReturnValue returnValue; if (!libvirtSecrets.isEmpty()) { try { returnValue = Backend.getInstance().getResourceManager().RunVdsCommand( VDSCommandType.RegisterLibvirtSecrets, new RegisterLibvirtSecretsVDSParameters(vdsId, libvirtSecrets)); } catch (RuntimeException e) { log.error("Failed to register libvirt secret for storage domain on vds {}. Error: {}", storageDomain.getName(), vds.getName(), e.getMessage()); log.debug("Exception", e); return new Pair<>(false, null); } if (!returnValue.getSucceeded()) { addMessageToAuditLog(AuditLogType.FAILED_TO_REGISTER_LIBVIRT_SECRET, storageDomain.getName(), vds.getName()); log.error("Failed to register libvirt secret for storage domain on vds {}.", storageDomain.getName(), vds.getName()); VdcFault vdcFault = new VdcFault(); vdcFault.setError(returnValue.getVdsError().getCode()); return new Pair<>(false, vdcFault); } } return new Pair<>(true, null); }
Source:
<code>private Criterion getCriterionForShortName(String name, boolean includeVoided) { if (includeVoided) { return Restrictions.disjunction().add(Restrictions.eq("name.givenName", name).ignoreCase()).add( Restrictions.eq("name.middleName", name).ignoreCase()).add( Restrictions.eq("name.familyName", name).ignoreCase()).add( Restrictions.eq("name.familyName2", name).ignoreCase()); } else { return Restrictions.conjunction().add(Restrictions.eq("name.voided", false)).add( <START> Restrictions.disjunction().add(Restrictions.eq("name.givenName", name).ignoreCase()).add( <END> Restrictions.eq("name.middleName", name).ignoreCase()).add( Restrictions.eq("name.familyName", name).ignoreCase()).add( Restrictions.eq("name.familyName2", name).ignoreCase())); } }</code><technical_language>repeats above, it? Eliminate duplication please</technical_language>

Target:
private Criterion getCriterionForShortName(String name, boolean includeVoided) { Criterion criterion = Restrictions.disjunction().add(Restrictions.eq("name.givenName", name).ignoreCase()).add( Restrictions.eq("name.middleName", name).ignoreCase()) .add(Restrictions.eq("name.familyName", name).ignoreCase()).add( Restrictions.eq("name.familyName2", name).ignoreCase()); if (!includeVoided) { return Restrictions.conjunction().add(Restrictions.eq("name.voided", false)).add(criterion); } return criterion; }
Source:
<code>public IndexingResult index(DbSession dbSession, Collection<EsQueueDto> items) { if (items.isEmpty()) { return new IndexingResult(); } <START> Set<String> logins = items <END> .stream() .map(EsQueueDto::getDocId) .collect(toHashSet(items.size())); BulkIndexer bulkIndexer = newBulkIndexer(Size.REGULAR, new OneToOneResilientIndexingListener(dbClient, dbSession, items)); bulkIndexer.start(); logins.forEach(l -> bulkIndexer.addDeletion(INDEX_TYPE_VIEW, l)); return bulkIndexer.stop(); }</code><technical_language>logins</technical_language>

Target:
public IndexingResult index(DbSession dbSession, Collection<EsQueueDto> items) { if (items.isEmpty()) { return new IndexingResult(); } Set<String> views = items .stream() .map(EsQueueDto::getDocId) .collect(toHashSet(items.size())); BulkIndexer bulkIndexer = newBulkIndexer(Size.REGULAR, new OneToOneResilientIndexingListener(dbClient, dbSession, items)); bulkIndexer.start(); views.removeAll(dbClient.componentDao().selectExistingUuids(dbSession, views)); views.forEach(v -> bulkIndexer.addDeletion(INDEX_TYPE_VIEW, v)); return bulkIndexer.stop(); }
Source:
<code>public static void deIdentifyTableWithFpe() throws IOException { String projectId = "your-project-id"; Table tableToDeIdentify = Table.newBuilder() .addHeaders(FieldId.newBuilder().setName("Employee ID").build()) .addHeaders(FieldId.newBuilder().setName("Date").build()) .addHeaders(FieldId.newBuilder().setName("Compensation").build()) .addRows(Row.newBuilder() .addValues(Value.newBuilder().setStringValue("11111").build()) .addValues(Value.newBuilder().setStringValue("2015").build()) .addValues(Value.newBuilder().setStringValue("$10").build()) .build()) .addRows(Row.newBuilder() .addValues(Value.newBuilder().setStringValue("11111").build()) .addValues(Value.newBuilder().setStringValue("2016").build()) .addValues(Value.newBuilder().setStringValue("$20").build()) .build()) .addRows(Row.newBuilder() .addValues(Value.newBuilder().setStringValue("22222").build()) .addValues(Value.newBuilder().setStringValue("2016").build()) .addValues(Value.newBuilder().setStringValue("$15").build()) .build()) .build(); <START> String kmsKeyName = <END> "projects/YOUR_PROJECT/" + "locations/YOUR_KEYRING_REGION/" + "keyRings/YOUR_KEYRING_NAME/" + "cryptoKeys/YOUR_KEY_NAME"; String wrappedAesKey = "YOUR_ENCRYPTED_AES_256_KEY"; deIdentifyTableWithFpe(projectId, tableToDeIdentify, kmsKeyName, wrappedAesKey); }</code><technical_language>move of projectId users missing filling in</technical_language>

Target:
public static void deIdentifyTableWithFpe() throws IOException { String projectId = "your-project-id"; String kmsKeyName = "projects/YOUR_PROJECT/" + "locations/YOUR_KEYRING_REGION/" + "keyRings/YOUR_KEYRING_NAME/" + "cryptoKeys/YOUR_KEY_NAME"; String wrappedAesKey = "YOUR_ENCRYPTED_AES_256_KEY"; Table tableToDeIdentify = Table.newBuilder() .addHeaders(FieldId.newBuilder().setName("Employee ID").build()) .addHeaders(FieldId.newBuilder().setName("Date").build()) .addHeaders(FieldId.newBuilder().setName("Compensation").build()) .addRows(Row.newBuilder() .addValues(Value.newBuilder().setStringValue("11111").build()) .addValues(Value.newBuilder().setStringValue("2015").build()) .addValues(Value.newBuilder().setStringValue("$10").build()) .build()) .addRows(Row.newBuilder() .addValues(Value.newBuilder().setStringValue("11111").build()) .addValues(Value.newBuilder().setStringValue("2016").build()) .addValues(Value.newBuilder().setStringValue("$20").build()) .build()) .addRows(Row.newBuilder() .addValues(Value.newBuilder().setStringValue("22222").build()) .addValues(Value.newBuilder().setStringValue("2016").build()) .addValues(Value.newBuilder().setStringValue("$15").build()) .build()) .build(); deIdentifyTableWithFpe(projectId, tableToDeIdentify, kmsKeyName, wrappedAesKey); }
Source:
<code>public <U> Vector<T> distinctBy(Function<? super T, ? extends U> keyExtractor) { Objects.requireNonNull(keyExtractor, "keyExtractor is null"); <START> final Set<U> seen = new java.util.HashSet<>(); <END> return filter(t -> seen.add(keyExtractor.apply(t))); }</code><technical_language>Hint: In Javaslang code I fully qualify Java collection types difference clear, if is conflict</technical_language>

Target:
public <U> Vector<T> distinctBy(Function<? super T, ? extends U> keyExtractor) { Objects.requireNonNull(keyExtractor, "keyExtractor is null"); final java.util.Set<U> seen = new java.util.HashSet<>(length()); return filter(t -> seen.add(keyExtractor.apply(t))); }
Source:
<code>public boolean isSparse(){ <START> return isSparse; <END> }</code><technical_language>this return false? a sparse ndarray well</technical_language>

Target:
public boolean isSparse() { return false; }
Source:
<code>public CommandResult2(int resultCode, DataSourceDesc2 desc) { this(resultCode, desc, <START> System.currentTimeMillis()); <END> }</code><technical_language>+1 for SystemClock.elapsedRealTime()</technical_language>

Target:
public CommandResult2(int resultCode, DataSourceDesc2 desc) { this(resultCode, desc, SystemClock.elapsedRealtime()); }
Source:
<code>public Expression from(@NonNull String alias) { <START> <END> if(alias == null) { throw new IllegalArgumentException("alias is null"); } return new MetaExpression(this.keyPath, alias); }</code><technical_language>Remove extra line</technical_language>

Target:
public Expression from(@NonNull String alias) { if (alias == null) { throw new IllegalArgumentException("alias is null."); } return new MetaExpression(this.keyPath, alias); }
Source:
<code>private int invalidateSmallestTxVersion() { ConflictTxStream firstEntry = cacheEntries.peek(); if (cacheEntries.size() == 0) { return 0; } int numEntries = 0; while (firstAddress() == firstEntry.txVersion) { <START> if (log.isTraceEnabled()) { <END> log.trace("evict items " + numEntries + " with address " + firstAddress()); } ConflictTxStream entry = cacheEntries.poll(); conflictKeys.remove(entry); numEntries++; } if (log.isTraceEnabled()) { log.trace("Evict entries", numEntries); } maxConflictWildcard = Math.max(maxConflictWildcard, firstEntry.txVersion); return numEntries; }</code><technical_language>is necessary check if trace is enabled? message get logged if logging level is > trace</technical_language>

Target:
private int invalidateSmallestTxVersion() { ConflictTxStream firstEntry = cacheEntries.peek(); if (cacheEntries.size() == 0) { return 0; } int numEntries = 0; while (firstAddress() == firstEntry.txVersion) { if (log.isTraceEnabled()) { log.trace( "invalidateSmallestTxVersion: items evicted min address {}", numEntries, firstAddress()); } ConflictTxStream entry = cacheEntries.poll(); conflictKeys.remove(entry); numEntries++; } maxConflictWildcard = Math.max(maxConflictWildcard, firstEntry.txVersion); return numEntries; }
Source:
<code>private static void serializePrimitive(Type type, BlockBuilder builder, Object object) { <START> requireNonNull(builder, "parent builder is null"); <END> if (object == null) { builder.appendNull(); return; } if (type.equals(BOOLEAN)) { type.writeBoolean(builder, (Boolean) object); return; } else if (type.equals(BIGINT)) { type.writeLong(builder, Long.valueOf(String.valueOf(object))); return; } else if (type.equals(DOUBLE)) { type.writeDouble(builder, (Double) object); return; } else if (type.equals(INTEGER)) { type.writeLong(builder, Long.valueOf(String.valueOf(object))); return; } else if (type.equals(VARCHAR)) { type.writeSlice(builder, utf8Slice(String.valueOf(object))); return; } else if (type.equals(VARBINARY)) { type.writeSlice(builder, utf8Slice(String.valueOf(object))); return; } throw new RuntimeException("Unknown primitive type: " + type.getDisplayName()); }</code><technical_language>builder is null</technical_language>

Target:
private static void serializePrimitive(Type type, BlockBuilder builder, Object object) { requireNonNull(builder, "builder is null"); if (object == null) { builder.appendNull(); return; } if (type.equals(BOOLEAN)) { type.writeBoolean(builder, (Boolean) object); } else if (type.equals(BIGINT)) { type.writeLong(builder, Long.valueOf(String.valueOf(object))); } else if (type.equals(DOUBLE)) { type.writeDouble(builder, (Double) object); } else if (type.equals(INTEGER)) { type.writeLong(builder, Long.valueOf(String.valueOf(object))); } else if (type.equals(VARCHAR)) { type.writeSlice(builder, utf8Slice(String.valueOf(object))); } else if (type.equals(VARBINARY)) { type.writeSlice(builder, utf8Slice(String.valueOf(object))); } else { throw new RuntimeException("Unknown primitive type: " + type.getDisplayName()); } }
Source:
<code>private void handleBody(InputStream payload, MessageMetadata messageMetadata) throws IOException, MessageFormatException { <START> if (!successfullyDeserialized) { <END> ByteBuffer encryptionKey = messageMetadata == null ? null : messageMetadata.getEncryptionKey(); serverBlobProperties = MessageFormatRecord.deserializeBlobProperties(payload); serverUserMetadata = MessageFormatRecord.deserializeUserMetadata(payload); successfullyDeserialized = true; if (!serverBlobProperties.isEncrypted()) { state = State.Complete; if (operationResult == null) { operationResult = new GetBlobResultInternal( new GetBlobResult(new BlobInfo(serverBlobProperties, serverUserMetadata.array()), null), null); } } else { state = State.Decrypting; logger.trace("Moving the state to and submitting decrypt job for {}", State.Decrypting, blobId); cryptoJobHandler.submitJob( new DecryptJob(blobId, encryptionKey.duplicate(), null, serverUserMetadata, cryptoService, kms, (DecryptJob.DecryptJobResult result, Exception exception) -> { logger.trace("Handling decrypt job callback results for {}", blobId); decryptCallbackResultInfo.get().setResultAndException(result, exception); routerCallback.onPollReady(); })); } } else { } }</code><technical_language>understand this interaction 1) Response is received server 2) response is deserialized needs decryption 3) Decryption fails need ask other servers for data 4) This piece of code execute successfullyDeserialized is reset? is this check for btw</technical_language>

Target:
private void handleBody(InputStream payload, MessageMetadata messageMetadata) throws IOException, MessageFormatException { ByteBuffer encryptionKey = messageMetadata == null ? null : messageMetadata.getEncryptionKey(); serverBlobProperties = MessageFormatRecord.deserializeBlobProperties(payload); ByteBuffer userMetadata = MessageFormatRecord.deserializeUserMetadata(payload); if (encryptionKey == null) { operationResult = new GetBlobResultInternal(new GetBlobResult(new BlobInfo(serverBlobProperties, userMetadata.array()), null), null); } else { progressTracker.initializeDecryptionTracker(); logger.trace("Submitting decrypt job for {}", blobId); long startTimeMs = System.currentTimeMillis(); cryptoJobHandler.submitJob( new DecryptJob(blobId, encryptionKey.duplicate(), null, userMetadata, cryptoService, kms, (DecryptJob.DecryptJobResult result, Exception exception) -> { logger.trace("Handling decrypt job callback results for {}", blobId); routerMetrics.decryptTimeMs.update(System.currentTimeMillis() - startTimeMs); if (exception == null) { logger.trace("Successfully updating decrypt job callback results for {}", blobId); operationResult = new GetBlobResultInternal( new GetBlobResult(new BlobInfo(serverBlobProperties, result.getDecryptedUserMetadata().array()), null), null); progressTracker.setDecryptionSuccess(); } else { logger.trace("Exception thrown on decryption for {}", exception, blobId); setOperationException( new RouterException("Exception thrown on decrypting the content for " + blobId, exception, RouterErrorCode.UnexpectedInternalError)); progressTracker.setDecryptionFailed(); } routerCallback.onPollReady(); })); } }
Source:
<code>public void doesNotLogIfOperationsAreFast() { makeOperationsTakeSpecifiedDuration(SHORT_DURATION); <START> allowLogging(); <END> profilingTimelockService.getFreshTimestamp(); profilingTimelockService.startIdentifiedAtlasDbTransaction(); verify(delegate).getFreshTimestamp(); verify(delegate).startIdentifiedAtlasDbTransaction(); verifyLoggerNeverInvoked(); }</code><technical_language>this means, "flush call" effectively</technical_language>

Target:
public void doesNotLogIfOperationsAreFast() { flushLogsWithCall(SHORT_DURATION, profilingTimelockService::getFreshTimestamp); flushLogsWithCall(SHORT_DURATION, profilingTimelockService::startIdentifiedAtlasDbTransaction); verify(delegate).getFreshTimestamp(); verify(delegate).startIdentifiedAtlasDbTransaction(); verifyLoggerNeverInvoked(); }
Source:
<code>private void addStreamProperties(IMediaStream stream, HashMap<String,Object> streamHash){ <START> HashMap<String,Object> EncodersHash = new HashMap<>(); <END> double videoBitrate = stream.getPublishBitrateVideo() / 1000; double audioBitrate = stream.getPublishBitrateAudio() / 1000; double totalBitrate = videoBitrate + audioBitrate; double framerate = stream.getPublishFramerateVideo(); EncodersHash.put("videoBitrate", videoBitrate); EncodersHash.put("audioBitrate", audioBitrate); EncodersHash.put("totalBitrate", totalBitrate); EncodersHash.put("frameRate", framerate); getMetaDataProperties(stream, EncodersHash); streamHash.put("Encoder", EncodersHash); logger.debug(httpSessionId+"[" + stream.getName() + "] Add the following params: videoBitrate "+ videoBitrate + ", audioBitrate " + audioBitrate + ", framerate "+ framerate); }</code><technical_language>HashMap<String,Object></technical_language>

Target:
private void addStreamProperties(IMediaStream stream, HashMap<String,Object> streamHash){ HashMap<String,Object> EncodersHash = new HashMap<String,Object>(); double videoBitrate = stream.getPublishBitrateVideo() / 1000; double audioBitrate = stream.getPublishBitrateAudio() / 1000; double framerate = stream.getPublishFramerateVideo(); String audioCodec = FLVUtils.audioCodecToString(stream.getPublishAudioCodecId()); String videoCodec = FLVUtils.videoCodecToString(stream.getPublishVideoCodecId()); EncodersHash.put("videoCodec", videoCodec); EncodersHash.put("audioCodec", audioCodec); EncodersHash.put("videoBitrate", videoBitrate); EncodersHash.put("audioBitrate", audioBitrate); EncodersHash.put("frameRate", framerate); getMetaDataProperties(stream, EncodersHash); streamHash.put("Encoder", EncodersHash); logger.debug(httpSessionId+"[" + stream.getName() + "] Add the following params: videoBitrate "+ videoBitrate + ", audioBitrate " + audioBitrate + ", framerate "+ framerate); }
Source:
<code>public void importButtonClicked() { ImportEntriesDialog dialog = new ImportEntriesDialog(databaseContext, BackgroundTask.wrap(() -> new ArrayList<>(resolverResult.getNewEntries()))); dialog.setTitle(Localization.lang("Import entries from LaTeX files")); dialog.showAndWait(); <START> close.set(true); <END> }</code><technical_language>I understand this close property</technical_language>

Target:
public void importButtonClicked() { ImportEntriesDialog dialog = new ImportEntriesDialog(databaseContext, BackgroundTask.wrap(() -> new ArrayList<>(resolverResult.getNewEntries()))); dialog.setTitle(Localization.lang("Import entries from LaTeX files")); dialog.showAndWait(); }
Source:
<code>public void testUpdateToolForumUrl() throws ApiException { ContainersApi toolsApi = setupWebService(); DockstoreTool toolTest = toolsApi.getContainerByToolPath(DOCKERHUB_TOOL_PATH, null); toolsApi.refresh(toolTest.getId()); toolTest.setForumUrl("hello.com"); toolsApi.updateContainer(toolTest.getId(), toolTest); toolsApi.refresh(toolTest.getId()); final String updatedForumUrl = testingPostgres.runSelectStatement("select forumurl from tool where id = " + toolTest.getId(), String.class); <START> assertEquals("the forumurl should be hello.com", "hello.com", updatedForumUrl); <END> }</code><technical_language>constant line 1330 obvious</technical_language>

Target:
public void testUpdateToolForumUrl() throws ApiException { final String forumUrl = "hello.com"; ContainersApi toolsApi = setupWebService(); DockstoreTool toolTest = toolsApi.getContainerByToolPath(DOCKERHUB_TOOL_PATH, null); toolsApi.refresh(toolTest.getId()); toolTest.setForumUrl(forumUrl); toolsApi.updateContainer(toolTest.getId(), toolTest); toolsApi.refresh(toolTest.getId()); final String updatedForumUrl = testingPostgres.runSelectStatement("select forumurl from tool where id = " + toolTest.getId(), String.class); assertEquals("the forumurl should be hello.com", forumUrl, updatedForumUrl); }
Source:
<code>public void testList() throws IOException, StripeException { final Customer customer = Customer.retrieve(CUSTOMER_ID); Map<String, Object> params = new HashMap<String, Object>(); params.put("object", "card"); Card stubbedCard = getCardFixture(customer); ExternalAccountCollection stubbedCollection = new ExternalAccountCollection(); List<ExternalAccount> stubbedData = new LinkedList<ExternalAccount>(); stubbedData.add(stubbedCard); stubbedCollection.setData(stubbedData); stubRequest( APIResource.RequestMethod.GET, String.format("/v1/customers/%s/sources", customer.getId()), params, ExternalAccountCollection.class, stubbedCollection.toJson() ); <START> final ExternalAccountCollection externalAccounts = customer.getSources().list(params); <END> assertNotNull(externalAccounts); assertEquals(1, externalAccounts.getData().size()); verifyRequest( APIResource.RequestMethod.GET, String.format("/v1/customers/%s/sources", customer.getId()) ); Card card = (Card) externalAccounts.getData().get(0); assertNotNull(card); }</code><technical_language>bank account, a real fixture</technical_language>

Target:
public void testList() throws IOException, StripeException { final Customer customer = Customer.retrieve(CUSTOMER_ID); final Map<String, Object> params = new HashMap<String, Object>(); params.put("object", "card"); params.put("limit", 1); final Card stubbedCard = getCardFixture(customer); final ExternalAccountCollection stubbedCollection = new ExternalAccountCollection(); final List<ExternalAccount> stubbedData = new LinkedList<ExternalAccount>(); stubbedData.add(stubbedCard); stubbedCollection.setData(stubbedData); stubRequest( APIResource.RequestMethod.GET, String.format("/v1/customers/%s/sources", customer.getId()), params, ExternalAccountCollection.class, stubbedCollection.toJson() ); final ExternalAccountCollection externalAccounts = customer.getSources().list(params); assertNotNull(externalAccounts); assertEquals(1, externalAccounts.getData().size()); verifyRequest( APIResource.RequestMethod.GET, String.format("/v1/customers/%s/sources", customer.getId()) ); final Card card = (Card) externalAccounts.getData().get(0); assertNotNull(card); }
Source:
<code>public void accept(ProbeResult probeResult) { String machineName = probeResult.getMachineName(); DockerMachine machine = startSynchronizer.getMachines().get(machineName); if (machine == null) { return; } String serverName = probeResult.getServerName(); ProbeStatus probeStatus = probeResult.getStatus(); Server server = machine.getServers().get(serverName); ServerStatus oldServerStatus = server.getStatus(); ServerStatus serverStatus; if (probeStatus == ProbeStatus.FAILED && oldServerStatus == ServerStatus.RUNNING) { serverStatus = ServerStatus.STOPPED; } else if (probeStatus == ProbeStatus.PASSED <START> && (oldServerStatus == null <END> || oldServerStatus == ServerStatus.UNKNOWN || oldServerStatus == ServerStatus.STOPPED)) { serverStatus = ServerStatus.RUNNING; } else { return; } machine.setServerStatus(serverName, serverStatus); sendServerStatusEvent(machineName, serverName, machine.getServers().get(serverName)); }</code><technical_language>Consider simplifying this check oldServerStatus != ServerStatus.RUNNING</technical_language>

Target:
public void accept(ProbeResult probeResult) { String machineName = probeResult.getMachineName(); DockerMachine machine = startSynchronizer.getMachines().get(machineName); if (machine == null) { return; } String serverName = probeResult.getServerName(); ProbeStatus probeStatus = probeResult.getStatus(); Server server = machine.getServers().get(serverName); ServerStatus oldServerStatus = server.getStatus(); ServerStatus serverStatus; if (probeStatus == ProbeStatus.FAILED && oldServerStatus == ServerStatus.RUNNING) { serverStatus = ServerStatus.STOPPED; } else if (probeStatus == ProbeStatus.PASSED && (oldServerStatus != ServerStatus.RUNNING)) { serverStatus = ServerStatus.RUNNING; } else { return; } machine.setServerStatus(serverName, serverStatus); sendServerStatusEvent(machineName, serverName, machine.getServers().get(serverName)); }
Source:
<code>public Snippet063ComboViewer(Shell shell) { GridLayoutFactory.fillDefaults().numColumns(2) .margins(LayoutConstants.getMargins()).generateLayout(shell); final Label l = new Label(shell, SWT.None); l.setText("Choose Item:"); final ComboViewer v = new ComboViewer(shell); v.setLabelProvider(new LabelProvider()); v.setContentProvider(new MyContentProvider()); <START> v.setInput(createModel()); <END> }</code><technical_language>snippet show providing a useful selection if can. like: MyModel[] model = createModel(); v.setInput(model); v.setSelection(new StructuredSelection(model[0]));</technical_language>

Target:
public Snippet063ComboViewer(Shell shell) { GridLayoutFactory.fillDefaults().numColumns(2) .margins(LayoutConstants.getMargins()).generateLayout(shell); final Label l = new Label(shell, SWT.None); l.setText("Choose Item:"); final ComboViewer v = new ComboViewer(shell); v.setLabelProvider(new LabelProvider()); v.setContentProvider(new MyContentProvider()); MyModel[] model = createModel(); v.setInput(model); if (model.length > 0) { v.setSelection(new StructuredSelection(model[0])); } }