auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public void onBindViewHolder(StockViewHolder holder, int position) { StockMediaModel media = mItems.get(position); String imageUrl = PhotonUtils.getPhotonImageUrl(media.getThumbnail(), mThumbWidth, mThumbHeight); holder.mImageView.setImageUrl(imageUrl, WPNetworkImageView.ImageType.PHOTO); boolean isSelected = isItemSelected(position); holder.mSelectionCountTextView.setSelected(isSelected); if (isSelected) { int count = mSelectedItems.indexOf(position) + 1; String label = Integer.toString(count); holder.mSelectionCountTextView.setText(label); } else { holder.mSelectionCountTextView.setText(null); } float scale = isSelected ? SCALE_SELECTED : SCALE_NORMAL; if (holder.mImageView.getScaleX() != scale) { holder.mImageView.setScaleX(scale); holder.mImageView.setScaleY(scale); } <START> if (!mIsFetching && mCanLoadMore && position == getItemCount() - 1) { <END> fetchStockMedia(mSearchQuery, mNextPage); } }</code><technical_language>I cleaner !mIsFetching && mCanLoadMore checks in fetchStockMedia. adapter care another developer fetchStockMedia method, a new request happen won't. easier catch unexplored paths well. do think</technical_language>

Target:
public void onBindViewHolder(StockViewHolder holder, int position) { StockMediaModel media = mItems.get(position); String imageUrl = PhotonUtils.getPhotonImageUrl(media.getThumbnail(), mThumbWidth, mThumbHeight); holder.mImageView.setImageUrl(imageUrl, WPNetworkImageView.ImageType.PHOTO); boolean isSelected = isItemSelected(position); holder.mSelectionCountTextView.setSelected(isSelected); if (isSelected) { int count = mSelectedItems.indexOf(position) + 1; String label = Integer.toString(count); holder.mSelectionCountTextView.setText(label); } else { holder.mSelectionCountTextView.setText(null); } float scale = isSelected ? SCALE_SELECTED : SCALE_NORMAL; if (holder.mImageView.getScaleX() != scale) { holder.mImageView.setScaleX(scale); holder.mImageView.setScaleY(scale); } if (mCanLoadMore && position == getItemCount() - 1) { fetchStockMedia(mSearchQuery, mNextPage); } }
Source:
<code>protected void safeRun(IProgressMonitor progressMonitor) throws Exception <START> { <END> target.delete(CDOAdmin.TYPE_DEFAULT); }</code><technical_language>type configurable somehow</technical_language>

Target:
protected void safeRun(IProgressMonitor progressMonitor) throws Exception { target.delete(CDOAdmin.DEFAULT_TYPE); }
Source:
<code>private void declareMetadata(OperationDeclarer operation, ClassTypeLoader loader) { Map<String, Supplier<? extends InputTypeResolver>> inputResolver = ImmutableMap.<String, Supplier<? extends InputTypeResolver>>builder() .put(BODY_PARAM, InvokeRequestTypeResolver::new) .put(HEADERS_PARAM, InvokeInputHeadersTypeResolver::new) .put(ATTACHMENTS_PARAM, InvokeInputAttachmentsTypeResolver::new) .build(); Supplier<TypeKeysResolver> keysResolverSupplier = InvokeKeysResolver::new; Supplier<OutputTypeResolver> outputResolverSupplier = InvokeOutputTypeResolver::new; DefaultMetadataResolverFactory factory = new DefaultMetadataResolverFactory(keysResolverSupplier, inputResolver, outputResolverSupplier, NullMetadataResolver::new); operation.withModelProperty(new MetadataResolverFactoryModelProperty(() -> factory)); operation.withModelProperty(new MetadataKeyIdModelProperty(loader.load(WebServiceTypeKey.class), KEYS_GROUP, SOAP_INVOKE_METADATA_CATEGORY)); Map<String, String> inputResolversByParam = inputResolver .entrySet().stream() <START> .collect(Collectors.toImmutableMap(Map.Entry::getKey, <END> e -> e.getValue().get().getResolverName())); String outputResolver = outputResolverSupplier.get().getResolverName(); String attributesResolver = NULL_RESOLVER_NAME; String keysResolver = keysResolverSupplier.get().getResolverName(); operation.withModelProperty(new TypeResolversInformationModelProperty(SOAP_INVOKE_METADATA_CATEGORY, inputResolversByParam, outputResolver, attributesResolver, keysResolver, true, true)); }</code><technical_language>static import</technical_language>

Target:
private void declareMetadata(OperationDeclarer operation, ClassTypeLoader loader) { Map<String, Supplier<? extends InputTypeResolver>> inputResolver = ImmutableMap.<String, Supplier<? extends InputTypeResolver>>builder() .put(BODY_PARAM, InvokeRequestTypeResolver::new) .put(HEADERS_PARAM, InvokeInputHeadersTypeResolver::new) .put(ATTACHMENTS_PARAM, InvokeInputAttachmentsTypeResolver::new) .build(); TypeKeysResolver keysResolver = new InvokeKeysResolver(); OutputTypeResolver outputResolver = new InvokeOutputTypeResolver(); DefaultMetadataResolverFactory factory = new DefaultMetadataResolverFactory(() -> keysResolver, inputResolver, () -> outputResolver, NullMetadataResolver::new); operation.withModelProperty(new MetadataResolverFactoryModelProperty(() -> factory)); operation.withModelProperty(new MetadataKeyIdModelProperty(loader.load(WebServiceTypeKey.class), KEYS_GROUP, keysResolver.getCategoryName())); Map<String, String> inputResolversByParam = inputResolver .entrySet().stream() .collect(toImmutableMap(Map.Entry::getKey, e -> e.getValue().get().getResolverName())); operation.withModelProperty(new TypeResolversInformationModelProperty(keysResolver.getCategoryName(), inputResolversByParam, outputResolver.getResolverName(), NULL_RESOLVER_NAME, keysResolver.getResolverName(), true, true)); }
Source:
<code><START> catch (final SQLException | ClassNotFoundException e) { <END> throw new RuntimeException(e); }</code><technical_language>Style nit: catch in line of closing try curly brace. java try { ... } catch (Exception ex) { ... } I personally prefer Google style guide. I raise this point in chat room. do prefer here</technical_language>

