auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public List<PermissionSubject> getPermissionCheckSubjects() { List<PermissionSubject> permissionList = new ArrayList<PermissionSubject>(); for (LiveMigrateDiskParameters parameters : getParameters().getParametersList()) { DiskImage diskImage = getDiskImageDao().get(parameters.getImageId()); if (diskImage != null) { permissionList.add(new PermissionSubject(diskImage.getId(), VdcObjectType.Disk, <START> ActionGroup.CONFIGURE_DISK_STORAGE)); <END> permissionList.add(new PermissionSubject(diskImage.getId(), VdcObjectType.Disk, ActionGroup.DISK_LIVE_STORAGE_MIGRATION)); } permissionList.add(new PermissionSubject(parameters.getTargetStorageDomainId(), VdcObjectType.Storage, ActionGroup.CREATE_DISK)); } return permissionList; }</code><technical_language>REPLACED DISK_LIVE_STORAGE_MIGRATION</technical_language>

Target:
public List<PermissionSubject> getPermissionCheckSubjects() { List<PermissionSubject> permissionList = new ArrayList<PermissionSubject>(); for (LiveMigrateDiskParameters parameters : getParameters().getParametersList()) { DiskImage diskImage = getDiskImageDao().get(parameters.getImageId()); if (diskImage != null) { permissionList.add(new PermissionSubject(diskImage.getId(), VdcObjectType.Disk, ActionGroup.DISK_LIVE_STORAGE_MIGRATION)); } } return permissionList; }
Source:
<code>public Path generateArtifact(NpmArtifactCoordinates coordinates) throws IOException { <START> return this.of(coordinates).buildPublishJson(); <END> }</code><technical_language>@ptirador I this: java this.of(coordinates).buildPublishJson(); return getPackagePath();</technical_language>

Target:
public Path generateArtifact(NpmArtifactCoordinates coordinates) throws IOException { this.of(coordinates).buildPublishJson(); return getPackagePath(); }
Source:
<code>public HAServiceProtocol.HAServiceState getHAServiceState() { try { <START> rpcServer.checkOperation(NameNode.OperationCategory.WRITE); <END> } catch (StandbyException e) { return HAServiceProtocol.HAServiceState.STANDBY; } return HAServiceProtocol.HAServiceState.ACTIVE; }</code><technical_language>Instead of exceptions, extract code checkSafeMode() check state</technical_language>

Target:
public HAServiceProtocol.HAServiceState getHAServiceState() { if (rpcServer.isSafeMode()) { return HAServiceProtocol.HAServiceState.STANDBY; } return HAServiceProtocol.HAServiceState.ACTIVE; }
Source:
<code>protected void doStart() throws Exception { super.doStart(); BasicCacheContainer cacheContainer = configuration.getCacheContainer(); cache = InfinispanUtil.getCache(configuration.getCacheContainer(), configuration.getCacheName()); if (configuration.hasQueryBuilder()) { if (InfinispanUtil.isRemote(cache)) { RemoteCache<Object, Object> remoteCache = InfinispanUtil.asRemote(cache); Query query = InfinispanRemoteOperation.buildQuery(configuration.getQueryBuilder(), remoteCache); continuousQuery = Search.getContinuousQuery(remoteCache); continuousQuery.addContinuousQueryListener(query, new ContinuousQueryEventListener(cache.getName())); } else { throw new IllegalArgumentException("Can't run continuous queries against embedded cache (" + cache.getName() + ")"); } } else { if (InfinispanUtil.isEmbedded(cacheContainer)) { consumerHandler = InfinispanConsumerEmbeddedHandler.INSTANCE; } else if (InfinispanUtil.isRemote(cacheContainer)) { consumerHandler = InfinispanConsumerRemoteHandler.INSTANCE; } else { <START> throw new UnsupportedOperationException("Consumer not support for CacheContainer: " + cacheContainer); <END> } listener = consumerHandler.start(this); } }</code><technical_language>"Consumer supported for..."</technical_language>

Target:
protected void doStart() throws Exception { super.doStart(); BasicCacheContainer cacheContainer = configuration.getCacheContainer(); cache = InfinispanUtil.getCache(configuration.getCacheContainer(), configuration.getCacheName()); if (configuration.hasQueryBuilder()) { if (InfinispanUtil.isRemote(cache)) { RemoteCache<Object, Object> remoteCache = InfinispanUtil.asRemote(cache); Query query = InfinispanRemoteOperation.buildQuery(configuration.getQueryBuilder(), remoteCache); continuousQuery = Search.getContinuousQuery(remoteCache); continuousQuery.addContinuousQueryListener(query, new ContinuousQueryEventListener(cache.getName())); } else { throw new IllegalArgumentException("Can't run continuous queries against embedded cache (" + cache.getName() + ")"); } } else { if (InfinispanUtil.isEmbedded(cacheContainer)) { consumerHandler = InfinispanConsumerEmbeddedHandler.INSTANCE; } else if (InfinispanUtil.isRemote(cacheContainer)) { consumerHandler = InfinispanConsumerRemoteHandler.INSTANCE; } else { throw new UnsupportedOperationException("CacheContainer of type " + cacheContainer.getClass().getName() + " not supported"); } listener = consumerHandler.start(this); } }
Source:
<code>public Matrix4 setToRotation(final Axis axis, double angle) { if (angle == 0) return identity(); <START> return setAll(mQuat.fromAngleAxis(axis, angle)); <END> }</code><technical_language>return angle == 0 ? identity() : setAll(mQuat.fromAngleAxis(axis, angle));</technical_language>

Target:
public Matrix4 setToRotation(final Axis axis, double angle) { return angle == 0 ? identity() : setAll(mQuat.fromAngleAxis(axis, angle)); }
Source:
<code><START> protected boolean validate() { <END> final boolean result = validateImpl(); if (!result && !isInternalExecution() && !getParameters().isRerun()) { logValidationFailed(); } return result; }</code><technical_language>do making this method final? descendants override correct method (validateImpl()) instead of validate()</technical_language>

Target:
protected final boolean validate() { final boolean result = validateImpl(); if (!result && !isInternalExecution() && !getParameters().isRerun()) { logValidationFailed(); } return result; }
Source:
<code>public void setIndexingPolicy(IndexingPolicy indexingPolicy) { if (indexingPolicy == null) { throw new IllegalArgumentException("IndexingPolicy cannot be null."); } this.indexingPolicy = indexingPolicy; <START> setProperty(this, Constants.Properties.INDEXING_POLICY, this.indexingPolicy); <END> }</code><technical_language>@kushagraThapar @Blackbaud-EricSlater is a test in com.azure.cosmos.CosmosContainerTest.replace validating replace scenario. this test is broken</technical_language>

