auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>private int getAvailablePort() { ServerSocket serverSocket = null; int port = 0; for(int i = 0; i < 50; i++){ try { serverSocket = new ServerSocket(0); port = serverSocket.getLocalPort(); if(port != 0) { serverSocket.close(); break; } } catch (IOException e) { <START> LOG.error("Unable to allocate port " + e.getMessage(), e); <END> } } if (serverSocket != null && !serverSocket.isClosed()) { try { serverSocket.close(); } catch (IOException e) { LOG.error("error closing port", e); } } return port; }</code><technical_language>allocate port --> close port</technical_language>

Target:
private int getAvailablePort() { ServerSocket serverSocket = null; int port = 0; for(int i = 0; i < 50; i++){ try { serverSocket = new ServerSocket(0); port = serverSocket.getLocalPort(); if(port != 0) { serverSocket.close(); break; } } catch (IOException e) { LOG.error("Unable to close the server socket " + e.getMessage(), e); } } if (serverSocket != null && !serverSocket.isClosed()) { try { serverSocket.close(); } catch (IOException e) { LOG.error("error closing port", e); } } return port; }
Source:
<code>public ListenableFuture<Boolean> processMetrics(final List<List<IMetric>> input) { int remainingCapacityOfTheBlockingQueue = this.remainingCapacityOfTheQueue(); <START> log.debug("Remaining capacity of DiscoveryWriter blocking queue: [" + remainingCapacityOfTheBlockingQueue + "]"); <END> if(remainingCapacityOfTheBlockingQueue == 0){ log.warn("Remaining capacity of DiscoveryWriter blocking queue: [" + remainingCapacityOfTheBlockingQueue + "]"); } return getThreadPool().submit(new Callable<Boolean>() { @Override public Boolean call() throws Exception { boolean success = true; final List<IMetric> willIndex = DiscoveryWriter.condense(input); for (DiscoveryIO io : discoveryIOs) { try { io.insertDiscovery(willIndex); } catch (Exception ex) { getLogger().error(ex.getMessage(), ex); writeErrorMeters.get(io.getClass()).mark(); success = false; } } if(success) { for(IMetric indexedMetric: willIndex) { LocatorCache.getInstance().setLocatorCurrentInDiscoveryLayer(indexedMetric.getLocator()); } } return success; } }); }</code><technical_language>Please avoid string concatenation in logging statements slf4j placeholders instead. a debug log pay string building penalty debug is off</technical_language>

Target:
public ListenableFuture<Boolean> processMetrics(final List<List<IMetric>> input) { int remainingCapacityOfTheBlockingQueue = this.remainingCapacityOfTheQueue(); log.debug("Remaining capacity of DiscoveryWriter blocking queue: [{}]", remainingCapacityOfTheBlockingQueue); if(remainingCapacityOfTheBlockingQueue == 0){ log.warn("Remaining capacity of DiscoveryWriter blocking queue: [{}]", remainingCapacityOfTheBlockingQueue); } return getThreadPool().submit(new Callable<Boolean>() { @Override public Boolean call() throws Exception { boolean success = true; final List<IMetric> willIndex = DiscoveryWriter.condense(input); for (DiscoveryIO io : discoveryIOs) { try { io.insertDiscovery(willIndex); } catch (Exception ex) { getLogger().error(ex.getMessage(), ex); writeErrorMeters.get(io.getClass()).mark(); success = false; } } if(success) { for(IMetric indexedMetric: willIndex) { LocatorCache.getInstance().setLocatorCurrentInDiscoveryLayer(indexedMetric.getLocator()); } } return success; } }); }
Source:
<code>private AgentNotificationData notificationDataFrom(AgentInstance agentInstance) { return new AgentNotificationData(agentInstance.getUuid(), agentInstance.getHostname(), <START> elasticAgentId(agentInstance), <END> agentInstance.getIpAddress(), agentInstance.getOperatingSystem(), agentInstance.freeDiskSpace().toString(), agentInstance.getAgentConfigStatus().name(), agentInstance.getRuntimeStatus().agentState().name(), agentInstance.getRuntimeStatus().buildState().name(), new Date() ); }</code><technical_language>do plan do elasticAgentId</technical_language>

