auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public void testList() { servers = serverApi().getList(); assertNotNull(servers); assertFalse(servers.isEmpty()); <START> Assert.assertTrue(servers.size() > 0); <END> }</code><technical_language>This is redundant</technical_language>

Target:
public void testList() { servers = serverApi().list(); assertNotNull(servers); Assert.assertTrue(servers.size() > 0); }
Source:
<code>public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View view = inflater.inflate(R.layout.fragment_playbar, container, false); final ImageButton playPause = ((ImageButton) view.findViewById(R.id.btn_play_pause)); playPause.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { try { PlaylistService service = playlistServiceLocator.getService(); if (service.isPlaying()) { service.pause(); setPlayImage(playPause); <START> Log.w(TAG, "pause called"); <END> } else { service.play(); playPause.setImageDrawable( getResources().getDrawable(R.drawable.av_pause)); Log.w(TAG, "play called"); } }catch (ServiceNotBoundException e) { Log.wtf(TAG, e); } } }); ((ImageButton) view.findViewById(R.id.btn_skip)) .setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { try { PlaylistService service = playlistServiceLocator.getService(); service.skip(); } catch (ServiceNotBoundException e) { Log.wtf(TAG, e); } } }); return view; }</code><technical_language>a warning</technical_language>

Target:
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View view = inflater.inflate(R.layout.fragment_playbar, container, false); playPause = ((ImageButton) view.findViewById(R.id.btn_play_pause)); playPause.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { try { PlaylistService service = playlistServiceLocator.getService(); if (service.isPlaying()) { service.pause(); } else { service.play(); } smartSetPlayPauseImage(service); }catch (ServiceNotBoundException e) { Log.wtf(TAG, e); } } }); ((ImageButton) view.findViewById(R.id.btn_skip)) .setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { try { PlaylistService service = playlistServiceLocator.getService(); service.skip(); } catch (ServiceNotBoundException e) { Log.wtf(TAG, e); } } }); return view; }
Source:
<code>public URI getUri() { try { <START> return new URI("level://" + URLEncoder.encode(path, "UTF-8")); <END> } catch (URISyntaxException e) { throw new AssertionError(e); } catch (UnsupportedEncodingException e) { throw new AssertionError(e); } }</code><technical_language>cache value</technical_language>

Target:
public URI getUri() { return this.uri; }
Source:
<code>public ProtocolResponse getProtocolOutput(String url, Metadata md) throws Exception { HttpClientBuilder builder = HttpClients.custom() .setUserAgent(userAgent) .setConnectionManager(CONNECTION_MANAGER); if (useProxy) { HttpHost proxy = new HttpHost(proxyHost, proxyPort); DefaultProxyRoutePlanner routePlanner = new DefaultProxyRoutePlanner( <START> proxy); <END> builder.setRoutePlanner(routePlanner); } LOG.debug("HTTP connection manager stats " + CONNECTION_MANAGER.getTotalStats().toString()); CloseableHttpClient httpclient = builder.build(); RequestConfig requestConfig = RequestConfig.custom() .setSocketTimeout(timeout).setConnectTimeout(timeout).build(); HttpGet httpget = new HttpGet(url); if (md != null) { String ifModifiedSince = md.getFirstValue("cachedLastModified"); if (StringUtils.isNotBlank(ifModifiedSince)) { httpget.addHeader("If-Modified-Since", ifModifiedSince); } String ifNoneMatch = md.getFirstValue("cachedEtag"); if (StringUtils.isNotBlank(ifNoneMatch)) { httpget.addHeader("If-None-Match", ifNoneMatch); } } httpget.setConfig(requestConfig); return httpclient.execute(httpget, this); }</code><technical_language>shared constructed in configure</technical_language>

Target:
public ProtocolResponse getProtocolOutput(String url, Metadata md) throws Exception { LOG.debug("HTTP connection manager stats {}", CONNECTION_MANAGER.getTotalStats()); HttpGet httpget = new HttpGet(url); httpget.setConfig(requestConfig); if (md != null) { String ifModifiedSince = md.getFirstValue("cachedLastModified"); if (StringUtils.isNotBlank(ifModifiedSince)) { httpget.addHeader("If-Modified-Since", ifModifiedSince); } String ifNoneMatch = md.getFirstValue("cachedEtag"); if (StringUtils.isNotBlank(ifNoneMatch)) { httpget.addHeader("If-None-Match", ifNoneMatch); } } try (CloseableHttpClient httpclient = builder.build()) { return httpclient.execute(httpget, this); } }
Source:
<code>public Pagination<Payment> getPayments(final Long offset, final Long limit, final String pluginName, final boolean withPluginInfo, final boolean withAttempts, final Iterable<PluginProperty> properties, final TenantContext tenantContext) throws PaymentApiException { <START> return paymentProcessor.getPayments(offset, limit, pluginName, withPluginInfo, properties, tenantContext, internalCallContextFactory.createInternalTenantContext(tenantContext)); <END> }</code><technical_language>here: new flag withAttempts is passed (used) paymentProcessor#getAccountPayments</technical_language>

Target:
public Pagination<Payment> getPayments(final Long offset, final Long limit, final String pluginName, final boolean withPluginInfo, final boolean withAttempts, final Iterable<PluginProperty> properties, final TenantContext tenantContext) throws PaymentApiException { return paymentProcessor.getPayments(offset, limit, pluginName, withPluginInfo, withAttempts, properties, tenantContext, internalCallContextFactory.createInternalTenantContext(tenantContext)); }
Source:
<code>public Iterator<T> iterator() { if ( count == -1 ) { throw new IllegalStateException( "sort() needs to be called before requesting an iterator" ); } return new Iterator<T>() { private int cursor = count; @Override public boolean hasNext() { return cursor > 0; } @Override @SuppressWarnings( "unchecked" ) public T next() { if ( !hasNext() ) { throw new NoSuchElementException(); } --cursor; <START> return (T) array[cursor]; <END> } }; }</code><technical_language>I this is improvement</technical_language>

Target:
public Iterator<T> iterator() { if ( count == -1 ) { throw new IllegalStateException( "sort() needs to be called before requesting an iterator" ); } return new Iterator<T>() { private int cursor = count; @Override public boolean hasNext() { return cursor > 0; } @Override @SuppressWarnings( "unchecked" ) public T next() { if ( !hasNext() ) { throw new NoSuchElementException(); } int offset = --cursor; return (T) array[offset]; } }; }
Source:
<code>public void updatePatientIdentifiers(String configName, String patientUuid, Map<String, String> identifiers) { Patient patient = new Patient(); List<Identifier> identifierList = convertIdentifierMapToList(configName, identifiers); patient.setIdentifiers(identifierList); patient.setUuid(patientUuid); <START> patientService.updatePatientIdentifiers(null, patient); <END> }</code><technical_language>configName</technical_language>