Target:
public void setIndexingPolicy(IndexingPolicy indexingPolicy) { if (indexingPolicy == null) { throw new IllegalArgumentException("IndexingPolicy cannot be null."); } this.indexingPolicy = indexingPolicy; }
Source:
<code>public boolean apply(Game game, Ability source) { Player targetPlayer = game.getPlayer(this.getTargetPointer().getFirst(game, source)); if (targetPlayer == null || targetPlayer.getHand().isEmpty()) { return false; } if (targetPlayer.getHand().count(StaticFilters.FILTER_CARD_ARTIFACT, game) < 1 <START> || !targetPlayer.chooseUse(outcome, "Discard an artifact card?", source, game)) { <END> return !targetPlayer.discard(2, false, source, game).isEmpty(); } TargetDiscard target = new TargetDiscard(StaticFilters.FILTER_CARD_ARTIFACT_AN, targetPlayer.getId()); targetPlayer.choose(Outcome.Discard, target, source.getSourceId(), game); Card card = targetPlayer.getHand().get(target.getFirstTarget(), game); if (card != null && targetPlayer.discard(card, source, game)) { return true; } return !targetPlayer.discard(2, false, source, game).isEmpty(); }</code><technical_language>Outcome.Benefit (AI try discard 1 card instead 2)</technical_language>

Target:
public boolean apply(Game game, Ability source) { Player targetPlayer = game.getPlayer(this.getTargetPointer().getFirst(game, source)); if (targetPlayer == null || targetPlayer.getHand().isEmpty()) { return false; } if (targetPlayer.getHand().count(StaticFilters.FILTER_CARD_ARTIFACT, game) < 1 || !targetPlayer.chooseUse(Outcome.Benefit, "Discard an artifact card?", source, game)) { return !targetPlayer.discard(2, false, source, game).isEmpty(); } TargetDiscard target = new TargetDiscard(StaticFilters.FILTER_CARD_ARTIFACT_AN, targetPlayer.getId()); targetPlayer.choose(Outcome.Discard, target, source.getSourceId(), game); Card card = targetPlayer.getHand().get(target.getFirstTarget(), game); if (card != null && targetPlayer.discard(card, source, game)) { return true; } return !targetPlayer.discard(2, false, source, game).isEmpty(); }
Source:
<code>public Map toMap() { <START> Map map = super.toMap(); <END> map.put(TYPE, type.name()); return map; }</code><technical_language>reason for explicitly invoking super.toMap()</technical_language>

Target:
public Map<String, Object> toMap() { Map map = super.toMap(); map.put(TYPE, type.name()); return map; }
Source:
<code>public Config() { <START> this(null, org.voltdb.VoltDB.DEFAULT_INTERNAL_PORT); <END> acceptor = org.voltdb.probe.MeshProber.builder() .coordinators(":" + internalPort) .build(); }</code><technical_language>This fix anything. voltdb leaking voltcore harder notice</technical_language>

Target:
public Config() { this(null, org.voltcore.common.Constants.DEFAULT_INTERNAL_PORT); acceptor = org.voltdb.probe.MeshProber.builder() .coordinators(":" + internalPort) .build(); }
Source:
<code>private <T> SortedMap<Cell, T> postFilterRows( TableReference tableRef, List<RowResult<Value>> rangeRows, Function<Value, T> transformer) { ensureUncommitted(); if (rangeRows.isEmpty()) { return ImmutableSortedMap.of(); } Map<Cell, Value> rawResults = Maps.newHashMapWithExpectedSize(estimateSize(rangeRows)); for (RowResult<Value> rowResult : rangeRows) { for (Map.Entry<byte[], Value> e : rowResult.getColumns().entrySet()) { rawResults.put(Cell.create(rowResult.getRowName(), e.getKey()), e.getValue()); } } return getWithPostFiltering( tableRef, rawResults, <START> input -> ImmutableSortedMap.<Cell, T>naturalOrder().putAll(input).build(), <END> transformer); }</code><technical_language>ImmutableSet.copyOf</technical_language>

Target:
private <T> SortedMap<Cell, T> postFilterRows( TableReference tableRef, List<RowResult<Value>> rangeRows, Function<Value, T> transformer) { ensureUncommitted(); if (rangeRows.isEmpty()) { return ImmutableSortedMap.of(); } Map<Cell, Value> rawResults = Maps.newHashMapWithExpectedSize(estimateSize(rangeRows)); for (RowResult<Value> rowResult : rangeRows) { for (Map.Entry<byte[], Value> e : rowResult.getColumns().entrySet()) { rawResults.put(Cell.create(rowResult.getRowName(), e.getKey()), e.getValue()); } } return ImmutableSortedMap.copyOf(getWithPostFilteringSync(tableRef, rawResults, transformer)); }
Source:
<code>public void run() { if ( !moveToRunningState() ) { return; } try { applicationProcess.pauseApplier( OPERATION_NAME ); while ( keepRunning ) { try { downloader.downloadSnapshot( addressProvider ); break; } catch ( StoreCopyFailedException e ) { log.error( format( "Failed to download snapshot. Retrying in %s ms.", timeout.getMillis() ), e ); } Thread.sleep( timeout.getMillis() ); timeout.increment(); } } catch ( InterruptedException e ) { <START> Thread.interrupted(); <END> log.error( "Persistent snapshot downloader was interrupted" ); } finally { applicationProcess.resumeApplier( OPERATION_NAME ); state = State.COMPLETED; } }</code><technical_language>I this line nothing. Thread.currentThread().interrupt() if intention is restore interruption status</technical_language>

Target:
public void run() { if ( !moveToRunningState() ) { return; } try { applicationProcess.pauseApplier( OPERATION_NAME ); while ( keepRunning && !downloader.downloadSnapshot( addressProvider ) ) { Thread.sleep( timeout.getMillis() ); timeout.increment(); } } catch ( InterruptedException e ) { Thread.currentThread().interrupt(); log.warn( "Persistent snapshot downloader was interrupted" ); } catch ( DatabaseShutdownException e ) { log.warn( "Store copy aborted due to shut down", e ); } catch ( Throwable e ) { log.error( "Unrecoverable error during store copy", e ); dbHealth.get().panic( e ); } finally { applicationProcess.resumeApplier( OPERATION_NAME ); state = State.COMPLETED; } }
Source:
<code>public ResourcesEntry(int quark, LttngKernelTrace trace, String name, long startTime, long endTime, Type type, int id) { <START> super(quark, trace, name, startTime, endTime); <END> fId = id; fType = type; }</code><technical_language>prefer store quark a member of this class a getQuark method</technical_language>