Target:
} catch (final SQLException | ClassNotFoundException e) { throw new RuntimeException(e); }
Source:
<code>private Set<String> validateForCreate(FilterDTO filterDTO) { if (filterDTO == null) { Set<String> errors = new HashSet<String>(); <START> errors.add("No filter object was present to be saved."); <END> return errors; } return validate(filterDTO); }</code><technical_language>this in errors.properties file</technical_language>

Target:
private Set<String> validateForCreate(FilterDTO filterDTO) { if (filterDTO == null) { Set<String> errors = new HashSet<String>(); errors.add(errorMessageUtil.getMessage("filter.notPresent")); return errors; } return validate(filterDTO); }
Source:
<code>public void run() { try { init(); } catch (Exception e) { throw new RuntimeException("Failed to initialize the consumer", e); } long nMessages = 0; long lastChecked = System.currentTimeMillis(); try { while (true) { boolean hasMoreMessages = consumeNextMessage(); if (!hasMoreMessages) { return; } long now = System.currentTimeMillis(); <START> if (nMessages++ % 10000 == 0 || <END> (now - lastChecked) > 10 * 60 * 1000) { lastChecked = now; checkUploadPolicy(); } } } finally { checkUploadPolicy(); } }</code><technical_language>end-to-end test (scripts/run_tests.sh) pass this logic in</technical_language>

Target:
public void run() { try { init(); } catch (Exception e) { throw new RuntimeException("Failed to initialize the consumer", e); } long checkEveryNSeconds = Math.min(10 * 60, mConfig.getMaxFileAgeSeconds() / 2); long nMessages = 0; long lastChecked = System.currentTimeMillis(); while (true) { boolean hasMoreMessages = consumeNextMessage(); if (!hasMoreMessages) { break; } long now = System.currentTimeMillis(); if (nMessages++ % 10000 == 0 || (now - lastChecked) > checkEveryNSeconds * 1000) { lastChecked = now; checkUploadPolicy(); } } checkUploadPolicy(); }
Source:
<code>public String jsonify(List<Long> records, boolean includePrimaryKey, AccessToken creds, TransactionToken transaction, String env) throws TSecurityException, TException { checkAccess(creds, transaction); try { Compoundable store = getStore(transaction, env); boolean nullOk = true; boolean retryable = store instanceof Engine; AtomicOperation operation = null; StringBuilder jsonResult = new StringBuilder(); <START> while((operation == null && nullOk) || operation != null && <END> !operation.commit() && retryable) { nullOk = false; operation = doJsonify(records, includePrimaryKey, store, jsonResult); } if (operation == null) { throw new TTransactionException(); } return jsonResult.toString(); } catch (TransactionStateException e) { throw new TTransactionException(); } }</code><technical_language>If jsonResult modified atomic operation fails commit retry need pass in a new StringBuilder retry data previous attempt stick around</technical_language>

Target:
public String jsonify(List<Long> records, boolean includePrimaryKey, AccessToken creds, TransactionToken transaction, String env) throws TSecurityException, TException { checkAccess(creds, transaction); try { Compoundable store = getStore(transaction, env); boolean nullOk = true; boolean retryable = store instanceof Engine; AtomicOperation operation = null; StringBuilder jsonResult = new StringBuilder(); while((operation == null && nullOk) || operation != null && !operation.commit() && retryable) { jsonResult = new StringBuilder(); nullOk = false; operation = doJsonify(records, includePrimaryKey, store, jsonResult); } if (operation == null) { throw new TTransactionException(); } return jsonResult.toString(); } catch (TransactionStateException e) { throw new TTransactionException(); } }
Source:
<code>public FacetDescriptor getFacetDescriptor(String name) { <START> FacetDescriptor desc = allFacets.stream().filter(f -> f.name.equals(name)).reduce((a, b) -> b).get(); <END> return desc; }</code><technical_language>replace reduce((a, b) -> b).get() findFirst().get()or findAny().get(). it, compute stream get value, find* methods, stream is closed a value</technical_language>

Target:
public FacetDescriptor getFacetDescriptor(String name) { return allFacets.stream().filter(f -> f.getName().equals(name)).reduce((a, b) -> b).orElse(null); }
Source:
<code>protected void refreshPieCharts(final boolean refreshGlobal, final boolean refreshSelection) { final Control viewerControl = getControl(); if (viewerControl.isDisposed()) { return; } <START> <END> if (fPieChartModel == null || fPieChartModel.getPieChartGlobalModel() == null) { return; } boolean moreThanOne = false; for (Entry<ITmfTrace, Map<String, Long>> entry : fPieChartModel.getPieChartGlobalModel().entrySet()) { if(entry.getValue() != null && entry.getValue().size() > 1) { moreThanOne = true; break; } } if (!moreThanOne) { setPieChartsVisible(false); } else { setPieChartsVisible(true); } Display.getDefault().asyncExec(new Runnable() { @Override public void run() { if (!viewerControl.isDisposed()) { fPieChartViewer.refresh(refreshGlobal, refreshSelection); } } }); }</code><technical_language>getter for piechartmodel a local variable TmfPieChartStatisticsModel pieChartModel = getPieChartModel();</technical_language>

Target:
protected void refreshPieCharts(final boolean refreshGlobal, final boolean refreshSelection) { final Control viewerControl = getControl(); if (viewerControl.isDisposed()) { return; } TmfPieChartStatisticsModel pieChartModel = getPieChartModel(); if (pieChartModel == null || pieChartModel.getPieChartGlobalModel() == null) { return; } boolean moreThanOne = false; for (Entry<ITmfTrace, Map<String, Long>> entry : pieChartModel.getPieChartGlobalModel().entrySet()) { if(entry.getValue() != null && entry.getValue().size() > 1) { moreThanOne = true; break; } } if (!moreThanOne) { setPieChartsVisible(false); } else { setPieChartsVisible(true); } Display.getDefault().asyncExec(new Runnable() { @Override public void run() { if (!viewerControl.isDisposed()) { fPieChartViewer.refresh(refreshGlobal, refreshSelection); } } }); }
Source:
<code>public DatabaseDataType toDatabaseDataType(Database database) { String originalDefinition = StringUtils.trimToEmpty(getRawDefinition()); if (database instanceof DB2Database || database instanceof FirebirdDatabase) { <START> return new DatabaseDataType("SMALLINT"); <END> } else if (database instanceof MSSQLDatabase) { return new DatabaseDataType(database.escapeDataTypeName("bit")); } else if (database instanceof MySQLDatabase) { if (originalDefinition.toLowerCase().startsWith("bit")) { return new DatabaseDataType("BIT", getParameters()); } return new DatabaseDataType("BIT", 1); } else if (database instanceof OracleDatabase) { return new DatabaseDataType("NUMBER", 1); } else if (database instanceof SybaseASADatabase || database instanceof SybaseDatabase) { return new DatabaseDataType("BIT"); } else if (database instanceof DerbyDatabase) { if (((DerbyDatabase) database).supportsBooleanDataType()) { return new DatabaseDataType("BOOLEAN"); } else { return new DatabaseDataType("SMALLINT"); } } else if (database instanceof HsqlDatabase) { return new DatabaseDataType("BOOLEAN"); } else if (database instanceof PostgresDatabase) { if (originalDefinition.toLowerCase().startsWith("bit")) { return new DatabaseDataType("BIT", getParameters()); } } else if (database instanceof H2Database) { return new DatabaseDataType("CHAR(5)"); } return super.toDatabaseDataType(database); }</code><technical_language>better... if (database instanceof H2Base) { return new DatabaseDataType("CHAR(5)"); } return super.toDatabaseDataType(database);</technical_language>