Target:
public void updatePatientIdentifiers(String configName, String patientUuid, Map<String, String> identifiers) { Patient patient = new Patient(); List<Identifier> identifierList = convertIdentifierMapToList(identifiers); patient.setIdentifiers(identifierList); patient.setUuid(patientUuid); patientService.updatePatientIdentifiers(configName, patient); }
Source:
<code>public void lifecycleEvent(LifecycleEvent event) { if (!Lifecycle.AFTER_START_EVENT.equals(event.getType())) { return; } <START> wizard.showMessage("OpenMRS is ready for you at http://localhost:8080/openmrs/"); <END> }</code><technical_language>java wizard.showMessage(String.format("OpenMRS is ready for http://localhost:%s/openmrs/", port == 80 ? "" : String.valueOf(port)));</technical_language>

Target:
public void lifecycleEvent(LifecycleEvent event) { if (!Lifecycle.AFTER_START_EVENT.equals(event.getType())) { return; } wizard.showMessage(String.format("OpenMRS is ready for you at http://localhost:%s/openmrs/", port == 80 ? "" : ":" + port)); }
Source:
<code>public static Optional<Set<VariableReferenceExpression>> pruneInputs( Collection<VariableReferenceExpression> availableInputs, Collection<RowExpression> expressions, TypeProvider types) { Set<VariableReferenceExpression> availableInputsSet = ImmutableSet.copyOf(availableInputs); Set<VariableReferenceExpression> referencedInputs; if (expressions.stream().anyMatch(OriginalExpressionUtils::isExpression)) { <START> referencedInputs = SymbolsExtractor.extractUniqueVariable( <END> expressions.stream().map(OriginalExpressionUtils::castToExpression).collect(toImmutableList()), types); } else { referencedInputs = SymbolsExtractor.extractUniqueVariable(expressions); } Set<VariableReferenceExpression> prunedInputs; prunedInputs = Sets.filter(availableInputsSet, referencedInputs::contains); if (prunedInputs.size() == availableInputsSet.size()) { return Optional.empty(); } return Optional.of(prunedInputs); }</code><technical_language>Do a check state</technical_language>

Target:
public static Optional<Set<VariableReferenceExpression>> pruneInputs( Collection<VariableReferenceExpression> availableInputs, Collection<RowExpression> expressions, TypeProvider types) { Set<VariableReferenceExpression> availableInputsSet = ImmutableSet.copyOf(availableInputs); Set<VariableReferenceExpression> referencedInputs; if (expressions.stream().allMatch(OriginalExpressionUtils::isExpression)) { referencedInputs = VariablesExtractor.extractUnique( expressions.stream().map(OriginalExpressionUtils::castToExpression).collect(toImmutableList()), types); } else if (expressions.stream().noneMatch(OriginalExpressionUtils::isExpression)) { referencedInputs = VariablesExtractor.extractUnique(expressions); } else { throw new IllegalStateException(format("Expressions %s contains mixed Expression and RowExpression", expressions)); } Set<VariableReferenceExpression> prunedInputs; prunedInputs = Sets.filter(availableInputsSet, referencedInputs::contains); if (prunedInputs.size() == availableInputsSet.size()) { return Optional.empty(); } return Optional.of(prunedInputs); }
Source:
<code>private WritableComparable convertToWritable(Schema.Field field, StructuredRecord input) throws UnsupportedTypeException { WritableComparable writable = null; Object fieldVal = input.get(field.getName()); switch (field.getSchema().getType()) { case NULL: break; case STRING: case ENUM: writable = new Text((String) fieldVal); break; case BOOLEAN: writable = new BooleanWritable((Boolean) fieldVal); break; case INT: writable = new IntWritable(Integer.valueOf((Integer) fieldVal)); break; case LONG: writable = new LongWritable(Long.valueOf((Long) fieldVal)); break; case FLOAT: writable = new FloatWritable((Float) fieldVal); break; case DOUBLE: writable = new DoubleWritable(Double.valueOf((Double) fieldVal)); break; case BYTES: writable = new BytesWritable(((String) fieldVal).getBytes()); break; default: <START> throw new UnsupportedTypeException(field.getSchema().getType().name() + <END> "type is currently not supported in ORC"); } return writable; }</code><technical_language>need a space "type"</technical_language>

Target:
private WritableComparable convertToWritable(Schema.Field field, StructuredRecord input) throws UnsupportedTypeException { Object fieldVal = input.get(field.getName()); Schema fieldSchema = field.getSchema(); Schema.Type fieldType = fieldSchema.getType(); if (fieldSchema.isNullable()) { if (fieldVal == null) { return null; } fieldType = fieldSchema.getNonNullable().getType(); } switch (fieldType) { case NULL: return null; case STRING: return new Text((String) fieldVal); case ENUM: return new Text(fieldVal.toString()); case BOOLEAN: return new BooleanWritable((Boolean) fieldVal); case INT: return new IntWritable((Integer) fieldVal); case LONG: return new LongWritable((Long) fieldVal); case FLOAT: return new FloatWritable((Float) fieldVal); case DOUBLE: return new DoubleWritable((Double) fieldVal); case BYTES: if (fieldVal instanceof byte[]) { return new BytesWritable((byte[]) fieldVal); } else { return new BytesWritable(Bytes.getBytes((ByteBuffer) fieldVal)); } default: throw new UnsupportedTypeException(String.format("{} type is currently not supported in ORC", field.getSchema().getType().name())); } }
Source:
<code>private void display(String message, int lengthMillis) { if (contextIsStillAlive()) { Toast toast = Toast.makeText(context, message, lengthMillis); toast.show(); <START> toasts.add(toast); <END> } else { Log.e("Couldn't toast, context has become null. Attempted message: " + message); } }</code><technical_language>I add show, means add , else show</technical_language>

Target:
private void display(String message, int lengthMillis) { Toast toast = Toast.makeText(context, message, lengthMillis); display(toast); }
Source:
<code><START> private String getJsonDiskDescription() { <END> Map<String, Object> description = new HashMap<>(); description.put(ImagesHandler.DISK_ALIAS, getDiskAlias()); description.put(ImagesHandler.DISK_DESCRIPTION, disk.getDiskDescription()); try { return JsonHelper.mapToJson(description, false); } catch (IOException e) { throw new RuntimeException("Exception while generating json for disk", e); } }</code><technical_language>This virtually code in AddImageFromScratchCommand - extracted a helper somewhere</technical_language>