Target:
public ResourcesEntry(int quark, LttngKernelTrace trace, String name, long startTime, long endTime, Type type, int id) { super(quark, trace, name, startTime, endTime); fId = id; fType = type; fQuark = quark; }
Source:
<code>private void showListOfPackages(final boolean includeDefaultPackage, final Command packagesLoadedCommand) { final Module activeModule = projectContext.getActiveModule().orElse(null); if (activeModule == null) { return; } else { moduleService.call((Set<Package> pkgs) -> { moduleService.call((Package activePackage) -> { final List<Package> sortedPackages = getPackages(includeDefaultPackage, pkgs); <START> if (sortedPackages.size() == 0) { <END> return; } addPackagesToSelect(sortedPackages, activePackage); if (packagesLoadedCommand != null) { packagesLoadedCommand.execute(); } }).resolveDefaultWorkspacePackage(activeModule); }).resolvePackages(activeModule); } }</code><technical_language>optional nitpick: simplify list.size() == 0 -> list.isEmpty()</technical_language>

Target:
private void showListOfPackages(final boolean includeDefaultPackage, final Command packagesLoadedCommand) { final Module activeModule = projectContext.getActiveModule().orElse(null); if (activeModule == null) { return; } else { moduleService.call((Set<Package> pkgs) -> { moduleService.call((Package activePackage) -> { final List<Package> sortedPackages = getPackages(includeDefaultPackage, pkgs); if (sortedPackages.isEmpty()) { return; } addPackagesToSelect(sortedPackages, activePackage); if (packagesLoadedCommand != null) { packagesLoadedCommand.execute(); } }).resolveDefaultWorkspacePackage(activeModule); }).resolvePackages(activeModule); } }
Source:
<code>public ClientOptions setApplicationId(String applicationId) { <START> if (!CoreUtils.isNullOrEmpty(applicationId)) { <END> if (applicationId.length() > MAX_APPLICATION_ID_LENGTH) { throw logger .logExceptionAsError(new IllegalArgumentException("'applicationId' length cannot be greater than " + MAX_APPLICATION_ID_LENGTH)); } else if (applicationId.contains(" ")) { throw logger .logExceptionAsError(new IllegalArgumentException("'applicationId' must not contain a space.")); } else { this.applicationId = applicationId; } } return this; }</code><technical_language>nit: a fan of multiple nested if statements harder read if necessary. bounce early? java if (CoreUtils.isNullorEmpty(applicationId)) { return this; } ... // other stuff</technical_language>

Target:
public ClientOptions setApplicationId(String applicationId) { if (CoreUtils.isNullOrEmpty(applicationId)) { this.applicationId = applicationId; return this; } if (applicationId.length() > MAX_APPLICATION_ID_LENGTH) { throw logger .logExceptionAsError(new IllegalArgumentException("'applicationId' length cannot be greater than " + MAX_APPLICATION_ID_LENGTH)); } else if (applicationId.contains(" ")) { throw logger .logExceptionAsError(new IllegalArgumentException("'applicationId' must not contain a space.")); } else { this.applicationId = applicationId; } return this; }
Source:
<code>public final void init() { preInit(); controls = new LinkedHashMap<SWTGridCell, Control>(); if (getViewModelContext() != null) { listener = new ModelChangeListener() { @Override public void notifyChange(ModelChangeNotification notification) { if (!renderingFinished) { return; } if (notification.getRawNotification().isTouch()) { return; } if (notification.getNotifier() != getVElement()) { return; } if (notification.getStructuralFeature() == VViewPackage.eINSTANCE.getElement_Visible()) { applyVisible(); } if (notification.getStructuralFeature() == VViewPackage.eINSTANCE.getElement_Enabled() && !getVElement().isReadonly()) { applyEnable(); } if (notification.getStructuralFeature() == VViewPackage.eINSTANCE .getElement_Diagnostic()) { applyValidation(); final VDiagnostic newDia = (VDiagnostic) notification.getRawNotification().getNewValue(); final VDiagnostic oldDia = (VDiagnostic) notification.getRawNotification().getOldValue(); final List<Object> diff = new ArrayList<Object>(); if (newDia != null) { diff.addAll(newDia.getDiagnostics()); } if (oldDia != null) { diff.removeAll(oldDia.getDiagnostics()); } final List<Object> diff2 = new ArrayList<Object>(); if (oldDia != null) { diff2.addAll(oldDia.getDiagnostics()); } if (newDia != null) { diff2.removeAll(newDia.getDiagnostics()); } diff.addAll(diff2); final Set<Object> toUpdate = new LinkedHashSet<Object>(); for (final Object o : diff) { final EObject toAdd = (EObject) Diagnostic.class.cast(o).getData().get(0); toUpdate.add(toAdd); <START> EObject parent = toAdd.eContainer(); <END> while (parent != null) { toUpdate.add(parent); parent = parent.eContainer(); } } applyValidation(toUpdate.toArray()); } } }; getViewModelContext().registerViewChangeListener(listener); } getViewModelContext().addContextUser(this); postInit(); }</code><technical_language>Problem is tree necessarily reflect containment hierarchy. miss elements</technical_language>