Target:
private AgentNotificationData notificationDataFrom(AgentInstance agentInstance) { return new AgentNotificationData(agentInstance.getUuid(), agentInstance.getHostname(), agentInstance.isElastic(), agentInstance.getIpAddress(), agentInstance.getOperatingSystem(), agentInstance.freeDiskSpace().toString(), agentInstance.getAgentConfigStatus().name(), agentInstance.getRuntimeStatus().agentState().name(), agentInstance.getRuntimeStatus().buildState().name(), new Date() ); }
Source:
<code>public void handle(String target, Request baseRequest, HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException { super.handle(target, baseRequest, request, response); if (baseRequest.isHandled()) return; try { response.setContentType(JSON_CONTENT_TYPE); if (m_jsonEnabled) { <START> if (target.equals("/") && !VoltDB.instance().rejoining()) { <END> httpClientInterface.process(baseRequest, response); } else { response.setStatus(HttpServletResponse.SC_NOT_FOUND); response.getWriter().println("Resource not found"); baseRequest.setHandled(true); } } else { response.setStatus(HttpServletResponse.SC_FORBIDDEN); baseRequest.setHandled(true); response.getWriter().println("JSON API IS CURRENTLY DISABLED"); } } catch(Exception ex){ logger.info("Not servicing url: " + baseRequest.getRequestURI() + " Details: "+ ex.getMessage(), ex); } }</code><technical_language>Is "Resource found" correct response a rejoin? If I OK changes long work pass tests</technical_language>

Target:
public void handle(String target, Request baseRequest, HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException { super.handle(target, baseRequest, request, response); if (baseRequest.isHandled()) return; try { response.setContentType(JSON_CONTENT_TYPE); if (m_jsonEnabled) { if (target.equals("/")) { httpClientInterface.process(baseRequest, response); } else { response.setStatus(HttpServletResponse.SC_NOT_FOUND); response.getWriter().println("Resource not found"); baseRequest.setHandled(true); } } else { response.setStatus(HttpServletResponse.SC_FORBIDDEN); baseRequest.setHandled(true); response.getWriter().println("JSON API IS CURRENTLY DISABLED"); } } catch(Exception ex){ logger.info("Not servicing url: " + baseRequest.getRequestURI() + " Details: "+ ex.getMessage(), ex); } }
Source:
<code>public void resourceSizeInGigabytes() { transformer.setAttributeMappings( Collections.singletonList( createMapping(Core.RESOURCE_SIZE, "ResourceSize", "{{ResourceSize}}"))); transformer.setDataUnit(WfsConstants.GB); final Optional<Metacard> metacardOptional = transformer.apply(inputStream, mockWfsMetadata); assertThat( "The transformer should have returned a metacard but didn't.", metacardOptional.isPresent(), is(true)); final Metacard metacard = metacardOptional.get(); <START> assertThat(getAttributeValue(Core.RESOURCE_SIZE, metacard), is("1073741824.0")); <END> }</code><technical_language>do data sizes from? magic numbers returned mock</technical_language>

Target:
public void resourceSizeInGigabytes() { transformer.setAttributeMappings( Collections.singletonList( createMapping(Core.RESOURCE_SIZE, "ResourceSize", "{{ResourceSize}}"))); transformer.setDataUnit(WfsConstants.GB); final Optional<Metacard> metacardOptional = transformer.apply(inputStream, mockWfsMetadata); assertThat( "The transformer should have returned a metacard but didn't.", metacardOptional.isPresent(), is(true)); final Metacard metacard = metacardOptional.get(); assertThat( getAttributeValue(Core.RESOURCE_SIZE, metacard), is(WfsConstants.BYTES_PER_GB + ".0")); }
Source:
<code>private List<ClosedAccount> findAllClosedAccountsFor(Map<String, Date> dateRange) { try { RowMapper<ClosedAccount> mapRow = new RowMapper<ClosedAccount>() { public ClosedAccount mapRow(ResultSet resultSet, int rowNumber) throws SQLException { <START> ClosedAccount laborClosedAccountDataRow = new ClosedAccount(); <END> laborClosedAccountDataRow.setChart(resultSet.getString(ACCT_FIN_COA_CD)); laborClosedAccountDataRow.setAccountNumber(resultSet.getString(ACCT_ACCOUNT_NBR)); laborClosedAccountDataRow.setSubAccountNumber(resultSet.getString(SUB_SUB_ACCT_NBR)); laborClosedAccountDataRow.setAccountClosedIndicator(resultSet.getString(ACCT_ACCT_CLOSED_IND)); laborClosedAccountDataRow.setAccountClosedDate(resultSet.getDate(ACCTX_ACCT_CLOSED_DT)); return laborClosedAccountDataRow; } }; return this.getJdbcTemplate().query(buildClosedAccountsForItChartDateRangeSql(dateRange), mapRow); } catch (Exception e) { LOG.info("findAllClosedAccountsFor Exception: " + e.getMessage()); return null; } }</code><technical_language>a cases of labor</technical_language>

Target:
private List<ClosedAccount> findAllClosedAccountsFor(Map<String, Date> dateRange) { try { RowMapper<ClosedAccount> mapRow = new RowMapper<ClosedAccount>() { public ClosedAccount mapRow(ResultSet resultSet, int rowNumber) throws SQLException { ClosedAccount closedAccountDataRow = new ClosedAccount(); closedAccountDataRow.setChart(resultSet.getString(ACCT_FIN_COA_CD)); closedAccountDataRow.setAccountNumber(resultSet.getString(ACCT_ACCOUNT_NBR)); closedAccountDataRow.setSubAccountNumber(resultSet.getString(SUB_SUB_ACCT_NBR)); closedAccountDataRow.setAccountClosedIndicator(resultSet.getString(ACCT_ACCT_CLOSED_IND)); closedAccountDataRow.setAccountClosedDate(resultSet.getDate(ACCTX_ACCT_CLOSED_DT)); return closedAccountDataRow; } }; return this.getJdbcTemplate().query(buildClosedAccountsForItChartDateRangeSql(dateRange), mapRow); } catch (Exception e) { LOG.info("findAllClosedAccountsFor Exception: " + e.getMessage()); return null; } }
Source:
<code>public int hashCode() { <START> return Objects.hashCode(mInputPartitionInfo, mInput, mOutput, mMaxNumFiles, mMinFileSize); <END> }</code><technical_language>this output partition too</technical_language>

Target:
public int hashCode() { return Objects.hashCode(mInputPartitionInfo, mOutputPartitionInfo, mInput, mOutput, mMaxNumFiles, mMinFileSize); }
Source:
<code><START> public Object apply(ConfigResource resource, Input input) <END> throws BadRequestException, ResourceConflictException, UnprocessableEntityException, OrmException, IOException { if (input == null) { input = new Input(); } if (input.username != null && !username.equals(input.username)) { throw new BadRequestException("username must match URL"); } if (Strings.isNullOrEmpty(input.sshKey)) { throw new BadRequestException("sshKey not set"); } if (blockedNames.contains(username.toLowerCase())) { throw new BadRequestException("The username '" + username + "' is not allowed as name for service users."); } CreateAccount.Input in = new ServiceUserInput(username, input.sshKey, cfg); Object response = createAccountFactory.create(username) .apply(TopLevelResource.INSTANCE, in); Config db = storage.get(); db.setString(USER_SECTION, username, CREATED_BY_KEY, userProvider.get().getUserName()); db.setString(USER_SECTION, username, CREATED_AT_KEY, rfc2822DateFormatter.format(new Date())); MetaDataUpdate md = metaDataUpdateFactory.create(allProjects); md.setMessage("Create Service User '" + username + "'\n"); storage.commit(md); return response; }</code><technical_language>s/Object/AccountInfo</technical_language>

Target:
public Object apply(ConfigResource resource, Input input) throws BadRequestException, ResourceConflictException, UnprocessableEntityException, OrmException, IOException { if (input == null) { input = new Input(); } if (input.username != null && !username.equals(input.username)) { throw new BadRequestException("username must match URL"); } if (Strings.isNullOrEmpty(input.sshKey)) { throw new BadRequestException("sshKey not set"); } if (blockedNames.contains(username.toLowerCase())) { throw new BadRequestException("The username '" + username + "' is not allowed as name for service users."); } CreateAccount.Input in = new ServiceUserInput(username, input.sshKey, cfg); Object response = createAccountFactory.create(username) .apply(TopLevelResource.INSTANCE, in); Config db = storage.get(); db.setString(USER, username, KEY_CREATED_BY, userProvider.get().getUserName()); db.setString(USER, username, KEY_CREATED_AT, rfc2822DateFormatter.format(new Date())); MetaDataUpdate md = metaDataUpdateFactory.create(allProjects); md.setMessage("Create Service User '" + username + "'\n"); storage.commit(md); return response; }
Source:
<code>synchronized int balance() { int currentNodeCount = nodeSupplier.getWorkerNodes().size(); if (currentNodeCount < minimumNodeCount) { <START> log.warn(format("Give up rebalancing because too many nodes are down (required: %s, current: %s)", minimumNodeCount, currentNodeCount)); <END> return 0; } log.info("Bucket balancer started. Computing assignments..."); Multimap<String, BucketAssignment> sourceToAssignmentChanges = computeAssignmentChanges(fetchClusterState()); log.info("Moving buckets..."); int moves = updateAssignments(sourceToAssignmentChanges); log.info("Bucket balancing finished. Moved %s buckets.", moves); return moves; }</code><technical_language>Rebalancing skipped enough nodes</technical_language>

Target:
synchronized int balance() { int currentNodeCount = nodeSupplier.getWorkerNodes().size(); if (currentNodeCount < minimumNodeCount) { log.warn(format("Rebalancing skipped because not enough nodes are available (required: %s, current: %s)", minimumNodeCount, currentNodeCount)); return 0; } log.info("Bucket balancer started. Computing assignments..."); Multimap<String, BucketAssignment> sourceToAssignmentChanges = computeAssignmentChanges(fetchClusterState()); log.info("Moving buckets..."); int moves = updateAssignments(sourceToAssignmentChanges); log.info("Bucket balancing finished. Moved %s buckets.", moves); return moves; }
Source:
<code>public StandaloneCatalogWithPriceOverride(final StaticCatalog catalog, final PriceOverride priceOverride, final Long tenantRecordId, final InternalCallContextFactory internalCallContextFactory) { setCatalogName(catalog.getCatalogName()); setEffectiveDate(catalog.getEffectiveDate()); <START> setProducts(((StandaloneCatalog) catalog).getCurrentProducts()); <END> setPlans(((StandaloneCatalog) catalog).getCurrentPlans()); setPriceLists(((StandaloneCatalog) catalog).getPriceLists()); setPlanRules((DefaultPlanRules) ((StandaloneCatalog) catalog).getPlanRules()); setSupportedCurrencies(((StandaloneCatalog) catalog).getCurrentSupportedCurrencies()); setUnits(((StandaloneCatalog) catalog).getCurrentUnits()); this.tenantRecordId = tenantRecordId; this.priceOverride = priceOverride; this.internalCallContextFactory = internalCallContextFactory; }</code><technical_language>cast is handle exception? easier instead propagate exception constructor</technical_language>

Target:
public StandaloneCatalogWithPriceOverride(final StaticCatalog catalog, final PriceOverride priceOverride, final Long tenantRecordId, final InternalCallContextFactory internalCallContextFactory) { setCatalogName(catalog.getCatalogName()); setEffectiveDate(catalog.getEffectiveDate()); setProducts(catalog.getProducts()); setPlans(catalog.getPlans()); setPriceLists(((StandaloneCatalog) catalog).getPriceLists()); setPlanRules((DefaultPlanRules) catalog.getPlanRules()); setSupportedCurrencies(catalog.getSupportedCurrencies()); setUnits((DefaultUnit[]) catalog.getUnits()); this.tenantRecordId = tenantRecordId; this.priceOverride = priceOverride; this.internalCallContextFactory = internalCallContextFactory; initialize(this); }
Source:
<code>public List<WriteEventInfo> getAllWriteEventInfo(long txnId, String dbName, String tableName) throws MetaException { List<WriteEventInfo> writeEventInfoList = null; boolean commited = false; Query query = null; try { openTransaction(); List<String> parameterVals = new ArrayList<>(); StringBuilder filterBuilder = new StringBuilder(" txnId == " + Long.toString(txnId)); if (dbName != null) { appendSimpleCondition(filterBuilder, "database", new String[]{dbName}, parameterVals); } if (tableName != null) { appendSimpleCondition(filterBuilder, "table", new String[]{tableName}, parameterVals); } query = pm.newQuery(MWriteNotificationLog.class, filterBuilder.toString()); <START> query.setOrdering("table ascending"); <END> List<MWriteNotificationLog> mplans = (List<MWriteNotificationLog>)query.executeWithArray( parameterVals.toArray(new String[parameterVals.size()])); pm.retrieveAll(mplans); commited = commitTransaction(); if (mplans != null && mplans.size() > 0) { writeEventInfoList = Lists.newArrayList(); for (MWriteNotificationLog mplan : mplans) { WriteEventInfo writeEventInfo = new WriteEventInfo(mplan.getWriteId(), mplan.getDatabase(), mplan.getTable(), mplan.getFiles()); writeEventInfo.setPartition(mplan.getPartition()); writeEventInfo.setPartitionObj(mplan.getPartObject()); writeEventInfo.setTableObj(mplan.getTableObject()); writeEventInfoList.add(writeEventInfo); } } } finally { rollbackAndCleanup(commited, query); } return writeEventInfoList; }</code><technical_language>is order database, table for warehouse level dump</technical_language>

Target:
public List<WriteEventInfo> getAllWriteEventInfo(long txnId, String dbName, String tableName) throws MetaException { List<WriteEventInfo> writeEventInfoList = null; boolean commited = false; Query query = null; try { openTransaction(); List<String> parameterVals = new ArrayList<>(); StringBuilder filterBuilder = new StringBuilder(" txnId == " + Long.toString(txnId)); if (dbName != null && !"*".equals(dbName)) { appendSimpleCondition(filterBuilder, "database", new String[]{dbName}, parameterVals); } if (tableName != null && !"*".equals(tableName)) { appendSimpleCondition(filterBuilder, "table", new String[]{tableName}, parameterVals); } query = pm.newQuery(MTxnWriteNotificationLog.class, filterBuilder.toString()); query.setOrdering("database,table ascending"); List<MTxnWriteNotificationLog> mplans = (List<MTxnWriteNotificationLog>)query.executeWithArray( parameterVals.toArray(new String[parameterVals.size()])); pm.retrieveAll(mplans); commited = commitTransaction(); if (mplans != null && mplans.size() > 0) { writeEventInfoList = Lists.newArrayList(); for (MTxnWriteNotificationLog mplan : mplans) { WriteEventInfo writeEventInfo = new WriteEventInfo(mplan.getWriteId(), mplan.getDatabase(), mplan.getTable(), mplan.getFiles()); writeEventInfo.setPartition(mplan.getPartition()); writeEventInfo.setPartitionObj(mplan.getPartObject()); writeEventInfo.setTableObj(mplan.getTableObject()); writeEventInfoList.add(writeEventInfo); } } } finally { rollbackAndCleanup(commited, query); } return writeEventInfoList; }
Source:
<code>public static void updateDiskStats(HWDiskStore diskStore) { <START> Map<String,List<Object>> vals = WmiUtil.selectObjectsFrom(null, "Win32_DiskDrive", <END> "Name,Manufacturer,Model,SerialNumber,Size,Index", "WHERE SerialNumber = " + diskStore.getSerial(),DRIVE_TYPES); diskStore.setName((String) vals.get("Name").get(0)); diskStore.setModel(String.format("%s %s", vals.get("Model").get(0), vals.get("Manufacturer").get(0)).trim()); String index = vals.get("Index").get(0).toString(); diskStore.setReads(MapUtil.getOrDefault(readMap, index, 0L)); diskStore.setReadBytes(MapUtil.getOrDefault(readByteMap, index, 0L)); diskStore.setWrites(MapUtil.getOrDefault(writeMap, index, 0L)); diskStore.setWriteBytes(MapUtil.getOrDefault(writeByteMap, index, 0L)); diskStore.setTransferTime(MapUtil.getOrDefault(xferTimeMap, index, 0L)); diskStore.setTimeStamp(MapUtil.getOrDefault(timeStampMap, index, 0L)); diskStore.setSize(ParseUtil.parseLongOrDefault((String) vals.get("Size").get(0), 0L)); HWPartition[] partitions = diskStore.getPartitions(); List<String> partList = driveToPartitionMap.get(diskStore.getName()); if (partList != null && !partList.isEmpty()) { for (int i = 0; i < partList.size(); i++) { String part = partList.get(i); partitions[i] = partitionMap.get(part); } } }</code><technical_language>need read WMI for this update. of values change</technical_language>

Target:
public static boolean updateDiskStats(HWDiskStore diskStore) { populateReadWriteMaps(); Map<String, List<Object>> vals = WmiUtil.selectObjectsFrom(null, "Win32_DiskDrive", "Index", "WHERE SerialNumber=" + diskStore.getSerial(), DRIVE_TYPES); if(vals.get("Index").size() == 0) { return false; } String index = vals.get("Index").get(0).toString(); if(readMap.containsKey(index)) { diskStore.setReads(MapUtil.getOrDefault(readMap, index, 0L)); diskStore.setReadBytes(MapUtil.getOrDefault(readByteMap, index, 0L)); diskStore.setWrites(MapUtil.getOrDefault(writeMap, index, 0L)); diskStore.setWriteBytes(MapUtil.getOrDefault(writeByteMap, index, 0L)); diskStore.setTransferTime(MapUtil.getOrDefault(xferTimeMap, index, 0L)); diskStore.setTimeStamp(MapUtil.getOrDefault(timeStampMap, index, 0L)); return true; } else { return false; } }
Source:
<code>public void dequeueMessage() { TestHelpers.assertResponseStatusCode(client.create(), 201); String messageText = "test message"; TestHelpers.assertResponseStatusCode(client.enqueueMessage(messageText), 201); <START> Iterator<DequeuedMessage> response = client.dequeueMessages().iterator(); <END> assertEquals(messageText, response.next().messageText()); assertFalse(response.hasNext()); }</code><technical_language>reach conclusion if want merge DequedMessage PeekedMessage</technical_language>

Target:
public void dequeueMessage() { helper.assertResponseStatusCode(client.create(), 201); String messageText = "test message"; helper.assertResponseStatusCode(client.enqueueMessage(messageText), 201); Iterator<DequeuedMessage> response = client.dequeueMessages().iterator(); assertEquals(messageText, response.next().messageText()); assertFalse(response.hasNext()); }
Source:
<code>public void publish(StreamPayload<Exchange> data) { List<CamelSubscription> subs = new LinkedList<>(subscriptions); DispatchCallback<Exchange> originalCallback = data.getCallback(); if (originalCallback != null && subs.size() > 0) { AtomicInteger counter = new AtomicInteger(0); AtomicReference<Throwable> thrown = new AtomicReference<>(null); data = new StreamPayload<>(data.getItem(), (ex, error) -> { int status = counter.incrementAndGet(); thrown.compareAndSet(null, error); <START> if (status == subs.size()) { <END> originalCallback.processed(ex, thrown.get()); } }); } if (subs.size() > 0) { LOG.debug("Exchange published to subscriptions for the stream {}: {}", subs.size(), name, data.getItem()); for (CamelSubscription sub : subs) { sub.publish(data); } } else { data.getCallback().processed(data.getItem(), new IllegalStateException("The stream has no active subscriptions")); } }</code><technical_language>Small optimization, implemented as: java AtomicInteger counter = new AtomicInteger(subs.size()); ... if (counter.decrementAndGet() == 0) { ... }</technical_language>

Target:
public void publish(StreamPayload<Exchange> data) { List<CamelSubscription> subs = new LinkedList<>(subscriptions); DispatchCallback<Exchange> originalCallback = data.getCallback(); if (originalCallback != null && subs.size() > 0) { AtomicInteger counter = new AtomicInteger(subs.size()); AtomicReference<Throwable> thrown = new AtomicReference<>(null); data = new StreamPayload<>(data.getItem(), (ex, error) -> { thrown.compareAndSet(null, error); if (counter.decrementAndGet() == 0) { originalCallback.processed(ex, thrown.get()); } }); } if (subs.size() > 0) { LOG.debug("Exchange published to subscriptions for the stream {}: {}", subs.size(), name, data.getItem()); for (CamelSubscription sub : subs) { sub.publish(data); } } else { data.getCallback().processed(data.getItem(), new IllegalStateException("The stream has no active subscriptions")); } }
Source:
<code>private URL getActionUrl(String metacardSource, String metacardId) throws MalformedURLException, URISyntaxException { StringBuilder sb = new StringBuilder(); sb.append(baseUrl); sb.append(context); sb.append("/"); sb.append( String.format( <START> "%s%s/%s/%s?transform=%s", <END> CONTEXT_ROOT, SOURCES_PATH, metacardSource, metacardId, metacardTransformerId)); return new URI(sb.toString()).toURL(); }</code><technical_language>Is a reason this format call wrapped in a StringBuilder instead of adding baseUrl context in original format string</technical_language>

Target:
private URL getActionUrl(String metacardSource, String metacardId) throws MalformedURLException, URISyntaxException { String actionUrl = String.format( "%s%s/%s%s/%s/%s?transform=%s", baseUrl, context, CONTEXT_ROOT, SOURCES_PATH, metacardSource, metacardId, metacardTransformerId); return new URI(actionUrl).toURL(); }
Source:
<code>public Stream<BytesHandle> getParamValues() { <START> return paramValues; <END> }</code><technical_language>getter fulfill contract constructing a stream request Stream.of() similar MultipleAtomicCallField</technical_language>

Target:
public Stream<BytesHandle> getParamValues() { return Stream.of(paramValues); }
Source:
<code>public Optional<Application> applicationFor(HttpServletRequest request) throws InvalidApiKeyException { String apiKey; try { apiKey = MoreObjects.firstNonNull( request.getParameter(API_KEY_QUERY_PARAMETER), request.getHeader(API_KEY_QUERY_PARAMETER) ); } catch (NullPointerException e) { throw InvalidApiKeyException.create(e.getMessage(), "No api key supplied"); } Result result = applicationsClient.resolve( Query.create(apiKey, environment) ); if (result.getErrorCode().isPresent()) { <START> throw InvalidApiKeyException.create(apiKey, result.getErrorCode().get().toString()); <END> } return result.getSingleResult(); }</code><technical_language>more obvious unfamiliar code if exception message like: Applications service returned error code: <errorCode></technical_language>

Target:
public Optional<Application> applicationFor(HttpServletRequest request) throws ApplicationResolutionException { String apiKeyParam = request.getParameter(API_KEY_QUERY_PARAMETER); String apiKeyHeader = request.getHeader(API_KEY_QUERY_PARAMETER); if (Strings.isNullOrEmpty(apiKeyParam) && Strings.isNullOrEmpty(apiKeyHeader)) { return Optional.empty(); } String apiKey = MoreObjects.firstNonNull(apiKeyParam, apiKeyHeader); Result result = applicationsClient.resolve( Query.create(apiKey, environment) ); if (result.getErrorCode().isPresent()) { log.error("Unable to resolve application: - {}", result.getErrorCode().get(), apiKey); throw ApplicationResolutionException.create( apiKey, "Unable to resolve application" ); } return result.getSingleResult(); }
Source:
<code>public WPSwitchPreference(Context context, AttributeSet attrs) { super(context, attrs); TypedArray array = context.obtainStyledAttributes(attrs, R.styleable.SummaryEditTextPreference); for (int i = 0; i < array.getIndexCount(); ++i) { int index = array.getIndex(i); if (index == R.styleable.SummaryEditTextPreference_longClickHint) { mHint = array.getString(index); } else if (index == R.styleable.SummaryEditTextPreference_iconTint) { mTint = array.getResourceId(index, R.color.neutral); } else if (index == R.styleable.SummaryEditTextPreference_switchThumbTint) { mThumbTint = array.getColorStateList(index); } else if (index == R.styleable.SummaryEditTextPreference_switchTrackTint) { mTrackTint = array.getColorStateList(index); } else if (index == R.styleable.SummaryEditTextPreference_preferenceTextColor) { <START> mTextColor = array.getResourceId(index, R.color.white); <END> } else if (index == R.styleable.SummaryEditTextPreference_backgroundColorChecked) { mBackgroundCheckedColor = array.getResourceId(index, R.color.white); } else if (index == R.styleable.SummaryEditTextPreference_backgroundColorUnchecked) { mBackgroundUncheckedColor = array.getResourceId(index, R.color.white); } } array.recycle(); }</code><technical_language>pulling this color of libraries, if get removed some point in trouble. I suggest android.R.color.white instead (in other places too)</technical_language>

Target:
public WPSwitchPreference(Context context, AttributeSet attrs) { super(context, attrs); TypedArray array = context.obtainStyledAttributes(attrs, R.styleable.SummaryEditTextPreference); for (int i = 0; i < array.getIndexCount(); ++i) { int index = array.getIndex(i); if (index == R.styleable.SummaryEditTextPreference_longClickHint) { mHint = array.getString(index); } else if (index == R.styleable.SummaryEditTextPreference_iconTint) { mTint = array.getResourceId(index, R.color.neutral); } else if (index == R.styleable.SummaryEditTextPreference_switchThumbTint) { mThumbTint = array.getColorStateList(index); } else if (index == R.styleable.SummaryEditTextPreference_switchTrackTint) { mTrackTint = array.getColorStateList(index); } else if (index == R.styleable.SummaryEditTextPreference_preferenceTextColor) { mTextColor = array.getResourceId(index, android.R.color.white); } else if (index == R.styleable.SummaryEditTextPreference_backgroundColorChecked) { mBackgroundCheckedColor = array.getResourceId(index, android.R.color.white); } else if (index == R.styleable.SummaryEditTextPreference_backgroundColorUnchecked) { mBackgroundUncheckedColor = array.getResourceId(index, android.R.color.white); } } array.recycle(); }
Source:
<code>public static @Nullable List<String> getOutputFromCommand(List<String> command) { try { ProcessBuilder builder = new ProcessBuilder(command); builder.redirectErrorStream(true); Process p = builder.start(); <START> try (BufferedReader br = new BufferedReader(new InputStreamReader(p.getInputStream(), Charset.defaultCharset()));) { <END> List<String> output = new LinkedList<>(); String line = br.readLine(); while (line != null) { output.add(line); line = br.readLine(); } int ret = p.waitFor(); return (ret == 0 ? output : null); } } catch (IOException | InterruptedException e) { return null; } }</code><technical_language>good point! encoding, static analysis is quick point out. Instead of defaultCharset() however, I explicitly UTF-8. Guava Charsets.UTF_8 for instance (I prefer Charset.forName("UTF-8") risk messing string). restrict external processes output in UTF-8, I a problem, UTF-8 is common. worst add a parameter pass expected charset</technical_language>

Target:
public static @Nullable List<String> getOutputFromCommand(List<String> command) { try { ProcessBuilder builder = new ProcessBuilder(command); builder.redirectErrorStream(true); Process p = builder.start(); try (BufferedReader br = new BufferedReader(new InputStreamReader(p.getInputStream(), Charsets.UTF_8));) { List<String> output = new LinkedList<>(); String line = br.readLine(); while (line != null) { output.add(line); line = br.readLine(); } int ret = p.waitFor(); return (ret == 0 ? output : null); } } catch (IOException | InterruptedException e) { return null; } }
Source:
<code>public int update(String sql, Object... args) throws SQLException { <START> try (PreparedStatement ps = connection.prepareStatement(sql)) { <END> setParameters(ps, args); return ps.executeUpdate(); } }</code><technical_language>Probably, this changes broken a current behavior ignore exception if Statement.close throw a SQLException</technical_language>

Target:
public int update(String sql, Object... args) throws SQLException { PreparedStatement ps = connection.prepareStatement(sql); try { setParameters(ps, args); return ps.executeUpdate(); } finally { try { ps.close(); } catch (SQLException e) { } } }
Source:
<code>private static int findFreePort() throws IOException { <START> try (ServerSocket socket = new ServerSocket(0);) { <END> return socket.getLocalPort(); } }</code><technical_language>Unnecessary semicolon</technical_language>

Target:
private static int findFreePort() throws IOException { try (ServerSocket socket = new ServerSocket(0)) { return socket.getLocalPort(); } }
Source:
<code><START> private View getScrollTarget(View target) { <END> return mScrollTargetCallback != null ? mScrollTargetCallback.callback(target) : target; }</code><technical_language>This is fix SwipeRefreshLayout issue. private View getScrollTarget(View target) { return mScrollTargetCallback != null ? mScrollTargetCallback.callback(target) : getSupportedScrollTarget(target); } private View getSupportedScrollTarget(View target) { if (target instanceof SwipeRefreshLayout && ((SwipeRefreshLayout) target).getChildCount() > 0) { SwipeRefreshLayout parent = (SwipeRefreshLayout) target; View child; int n = parent.getChildCount(); for (int i = 0; i < n; i++) { child = parent.getChildAt(i); if (child instanceof NestedScrollView || child instanceof RecyclerView) { return child; } } return ((SwipeRefreshLayout) target).getChildAt(0); } return target; }</technical_language>

Target:
private View getScrollTarget(View target) { return mScrollTargetCallback != null ? mScrollTargetCallback.callback(target) : getSupportedScrollTarget(target); }
Source:
<code>public @CheckForNull VersionNumber version() throws IOException, InterruptedException { LaunchResult result = launch(new EnvVars(), true, "-v"); final String stdout = result.getOut(); <START> if (result.getStatus() == 0 && stdout != null) { <END> return parseVersionNumber(stdout); } else { return null; } }</code><technical_language>below; is reason for this I see</technical_language>

Target:
public @CheckForNull VersionNumber version() throws IOException, InterruptedException { LaunchResult result = launch(new EnvVars(), true, "-v"); if (result.getStatus() == 0) { return parseVersionNumber(result.getOut()); } else { return null; } }
Source:
<code>public ResponseEntity<String> visualizeNetworks(@ProjectIdentifier @PathVariable("projectUnixName") String unixName, @PathVariable("networkId") String networkId, Principal principal, @CheckAccess @InjectProject IProject project) { ITransformedNetwork transformedNetwork = null; try { transformedNetwork = transformationManager.getTransformedNetwork(networkId); } catch (QuadrigaStorageException qse) { <START> logger.error("Error while retrieving networks for display:" + qse); <END> return new ResponseEntity<String>("", HttpStatus.INTERNAL_SERVER_ERROR); } String json = null; if (transformedNetwork != null) { json = jsonCreator.getJson(transformedNetwork.getNodes(), transformedNetwork.getLinks()); } else { return new ResponseEntity<String>(json, HttpStatus.NOT_FOUND); } return new ResponseEntity<String>(json, HttpStatus.OK); }</code><technical_language>I a comma a</technical_language>

Target:
public ResponseEntity<String> visualizeNetworks(@ProjectIdentifier @PathVariable("projectUnixName") String unixName, @PathVariable("networkId") String networkId, Principal principal, @CheckAccess @InjectProject IProject project) { ITransformedNetwork transformedNetwork = null; try { transformedNetwork = transformationManager.getTransformedNetwork(networkId); } catch (QuadrigaStorageException qse) { logger.error("Error while retrieving networks for display:", qse); return new ResponseEntity<String>("", HttpStatus.INTERNAL_SERVER_ERROR); } String json = null; if (transformedNetwork != null) { json = jsonCreator.getJson(transformedNetwork.getNodes(), transformedNetwork.getLinks()); } else { return new ResponseEntity<String>("", HttpStatus.NOT_FOUND); } return new ResponseEntity<String>(json, HttpStatus.OK); }
Source:
<code>public PageableResult search(RequestContext context) throws ResponseException { String patientUuid = context.getRequest().getParameter("patient"); String encounterTypeUuid = context.getRequest().getParameter("encounterType"); <START> if (patientUuid != null) { <END> Patient patient = ((PatientResource1_8) Context.getService(RestService.class).getResourceBySupportedClass( Patient.class)).getByUniqueId(patientUuid); EncounterType encounterType = ((EncounterTypeResource1_8) Context.getService(RestService.class).getResourceBySupportedClass(EncounterType.class)).getByUniqueId(encounterTypeUuid); if (patient != null && encounterType != null) { List<Encounter> encounters = Context.getEncounterService() .getEncounters(patient, null, null, null, null, Arrays.asList(encounterType), null, false); return new NeedsPaging<Encounter>(encounters, context); } } return new EmptySearchResult(); }</code><technical_language>patient is a required parameter, null</technical_language>

Target:
public PageableResult search(RequestContext context) throws ResponseException { String patientUuid = context.getRequest().getParameter("patient"); String encounterTypeUuid = context.getRequest().getParameter("encounterType"); Patient patient = ((PatientResource1_8) Context.getService(RestService.class).getResourceBySupportedClass( Patient.class)).getByUniqueId(patientUuid); EncounterType encounterType = ((EncounterTypeResource1_8) Context.getService(RestService.class).getResourceBySupportedClass(EncounterType.class)).getByUniqueId(encounterTypeUuid); if (patient != null && encounterType != null) { List<Encounter> encounters = Context.getEncounterService() .getEncounters(patient, null, null, null, null, Arrays.asList(encounterType), null, false); return new NeedsPaging<Encounter>(encounters, context); } return new EmptySearchResult(); }
Source:
<code>public List<Path> loadPaths(final Path path, final String suffix) { final List<Path> items = new ArrayList<Path>(); <START> if (!Files.exists(Paths.convert(path))) { <END> return items; } org.uberfire.java.nio.file.Path pPath = Paths.convert(path); if (!Files.isDirectory(pPath)) { pPath = pPath.getParent(); } final Set<ValueIndexTerm> queryTerms = new HashSet<>(); final ArrayList<String> extensions = new ArrayList<>(); extensions.add(suffix); queryTerms.add(new LibraryValueRepositoryRootIndexTerm(Paths.convert(pPath).toURI(), ValueIndexTerm.TermSearchType.NORMAL)); queryTerms.add(new LibraryValueFileExtensionIndexTerm(extensions)); final List<RefactoringPageRow> rows = refactoringQueryService.query(FindAllLibraryAssetsQuery.NAME, queryTerms); for (RefactoringPageRow row : rows) { items.add((Path) row.getValue()); } return items; }</code><technical_language>@Rikkola - beside calling method (Paths.convert(path) - do slow this method be) if execution get a not-existing path, throw Exception? asking 'cause I idea if is a valid/possible case unexpected one</technical_language>

Target:
public List<Path> loadPaths(final Path path, final String suffix) { PortablePreconditions.checkNotNull("path", path); PortablePreconditions.checkNotNull("suffix", suffix); org.uberfire.java.nio.file.Path nioPath = Paths.convert(path); final List<Path> items = new ArrayList<>(); if (!Files.exists(nioPath)) { return items; } if (!Files.isDirectory(nioPath)) { nioPath = nioPath.getParent(); } final Set<ValueIndexTerm> queryTerms = new HashSet<>(); final ArrayList<String> extensions = new ArrayList<>(); extensions.add(suffix); queryTerms.add(new LibraryValueRepositoryRootIndexTerm(Paths.convert(nioPath).toURI(), ValueIndexTerm.TermSearchType.NORMAL)); queryTerms.add(new LibraryValueFileExtensionIndexTerm(extensions)); final List<RefactoringPageRow> rows = refactoringQueryService.query(FindAllLibraryAssetsQuery.NAME, queryTerms); for (RefactoringPageRow row : rows) { items.add((Path) row.getValue()); } return items; }
Source:
<code>public Stream<ContainerItem> listContainers(ListContainersOptions options, Duration timeout) { Flux<ContainerItem> response = blobServiceAsyncClient.listContainers(options); <START> return timeout == null ? response.toStream() : response.timeout(timeout).toStream(); <END> }</code><technical_language>Alan's PR a helper method for timeout in Utility. Is visible you</technical_language>

Target:
public PagedIterable<ContainerItem> listContainers(ListContainersOptions options, Duration timeout) { return new PagedIterable<>(blobServiceAsyncClient.listContainersWithOptionalTimeout(options, timeout)); }
Source:
<code>public List<String> getPagesValues() { return getForm() <START> .findElements(By.xpath(". END> .map(webElement -> webElement.getAttribute(VALUE_ATTR)).collect(Collectors.toList()); }</code><technical_language>I a CSS selector (usually easier read)</technical_language>

Target:
public List<String> getPagesValues() { return getForm().findElements(By.cssSelector("input[type=hidden][name=pages]")).stream() .map(webElement -> webElement.getAttribute(VALUE_ATTR)).collect(Collectors.toList()); }
Source:
<code>protected void EndSuccessfully() { VM vm = getVm(); if (vm != null) { VmHandler.UnLockVm(vm.getId()); endDiskRelatedActions(vm); if (getParameters().getCopyCollapse()) { this.endCopyCollapseOps(vm); <START> } <END> else { this.endDefaultOps(vm); } setSucceeded(true); } else { setCommandShouldBeLogged(false); log.warn("ExportVmCommand::EndMoveVmCommand: Vm is null - not performing full EndAction"); } }</code><technical_language>minor: move else line, "}"</technical_language>

Target:
protected void EndSuccessfully() { VM vm = getVm(); if (vm != null) { VmHandler.UnLockVm(vm.getId()); endDiskRelatedActions(vm); if (getParameters().getCopyCollapse()) { this.endCopyCollapseOperations(vm); } else { this.endDefaultOps(vm); } setSucceeded(true); } else { setCommandShouldBeLogged(false); log.warn("ExportVmCommand::EndMoveVmCommand: Vm is null - not performing full EndAction"); } }
Source:
<code>TableConfWatcher(Instance instance) { this.instance = instance; tablesPrefix = ZooUtil.getRoot(instance) + Constants.ZTABLES + "/"; <START> tablesPrefixLength = tablesPrefix.length(); <END> scf = new ServerConfigurationFactory(instance); }</code><technical_language>store length</technical_language>

Target:
TableConfWatcher(Instance instance) { this.instance = instance; tablesPrefix = ZooUtil.getRoot(instance) + Constants.ZTABLES + "/"; scf = new ServerConfigurationFactory(instance); }
Source:
<code>public void requireLastHeartbeat() { if (lastHeartbeat == null) { <START> throw new RuntimeException("BinlogPosition.lastHeartbeat must be set"); <END> } }</code><technical_language>a checked exception here</technical_language>

Target:
public void requireLastHeartbeat() { if (lastHeartbeat == null) { throw new AssertionError("BinlogPosition.lastHeartbeat must be set"); } }
Source:
<code>protected void onPreExecute() { super.onPreExecute(); <START> if (context == null) { <END> return; } String title = context.getString(R.string.please_wait); String message = context.getString(R.string.fetching_templates); progressDialog = ProgressDialog.show(context, title, message); }</code><technical_language>Is possible, context is null</technical_language>

Target:
protected void onPreExecute() { super.onPreExecute(); if (context == null) { return; } String title = context.getString(R.string.please_wait); String progressMessage = context.getString(R.string.fetching_templates); progressDialog = ProgressDialog.show(context, title, progressMessage); }
Source:
<code>void verifyRawQueryBehavior(@Nullable TestItem actualItem) { <START> verify(storIOSQLite, times(1)).get(); <END> verify(getResolver, times(1)).performGet(storIOSQLite, rawQuery); verify(getResolver, times(1)).mapFromCursor(cursor); verify(cursor, times(1)).close(); assertThat(actualItem).isEqualTo(item); }</code><technical_language>times(1)</technical_language>

Target:
void verifyRawQueryBehavior(@Nullable TestItem actualItem) { verify(storIOSQLite).get(); verify(getResolver).performGet(storIOSQLite, rawQuery); verify(getResolver).mapFromCursor(cursor); verify(cursor).close(); assertThat(actualItem).isEqualTo(item); }
Source:
<code><START> public List<AstProcessingStage<?>> testOnlyGetDependencies(RuleSets ruleSets, LanguageVersion languageVersion) { <END> return getDependencies(ruleSets, languageVersion); }</code><technical_language>a public test method, consider turning getDependencies package-private, accessible test (same package) invisible world</technical_language>

Target:
List<AstProcessingStage<?>> testOnlyGetDependencies(RuleSets ruleSets, LanguageVersion languageVersion) { return getDependencies(ruleSets, languageVersion); }
Source:
<code>public void setDOMStorageItem(JsonRpcPeer peer, JSONObject params) throws JSONException { StorageId storage = mObjectMapper.convertValue( params.getJSONObject("storageId"), StorageId.class); String key = params.getString("key"); String value = params.getString("value"); if (storage.isLocalStorage) { SharedPreferences prefs = mContext.getSharedPreferences( storage.securityOrigin, Context.MODE_PRIVATE); Object exitingValue = prefs.getAll().get(key); SharedPreferences.Editor editor = prefs.edit(); if (!tryAssignByType(editor, key, value, exitingValue)) { editor.putString(key, value); } editor.apply(); <START> } <END> }</code><technical_language>else {CLog(...);}</technical_language>

Target:
public void setDOMStorageItem(JsonRpcPeer peer, JSONObject params) throws JSONException, JsonRpcException { StorageId storage = mObjectMapper.convertValue( params.getJSONObject("storageId"), StorageId.class); String key = params.getString("key"); String value = params.getString("value"); if (storage.isLocalStorage) { SharedPreferences prefs = mContext.getSharedPreferences( storage.securityOrigin, Context.MODE_PRIVATE); Object existingValue = prefs.getAll().get(key); try { if (existingValue == null) { throw new DOMStorageAssignmentException( "Unsupported: cannot add new key " + key + " due to lack of type inference"); } else { SharedPreferences.Editor editor = prefs.edit(); try { assignByType(editor, key, SharedPreferencesHelper.valueFromString(value, existingValue)); editor.apply(); } catch (IllegalArgumentException e) { throw new DOMStorageAssignmentException( String.format(Locale.US, "Type mismatch setting %s to %s (expected %s)", key, value, existingValue.getClass().getSimpleName())); } } } catch (DOMStorageAssignmentException e) { CLog.writeToConsole( mDOMStoragePeerManager, Console.MessageLevel.ERROR, Console.MessageSource.STORAGE, e.getMessage()); if (prefs.contains(key)) { mDOMStoragePeerManager.signalItemUpdated( storage, key, value, SharedPreferencesHelper.valueToString(existingValue)); } else { mDOMStoragePeerManager.signalItemRemoved(storage, key); } } } }
Source:
<code>private static String getSessionDescription(ISarosSession sarosSession) { final Set<IReferencePoint> referencePoints = sarosSession.getReferencePoints(); final StringBuilder result = new StringBuilder(); for (IReferencePoint referencePoint : referencePoints) { final Pair<Long, Long> fileCountAndSize; final List<IResource> resources = Collections.singletonList(ResourceConverter.getDelegate(referencePoint)); fileCountAndSize = FileUtils.getFileCountAndSize(resources, true, IContainer.EXCLUDE_DERIVED); result.append( String.format( "\nReference Point: %s, Files: %d, Size: %s", <START> referencePoint.getName(), <END> fileCountAndSize.getRight(), format(fileCountAndSize.getLeft()))); } return result.toString(); }</code><technical_language>this return full path folder name ? XYZ invited to: Reference Point: src, Files: 5 ... Reference Point: src, Files: 25 ... Reference Point: src, Files: 35 ... Reference Point: src, Files: 7 ... Reference Point: src, Files: 4711 ... I do this is helpful</technical_language>

Target:
private static String getSessionDescription(ISarosSession sarosSession) { final Set<IReferencePoint> referencePoints = sarosSession.getReferencePoints(); final StringBuilder result = new StringBuilder(); for (IReferencePoint referencePoint : referencePoints) { final IContainer referencePointDelegate = ResourceConverter.getDelegate(referencePoint); final Pair<Long, Long> fileCountAndSize; final List<IResource> resources = Collections.singletonList(ResourceConverter.getDelegate(referencePoint)); fileCountAndSize = FileUtils.getFileCountAndSize(resources, true, IContainer.EXCLUDE_DERIVED); result.append( String.format( "\nReference Point: %s, Files: %d, Size: %s", referencePointDelegate.getFullPath(), fileCountAndSize.getRight(), format(fileCountAndSize.getLeft()))); } return result.toString(); }
Source:
<code>public static void Init() { Class<?>[] inspectedClasses = new Class<?>[] { VDS.class, VdsStatic.class, VdsDynamic.class }; mUpdateVdsStatic = new ObjectIdentityChecker(VdsHandler.class, Arrays.asList(inspectedClasses), VDSStatus.class); <START> for (Pair<EditableField,String> pair : extractyAnnotatedFields(EditableField.class, inspectedClasses)) { <END> mUpdateVdsStatic.AddPermittedFields(pair.getSecond()); } for (Pair<EditableOnVdsStatus,String> pair : extractyAnnotatedFields(EditableOnVdsStatus.class, inspectedClasses)) { mUpdateVdsStatic.AddField(Arrays.asList(pair.getFirst().statuses()),pair.getSecond()); } }</code><technical_language>extracty extract (extractyAnnotatedFields)</technical_language>

Target:
public static void Init() { Class<?>[] inspectedClasses = new Class<?>[] { VDS.class, VdsStatic.class, VdsDynamic.class }; mUpdateVdsStatic = new ObjectIdentityChecker(VdsHandler.class, Arrays.asList(inspectedClasses), VDSStatus.class); for (Pair<EditableField,String> pair : extractAnnotatedFields(EditableField.class, inspectedClasses)) { mUpdateVdsStatic.AddPermittedField(pair.getSecond()); } for (Pair<EditableOnVdsStatus,String> pair : extractAnnotatedFields(EditableOnVdsStatus.class, inspectedClasses)) { mUpdateVdsStatic.AddField(Arrays.asList(pair.getFirst().statuses()),pair.getSecond()); } }