Target:
private String getJsonDiskDescription() { try { return ImagesHandler.getJsonDiskDescription(getParameters().getDiskInfo().getDiskAlias(), getParameters().getDiskInfo().getDiskDescription()); } catch (IOException e) { throw new RuntimeException("Exception while generating json for disk", e); } }
Source:
<code>public Object execute(ExecutionEvent event) throws ExecutionException { IWorkbenchWindow window = HandlerUtil.getActiveWorkbenchWindow(event); if (window != null) { <START> ISelection currentSelection = HandlerUtil.getCurrentStructuredSelection(event); <END> runBuildAction(window, currentSelection); } return null; }</code><technical_language>I this is same, extractSelectoinFromEditor is missing. I suggest revert this change</technical_language>

Target:
public Object execute(ExecutionEvent event) throws ExecutionException { IWorkbenchWindow window = HandlerUtil.getActiveWorkbenchWindow(event); if (window != null) { ISelection currentSelection = HandlerUtil .getCurrentSelection(event); if (currentSelection instanceof IStructuredSelection) { runBuildAction(window, currentSelection); } else { currentSelection = extractSelectionFromEditorInput(HandlerUtil .getActiveEditorInput(event)); runBuildAction(window, currentSelection); } } return null; }
Source:
<code>static Event validEvent() { return Event.newBuilder() .setMessage(AnyPacker.pack(ProjectCreated.newBuilder() .setProjectId(ProjectId.newBuilder().setId("12345AD0")) .build()) .toBuilder() .setTypeUrl(TypeUrl.SPINE_TYPE_URL_PREFIX + "/" + ProjectCreated.getDescriptor().getFullName()) .build()) .setContext(EventContext.newBuilder() .setDoNotEnrich(true) .setCommandContext(CommandContext.getDefaultInstance()) .setEventId(EventId.newBuilder() <START> .setUuid(PROJECT_UUID) <END> .build())) .build(); }</code><technical_language>event ID is built project UUID</technical_language>

Target:
static Event validEvent() { return Event.newBuilder() .setMessage(AnyPacker.pack(ProjectCreated.newBuilder() .setProjectId(ProjectId.newBuilder().setId("12345AD0")) .build()) .toBuilder() .setTypeUrl(TypeUrl.SPINE_TYPE_URL_PREFIX + "/" + ProjectCreated.getDescriptor().getFullName()) .build()) .setContext(EventContext.newBuilder() .setDoNotEnrich(true) .setCommandContext(CommandContext.getDefaultInstance()) .setEventId(EventId.newBuilder() .setUuid(Identifiers.newUuid()) .build())) .build(); }
Source:
<code>public void afterBulk(long executionId, BulkRequest request, BulkResponse response) { if (log.isDebugEnabled()) { log.debug(String.format("After bulk: %s, actions: %d, status: %s", executionId, request.numberOfActions(), response.status())); } if (!response.hasFailures()) { return; } <START> AtomicBoolean inError = new AtomicBoolean(false); <END> Arrays.stream(response.getItems()).filter(BulkItemResponse::isFailed).forEach(item -> { if (item.getFailure().getStatus() != RestStatus.CONFLICT) { log.warn("Failure in bulk indexing: " + item.getFailureMessage()); inError.set(true); } else if (log.isDebugEnabled()) { log.debug("Skipping version conflict: " + item.getFailureMessage()); } }); if (inError.get()) { log.error(String.format("Elasticsearch bulk %s returns with failures: %s", executionId, response.buildFailureMessage())); if (!continueOnFailure) { abort = true; } } }</code><technical_language>want thread-safety, a simple Apache Lang3 MutableBoolean is cheaper. a Stream-like of this..</technical_language>

Target:
public void afterBulk(long executionId, BulkRequest request, BulkResponse response) { if (log.isDebugEnabled()) { log.debug(String.format("After bulk: %s, actions: %d, status: %s", executionId, request.numberOfActions(), response.status())); } if (!response.hasFailures()) { return; } MutableBoolean inError = new MutableBoolean(false); Arrays.stream(response.getItems()).filter(BulkItemResponse::isFailed).forEach(item -> { if (item.getFailure().getStatus() != RestStatus.CONFLICT) { log.warn("Failure in bulk indexing: " + item.getFailureMessage()); inError.setTrue(); } else if (log.isDebugEnabled()) { log.debug("Skipping version conflict: " + item.getFailureMessage()); } }); if (inError.isTrue()) { log.error(String.format("Elasticsearch bulk %s returns with failures: %s", executionId, response.buildFailureMessage())); if (!continueOnFailure) { abort = true; } } }
Source:
<code>protected Bitmap doInBackground(Object... params) { Bitmap thumbnail = null; try { if (mAccount != null) { OwnCloudAccount ocAccount = new OwnCloudAccount(mAccount, MainApp.getAppContext()); mClient = OwnCloudClientManagerFactory.getDefaultSingleton(). getClientFor(ocAccount, MainApp.getAppContext()); } mFile = params[0]; if (mFile instanceof OCFile) { thumbnail = doOCFileInBackground(); if (((OCFile) mFile).isVideo()){ thumbnail = addVideoOverlay(thumbnail); } } else if (mFile instanceof File) { thumbnail = doFileInBackground(); String url = ((File) mFile).getAbsolutePath(); FileNameMap fileNameMap = URLConnection.getFileNameMap(); <START> String mMimeType = fileNameMap.getContentTypeFor("file://" + url); <END> if (mMimeType != null && mMimeType.startsWith("video/")){ thumbnail = addVideoOverlay(thumbnail); } } }catch(Throwable t){ Log_OC.e(TAG, "Generation of thumbnail for " + mFile + " failed", t); if (t instanceof OutOfMemoryError) { System.gc(); } } return thumbnail; }</code><technical_language>Please, FileStorageUtils.getMimeTypeFromExtension(...) instead. avoid introducing java.net.URLConnection in imports. prevent temptation of other network libraries</technical_language>