Target:
public final void init() { preInit(); controls = new LinkedHashMap<SWTGridCell, Control>(); if (getViewModelContext() != null) { listener = new ModelChangeListener() { @Override public void notifyChange(ModelChangeNotification notification) { if (!renderingFinished) { return; } if (notification.getRawNotification().isTouch()) { return; } if (notification.getNotifier() != getVElement()) { return; } if (notification.getStructuralFeature() == VViewPackage.eINSTANCE.getElement_Visible()) { applyVisible(); } if (notification.getStructuralFeature() == VViewPackage.eINSTANCE.getElement_Enabled() && !getVElement().isReadonly()) { applyEnable(); } if (notification.getStructuralFeature() == VViewPackage.eINSTANCE .getElement_Diagnostic()) { applyValidation(); final VDiagnostic newDia = (VDiagnostic) notification.getRawNotification().getNewValue(); final VDiagnostic oldDia = (VDiagnostic) notification.getRawNotification().getOldValue(); applyValidation(oldDia, newDia); } } }; getViewModelContext().registerViewChangeListener(listener); } getViewModelContext().addContextUser(this); postInit(); }
Source:
<code>public static void main(String[] args) { NotificationProperties prop = null; NotificationService notificationService = null; EngineMonitorService engineMonitorService = null; try { prop = NotificationProperties.getInstance(); if (prop.isConfigured(LOG_LEVEL)) { <START> JavaLoggingUtils.setLogLevel(prop.getProperty(LOG_LEVEL)); <END> } prop.validate(); notificationService = new NotificationService(prop); engineMonitorService = new EngineMonitorService(prop); notificationService.registerTransport(new Smtp(prop)); notificationService.registerTransport(new Snmp(prop)); if (!notificationService.hasTransports()) { throw new RuntimeException( "No transport is enabled, please enable at least one of SMTP (using MAIL_SERVER option)" + " or SNMP (using SNMP_MANAGERS option) transports."); } } catch (Exception ex) { log.error("Failed to initialize", ex); System.err.println(ex.getMessage()); System.exit(1); } if (args != null && args.length > 0 && ARG_VALIDATE.equals(args[0])) { System.exit(0); } try { notificationService.run(); engineMonitorService.run(); } catch (Exception e) { log.error("Failed to run the event notification service. ", e); System.exit(1); } }</code><technical_language>change default empty INFO use</technical_language>

Target:
public static void main(String[] args) { NotificationProperties prop = null; NotificationService notificationService = null; EngineMonitorService engineMonitorService = null; try { prop = NotificationProperties.getInstance(); JavaLoggingUtils.setLogLevel(prop.getProperty(LOG_LEVEL)); prop.validate(); notificationService = new NotificationService(prop); engineMonitorService = new EngineMonitorService(prop); notificationService.registerTransport(new Smtp(prop)); notificationService.registerTransport(new Snmp(prop)); if (!notificationService.hasTransports()) { throw new RuntimeException( "No transport is enabled, please enable at least one of SMTP (using MAIL_SERVER option)" + " or SNMP (using SNMP_MANAGERS option) transports."); } } catch (Exception ex) { log.error("Failed to initialize", ex); System.err.println(ex.getMessage()); System.exit(1); } if (args != null && args.length > 0 && ARG_VALIDATE.equals(args[0])) { System.exit(0); } try { notificationService.run(); engineMonitorService.run(); } catch (Exception e) { log.error("Failed to run the event notification service. ", e); System.exit(1); } }
Source:
<code>private static void updateStepMessage(CommandBase<?> cmd, Guid vdsForExecution) { StepEnum stepEnum = null; try { stepEnum = StepEnum.valueOf(cmd.getCommandStep().toString() + "_ON_HOST"); } catch (IllegalArgumentException e) { } <START> if (stepEnum != null) { <END> Step step = cmd.getExecutionContext().getStep(); Map<String, String> jobProperties = cmd.getJobMessageProperties(); jobProperties.put("VDS", getVdsDao().get(vdsForExecution).getName()); step.setDescription(ExecutionMessageDirector.resolveStepMessage(stepEnum, jobProperties)); getStepDao().update(step); } }</code><technical_language>returning catch, this check is longer needed</technical_language>

Target:
private static void updateStepMessage(CommandBase<?> cmd, Guid vdsForExecution) { StepEnum stepEnum = null; try { stepEnum = StepEnum.valueOf(cmd.getCommandStep().toString() + "_ON_HOST"); } catch (IllegalArgumentException e) { log.debug("No StepEnum found for "+cmd.getCommandStep().toString() + "_ON_HOST"); return; } Step step = cmd.getExecutionContext().getStep(); Map<String, String> jobProperties = cmd.getJobMessageProperties(); jobProperties.put("VDS", getVdsDao().get(vdsForExecution).getName()); step.setDescription(ExecutionMessageDirector.resolveStepMessage(stepEnum, jobProperties)); getStepDao().update(step); }
Source:
<code>protected void setUp() throws Exception { super.setUp(); getContext().getCacheDir(); System.setProperty("dexmaker.dexcache", getContext().getCacheDir().getPath()); getContext().getCacheDir(); <START> System.setProperty("dexmaker.dexcache", getContext().getCacheDir().getPath()); <END> }</code><technical_language>setting property twice? #Closed</technical_language>

Target:
protected void setUp() throws Exception { super.setUp(); getContext().getCacheDir(); System.setProperty("dexmaker.dexcache", getContext().getCacheDir().getPath()); }
Source:
<code><START> public SearchResult search(String catalogId, String field, String term, int rows) { <END> loadOPACConfiguration(catalogId); HashMap<String, String> searchFields = new HashMap<>(); searchFields.put(field, term); return search(catalogId, searchFields, rows); }</code><technical_language>question above... put search field in a map call other method ;)</technical_language>

Target:
public SearchResult search(String catalogId, String field, String term, int rows) { loadOPACConfiguration(catalogId); HashMap<String, String> searchFields = new HashMap<>(); searchFields.put(field, term); return search(catalogId, searchFields); }
Source:
<code>public void updateVendorThingID(@NonNull String newVendorThingID, @NonNull String newPassword) throws ThingIFException { <START> thingIfApi.updateVendorThingID(newVendorThingID, newPassword); <END> }</code><technical_language>Adding this a field is good manner</technical_language>

Target:
public void updateVendorThingID(@NonNull String newVendorThingID, @NonNull String newPassword) throws ThingIFException { this.thingIfApi.updateVendorThingID(newVendorThingID, newPassword); }
Source:
<code>public void shouldCreateACondition() throws Exception { long originalCount = getAllCount(); SimpleObject conditionSource = new SimpleObject(); conditionSource.add("condition_id", 2); conditionSource.add("additional_detail", ""); conditionSource.add("condition_coded", 1); conditionSource.add("clinical_status", "ACTIVE"); conditionSource.add("verification_status", "CONFIRMED"); conditionSource.add("onset_date", "2018-02-20 00:00:00.0"); String json = new ObjectMapper().writeValueAsString(conditionSource); MockHttpServletRequest req = request(RequestMethod.POST, getURI()); req.setContent(json.getBytes()); SimpleObject newConditionSource = deserialize(handle(req)); Assert.assertNotNull(PropertyUtils.getProperty(newConditionSource, "uuid")); <START> Assert.assertEquals(originalCount + 1, getAllCount()); <END> }</code><technical_language>assert property values created above? way, is more creating a condition, expected values too</technical_language>