Target:
public DatabaseDataType toDatabaseDataType(Database database) { if (database instanceof H2Database) { return new DatabaseDataType("CHAR(5)"); } return super.toDatabaseDataType(database); }
Source:
<code><START> public static boolean textIs(String actual, String text, boolean ignoreCase) { <END> return ignoreCase ? StringUtils.equalsIgnoreCase(actual, text) : StringUtils.equals(actual, text); }</code><technical_language>indentation is incorrect</technical_language>

Target:
private boolean textIs(String actual, String text, boolean ignoreCase) { return ignoreCase ? StringUtils.equalsIgnoreCase(actual, text) : StringUtils.equals(actual, text); }
Source:
<code>public void set(String dataPath, JsonElement newValue, int childIndex) { if (dataPath == null) { return; } String aliasedDataPath = DataContext.getAliasedDataPath(dataPath, parserContext.getDataContext().getReverseScopeMap(), true); <START> Result result = Utils.getElementFromData(aliasedDataPath.substring(0, aliasedDataPath.lastIndexOf(".")), parserContext.getDataContext().getDataProvider(), childIndex); <END> JsonElement parent = result.element; if (parent == null || !parent.isJsonObject()) { return; } String propertyName = aliasedDataPath.substring(aliasedDataPath.lastIndexOf(".") + 1, aliasedDataPath.length()); parent.getAsJsonObject().add(propertyName, newValue); updateView(aliasedDataPath); }</code><technical_language>please "." final static string? This get called times is initialized once</technical_language>

Target:
public void set(String dataPath, JsonElement newValue, int childIndex) { if (dataPath == null) { return; } String aliasedDataPath = DataContext.getAliasedDataPath(dataPath, parserContext.getDataContext().getReverseScopeMap(), true); Result result = Utils.getElementFromData(aliasedDataPath.substring(0, aliasedDataPath.lastIndexOf(DELIMITER)), parserContext.getDataContext().getDataProvider(), childIndex); JsonElement parent = result.element; if (parent == null || !parent.isJsonObject()) { return; } String propertyName = aliasedDataPath.substring(aliasedDataPath.lastIndexOf(DELIMITER) + 1, aliasedDataPath.length()); parent.getAsJsonObject().add(propertyName, newValue); updateView(aliasedDataPath); }
Source:
<code>private static ComponentDto asDto(Component component) { return newDto(ComponentDto.class) .withId(component.getId()) .withAlias(component.getAlias()) <START> .withType(component.getType()); <END> }</code><technical_language>rest of fields</technical_language>

Target:
private static ComponentDto asDto(Component component) { return newDto(ComponentDto.class) .withType(component.getType()) .withAlias(component.getAlias()) .withId(component.getId()) .withImage(component.getImage()) .withMemoryLimit(component.getMemoryLimit()) .withCommand(component.getCommand()) .withArgs(component.getArgs()) .withEndpoints(component.getEndpoints().stream().map(DtoConverter::asDto).collect(toList())) .withEnv(component.getEnv().stream().map(DtoConverter::asDto).collect(toList())) .withMountSources(component.getMountSources()) .withVolumes(component.getVolumes().stream().map(DtoConverter::asDto).collect(toList())) .withReference(component.getReference()) .withReferenceContent(component.getReferenceContent()) .withSelector(component.getSelector()) .withEntrypoints( component.getEntrypoints().stream().map(DtoConverter::asDto).collect(toList())); }
Source:
<code>public void givenChargeCapturedNotification_chargeNotificationProcessorShouldBeInvokedIfChargeIsHistoric() { final String payload = notificationPayloadForTransaction( payId, EPDQ_PAYMENT_REQUESTED); charge = Charge.from(ChargeEntityFixture.aValidChargeEntity() .withGatewayAccountEntity(gatewayAccountEntity) .build()); charge.setHistoric(true); when(mockGatewayAccountService.getGatewayAccount(charge.getGatewayAccountId())).thenReturn(Optional.of(gatewayAccountEntity)); when(mockChargeService.findByProviderAndTransactionIdFromDbOrLedger(EPDQ.getName(), payId)).thenReturn(Optional.of(charge)); ArgumentCaptor<ZonedDateTime> eventTimeStamp = ArgumentCaptor.forClass(ZonedDateTime.class); notificationService.handleNotificationFor(payload); verifyNoInteractions(mockRefundNotificationProcessor); <START> verify(mockChargeNotificationProcessor).processCaptureNotificationForExpungedCharge(eq(gatewayAccountEntity), eq(payId), eq(charge), eq(CAPTURED), eventTimeStamp.capture()); <END> }</code><technical_language>needing ArgumentCaptor here, able do any(ZonedDateTime.class)</technical_language>

Target:
public void givenChargeCapturedNotification_chargeNotificationProcessorShouldBeInvokedIfChargeIsHistoric() { final String payload = notificationPayloadForTransaction( payId, EPDQ_PAYMENT_REQUESTED); charge = Charge.from(ChargeEntityFixture.aValidChargeEntity() .withGatewayAccountEntity(gatewayAccountEntity) .build()); charge.setHistoric(true); when(mockGatewayAccountService.getGatewayAccount(charge.getGatewayAccountId())).thenReturn(Optional.of(gatewayAccountEntity)); when(mockChargeService.findByProviderAndTransactionIdFromDbOrLedger(EPDQ.getName(), payId)).thenReturn(Optional.of(charge)); notificationService.handleNotificationFor(payload); verifyNoInteractions(mockRefundNotificationProcessor); verify(mockChargeNotificationProcessor).processCaptureNotificationForExpungedCharge(gatewayAccountEntity, payId, charge, CAPTURED); }
Source:
<code>public void onCommit(@Nonnull NodeProvisioner.PlannedNode plannedNode, @Nonnull Node node) { <START> ; END> }</code><technical_language>do a ; here</technical_language>