Target:
protected Bitmap doInBackground(Object... params) { Bitmap thumbnail = null; try { if (mAccount != null) { OwnCloudAccount ocAccount = new OwnCloudAccount( mAccount, MainApp.getAppContext() ); mClient = OwnCloudClientManagerFactory.getDefaultSingleton(). getClientFor(ocAccount, MainApp.getAppContext()); } mFile = params[0]; if (mFile instanceof OCFile) { thumbnail = doOCFileInBackground(); if (((OCFile) mFile).isVideo() && thumbnail != null){ thumbnail = addVideoOverlay(thumbnail); } } else if (mFile instanceof File) { thumbnail = doFileInBackground(); String url = ((File) mFile).getAbsolutePath(); FileNameMap fileNameMap = URLConnection.getFileNameMap(); String mMimeType = fileNameMap.getContentTypeFor("file://" + url); if (mMimeType != null && mMimeType.startsWith("video/") && thumbnail != null){ thumbnail = addVideoOverlay(thumbnail); } } }catch(Throwable t){ Log_OC.e(TAG, "Generation of thumbnail for " + mFile + " failed", t); if (t instanceof OutOfMemoryError) { System.gc(); } } return thumbnail; }
Source:
<code>public DefaultQdsConfiguration(String apiEndpoint, String apiVersion, String apiToken, ClientConfig jerseyConfiguration, final Retry retry, final RetryConnectorAllocator retryConnectorAllocator) { this.apiEndpoint = Preconditions.checkNotNull(apiEndpoint, "apiEndpoint cannot be null"); <START> this.apiVersion = Preconditions.checkNotNull(apiVersion, "apiVersion cannot be null"); <END> this.apiToken = Preconditions.checkNotNull(apiToken, "apiToken cannot be null"); if ( jerseyConfiguration == null ) { jerseyConfiguration = new ClientConfig(); jerseyConfiguration.property(ClientProperties.CONNECT_TIMEOUT, DEFAULT_CONNECTION_TIMEOUT); jerseyConfiguration.property(ClientProperties.READ_TIMEOUT, DEFAULT_READ_TIMEOUT); } ConnectorProvider connectorProvider = new HttpUrlConnectorProvider() { @Override public Connector getConnector(Client client, Configuration config) { return retryConnectorAllocator.newRetryConnector(super.getConnector(client, config), retry); } }; jerseyConfiguration.connectorProvider(connectorProvider); this.jerseyConfiguration = jerseyConfiguration; }</code><technical_language>this result in v1.2 if apiVersion is null</technical_language>

Target:
public DefaultQdsConfiguration(String apiEndpoint, String apiVersion, String apiToken, ClientConfig jerseyConfiguration, final Retry retry, final RetryConnectorAllocator retryConnectorAllocator) { this.apiEndpoint = Preconditions.checkNotNull(apiEndpoint, "apiEndpoint cannot be null"); this.apiToken = Preconditions.checkNotNull(apiToken, "apiToken cannot be null"); if (apiVersion == null) { this.apiVersion = API_VERSION; } else { this.apiVersion = apiVersion; } if ( jerseyConfiguration == null ) { jerseyConfiguration = new ClientConfig(); jerseyConfiguration.property(ClientProperties.CONNECT_TIMEOUT, DEFAULT_CONNECTION_TIMEOUT); jerseyConfiguration.property(ClientProperties.READ_TIMEOUT, DEFAULT_READ_TIMEOUT); } ConnectorProvider connectorProvider = new HttpUrlConnectorProvider() { @Override public Connector getConnector(Client client, Configuration config) { return retryConnectorAllocator.newRetryConnector(super.getConnector(client, config), retry); } }; jerseyConfiguration.connectorProvider(connectorProvider); this.jerseyConfiguration = jerseyConfiguration; }
Source:
<code>public <K> MessageStream<M> partitionBy(Function<M, K> parKeyExtractor) { int opId = graph.getNextOpId(); <START> String streamId = String.format("%s-%s", OperatorSpec.OpCode.PARTITION_BY.name().toLowerCase(), opId); <END> MessageStreamImpl<M> intStream = this.graph.createIntStream(streamId, parKeyExtractor); OutputStream<M> outputStream = this.graph.getOutputStream(intStream); this.registeredOperatorSpecs.add(OperatorSpecs.createPartitionOperatorSpec(outputStream.getSinkFunction(), this.graph, outputStream, opId)); return intStream; }</code><technical_language>this works this RB alone. Is this logical id for stream create a spec for in Planner? physical name default appends JOB_NAME JOB_ID</technical_language>

Target:
public <K> MessageStream<M> partitionBy(Function<M, K> parKeyExtractor) { int opId = graph.getNextOpId(); MessageStreamImpl<M> intStream = this.graph.generateIntStreamFromOpId(opId, parKeyExtractor); OutputStream<M> outputStream = this.graph.getOutputStream(intStream); this.registeredOperatorSpecs.add(OperatorSpecs.createPartitionOperatorSpec(outputStream.getSinkFunction(), outputStream, opId)); return intStream; }
Source:
<code>@Inject public AutomationClientAuthFactory(ClientDAOFactory clientDAOFactory) { <START> this.authenticator = new MyAuthenticator(clientDAOFactory.readwrite()); <END> }</code><technical_language>this clientDAOFactory.read()</technical_language>

Target:
@Inject public AutomationClientAuthFactory(ClientDAOFactory clientDAOFactory) { this.authenticator = new MyAuthenticator(clientDAOFactory.readonly()); }
Source:
<code>protected boolean canDoAction() { boolean canDo = true; setVmId((Guid) (getParameters().getSlaParameter(VmSlaPolicyParameters.Params.VM_ID))); setVdsId((Guid) getParameters().getSlaParameter(VmSlaPolicyParameters.Params.VDS_ID)); setVdsGroupId(getVds().getVdsGroupId()); if (!FeatureSupported.vmSlaPolicy(getVdsGroup().getcompatibility_version())) { addCanDoActionMessage(VdcBllMessages.VM_SLA_POLICY_NOT_SUPPORTED); <START> return false; <END> } if (getVm() == null) { return failCanDoAction(VdcBllMessages.ACTION_TYPE_FAILED_VM_NOT_EXIST); } if (getVm() == null) { return failCanDoAction(VdcBllMessages.ACTION_TYPE_FAILED_VM_NOT_EXIST); } if (getVm().getStatus() != VMStatus.Up) { return failCanDoAction(VdcBllMessages.ACTION_TYPE_FAILED_VM_STATUS_ILLEGAL, LocalizedVmStatus.from(getVm().getStatus())); } return canDo; }</code><technical_language>return failCanDoAction well</technical_language>