Target:
public void shouldCreateACondition() throws Exception { CodedOrFreeText cond = new CodedOrFreeText(); cond.setNonCoded("Some condition"); SimpleObject conditionSource = new SimpleObject(); conditionSource.add("condition", cond); conditionSource.add("patient", patient.getUuid()); conditionSource.add("clinicalStatus", ConditionClinicalStatus.ACTIVE); conditionSource.add("verificationStatus", ConditionVerificationStatus.CONFIRMED); conditionSource.add("onsetDate", "2017-01-12 00:00:00"); String json = new ObjectMapper().writeValueAsString(conditionSource); MockHttpServletRequest req = request(RequestMethod.POST, getURI()); req.setContent(json.getBytes()); MockHttpServletResponse res = handle(req); SimpleObject newConditionSource = deserialize(res); String uuid = newConditionSource.get("uuid"); LinkedHashMap nonCoded = newConditionSource.get("condition"); LinkedHashMap patient = newConditionSource.get("patient"); Assert.assertNotNull(conditionService.getConditionByUuid(uuid)); Condition condition = conditionService.getConditionByUuid(uuid); Assert.assertEquals(nonCoded.get("nonCoded"), condition.getCondition().getNonCoded()); Assert.assertEquals(patient.get("uuid"), condition.getPatient().getUuid()); Assert.assertEquals(newConditionSource.get("clinicalStatus"), condition.getClinicalStatus().toString()); Assert.assertEquals(newConditionSource.get("verificationStatus"), condition.getVerificationStatus().toString()); Assert.assertNotNull(newConditionSource.get("onsetDate")); }
Source:
<code>private String getDurationTime(IRepositoryElement element) { if (element instanceof IRepositoryQuery) { RepositoryQuery query = (RepositoryQuery) element; long duration_max = parseLongFromString(query.getAttribute("duration_max")); if (duration_max > 2 * 60 * 1000) { long duration_min = parseLongFromString(query.getAttribute("duration_min")); long duration_avg = parseLongFromString(query.getAttribute("duration_avg")); long duration_anz = parseLongFromString(query.getAttribute("duration_anz")); String erg = "Min: " + (duration_min == 0 ? "" : "" + duration_min / 1000 + "s") + " Max: " + (duration_max == 0 ? "" : "" + duration_max / 1000 + "s") <START> + " Anz: " + (duration_anz == 0 ? "" : "" + duration_anz) END> + " Avg: " + (duration_avg == 0 ? "" : "" + duration_avg / 1000 + "s"); return erg; } } return null; }</code><technical_language>Again, I "Anz" is a standard term in English. this externalized</technical_language>

Target:
private String getDurationTime(IRepositoryElement element) { if (element instanceof IRepositoryQuery) { RepositoryQuery query = (RepositoryQuery) element; long duration_max = parseLongFromString(query.getAttribute("org.eclipse.mylyn.duration.duration_max")); if (duration_max > 0 && duration_max < 3 * 60 * 1000) { long duration_min = parseLongFromString(query.getAttribute("org.eclipse.mylyn.duration.duration_min")); long duration_avg = parseLongFromString(query.getAttribute("org.eclipse.mylyn.duration.duration_avg")); long duration_count = parseLongFromString(query.getAttribute("org.eclipse.mylyn.duration.duration_count")); String erg = "Min: " + (duration_min == 0 ? "" : (duration_min < 1000 ? "<1" : "" + duration_min / 1000) + "s") + " Max: " + (duration_max == 0 ? "" : (duration_max < 1000 ? "<1" : "" + duration_max / 1000) + "s") + " Count: " + (duration_count == 0 ? "" : "" + duration_count) + " Avg: " + (duration_avg == 0 ? "" : "" + (duration_avg < 1000 ? "<1" : "" + duration_avg / 1000) + "s"); return erg; } } return null; }
Source:
<code>public final void sync(ContentResolver contentResolver, SyncResult syncResult, ContentProviderClient providerClient) throws Throwable { boolean okToProceedSync = beforeSyncStarted(contentResolver, syncResult, providerClient); if(!okToProceedSync) { <START> LOG.w("Skipping synchronization for %s", this.getClass().getName()); <END> return; } String syncToken = SyncAdapter.getLastSyncToken(providerClient, dbTable); IncrementalSyncResponse<T> response; do { RequestFuture<IncrementalSyncResponse<T>> future = RequestFuture.newFuture(); createRequest(syncToken, future, future); response = future.get(); ArrayList<ContentProviderOperation> ops = getUpdateOps(response.results, syncResult); providerClient.applyBatch(ops); LOG.i("Updated page of %s (%d db ops)", resourceType, ops.size()); syncToken = response.syncToken; } while (response.more); SyncAdapter.storeSyncToken(providerClient, dbTable, response.syncToken); afterSyncFinished(contentResolver, syncResult, providerClient); }</code><technical_language>getClass().getSimpleName() instead for this, getName() is fully-qualified verbose name</technical_language>