Target:
public void onCommit(@Nonnull NodeProvisioner.PlannedNode plannedNode, @Nonnull Node node) { }
Source:
<code>public Accessibility getAccessibility() { <START> return Accessibility.PUBLIC; <END> }</code><technical_language>setting protected only? want encourage people pull in / downcast generated Impl class in order generated declared mapping methods... do we</technical_language>

Target:
public Accessibility getAccessibility() { return Accessibility.PROTECTED; }
Source:
<code>public static List<Pair<String, Map<String, Object>>> edgeStatements(Activity activity) { List<Pair<String, Map<String, Object>>> statements = new ArrayList<>();; ActivityObject actor = activity.getActor(); ActivityObject object = activity.getObject(); ActivityObject target = activity.getTarget(); if (StringUtils.isNotBlank(actor.getId()) && object != null && StringUtils.isNotBlank(object.getId())) { Pair<String, Map<String, Object>> actorObjectEdgeStatement = helper.createActorObjectEdge(activity); HashMap<String, Object> props = new HashMap<>(); props.put("props", actorObjectEdgeStatement.getValue1()); actorObjectEdgeStatement = actorObjectEdgeStatement.setAt1(props); statements.add(actorObjectEdgeStatement); } if (StringUtils.isNotBlank(actor.getId()) && target != null && StringUtils.isNotBlank(target.getId())) { Pair<String, Map<String, Object>> actorTargetEdgeStatement = helper.createActorTargetEdge(activity); <START> HashMap<String, Object> props = new HashMap<>(); <END> props.put("props", actorTargetEdgeStatement.getValue1()); actorTargetEdgeStatement = actorTargetEdgeStatement.setAt1(props); statements.add(actorTargetEdgeStatement); } return statements; }</code><technical_language>Map<> LHS</technical_language>

Target:
public static List<Pair<String, Map<String, Object>>> edgeStatements(Activity activity) { List<Pair<String, Map<String, Object>>> statements = new ArrayList<>();; ActivityObject actor = activity.getActor(); ActivityObject object = activity.getObject(); ActivityObject target = activity.getTarget(); if (StringUtils.isNotBlank(actor.getId()) && object != null && StringUtils.isNotBlank(object.getId())) { Pair<String, Map<String, Object>> actorObjectEdgeStatement = helper.createActorObjectEdge(activity); Map<String, Object> props = new HashMap<>(); props.put("props", actorObjectEdgeStatement.getValue1()); actorObjectEdgeStatement = actorObjectEdgeStatement.setAt1(props); statements.add(actorObjectEdgeStatement); } if (StringUtils.isNotBlank(actor.getId()) && target != null && StringUtils.isNotBlank(target.getId())) { Pair<String, Map<String, Object>> actorTargetEdgeStatement = helper.createActorTargetEdge(activity); Map<String, Object> props = new HashMap<>(); props.put("props", actorTargetEdgeStatement.getValue1()); actorTargetEdgeStatement = actorTargetEdgeStatement.setAt1(props); statements.add(actorTargetEdgeStatement); } return statements; }
Source:
<code>public void load(LazyBlock lazyBlock) { if (block == null) { return; } <START> while (block instanceof LazyBlock) { <END> block = ((LazyBlock) block).getBlock(); } Block coercedBlock = coercer.apply(block); lazyBlock.setBlock(coercedBlock); block = null; }</code><technical_language>if instead. nest LazyBlocks</technical_language>

Target:
public void load(LazyBlock lazyBlock) { if (block == null) { return; } if (block instanceof LazyBlock) { block = ((LazyBlock) block).getBlock(); } Block coercedBlock = coercer.apply(block); lazyBlock.setBlock(coercedBlock); block = null; }
Source:
<code>void insert(BranchInfo info) { <START> if (match != null && !match.equals("") && !info.getShortName().contains(match)) { return; } <END> if (table.getRowCount() <= pageSize || pageSize == 0) { Comparator<BranchInfo> c = new Comparator<BranchInfo>() { @Override public int compare(BranchInfo a, BranchInfo b) { return a.ref().compareTo(b.ref()); } }; int insertPos = getInsertRow(c, info); if (insertPos >= 0) { table.insertRow(insertPos); applyDataRowStyle(insertPos); populate(insertPos, info); } } else { setupNavigationLink(next, match, ProjectBranchesScreen.this.start + pageSize); } }</code><technical_language>If 'match' is a regular expression this work. E.g. if 'match' is '^.*1.3.*' e new branch 'stable-1.3.1' is created is added table matches regular expression. refreshing page is displayed</technical_language>