Target:
protected boolean canDoAction() { setVmId((Guid) (getParameters().getSlaParameter(VmSlaPolicyParameters.Params.VM_ID))); setVdsId((Guid) getParameters().getSlaParameter(VmSlaPolicyParameters.Params.VDS_ID)); setVdsGroupId(getVds().getVdsGroupId()); if (!FeatureSupported.vmSlaPolicy(getVdsGroup().getcompatibility_version())) { return failCanDoAction(VdcBllMessages.VM_SLA_POLICY_NOT_SUPPORTED); } if (getVm() == null) { return failCanDoAction(VdcBllMessages.ACTION_TYPE_FAILED_VM_NOT_EXIST); } if (getVm() == null) { return failCanDoAction(VdcBllMessages.ACTION_TYPE_FAILED_VM_NOT_EXIST); } if (getVm().getStatus() != VMStatus.Up) { return failCanDoAction(VdcBllMessages.ACTION_TYPE_FAILED_VM_STATUS_ILLEGAL, LocalizedVmStatus.from(getVm().getStatus())); } return true; }
Source:
<code><START> private void doLookUpGetChildrenMethod() { <END> if (!GETCHILDREN_PAGINATION_DISABLED) { try { _getChildrenMethod = ZooKeeper.class.getMethod("getAllChildrenPaginated", String.class, boolean.class); return; } catch (NoSuchMethodException e) { LOG.info("Paginated getChildren is not supported, fall back to non-paginated getChildren"); } } lookupNonPaginatedGetChildren(); }</code><technical_language>move lookupGetChildrenMethod() method? I other callers of it</technical_language>

Target:
private Method doLookUpGetChildrenMethod() { if (!GETCHILDREN_PAGINATION_DISABLED) { try { return ZooKeeper.class.getMethod("getAllChildrenPaginated", String.class, boolean.class); } catch (NoSuchMethodException e) { LOG.info("Paginated getChildren is not supported, fall back to non-paginated getChildren"); } } return lookupNonPaginatedGetChildren(); }
Source:
<code><START> List<ICompletionProposal> computeProposals(int offset) { <END> fProposalShell.dispose(); showProposals(true); List<ICompletionProposal> loadingList = new ArrayList<>(); loadingList.add(new ComputingProposal(fInvocationOffset, fFutures.size())); return loadingList; }</code><technical_language>is this modified this patch set is earlier</technical_language>

Target:
List<ICompletionProposal> computeProposals(int offset) { fProposalShell.dispose(); showProposals(true); return fComputedProposals; }
Source:
<code>public ToolItem getWorkbenchToolItem(Matcher<String> matcher) { ToolBarLookup tl = ToolBarLookup.getInstance(); List<ToolBar> workbenchToolBars = tl.getWorkbenchToolBars(); Shell swtShell = ShellLookup.getInstance().getWorkbenchShell(); String text = WidgetHandler.getInstance().getText(swtShell); WidgetHandler.getInstance().setFocus(swtShell); <START> new WaitUntil(new ShellWithTextIsAvailable(text)); <END> final ToolItem ti = getToolItem(new DefaultReferencedComposite((Control) swtShell), 0, matcher); ToolBar tb = Display.syncExec(new ResultRunnable<ToolBar>() { @Override public ToolBar run() { return ti.getParent(); } }); if (workbenchToolBars.contains(tb)) { return ti; } else { Thrower.objectIsNull(ti, "ToolItem matching " + matcher.toString() + " cannot be found in any workbench toolbar"); } return null; }</code><technical_language>this place waiting for a ShellWithTextIsAvailable is useless. Shell is in previous step focused. Original wait condition waited for shell focused. I replace lines "new WorkbenchShell()"</technical_language>

Target:
public ToolItem getWorkbenchToolItem(Matcher<String> matcher) { ToolBarLookup tl = ToolBarLookup.getInstance(); List<ToolBar> workbenchToolBars = tl.getWorkbenchToolBars(); Shell swtShell = ShellLookup.getInstance().getWorkbenchShell(); if(swtShell == null){ Thrower.objectIsNull(swtShell, "There is no active workbench shell"); } final ToolItem ti = getToolItem(new DefaultReferencedComposite((Control) swtShell), 0, matcher); ToolBar tb = Display.syncExec(new ResultRunnable<ToolBar>() { @Override public ToolBar run() { return ti.getParent(); } }); if (workbenchToolBars.contains(tb)) { return ti; } else { Thrower.objectIsNull(ti, "ToolItem matching " + matcher.toString() + " cannot be found in any workbench toolbar"); } return null; }
Source:
<code>public void shouldDecorateFutureAndThrowTimeoutException() throws Exception { CircuitBreaker circuitBreaker = CircuitBreaker.ofDefaults("testName"); <START> final Future<String> future = executor.submit(() -> { <END> Thread.currentThread().sleep(10000); return null; }); CircuitBreakerFuture<String> decoratedFuture = new CircuitBreakerFuture<>(circuitBreaker, future); Throwable thrown = catchThrowable(() -> decoratedFuture.get(5, TimeUnit.SECONDS)); assertThat(thrown).isInstanceOf(TimeoutException.class); assertThat(circuitBreaker.getMetrics().getNumberOfBufferedCalls()).isEqualTo(1); assertThat(circuitBreaker.getMetrics().getNumberOfFailedCalls()).isEqualTo(1); assertThat(circuitBreaker.getMetrics().getNumberOfSuccessfulCalls()).isEqualTo(0); assertThat(circuitBreaker.getMetrics().getNumberOfNotPermittedCalls()).isEqualTo(0); assertThat(circuitBreaker.getState()).isEqualTo(CircuitBreaker.State.CLOSED); }</code><technical_language>please mock Future</technical_language>