Target:
public final void sync(ContentResolver contentResolver, SyncResult syncResult, ContentProviderClient providerClient) throws Throwable { boolean okToProceedSync = beforeSyncStarted(contentResolver, syncResult, providerClient); if(!okToProceedSync) { LOG.w("Skipping synchronization for %s", this.getClass().getSimpleName()); return; } String syncToken = SyncAdapter.getLastSyncToken(providerClient, dbTable); LOG.i("Using sync token `%s`", syncToken); IncrementalSyncResponse<T> response; do { RequestFuture<IncrementalSyncResponse<T>> future = RequestFuture.newFuture(); createRequest(syncToken, future, future); response = future.get(); ArrayList<ContentProviderOperation> ops = getUpdateOps(response.results, syncResult); providerClient.applyBatch(ops); LOG.i("Updated page of %s (%d db ops)", resourceType, ops.size()); syncToken = response.syncToken; } while (response.more); LOG.i("Saving new sync token `%s`", syncToken); SyncAdapter.storeSyncToken(providerClient, dbTable, response.syncToken); afterSyncFinished(contentResolver, syncResult, providerClient); }
Source:
<code>private byte[] makeRequest(byte[] requestPayload) throws TTransportException, IOException { String encoded = Base64.encodeBase64String(requestPayload); StringEntity requestEntity = new StringEntity( encoded, ContentType.create(HttpHeaders.APPLICATION_X_FRUGAL_HEADER, HttpHeaders.CONTENT_TYPE)); HttpPost request = new HttpPost(url); request.setHeader(HttpHeaders.ACCEPT_HEADER, HttpHeaders.APPLICATION_X_FRUGAL_HEADER); request.setHeader(HttpHeaders.CONTENT_TRANSFER_ENCODING_HEADER, HttpHeaders.CONTENT_TRANSFER_ENCODING); if (responseSizeLimit > 0) { request.setHeader(HttpHeaders.X_FRUGAL_PAYLOAD_LIMIT_HEADER, Integer.toString(responseSizeLimit)); } request.setEntity(requestEntity); CloseableHttpResponse response = httpClient.execute(request); String responseBody = ""; try { int status = response.getStatusLine().getStatusCode(); if (status == HttpStatus.SC_REQUEST_TOO_LONG) { <START> throw new FMessageSizeException(FTransport.RESPONSE_TOO_LARGE, <END> "response was too large for the transport"); } if (status >= 300) { throw new TTransportException("Error: " + response.getStatusLine().toString()); } HttpEntity responseEntity = response.getEntity(); if (responseEntity != null) { responseBody = EntityUtils.toString(responseEntity, "utf-8"); } EntityUtils.consume(responseEntity); } finally { response.close(); } return Base64.decodeBase64(responseBody); }</code><technical_language>pretty this change based response codes changed</technical_language>

Target:
private byte[] makeRequest(byte[] requestPayload) throws TTransportException, IOException { String encoded = Base64.encodeBase64String(requestPayload); StringEntity requestEntity = new StringEntity( encoded, ContentType.create(HttpHeaders.APPLICATION_X_FRUGAL_HEADER, HttpHeaders.CONTENT_TYPE)); HttpPost request = new HttpPost(url); request.setHeader(HttpHeaders.ACCEPT_HEADER, HttpHeaders.APPLICATION_X_FRUGAL_HEADER); request.setHeader(HttpHeaders.CONTENT_TRANSFER_ENCODING_HEADER, HttpHeaders.CONTENT_TRANSFER_ENCODING); if (responseSizeLimit > 0) { request.setHeader(HttpHeaders.X_FRUGAL_PAYLOAD_LIMIT_HEADER, Integer.toString(responseSizeLimit)); } request.setEntity(requestEntity); CloseableHttpResponse response = httpClient.execute(request); String responseBody = ""; try { int status = response.getStatusLine().getStatusCode(); if (status >= 300) { throw new TTransportException("Error: " + response.getStatusLine().toString()); } HttpEntity responseEntity = response.getEntity(); if (responseEntity != null) { responseBody = EntityUtils.toString(responseEntity, "utf-8"); } EntityUtils.consume(responseEntity); } finally { response.close(); } return Base64.decodeBase64(responseBody); }
Source:
<code>public static SQLContext getSqlContext() { <START> return SparkSession.builder().appName("Java Spark Tests").master("local[2]") <END> .config("spark.ui.showConsoleProgress", false).getOrCreate().sqlContext(); }</code><technical_language>nit: Extract strings static final member variables</technical_language>

Target:
public static SQLContext getSqlContext() { return SparkSession.builder().appName(APP_NAME).master(NUM_EXECUTORS) .config(UI_SHOW_CONSOLE_PROGRESS, false).getOrCreate().sqlContext(); }
Source:
<code>public ValidationResult isDomainWithinThresholds() { StorageDomainDynamic dynamic = storageDomain.getStorageDynamicData(); <START> if (dynamic != null && dynamic.getfreeDiskInGB() > getLowDiskSpaceThreshold()) { <END> return new ValidationResult(VdcBllMessages.ACTION_TYPE_FAILED_DISK_SPACE_LOW_ON_TARGET_STORAGE_DOMAIN, storageName()); } return ValidationResult.VALID; }</code><technical_language>nan</technical_language>

Target:
public ValidationResult isDomainWithinThresholds() { StorageDomainDynamic dynamic = storageDomain.getStorageDynamicData(); if (dynamic != null && dynamic.getfreeDiskInGB() < getLowDiskSpaceThreshold()) { return new ValidationResult(VdcBllMessages.ACTION_TYPE_FAILED_DISK_SPACE_LOW_ON_TARGET_STORAGE_DOMAIN, storageName()); } return ValidationResult.VALID; }
Source:
<code>private void assertValueUnchecked(Block rowBlock, int internalPosition, List<Object> row) { requireNonNull(row, "row is null"); assertFalse(rowBlock.isNullUnchecked(internalPosition)); SingleRowBlock singleRowBlock = (SingleRowBlock) rowBlock.getBlockUnchecked(internalPosition); assertEquals(singleRowBlock.getPositionCount(), row.size()); for (int i = 0; i < row.size(); i++) { Object fieldValue = row.get(i); if (fieldValue == null) { assertTrue(singleRowBlock.isNullUnchecked(i + singleRowBlock.getOffsetBase())); } else { if (fieldValue instanceof Long) { assertEquals(BIGINT.getLongUnchecked(singleRowBlock, i + singleRowBlock.getOffsetBase()), ((Long) fieldValue).longValue()); } else if (fieldValue instanceof String) { assertEquals(VARCHAR.getSliceUnchecked(singleRowBlock, i + singleRowBlock.getOffsetBase()), utf8Slice((String) fieldValue)); } else { <START> throw new IllegalArgumentException(); <END> } } } }</code><technical_language>nit: reason fail("Unexpected type: " + fieldValue.getClass().getSimpleName())</technical_language>