Target:
void insert(BranchInfo info) { if (table.getRowCount() <= pageSize) { Comparator<BranchInfo> c = new Comparator<BranchInfo>() { @Override public int compare(BranchInfo a, BranchInfo b) { return a.ref().compareTo(b.ref()); } }; int insertPos = getInsertRow(c, info); if (insertPos >= 0) { table.insertRow(insertPos); applyDataRowStyle(insertPos); populate(insertPos, info); } } else { setupNavigationLink(next, match, ProjectBranchesScreen.this.start + pageSize); } }
Source:
<code>public void validate() { for (Agency agency : feed.agencies) { validateFieldLength(agency, agency.agency_id, 50); validateFieldLength(agency, agency.agency_name, 50); validateFieldLength(agency, agency.agency_url, 500); } for (Stop stop : feed.stops) { validateFieldLength(stop, stop.stop_name, 100); } for (Trip trip : feed.trips) { validateFieldLength(trip, trip.trip_headsign, 120); validateFieldLength(trip, trip.trip_short_name, 50); } for (Calendar calendar : feed.calendars) { validateCalendarDays(calendar); <START> } <END> }</code><technical_language>I this needs MTC-specific validator. I this apply board (perhaps ServiceValidator#validateServiceInfo)</technical_language>

Target:
public void validate() { for (Agency agency : feed.agencies) { validateFieldLength(agency, agency.agency_id, 50); validateFieldLength(agency, agency.agency_name, 50); validateFieldLength(agency, agency.agency_url, 500); } for (Stop stop : feed.stops) { validateFieldLength(stop, stop.stop_name, 100); } for (Trip trip : feed.trips) { validateFieldLength(trip, trip.trip_headsign, 120); validateFieldLength(trip, trip.trip_short_name, 50); } }
Source:
<code>public Construct exec(Target t, Environment env, Construct... args) throws CancelCommandException, ConfigRuntimeException { if (!(args[0] instanceof CString)) { <START> throw new CREFormatException(this.getName() + " expects a string as first argument, but type " <END> + args[0].typeof() + " was found.", t); } Static.AssertNonCNull(t, args); String teststring = args[0].nval(); String keyword = args[1].nval(); boolean ret = teststring.endsWith(keyword); return CBoolean.get(ret); }</code><technical_language>CastException</technical_language>

Target:
public Construct exec(Target t, Environment env, Construct... args) throws CancelCommandException, ConfigRuntimeException { Static.AssertNonCNull(t, args); String teststring = args[0].nval(); String keyword = args[1].nval(); boolean ret = teststring.endsWith(keyword); return CBoolean.get(ret); }
Source:
<code>private static boolean canExecute(BusinessEntityWithStatus<?, ?> entity, Class type, ActionType action) { Set<ActionType> <START> actions = <END> _matrix.get(type).get(entity.getStatus()); if (actions != null && actions.contains(action)) { return false; } return true; }</code><technical_language>renaming 'disallowedActions' express actions are</technical_language>

Target:
private static boolean canExecute(BusinessEntityWithStatus<?, ?> entity, Class type, ActionType action) { Set<ActionType> disallowedActions = _matrix.get(type).get(entity.getStatus()); if (disallowedActions != null && disallowedActions.contains(action)) { return false; } return true; }
Source:
<code>private void loadNextPage(final boolean shouldClear) { if (shouldClear && pager != null) { <START> cts.cancel(); <END> pager = null; } notifyOnLoadingListeners(); getPager().loadNextPage(new FindCallback<T>() { @Override public void done(List<T> results, ParseException e) { if (results == null && e == null) { return; } if ((!Parse.isLocalDatastoreEnabled() && query.getCachePolicy() == ParseQuery.CachePolicy.CACHE_ONLY) && (e != null) && e.getCode() == ParseException.CACHE_MISS) { return; } notifyDataSetChanged(); notifyOnLoadedListeners(results, e); } }, cts.getToken()); }</code><technical_language>set cts null in clear(), do need null checking for cts here</technical_language>

Target:
private void loadNextPage(final boolean shouldClear) { synchronized (lock) { if (shouldClear && pager != null) { cts.cancel(); pager = null; } } notifyOnLoadingListeners(); getPager().loadNextPage(new FindCallback<T>() { @Override public void done(List<T> results, ParseException e) { if (results == null && e == null) { return; } if ((!Parse.isLocalDatastoreEnabled() && query.getCachePolicy() == ParseQuery.CachePolicy.CACHE_ONLY) && (e != null) && e.getCode() == ParseException.CACHE_MISS) { return; } notifyDataSetChanged(); notifyOnLoadedListeners(results, e); } }, cts.getToken()); }
Source:
<code>public List<CloudBlobMetadata> findEntriesSince(String partitionPath, CloudFindToken findToken, long maxTotalSizeOfEntries) throws CloudStorageException { SqlQuerySpec entriesSinceQuery = new SqlQuerySpec(ENTRIES_SINCE_QUERY_TEMPLATE, new SqlParameterCollection(new SqlParameter(LIMIT_PARAM, findSinceQueryLimit), new SqlParameter(TIME_SINCE_PARAM, findToken.getLastUpdateTime()))); try { List<CloudBlobMetadata> queryResults = cosmosDataAccessor.queryMetadata(partitionPath, entriesSinceQuery, azureMetrics.findSinceQueryTime); if (queryResults.isEmpty()) { return queryResults; } if (queryResults.get(0).getLastUpdateTime() == findToken.getLastUpdateTime()) { filterOutLastReadBlobs(queryResults, findToken.getLastUpdateTimeReadBlobIds(), findToken.getLastUpdateTime()); } List<CloudBlobMetadata> cappedResults = new ArrayList<>(); long totalSize = 0; for (CloudBlobMetadata metadata : queryResults) { if (totalSize + metadata.getSize() > maxTotalSizeOfEntries) { <START> if (cappedResults.size() == 0) { <END> cappedResults.add(metadata); } break; } cappedResults.add(metadata); totalSize += metadata.getSize(); } return cappedResults; } catch (DocumentClientException dex) { throw new CloudStorageException("Failed to query blobs for partition " + partitionPath, dex); } }</code><technical_language>is size() == 0 preferable isEmpty()</technical_language>

Target:
public List<CloudBlobMetadata> findEntriesSince(String partitionPath, CloudFindToken findToken, long maxTotalSizeOfEntries) throws CloudStorageException { SqlQuerySpec entriesSinceQuery = new SqlQuerySpec(ENTRIES_SINCE_QUERY_TEMPLATE, new SqlParameterCollection(new SqlParameter(LIMIT_PARAM, findSinceQueryLimit), new SqlParameter(TIME_SINCE_PARAM, findToken.getLastUpdateTime()))); try { List<CloudBlobMetadata> queryResults = cosmosDataAccessor.queryMetadata(partitionPath, entriesSinceQuery, azureMetrics.findSinceQueryTime); if (queryResults.isEmpty()) { return queryResults; } if (queryResults.get(0).getLastUpdateTime() == findToken.getLastUpdateTime()) { filterOutLastReadBlobs(queryResults, findToken.getLastUpdateTimeReadBlobIds(), findToken.getLastUpdateTime()); } return CloudBlobMetadata.capMetadataListBySize(queryResults, maxTotalSizeOfEntries); } catch (DocumentClientException dex) { throw new CloudStorageException("Failed to query blobs for partition " + partitionPath, dex); } }
Source:
<code>public static void main(final String[] args) { final CommandLine application = new CommandLine(new MantaCLI()); application.registerConverter(Path.class, Paths::get); List<CommandLine> parsedCommands; try { parsedCommands = application.parse(args); } catch (CommandLine.ParameterException ex) { System.err.println(ex.getMessage()); CommandLine.usage(new MantaCLI(), System.err); return; } MantaCLI cli = parsedCommands.get(0).getCommand(); if (cli.isHelpRequested) { application.usage(System.out); <START> return; <END> } if (cli.isVersionRequested) { System.out.println("java-manta-client: " + MantaVersion.VERSION); return; } if (parsedCommands.size() == 1) { application.usage(System.err); return; } CommandLine deepest = parsedCommands.get(parsedCommands.size() - 1); MantaSubCommand subcommand = (MantaSubCommand) deepest.getCommand(); if (subcommand.isHelpRequested) { CommandLine.usage(deepest.getCommand(), System.err); return; } if (subcommand.logLevel != null) { Logger root = (Logger)LoggerFactory.getLogger(Logger.ROOT_LOGGER_NAME); root.setLevel(Level.valueOf(subcommand.logLevel.toString())); } subcommand.run(); }</code><technical_language>Unnecessary casting in L109, Unused enum L130, Access modifier changed L132, L134, unassigned fields cipher, path, filePath, mantaPath, etc. L371, L373, L282, L250, L316 & L318, L350</technical_language>

Target:
public static void main(final String[] args) { final CommandLine application = new CommandLine(new MantaCLI()); application.registerConverter(Path.class, Paths::get); List<CommandLine> parsedCommands; try { parsedCommands = application.parse(args); } catch (CommandLine.ParameterException ex) { System.err.println(ex.getMessage()); CommandLine.usage(new MantaCLI(), System.err); return; } MantaCLI cli = parsedCommands.get(0).getCommand(); if (cli.isHelpRequested) { application.usage(System.out); return; } if (cli.isVersionRequested) { System.out.println("java-manta-client: " + MantaVersion.VERSION); return; } if (parsedCommands.size() == 1) { application.usage(System.err); return; } CommandLine deepest = parsedCommands.get(parsedCommands.size() - 1); MantaSubCommand subcommand = deepest.getCommand(); if (subcommand.isHelpRequested) { CommandLine.usage(deepest.getCommand(), System.err); return; } if (subcommand.logLevel != null) { Logger root = (Logger)LoggerFactory.getLogger(Logger.ROOT_LOGGER_NAME); root.setLevel(Level.valueOf(subcommand.logLevel.toString())); } subcommand.run(); }
Source:
<code><START> public String toString() { <END> StringBuilder buf = new StringBuilder(); buf.append("DiffEntry"); switch (changeType) { case ADD: buf.append(" (Add " + newName + ")"); break; case COPY: buf.append(" (Copy " + oldName + " to " + newName + ")"); break; case DELETE: buf.append(" (Delete " + oldName + ")"); break; case MODIFY: buf.append(" (Modify " + oldName + ")"); break; case RENAME: buf.append(" (Rename " + oldName + " to " + newName + ")"); break; } return buf.toString(); }</code><technical_language>Style-nit: toString style more DiffEntry[ADD newName] DiffEntry[COPY oldName -> newName score] DiffEntry[DELETE oldName] etc... Please match here. Of this is a bit easier, do buf.append(type) get type part duplicate name in case label string text</technical_language>

Target:
public String toString() { StringBuilder buf = new StringBuilder(); buf.append("DiffEntry["); buf.append(changeType); buf.append(" "); switch (changeType) { case ADD: buf.append(newName); break; case COPY: buf.append(oldName + "->" + newName); break; case DELETE: buf.append(oldName); break; case MODIFY: buf.append(oldName); break; case RENAME: buf.append(oldName + "->" + newName); break; } buf.append("]"); return buf.toString(); }
Source:
<code>public LoadProfile() { <START> this.batchSize = Integer.MIN_VALUE; <END> }</code><technical_language>setting this a negative number? lease 1</technical_language>

Target:
public LoadProfile() { this.batchSize = MIN_BATCH_SIZE; this.numOperations = Long.MAX_VALUE; this.tenantIdFormat = DEFAULT_TENANT_ID_FMT; this.tenantIdLength = DEFAULT_TENANT_ID_LEN; this.groupIdLength = DEFAULT_GROUP_ID_LEN; }
Source:
<code>public void RelatedVideo_002_Library() { WikiBasePageObject base = new WikiBasePageObject(driver); base.logInCookie(credentials.userNameStaff, credentials.passwordStaff, wikiURL); <START> VisualEditModePageObject rVmoduleMessageEdit = base.goToArticleEditPage(wikiURL, "MediaWiki:RelatedVideosGlobalList"); <END> rVmoduleMessageEdit.deleteUnwantedVideoFromMessage(VideoContent.youtubeVideoURL2name); ArticlePageObject article = (ArticlePageObject) rVmoduleMessageEdit.submit(PageType.Article); article.openRandomArticle(wikiURL); article.verifyRVModulePresence(); VetAddVideoComponentObject vetAddingVideo = article.clickAddRelatedVideo(); vetAddingVideo.addVideoByQuery(VideoContent.wikiaVideoQuery, 1); article.verifyRelatedVideoAdded(vetAddingVideo.getVideoName()); }</code><technical_language>is this String MediaWiki:RelatedVideosGlobalList</technical_language>

Target:
public void RelatedVideo_002_Library() { WikiBasePageObject base = new WikiBasePageObject(driver); base.logInCookie(credentials.userNameStaff, credentials.passwordStaff, wikiURL); VisualEditModePageObject rVmoduleMessageEdit = base.goToArticleEditPage(wikiURL, URLsContent.relatedVideosList); rVmoduleMessageEdit.deleteUnwantedVideoFromMessage(VideoContent.youtubeVideoURL2name); ArticlePageObject article = rVmoduleMessageEdit.submitArticle(); article.openRandomArticle(wikiURL); article.verifyRelatedVideosModule(); VetAddVideoComponentObject vetAddingVideo = article.clickAddRelatedVideo(); vetAddingVideo.addVideoByQuery(VideoContent.wikiaVideoQuery, 1); article.verifyRelatedVideoAdded(vetAddingVideo.getVideoName()); }
Source:
<code>public void shutdownNow() { logger.warn("Shutting down FlowRunnerManager now..."); this.executorService.shutdownNow(); this.triggerManager.shutdown(); <START> deleteExecutionDirectory(); <END> }</code><technical_language>deleting shutdown hook</technical_language>

Target:
public void shutdownNow() { logger.warn("Shutting down FlowRunnerManager now..."); this.executorService.shutdownNow(); this.triggerManager.shutdown(); }
Source:
<code>public <Q, I, U> SubscriptionQueryResult<QueryResponseMessage<I>, SubscriptionQueryUpdateMessage<U>> subscriptionQuery( SubscriptionQueryMessage<Q, I, U> query, SubscriptionQueryBackpressure backPressure, int updateBufferSize ) { <START> return subscriptionQuery(query, backPressure, updateBufferSize); <END> }</code><technical_language>This recursive invocation ends</technical_language>

Target:
public <Q, I, U> SubscriptionQueryResult<QueryResponseMessage<I>, SubscriptionQueryUpdateMessage<U>> subscriptionQuery( SubscriptionQueryMessage<Q, I, U> query, SubscriptionQueryBackpressure backPressure, int updateBufferSize ) { return subscriptionQuery(query, updateBufferSize); }
Source:
<code>public RegexGroupFilter(final int groupIdx) { if (groupIdx < 1) <START> throw new IllegalArgumentException(MessageFormat.format(HttpServerText.get().invalidIndex, groupIdx)); <END> this.groupIdx = groupIdx - 1; }</code><technical_language>In other places suppress boxing warnings manually boxing in code Integer.valueOf() expression. This is especially true in MessageFormat.format invocations, common in error paths. I is general approach preferred JGit</technical_language>

Target:
public RegexGroupFilter(final int groupIdx) { if (groupIdx < 1) throw new IllegalArgumentException(MessageFormat.format( HttpServerText.get().invalidIndex, valueOf(groupIdx))); this.groupIdx = groupIdx - 1; }
Source:
<code>private List<InstructorFeedbackResultsResponseRow> buildMissingResponseRowsBetweenRecipientAndPossibleGivers( FeedbackQuestionAttributes question, List<String> possibleGivers, String recipientIdentifier, String recipientName, String recipientTeam) { List<InstructorFeedbackResultsResponseRow> missingResponses = new ArrayList<InstructorFeedbackResultsResponseRow>(); FeedbackQuestionDetails questionDetails = question.getQuestionDetails(); for (String possibleGiver : possibleGivers) { <START> String possibleGiverName = bundle.getFullNameFromRoster(possibleGiver); <END> String possibleGiverTeam = bundle.getTeamNameFromRoster(possibleGiver); String textToDisplay = questionDetails.getNoResponseTextInHtml(recipientIdentifier, possibleGiver, bundle, question); if (questionDetails.shouldShowNoResponseText(possibleGiver, recipientIdentifier, question)) { InstructorFeedbackResultsModerationButton moderationButton = buildModerationButtonForGiver( question, possibleGiver, "btn btn-default btn-xs", "Moderate Response"); InstructorFeedbackResultsResponseRow missingResponse = new InstructorFeedbackResultsResponseRow(possibleGiverName, possibleGiverTeam, recipientName, recipientTeam, textToDisplay, moderationButton, true); missingResponse.setRowAttributes(new ElementTag("class", "pending_response_row")); configureResponseRow(question, possibleGiver, recipientIdentifier, missingResponse); missingResponses.add(missingResponse); } } return missingResponses; }</code><technical_language>isAllowedToModerate isDisabled necessary? inverse of other (the constructor for button is here)</technical_language>

Target:
private List<InstructorFeedbackResultsResponseRow> buildMissingResponseRowsBetweenRecipientAndPossibleGivers( FeedbackQuestionAttributes question, List<String> possibleGivers, String recipientIdentifier, String recipientName, String recipientTeam) { List<InstructorFeedbackResultsResponseRow> missingResponses = new ArrayList<InstructorFeedbackResultsResponseRow>(); FeedbackQuestionDetails questionDetails = question.getQuestionDetails(); for (String possibleGiver : possibleGivers) { String possibleGiverName = bundle.getFullNameFromRoster(possibleGiver); String possibleGiverTeam = bundle.getTeamNameFromRoster(possibleGiver); String textToDisplay = questionDetails.getNoResponseTextInHtml(recipientIdentifier, possibleGiver, bundle, question); if (questionDetails.shouldShowNoResponseText(possibleGiver, recipientIdentifier, question)) { InstructorFeedbackResultsModerationButton moderationButton = buildModerationButtonForGiver( question, possibleGiver, "btn btn-default btn-xs", MODERATE_SINGLE_RESPONSE); InstructorFeedbackResultsResponseRow missingResponse = new InstructorFeedbackResultsResponseRow( possibleGiverName, possibleGiverTeam, recipientName, recipientTeam, textToDisplay, moderationButton, true); missingResponse.setRowAttributes(new ElementTag("class", "pending_response_row")); configureResponseRow(question, possibleGiver, recipientIdentifier, missingResponse); missingResponses.add(missingResponse); } } return missingResponses; }
Source:
<code>public void applyConfig(Configuration config, boolean reindex, boolean interactive) { setConfiguration(config, interactive); LOGGER.log(Level.INFO, "Configuration updated"); if (reindex) { refreshSearcherManagerMap(); maybeRefreshIndexSearchers(); refreshDateForLastIndexRun(); } <START> if (isAuthorizationWatchdog() && config.getPluginDirectory() != null) { <END> watchDog.start(new File(config.getPluginDirectory())); } else { watchDog.stop(); } getAuthorizationFramework().setPluginDirectory(config.getPluginDirectory()); getAuthorizationFramework().setStack(config.getPluginStack()); getAuthorizationFramework().reload(); messagesContainer.setMessageLimit(config.getMessageLimit()); }</code><technical_language>config.getPluginDirectory() this is ok locking</technical_language>

Target:
public void applyConfig(Configuration config, boolean reindex, boolean interactive) { setConfiguration(config, interactive); LOGGER.log(Level.INFO, "Configuration updated"); if (reindex) { refreshSearcherManagerMap(); maybeRefreshIndexSearchers(); refreshDateForLastIndexRun(); } if (isAuthorizationWatchdog() && getPluginDirectory() != null) { watchDog.start(new File(getPluginDirectory())); } else { watchDog.stop(); } getAuthorizationFramework().setPluginDirectory(getPluginDirectory()); getAuthorizationFramework().setStack(getPluginStack()); getAuthorizationFramework().reload(); messagesContainer.setMessageLimit(getMessageLimit()); }
Source:
<code><START> PoolKey getPoolKey(Version.Main version) throws IOException { if (Objects.isNull(keys.get(version))) { newPoolKey(version); } return keys.get(version); } <END></code><technical_language>a race condition here: 2 threads check isNull in parallel, call newPoolKey in parallel. I synchronize block ConcurrentMap putIfAbsent</technical_language>

Target:
PoolKey getPoolKey(Version.Main version) { return keys.computeIfAbsent(version, EmbedMongoFactory::newPoolKey); }
Source:
<code>public void init(boolean beginTransaction) throws Exception { this.config = new CandlepinCommonTestConfig(); Module testingModule = new TestingModules.StandardTest(this.config); this.injector = parentInjector.createChildInjector( Modules.override(testingModule).with(getGuiceOverrideModule())); locatorMap = this.injector.getInstance(ResourceLocatorMap.class); locatorMap.init(); <START> methodLocator = new MethodLocator(injector); <END> methodLocator.init(); annotationLocator = new AnnotationLocator(methodLocator); securityInterceptor = this.injector.getInstance(TestingInterceptor.class); cpRequestScope = injector.getInstance(CandlepinRequestScope.class); cpRequestScope.exit(); cpRequestScope.enter(); this.injector.injectMembers(this); dateSource = (DateSourceForTesting) injector.getInstance(DateSource.class); dateSource.currentDate(TestDateUtil.date(2010, 1, 1)); HttpServletRequest req = parentInjector.getInstance(HttpServletRequest.class); when(req.getAttribute("username")).thenReturn("mock_user"); this.i18n = I18nFactory.getI18n(getClass(), Locale.US, I18nFactory.FALLBACK); if (beginTransaction) { this.beginTransaction(); } }</code><technical_language>This ResourceLocatorMap instantiation is incorrect method locator instantiated is below</technical_language>

Target:
public void init(boolean beginTransaction) throws Exception { this.config = new CandlepinCommonTestConfig(); Module testingModule = new TestingModules.StandardTest(this.config); this.injector = parentInjector.createChildInjector( Modules.override(testingModule).with(getGuiceOverrideModule())); methodLocator = new MethodLocator(injector); methodLocator.init(); locatorMap = new ResourceLocatorMap(injector, methodLocator); locatorMap.init(); annotationLocator = new AnnotationLocator(methodLocator); securityInterceptor = this.injector.getInstance(TestingInterceptor.class); cpRequestScope = injector.getInstance(CandlepinRequestScope.class); cpRequestScope.exit(); cpRequestScope.enter(); this.injector.injectMembers(this); dateSource = (DateSourceForTesting) injector.getInstance(DateSource.class); dateSource.currentDate(TestDateUtil.date(2010, 1, 1)); HttpServletRequest req = parentInjector.getInstance(HttpServletRequest.class); when(req.getAttribute("username")).thenReturn("mock_user"); this.i18n = I18nFactory.getI18n(getClass(), Locale.US, I18nFactory.FALLBACK); if (beginTransaction) { this.beginTransaction(); } }
Source:
<code>private void reportAll(CheckerContext context) { <START> Map<Symbol.MethodSymbol, MethodBehavior> behaviors = new HashMap<>(); <END> methodSymbols.pop().entrySet().forEach(entry -> { Symbol.MethodSymbol methodSymbol = entry.getValue(); behaviors.putIfAbsent(methodSymbol, ((CheckerDispatcher) context).peekMethodBehavior(methodSymbol)); MethodBehavior mb = behaviors.get(methodSymbol); if (mb != null && mb.isComplete()) { IdentifierTree methodName = entry.getKey(); Set<Flow> flow = flowFromYield(mb, methodName); reportIssue(methodName, String.format("Method '%s' has %d method yields.", methodName.name(), mb.yields().size()), flow); } }); }</code><technical_language>I this cache is necessary, call CheckerDispatcher.peekMethodBehavior is cheap, need add another cache</technical_language>

Target:
private void reportAll(CheckerContext context) { CheckerDispatcher checkerDispatcher = (CheckerDispatcher) context; methodInvocations.pop().stream() .filter(mit -> mit.symbol().isMethodSymbol()) .forEach(mit -> reportYields(mit, checkerDispatcher)); }
Source:
<code>public void runActivity(Body body) { Service service = new Service(body); while (body.isActive()) { try { Request request = service.blockingRemoveOldest(); if (request == null) { return; } if (request.getMethodName().startsWith("wait") && !testWaitFunction(service, request)) { waitUntilQueue.add(request); } else { service.serve(request); <START> unblockWaitMethods(service); <END> } } catch (InterruptedException e) { Thread.currentThread().interrupt(); } } }</code><technical_language>I call unblockWaitMethods(service) moved of if/else statement. is why: suppose request predicate is satisfied. put request in queue loop again. serve another request served immediately, execute it. call unblockWaitMethods finally execute request put in waitUntilQueue. In end swapped order of execution of requests for reason executed immediately</technical_language>

Target:
public void runActivity(Body body) { Service service = new Service(body); while (body.isActive()) { try { NewRequestWithWaitTime requestWithWaitTime = waitForNewRequest(service); Request request = requestWithWaitTime.getNewRequest(); if (request != null && request.getMethodName().startsWith("wait") && !testWaitFunction(service, request)) { TimedOutRequest timedOutRequest = new TimedOutRequest(request, extractWaitRequestTimeoutParameter(request)); logger.trace("New pending wait request : " + timedOutRequest); waitUntilQueue.add(new TimedOutRequest(request, extractWaitRequestTimeoutParameter(request))); } else if (request != null) { service.serve(request); } unblockWaitMethods(service, requestWithWaitTime.getWaitTime()); } catch (InterruptedException e) { Thread.currentThread().interrupt(); } } }
Source:
<code>public void testListZones() throws InterruptedException { server.enqueue(jsonResponse("/zones.json")); List<Zone> zones = api.regionAndZoneApi().describeZones(Regions.EU_CENTRAL_1.getName()); assertEquals(size(zones), 2); assertEquals(server.getRequestCount(), 1); <START> assertSent(server, "GET", "DescribeZones"); <END> }</code><technical_language>incomplete... a parameter verifying exact request</technical_language>

Target:
public void testListZones() throws InterruptedException { server.enqueue(jsonResponse("/zones.json")); List<Zone> zones = api.regionAndZoneApi().describeZones(Regions.EU_CENTRAL_1.getName()); assertEquals(size(zones), 2); assertEquals(server.getRequestCount(), 1); assertSent(server, "GET", "DescribeZones", ImmutableMap.of("RegionId", Regions.EU_CENTRAL_1.getName())); }