Target:
public void shouldDecorateFutureAndThrowTimeoutException() throws Exception { CircuitBreaker circuitBreaker = CircuitBreaker.ofDefaults("testName"); final Future<String> future = mock(Future.class); when(future.get(anyLong(), any(TimeUnit.class))).thenThrow(new TimeoutException()); CircuitBreakerFuture<String> decoratedFuture = new CircuitBreakerFuture<>(circuitBreaker, future); Throwable thrown = catchThrowable(() -> decoratedFuture.get(5, TimeUnit.SECONDS)); assertThat(thrown).isInstanceOf(TimeoutException.class); assertThat(circuitBreaker.getMetrics().getNumberOfBufferedCalls()).isEqualTo(1); assertThat(circuitBreaker.getMetrics().getNumberOfFailedCalls()).isEqualTo(1); assertThat(circuitBreaker.getMetrics().getNumberOfSuccessfulCalls()).isEqualTo(0); assertThat(circuitBreaker.getMetrics().getNumberOfNotPermittedCalls()).isEqualTo(0); assertThat(circuitBreaker.getState()).isEqualTo(CircuitBreaker.State.CLOSED); then(future).should().get(anyLong(), any(TimeUnit.class)); }
Source:
<code>private File writeFile( AttachmentModel attachment, MediaType mediaType ) { String extension = getExtension( mediaType ); File targetFile = getTargetFile( attachment.getFileName(), extension ); try { <START> if( attachment.isBinary() ) { <END> File thumbFile = getTargetFile( "attachment-thumb", extension ); String thumbnail = compressToThumbnail( attachment.getValue(), extension ); Files.write( parseBase64Binary( thumbnail ), thumbFile ); Files.write( parseBase64Binary( attachment.getValue() ), targetFile ); } else { Files.write( attachment.getValue(), targetFile, Charsets.UTF_8 ); } } catch( IOException e ) { log.error( "Error while trying to write attachment to file " + targetFile, e ); } return targetFile; }</code><technical_language>I is enough. attachment binary, image (e.g. a ZIP file)</technical_language>

Target:
private File writeFile( AttachmentModel attachment, MediaType mediaType ) { String extension = getExtension( mediaType ); File targetFile = getTargetFile( attachment.getFileName(), extension ); try { if( attachment.isBinary() ) { if( mediaType.is( MediaType.ANY_IMAGE_TYPE ) ) { File thumbFile = getThumbnailFileFor( targetFile ); byte[] thumbnail = compressToThumbnail( attachment.getValue(), extension ); Files.write( thumbnail, thumbFile ); } Files.write( parseBase64Binary( attachment.getValue() ), targetFile ); } else { Files.write( attachment.getValue(), targetFile, Charsets.UTF_8 ); } } catch( IOException e ) { log.error( "Error while trying to write attachment to file " + targetFile, e ); } return targetFile; }
Source:
<code>void addDiff(int endA, int endB, List<Edit> internalEdit) { int lenA = endA - nextA; int lenB = endB - nextB; checkState(lenA > 0 || lenB > 0); ContentEntry e = entry(); if (lenA > 0) { e.a = Lists.newArrayListWithCapacity(lenA); for (; nextA < endA; nextA++) { e.a.add(fileA.get(nextA)); } } if (lenB > 0) { e.b = Lists.newArrayListWithCapacity(lenB); for (; nextB < endB; nextB++) { e.b.add(fileB.get(nextB)); } } if (internalEdit != null && !internalEdit.isEmpty()) { e.editA = Lists.newArrayListWithCapacity(internalEdit.size() * 2); e.editB = Lists.newArrayListWithCapacity(internalEdit.size() * 2); <START> int lastA = 0; <END> int lastB = 0; for (Edit edit : internalEdit) { if (edit.getBeginA() != edit.getEndA()) { e.editA.add(ImmutableList.of(edit.getBeginA() - lastA, edit.getEndA() - edit.getBeginA())); lastA = edit.getBeginA() + edit.getEndA(); } if (edit.getBeginB() != edit.getEndB()) { e.editB.add(ImmutableList.of(edit.getBeginB() - lastB, edit.getEndB() - edit.getBeginB())); lastB = edit.getBeginB() + edit.getEndB(); } } } }</code><technical_language>bad formatting, tabs in this file spaces</technical_language>

Target:
void addDiff(int endA, int endB, List<Edit> internalEdit) { int lenA = endA - nextA; int lenB = endB - nextB; checkState(lenA > 0 || lenB > 0); ContentEntry e = entry(); if (lenA > 0) { e.a = Lists.newArrayListWithCapacity(lenA); for (; nextA < endA; nextA++) { e.a.add(fileA.get(nextA)); } } if (lenB > 0) { e.b = Lists.newArrayListWithCapacity(lenB); for (; nextB < endB; nextB++) { e.b.add(fileB.get(nextB)); } } if (internalEdit != null && !internalEdit.isEmpty()) { e.editA = Lists.newArrayListWithCapacity(internalEdit.size() * 2); e.editB = Lists.newArrayListWithCapacity(internalEdit.size() * 2); int lastA = 0; int lastB = 0; for (Edit edit : internalEdit) { if (edit.getBeginA() != edit.getEndA()) { e.editA.add(ImmutableList.of(edit.getBeginA() - lastA, edit.getEndA() - edit.getBeginA())); lastA = edit.getEndA(); } if (edit.getBeginB() != edit.getEndB()) { e.editB.add(ImmutableList.of(edit.getBeginB() - lastB, edit.getEndB() - edit.getBeginB())); lastB = edit.getEndB(); } } } }
Source:
<code>public CompositeModuleDeploymentRequest() { <START> } <END></code><technical_language>This needed Kryo. If support other serialization mechanisms in future, able serialize classes constructor args. (Or Json marshalling)</technical_language>

Target:
private CompositeModuleDeploymentRequest() { }
Source:
<code>private int <START> findNext(String findString, int startIndex, BiMap<ITimeGraphEntry, Integer> items, boolean forwardSearch, boolean caseSensitive, boolean wrapSearch, boolean wholeWord, boolean regExSearch, boolean beep) { <END> if (forwardSearch) { int index = startIndex == items.size() - 1 ? -1 : findNext(startIndex + 1, findString, items, true, caseSensitive, wholeWord, regExSearch); if (index == -1) { if (beep && okToUse(getShell())) { getShell().getDisplay().beep(); } if (wrapSearch) { statusMessage("Wrapped search"); index = findNext(-1, findString, items, true, caseSensitive, wholeWord, regExSearch); } } return index; } int index = startIndex == 0 ? -1 : findNext(startIndex - 1, findString, items, false, caseSensitive, wholeWord, regExSearch); if (index == -1) { if (beep && okToUse(getShell())) { getShell().getDisplay().beep(); } if (wrapSearch) { statusMessage("Wrapped search"); index = findNext(-1, findString, items, false, caseSensitive, wholeWord, regExSearch); } } return index; }</code><technical_language>This a huge parameter list. a class for parameters is passed around</technical_language>