Target:
private void assertValueUnchecked(Block rowBlock, int internalPosition, List<Object> row) { requireNonNull(row, "row is null"); assertFalse(rowBlock.isNullUnchecked(internalPosition)); SingleRowBlock singleRowBlock = (SingleRowBlock) rowBlock.getBlockUnchecked(internalPosition); assertEquals(singleRowBlock.getPositionCount(), row.size()); for (int i = 0; i < row.size(); i++) { Object fieldValue = row.get(i); if (fieldValue == null) { assertTrue(singleRowBlock.isNullUnchecked(i + singleRowBlock.getOffsetBase())); } else { if (fieldValue instanceof Long) { assertEquals(BIGINT.getLongUnchecked(singleRowBlock, i + singleRowBlock.getOffsetBase()), ((Long) fieldValue).longValue()); } else if (fieldValue instanceof String) { assertEquals(VARCHAR.getSliceUnchecked(singleRowBlock, i + singleRowBlock.getOffsetBase()), utf8Slice((String) fieldValue)); } else { fail("Unexpected type: " + fieldValue.getClass().getSimpleName()); } } } }
Source:
<code>private Disk getUnregisteredDisk() { QueryReturnValue queryReturnValue = backend.runInternalQuery(QueryType.GetUnregisteredDisk, new GetUnregisteredDiskQueryParameters( getParameters().getDiskId(), getParameters().getStorageDomainId(), getStoragePoolId()) ); if (queryReturnValue.getSucceeded()) { return queryReturnValue.getReturnValue(); } log.error("Failed to find unregistered disk with the following ID '{}' in storage domain '{}'", getParameters().getDiskId(), <START> getParameters().getStorageDomainId()); <END> return null; }</code><technical_language>represent name</technical_language>

Target:
private Disk getUnregisteredDisk() { QueryReturnValue queryReturnValue = backend.runInternalQuery(QueryType.GetUnregisteredDisk, new GetUnregisteredDiskQueryParameters( getParameters().getDiskId(), getParameters().getStorageDomainId(), getStoragePoolId()) ); if (queryReturnValue.getSucceeded()) { return queryReturnValue.getReturnValue(); } log.error("Failed to find unregistered disk with the following ID '{}' in storage domain '{}'", getParameters().getDiskId(), getStorageDomain().getName()); return null; }
Source:
<code>private com.google.longrunning.Operation snapshotTable(String snapshotName, TableName tableName) throws IOException { <START> BigtableClusterName clusterName = this.connection.getSession().getClusterName(); <END> BigtableInstanceName instanceName = options.getInstanceName(); BigtableTableName btTableName = instanceName.toTableName(tableName.getNameAsString()); return bigtableTableAdminClient.snapshotTable(SnapshotTableRequest.newBuilder() .setCluster(clusterName.getClusterName()) .setSnapshotId(snapshotName) .setName(btTableName.toString()) .build()); }</code><technical_language>BigtableClusterName BigtableInstanceName places? V1 V2 names? If V2 name get InstanceName ClusterName</technical_language>

Target:
private Operation snapshotTable(String snapshotName, TableName tableName) throws IOException { return bigtableTableAdminClient.snapshotTable(SnapshotTableRequest.newBuilder() .setCluster(getClusterName().toString()) .setSnapshotId(snapshotName) .setName(options.getInstanceName().toTableNameStr(tableName.getNameAsString())) .build()); }
Source:
<code>private static boolean isElementIsReferencedInScript(final Expression expr, final EObject element) { if (!expr.getReferencedElements().isEmpty()) { for (final EObject o : expr.getReferencedElements()) { if (EcoreUtil.equals(element, o)) { return true; } if (element instanceof Element && o instanceof Element && ModelHelper.isSameElement(element, o)) { <START> return true && !ModelHelper.isReferencedElementIsInExpression(expr); <END> } else { if (element instanceof Parameter && o instanceof Parameter && ((Parameter) element).getName().equals(((Parameter) o).getName())) { return true && !ModelHelper.isReferencedElementIsInExpression(expr); } } } } return false; }</code><technical_language>"true &&" surely removed</technical_language>

Target:
private static boolean isElementIsReferencedInScript(final Expression expr, final EObject element) { if (!expr.getReferencedElements().isEmpty()) { for (final EObject o : expr.getReferencedElements()) { if (EcoreUtil.equals(element, o)) { return true; } if (element instanceof Element && o instanceof Element && ModelHelper.isSameElement(element, o)) { return !ModelHelper.isReferencedElementIsInExpression(expr); } else { if (element instanceof Parameter && o instanceof Parameter && ((Parameter) element).getName().equals(((Parameter) o).getName())) { return !ModelHelper.isReferencedElementIsInExpression(expr); } } } } return false; }
Source:
<code>public Datastream get(String name) { Datastream stream = null; <START> try { <END> _dynamicMetricsManager.createOrUpdateMeter(CLASS_NAME, GET_CALL, 1); stream = _store.getDatastream(name); } catch (Exception e) { _dynamicMetricsManager.createOrUpdateMeter(CLASS_NAME, CALL_ERROR, 1); _errorLogger.logAndThrowRestLiServiceException(HttpStatus.S_500_INTERNAL_SERVER_ERROR, "Get datastream failed for datastream: " + name, e); } if (stream == null) { _errorLogger.logAndThrowRestLiServiceException(HttpStatus.S_404_NOT_FOUND, "Datastream not found: " + name); } return stream; }</code><technical_language>nit: this log? Get called? I this log for other operations perform (stop, resume, pause, etc), helpful if server is receiving Get requests if some failures</technical_language>

Target:
public Datastream get(String name) { Datastream stream = null; try { LOG.info("Get datastream called for datastream {}", name); _dynamicMetricsManager.createOrUpdateMeter(CLASS_NAME, GET_CALL, 1); stream = _store.getDatastream(name); } catch (Exception e) { _dynamicMetricsManager.createOrUpdateMeter(CLASS_NAME, CALL_ERROR, 1); _errorLogger.logAndThrowRestLiServiceException(HttpStatus.S_500_INTERNAL_SERVER_ERROR, "Get datastream failed for datastream: " + name, e); } if (stream == null) { _errorLogger.logAndThrowRestLiServiceException(HttpStatus.S_404_NOT_FOUND, "Datastream not found: " + name); } return stream; }
Source:
<code>public void cancelStreamedResponseTest() throws Throwable { <START> createClientAndCancelAfterN(0); <END> createClientAndCancelAfterN(1); createClientAndCancelAfterN(10); try (AsyncHttpClient c = asyncHttpClient()) { assertEquals(c.preparePost(getTargetUrl()).setBody("Hello").execute().get().getResponseBody(), "Hello"); } }</code><technical_language>This test is wrong. closing recreating a client instance in step. purpose of this test is check a client instance recovers cancellations</technical_language>