Target:
private int findNext(String findString, int startIndex, BiMap<ITimeGraphEntry, Integer> items, boolean forwardSearch, boolean caseSensitive, boolean wrapSearch, boolean wholeWord, boolean regExSearch, boolean beep) { if (forwardSearch) { int index = startIndex == items.size() - 1 ? -1 : findNext(startIndex + 1, findString, items, true, caseSensitive, wholeWord, regExSearch); if (index == -1) { if (beep && okToUse(getShell())) { getShell().getDisplay().beep(); } if (wrapSearch) { statusMessage(Messages.TimeGraphFindDialog_Status_wrapped_label); index = findNext(-1, findString, items, true, caseSensitive, wholeWord, regExSearch); } } return index; } int index = startIndex == 0 ? -1 : findNext(startIndex - 1, findString, items, false, caseSensitive, wholeWord, regExSearch); if (index == -1) { if (beep && okToUse(getShell())) { getShell().getDisplay().beep(); } if (wrapSearch) { statusMessage("Wrapped search"); index = findNext(-1, findString, items, false, caseSensitive, wholeWord, regExSearch); } } return index; }
Source:
<code>public static DnsServerAddressStreamProvider unixDefault() { <START> return DEFAULT_DNS_SERVER_ADDRESS_STREAM_PROVIDER; <END> }</code><technical_language>macOS users hit DEFAULT_DNS_SERVER_ADDRESS_STREAM_PROVIDER. Therefore, defer initialization necessary, if move this constant another class</technical_language>

Target:
public static DnsServerAddressStreamProvider unixDefault() { return DefaultProviderHolder.DEFAULT_DNS_SERVER_ADDRESS_STREAM_PROVIDER; }
Source:
<code>public AbstractPlanNode toPlanNode() { final MergeJoinPlanNode mjpn = new MergeJoinPlanNode(); <START> if (joinType != JoinRelType.INNER) { <END> throw new PlannerFallbackException("Join type not supported: " + joinType.name()); } mjpn.setJoinType(JoinType.INNER); mjpn.addAndLinkChild(inputRelNodeToPlanNode(this, 0)); mjpn.addAndLinkChild(inputRelNodeToPlanNode(this, 1)); mjpn.setJoinPredicate(RexConverter.convertJoinPred(getInput(0).getRowType().getFieldCount(), getCondition())); addLimitOffset(mjpn); return setOutputSchema(mjpn); }</code><technical_language>I this check done for joins (NLJ, NLIJ) Logical planning stage add outer join support Calcite planner</technical_language>

Target:
public AbstractPlanNode toPlanNode() { if (joinType != JoinRelType.INNER) { throw new PlannerFallbackException("Join type not supported: " + joinType.name()); } final MergeJoinPlanNode mjpn = new MergeJoinPlanNode(); mjpn.setJoinType(JoinType.INNER); mjpn.addAndLinkChild(inputRelNodeToPlanNode(this, 0)); mjpn.addAndLinkChild(inputRelNodeToPlanNode(this, 1)); mjpn.setJoinPredicate(RexConverter.convertJoinPred(getInput(0).getRowType().getFieldCount(), getCondition())); addLimitOffset(mjpn); return setOutputSchema(mjpn); }
Source:
<code><START> public synchronized void authorize(UserGroupInformation user, ConnectionHeader connection, <END> InetAddress addr) throws AuthorizationException { if (authorize) { Class<?> c = getServiceInterface(services, connection.getServiceName()); synchronized (authManager) { authManager.authorize(user, c, getConf(), addr); } } }</code><technical_language>Add synchronized this method, " synchronized (authManager) { } " in method removed</technical_language>

Target:
public synchronized void authorize(UserGroupInformation user, ConnectionHeader connection, InetAddress addr) throws AuthorizationException { if (authorize) { Class<?> c = getServiceInterface(services, connection.getServiceName()); authManager.authorize(user, c, getConf(), addr); } }
Source:
<code><START> public FluoQuery createPcj(String sparql, FluoClient fluo) throws MalformedQueryException, UnsupportedQueryException { <END> Preconditions.checkNotNull(sparql); Preconditions.checkNotNull(fluo); String pcjId = FluoQueryUtils.createNewPcjId(); return createPcj(pcjId, sparql, Sets.newHashSet(ExportStrategy.Kafka), fluo); }</code><technical_language>@params match</technical_language>

Target:
public FluoQuery createPcj(String sparql, FluoClient fluo) throws MalformedQueryException, UnsupportedQueryException { Preconditions.checkNotNull(sparql); Preconditions.checkNotNull(fluo); String pcjId = FluoQueryUtils.createNewPcjId(); return createPcj(pcjId, sparql, Sets.newHashSet(ExportStrategy.KAFKA), fluo); }
Source:
<code>private boolean classOrModelClassExists(String className) { Elements elementUtils = processingEnv.getElementUtils(); if (className.endsWith(ModelConstants.generationSuffix())) { <START> className = className.substring(0, className.length() - 1); <END> } return elementUtils.getTypeElement(className) != null; }</code><technical_language>I is issue if generation suffix more 1 character</technical_language>

Target:
private boolean classOrModelClassExists(String className) { Elements elementUtils = processingEnv.getElementUtils(); if (className.endsWith(classSuffix())) { className = className.substring(0, className.length() - classSuffix().length()); } return elementUtils.getTypeElement(className) != null; }
Source:
<code><START> static boolean isBug(Throwable error) { <END> if (error instanceof OnErrorNotImplementedException) { return true; } if (error instanceof MissingBackpressureException) { return true; } if (error instanceof IllegalStateException) { return true; } if (error instanceof NullPointerException) { return true; } if (error instanceof IllegalArgumentException) { return true; } return false; }</code><technical_language>CompositeException in well? While technically _always_ undeliverable, crash-worthy exceptions error while processing error</technical_language>

Target:
static boolean isBug(Throwable error) { if (error instanceof OnErrorNotImplementedException) { return true; } if (error instanceof MissingBackpressureException) { return true; } if (error instanceof IllegalStateException) { return true; } if (error instanceof NullPointerException) { return true; } if (error instanceof IllegalArgumentException) { return true; } if (error instanceof CompositeException) { return true; } return false; }
Source:
<code>public void testIncIteration() { <START> Assertions.assertThrows( UnsupportedOperationException.class, unmodifiables::incIteration ); <END> }</code><technical_language>assertThrowsUnsupported(lambda) helpful repeat Assertions.assertThrows time, assertThrowsUnsupported(unmodifiables::incIteration), assertThrowsUnsupported(() -> unmodifiables.remove("some.key"))</technical_language>