Target:
public void cancelStreamedResponseTest() throws Throwable { try (AsyncHttpClient c = asyncHttpClient()) { c.preparePost(getTargetUrl()).setBody(LARGE_IMAGE_BYTES).execute(new CancellingStreamedAsyncProvider(0)).get(); c.preparePost(getTargetUrl()).setBody(LARGE_IMAGE_BYTES).execute(new CancellingStreamedAsyncProvider(1)).get(); c.preparePost(getTargetUrl()).setBody(LARGE_IMAGE_BYTES).execute(new CancellingStreamedAsyncProvider(10)).get(); assertEquals(c.preparePost(getTargetUrl()).setBody("Hello").execute().get().getResponseBody(), "Hello"); } }
Source:
<code>TestOutputTopic(final TopologyTestDriver driver, final String topicName, final Deserializer<K> keyDeserializer, final Deserializer<V> valueDeserializer) { Objects.requireNonNull(driver, "TopologyTestDriver cannot be null"); <START> Objects.requireNonNull(topicName, "topicName cannot be null"); <END> this.driver = driver; this.topic = topicName; this.keyDeserializer = keyDeserializer; this.valueDeserializer = valueDeserializer; }</code><technical_language>require non-null deserializers</technical_language>

Target:
TestOutputTopic(final TopologyTestDriver driver, final String topicName, final Deserializer<K> keyDeserializer, final Deserializer<V> valueDeserializer) { Objects.requireNonNull(driver, "TopologyTestDriver cannot be null"); Objects.requireNonNull(topicName, "topicName cannot be null"); Objects.requireNonNull(keyDeserializer, "keyDeserializer cannot be null"); Objects.requireNonNull(valueDeserializer, "valueDeserializer cannot be null"); this.driver = driver; this.topic = topicName; this.keyDeserializer = keyDeserializer; this.valueDeserializer = valueDeserializer; }
Source:
<code>HashSet<ObjectId> listNonHEADIndexObjects() throws NoWorkTreeException, CorruptObjectException, IOException { RevWalk revWalk = null; TreeWalk treeWalk = new TreeWalk(repo); try { <START> if (!repo.isBare()) { <END> DirCache dc = repo.lockDirCache(); treeWalk.addTree(new DirCacheIterator(dc)); ObjectId headID = repo.resolve(Constants.HEAD); if (headID != null) { revWalk = new RevWalk(repo); treeWalk.addTree(revWalk.parseTree(headID)); revWalk.dispose(); } } treeWalk.setFilter(TreeFilter.ANY_DIFF); treeWalk.setRecursive(true); HashSet<ObjectId> ret = new HashSet<ObjectId>(); while (treeWalk.next()) { ObjectId objectId = treeWalk.getObjectId(0); if (objectId != ObjectId.zeroId()) ret.add(objectId); } return ret; } finally { if (revWalk != null) revWalk.dispose(); treeWalk.release(); } }</code><technical_language>if repo is bare, is index, this method produce empty set</technical_language>

Target:
HashSet<ObjectId> listNonHEADIndexObjects() throws NoWorkTreeException, CorruptObjectException, IOException { RevWalk revWalk = null; DirCache dc = null; if (repo.isBare()) return ((HashSet<ObjectId>) Collections.EMPTY_SET); TreeWalk treeWalk = new TreeWalk(repo); try { dc = repo.readDirCache(); treeWalk.addTree(new DirCacheIterator(dc)); ObjectId headID = repo.resolve(Constants.HEAD); if (headID != null) { revWalk = new RevWalk(repo); treeWalk.addTree(revWalk.parseTree(headID)); revWalk.dispose(); } treeWalk.setFilter(TreeFilter.ANY_DIFF); treeWalk.setRecursive(true); HashSet<ObjectId> ret = new HashSet<ObjectId>(); while (treeWalk.next()) { ObjectId objectId = treeWalk.getObjectId(0); if (objectId != ObjectId.zeroId()) ret.add(objectId); } return ret; } finally { if (revWalk != null) revWalk.dispose(); treeWalk.release(); } }
Source:
<code>public OptionsBuilder put(String key, Object value) { <START> if (value != null) { <END> options.put(key, value); } return this; }</code><technical_language>I if call put for key, null effectively removed previous in method's "before" form, doesn't</technical_language>

Target:
public OptionsBuilder put(String key, Object value) { if (value != null) { options.put(key, value); } else { options.remove(key); } return this; }
Source:
<code>private Guid getClusterId() { <START> Guid vdsGroupId; <END> if (Guid.Empty.equals(getParameters().getVdsGroupId())) { vdsGroupId = Guid.createGuidFromStringDefaultEmpty( Config.<String> getValue(ConfigValues.AutoRegistrationDefaultVdsGroupID)); log.debug( "RegisterVdsQuery::ExecuteCommand - VdsGroupId received as -1, using AutoRegistrationDefaultVdsGroupID: '{}'", vdsGroupId); } else { vdsGroupId = getParameters().getVdsGroupId(); } if (vdsGroupId == null || Guid.Empty.equals(vdsGroupId)) { VdsGroupDAO dao = DbFacade.getInstance().getVdsGroupDao(); VDSGroup cluster = dao.getByName("Default"); if (cluster != null) { vdsGroupId = cluster.getId(); } else { List<VDSGroup> clusters = dao.getAll(); if (clusters.size() > 0) { vdsGroupId = clusters.get(0).getId(); } } } return vdsGroupId; }</code><technical_language>matter do - Guid vdsGroupId = getParameters().getVdsGroupId(); if empty(vdsGroupId) ... instead of else</technical_language>

Target:
private Guid getClusterId() { Guid vdsGroupId = getParameters().getVdsGroupId(); if (Guid.Empty.equals(getParameters().getVdsGroupId())) { vdsGroupId = Guid.createGuidFromStringDefaultEmpty( Config.<String> getValue(ConfigValues.AutoRegistrationDefaultVdsGroupID)); log.debug( "RegisterVdsQuery::ExecuteCommand - VdsGroupId received as -1, using AutoRegistrationDefaultVdsGroupID: '{}'", vdsGroupId); } if (vdsGroupId == null || Guid.Empty.equals(vdsGroupId)) { VdsGroupDAO dao = DbFacade.getInstance().getVdsGroupDao(); VDSGroup cluster = dao.getByName("Default"); if (cluster != null) { vdsGroupId = cluster.getId(); } else { List<VDSGroup> clusters = dao.getAll(); if (clusters.size() > 0) { vdsGroupId = clusters.get(0).getId(); } } } return vdsGroupId; }