Target:
public void testIncIteration() { assertThrowsUnsupportedOperation(unmodifiables::incIteration); }
Source:
<code>private boolean testDatabase(Instance instance) throws TimeoutException { System.out.println("Connect to database"); Connection conn = null; try { <START> String connString = "jdbc:mysql://" + getVirtualIPv4(getLb().getVirtualIPs()) + <END> "/" + Constants.NAME + "?user=" + Constants.NAME + "&password=" + Constants.PASSWORD; System.out.println("Connecting to " + connString); conn = DriverManager.getConnection(connString); Statement stmt = null; ResultSet rs = null; try { stmt = conn.createStatement(); rs = stmt.executeQuery("SELECT 3+5"); rs.first(); System.out.println("3+5 is " + rs.getInt(1)); } catch (SQLException ex){ System.out.println("SQLException: " + ex.getMessage()); System.out.println("SQLState: " + ex.getSQLState()); System.out.println("VendorError: " + ex.getErrorCode()); return false; } finally { if (rs != null) { try { rs.close(); } catch (SQLException sqlEx) { } rs = null; } if (stmt != null) { try { stmt.close(); } catch (SQLException sqlEx) { } stmt = null; } } } catch (SQLException ex) { System.out.println("SQLException: " + ex.getMessage()); System.out.println("SQLState: " + ex.getSQLState()); System.out.println("VendorError: " + ex.getErrorCode()); return false; } return true; }</code><technical_language>This needs a StringBuilder</technical_language>

Target:
private boolean testDatabase(Instance instance) throws TimeoutException { System.out.println("Connect to database"); Connection conn = null; try { StringBuilder connString = new StringBuilder(); connString.append( "jdbc:mysql://" ); connString.append( getVirtualIPv4(getLb().getVirtualIPs()) ); connString.append("/"); connString.append(Constants.NAME); connString.append("?user="); connString.append(Constants.NAME); connString.append("&password="); connString.append(Constants.PASSWORD); System.out.println("Connecting to " + connString); conn = DriverManager.getConnection(connString.toString()); Statement stmt = null; ResultSet rs = null; try { stmt = conn.createStatement(); rs = stmt.executeQuery("SELECT 3+5"); rs.first(); System.out.println("3+5 is " + rs.getInt(1)); } catch (SQLException e){ System.out.println("SQLException: " + e.getMessage()); System.out.println("SQLState: " + e.getSQLState()); System.out.println("VendorError: " + e.getErrorCode()); e.printStackTrace(); return false; } finally { if (rs != null) { try { rs.close(); } catch (SQLException sqlEx) { } rs = null; } if (stmt != null) { try { stmt.close(); } catch (SQLException sqlEx) { } stmt = null; } if(conn != null) try { conn.close(); } catch (SQLException sqlEx) { } } } catch (SQLException e) { System.out.println("SQLException: " + e.getMessage()); System.out.println("SQLState: " + e.getSQLState()); System.out.println("VendorError: " + e.getErrorCode()); e.printStackTrace(); return false; } return true; }
Source:
<code>protected String getChangePasswordMsg(CLIParser parser) throws ManageDomainsResult, UnsupportedEncodingException { if (!changePasswordMsg) { return null; } String changePasswordMsgStr = <START> readInteractively("Please enter message or URL to appear when user tries to login with an expired password.\n", <END> false); if (changePasswordMsgStr.indexOf("http") == 0 || changePasswordMsgStr.indexOf("https") == 0) { try { URL url = new URL(changePasswordMsgStr); log.debug("Validated that " + url + " is in correct format"); } catch (MalformedURLException ex) { throw new ManageDomainsResult(ManageDomainsResultEnum.INVALID_ARGUMENT_FOR_COMMAND, "The provided value begins with a URL prefix of either http or https. However this is not a valid URL"); } } return URLEncoder.encode(changePasswordMsgStr, "UTF-8"); }</code><technical_language>this prompt end ":" a new line? giving user indication need type something, do ask passwords</technical_language>

Target:
protected String getChangePasswordMsg(CLIParser parser) throws ManageDomainsResult, UnsupportedEncodingException { if (!changePasswordMsg) { return null; } String changePasswordMsgStr = readInteractively("Please enter message or URL to appear when user tries to login with an expired password: ", false); if (changePasswordMsgStr.indexOf("http") == 0 || changePasswordMsgStr.indexOf("https") == 0) { try { URL url = new URL(changePasswordMsgStr); log.debug("Validated that " + url + " is in correct format"); } catch (MalformedURLException ex) { throw new ManageDomainsResult(ManageDomainsResultEnum.INVALID_ARGUMENT_FOR_COMMAND, "The provided value begins with a URL prefix of either http or https. However this is not a valid URL"); } } return URLEncoder.encode(changePasswordMsgStr, "UTF-8"); }
Source:
<code>public List<Pair<Guid, Integer>> score(Cluster cluster, List<VDS> hosts, <START> VM vm, Map<String, String> parameters) { <END> List<VDS> acceptableHostsList = vmToHostAffinityFilterPolicyUnit.getAcceptableHosts(false, hosts, vm, new PerHostMessages(), getPendingResourceManager()); Map<Guid, VDS> acceptableHostsMap = new HashMap<>(); if (acceptableHostsList != null) { acceptableHostsMap = acceptableHostsList.stream().collect(Collectors.toMap(VDS::getId, h -> h)); } List<Pair<Guid, Integer>> retList = new ArrayList<>(); int score; for (VDS host : hosts) { score = DEFAULT_SCORE; if (!acceptableHostsMap.containsKey(host.getId())) { score = MaxSchedulerWeight; } retList.add(new Pair<>(host.getId(), score)); } return retList; }</code><technical_language>I wrap avoid excessive line length</technical_language>

Target:
public List<Pair<Guid, Integer>> score(Cluster cluster, List<VDS> hosts, VM vm, Map<String, String> parameters) { List<VDS> acceptableHostsList = vmToHostAffinityFilterPolicyUnit.get().getAcceptableHosts(false, hosts, vm, new PerHostMessages(), getPendingResourceManager()); Map<Guid, VDS> acceptableHostsMap = new HashMap<>(); if (acceptableHostsList != null) { acceptableHostsMap = acceptableHostsList.stream().collect(Collectors.toMap(VDS::getId, h -> h)); } List<Pair<Guid, Integer>> retList = new ArrayList<>(); int score; for (VDS host : hosts) { score = DEFAULT_SCORE; if (!acceptableHostsMap.containsKey(host.getId())) { score = MaxSchedulerWeight; } retList.add(new Pair<>(host.getId(), score)); } return retList; }