auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public void testGetIscsiInitiatorsByHostIdAndStorageTargetId() { List<VdsNetworkInterface> interfaces = dao.getIscsiInitiatorsByHostIdAndStorageTargetId(VDS_ID, TARGET_ID); assertNotNull(interfaces); <START> assertTrue(interfaces.size() == 1); <END> }</code><technical_language>assertEquals() verify a single nic returned: assertFalse(interface.isEmpty()) ; in addition, iterate interfaces verify of belong desired hosts: for (VdsNetworkInterface nic : interfaces) { assertEquals(VDS_ID, nic.getVdsId()); }</technical_language>

Target:
public void testGetIscsiInitiatorsByHostIdAndStorageTargetId() { List<VdsNetworkInterface> interfaces = dao.getIscsiInitiatorsByHostIdAndStorageTargetId(VDS_ID, TARGET_ID); assertNotNull(interfaces); for (VdsNetworkInterface nic : interfaces) { assertEquals(VDS_ID, nic.getVdsId()); } }
Source:
<code>private void testWithAllStorageFormats(BiConsumer<Session, HiveStorageFormat> test) { for (HiveStorageFormat storageFormat : HiveStorageFormat.values()) { Session session = getSession(); if (storageFormat == PAGEFILE) { session = Session.builder(getSession()) <START> .setCatalogSessionProperty(catalog, "compression_codec", "SNAPPY") <END> .build(); } test.accept(session, storageFormat); } }</code><technical_language>do reset here? Is standard, GZIP compression is supported? hard is simply support it</technical_language>

Target:
private void testWithAllStorageFormats(BiConsumer<Session, HiveStorageFormat> test) { for (HiveStorageFormat storageFormat : HiveStorageFormat.values()) { test.accept(getSession(), storageFormat); } }
Source:
<code>private MethodSpec createToContentValuesMethod(ExecutableElement method, Map<String, ExecutableElement> properties) { MethodSpec.Builder builder = MethodSpec.methodBuilder(method.getSimpleName().toString()) .addModifiers(PUBLIC) .returns(CONTENT_VALUES) <START> .addStatement("$T values = new $T($L)", CONTENT_VALUES, CONTENT_VALUES, <END> properties.size()); for (Map.Entry<String, ExecutableElement> entry : properties.entrySet()) { String name = entry.getKey(); ExecutableElement element = entry.getValue(); TypeName type = TypeName.get(element.getReturnType()); if (getCursorMethod(type) == null) { throw new IllegalArgumentException(String.format("Property \"%s\" has type " + "\"%s\" that can't be put into ContentValues.", name, type)); } String columnName = getColumnName(element); if (columnName == null) columnName = entry.getKey(); builder.addStatement("values.put($S, $L())", columnName, name); } return builder.addStatement("return values") .build(); }</code><technical_language>do $1T values = new $1T($2L) pass CONTENT_VALUES once</technical_language>

Target:
private MethodSpec createToContentValuesMethod(ExecutableElement method, Map<String, ExecutableElement> properties) { MethodSpec.Builder builder = MethodSpec.methodBuilder(method.getSimpleName().toString()) .addModifiers(PUBLIC) .returns(CONTENT_VALUES) .addStatement("$1T values = new $1T($2L)", CONTENT_VALUES, properties.size()); for (Map.Entry<String, ExecutableElement> entry : properties.entrySet()) { String name = entry.getKey(); ExecutableElement element = entry.getValue(); TypeName type = TypeName.get(element.getReturnType()); if (getCursorMethod(type) == null) { throw new IllegalArgumentException(String.format("Property \"%s\" has type " + "\"%s\" that can't be put into ContentValues.", name, type)); } String columnName = getColumnName(element); if (columnName == null) columnName = entry.getKey(); builder.addStatement("values.put($S, $L())", columnName, name); } return builder.addStatement("return values") .build(); }
Source:
<code>private List<SectionMatcher> getLocalAccessSections() { List<SectionMatcher> sm = localAccessSections; if (sm == null) { Collection<AccessSection> fromConfig = config.getAccessSections(); sm = new ArrayList<SectionMatcher>(fromConfig.size()); for (AccessSection section : fromConfig) { if (isAllProjects) { final List<Permission> permissions = section.getPermissions(); section = new AccessSection(section.getName()); <START> section.setPermissions(permissions); <END> for (final String permissionName : Permission.getPermissionNames()) { if (!Permission.canBeOnAllProjects(section.getName(), permissionName)) { section.removePermission(permissionName); } } } SectionMatcher matcher = SectionMatcher.wrap(section); if (matcher != null) { sm.add(matcher); } } localAccessSections = sm; } return sm; }</code><technical_language>sections sharing backing List instance. setPermissions List supplied. need copy this a new ArrayList first</technical_language>

Target:
private List<SectionMatcher> getLocalAccessSections() { List<SectionMatcher> sm = localAccessSections; if (sm == null) { Collection<AccessSection> fromConfig = config.getAccessSections(); sm = new ArrayList<SectionMatcher>(fromConfig.size()); for (AccessSection section : fromConfig) { if (isAllProjects) { section = cloneAccessSection(section); for (final String permissionName : Permission.getPermissionNames()) { if (!Permission.canBeOnAllProjects(section.getName(), permissionName)) { section.removePermission(permissionName); } } } SectionMatcher matcher = SectionMatcher.wrap(section); if (matcher != null) { sm.add(matcher); } } localAccessSections = sm; } return sm; }
Source:
<code>public void setTransformAnimated( final Matrix newTransform, long durationMs, @Nullable final Runnable onAnimationComplete) { FLog.v(getLogTag(), "setTransformAnimated: duration %d ms", durationMs); stopAnimation(); Preconditions.checkArgument(durationMs > 0); Preconditions.checkState(!isAnimating()); setAnimating(true); mValueAnimator.setDuration(durationMs); getTransform().getValues(getStartValues()); newTransform.getValues(getStopValues()); <START> mValueAnimator.addUpdateListener((valueAnimator) -> { <END> calculateInterpolation(getWorkingTransform(), (float) valueAnimator.getAnimatedValue()); AnimatedZoomableController.super.setTransform(getWorkingTransform()); }); mValueAnimator.addListener(new AnimatorListenerAdapter() { @Override public void onAnimationCancel(Animator animation) { FLog.v(getLogTag(), "setTransformAnimated: animation cancelled"); onAnimationStopped(); } @Override public void onAnimationEnd(Animator animation) { FLog.v(getLogTag(), "setTransformAnimated: animation finished"); onAnimationStopped(); } private void onAnimationStopped() { if (onAnimationComplete != null) { onAnimationComplete.run(); } setAnimating(false); getDetector().restartGesture(); } }); mValueAnimator.start(); }</code><technical_language>files "com.facebook.samples" package copied Facebook repo, modified us</technical_language>

Target:
public void setTransformAnimated( final Matrix newTransform, long durationMs, @Nullable final Runnable onAnimationComplete) { FLog.v(getLogTag(), "setTransformAnimated: duration %d ms", durationMs); stopAnimation(); Preconditions.checkArgument(durationMs > 0); Preconditions.checkState(!isAnimating()); setAnimating(true); mValueAnimator.setDuration(durationMs); getTransform().getValues(getStartValues()); newTransform.getValues(getStopValues()); mValueAnimator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() { @Override public void onAnimationUpdate(ValueAnimator valueAnimator) { calculateInterpolation(getWorkingTransform(), (float) valueAnimator.getAnimatedValue()); AnimatedZoomableController.super.setTransform(getWorkingTransform()); } }); mValueAnimator.addListener(new AnimatorListenerAdapter() { @Override public void onAnimationCancel(Animator animation) { FLog.v(getLogTag(), "setTransformAnimated: animation cancelled"); onAnimationStopped(); } @Override public void onAnimationEnd(Animator animation) { FLog.v(getLogTag(), "setTransformAnimated: animation finished"); onAnimationStopped(); } private void onAnimationStopped() { if (onAnimationComplete != null) { onAnimationComplete.run(); } setAnimating(false); getDetector().restartGesture(); } }); mValueAnimator.start(); }
Source:
<code>private TransactionManager tryToCreateTransactionManager(AtlasDbEteConfiguration config, Environment environment) throws InterruptedException { if (config.getAtlasDbConfig().initializeAsync()) { return createTransactionManager(config.getAtlasDbConfig(), environment, config.getAtlasDbRuntimeConfig()); } else { return createTransactionManagerWithRetry(config.getAtlasDbConfig(), config.getAtlasDbRuntimeConfig(), environment <START> ); <END> } }</code><technical_language>nit: ordering factories consistent (i.e. install/runtime/environment, install/environment/runtime). I generally prefer install/runtime/environment this is closer internal server framework's ordering</technical_language>

Target:
private TransactionManager tryToCreateTransactionManager(AtlasDbEteConfiguration config, Environment environment) throws InterruptedException { if (config.getAtlasDbConfig().initializeAsync()) { return createTransactionManager(config.getAtlasDbConfig(), config.getAtlasDbRuntimeConfig(), environment); } else { return createTransactionManagerWithRetry(config.getAtlasDbConfig(), config.getAtlasDbRuntimeConfig(), environment); } }
Source:
<code>private IProject getSingleProject() { IProject result= null; for (IPackageFragmentRoot <START> fPackageFragmentRoot : <END> fPackageFragmentRoots) { if (result == null) { result= fPackageFragmentRoot.getJavaProject().getProject(); } else if (!result.equals(fPackageFragmentRoot.getJavaProject().getProject())) { return null; } } return result; }</code><technical_language>rename root</technical_language>

Target:
private IProject getSingleProject() { IProject result= null; for (IPackageFragmentRoot root : fPackageFragmentRoots) { if (result == null) { result= root.getJavaProject().getProject(); } else if (!result.equals(root.getJavaProject().getProject())) { return null; } } return result; }
Source:
<code>public BlobStoreStatsTest(boolean isLogSegmented) throws InterruptedException, IOException, StoreException { <START> tempDir = StoreTestUtils.createTempDirectory("indexDir-" + UtilsTest.getRandomString(10)); <END> state = new CuratedLogIndexState(isLogSegmented, tempDir); DiskIOScheduler diskIOScheduler = new DiskIOScheduler(null); blobStoreStats = new BlobStoreStats(state.index, state.time, diskIOScheduler); }</code><technical_language>minor: blobStoreStatsDir-</technical_language>

Target:
public BlobStoreStatsTest(boolean isLogSegmented) throws InterruptedException, IOException, StoreException { tempDir = StoreTestUtils.createTempDirectory("blobStoreStatsDir-" + UtilsTest.getRandomString(10)); state = new CuratedLogIndexState(isLogSegmented, tempDir); blobStoreStats = new BlobStoreStats(state.index, state.time, DISK_IO_SCHEDULER); }
Source:
<code>public void buildVmVideoCards() { <START> boolean videoCardOverridden = vm.isRunOnce() && vm.getDefaultDisplayType() != null; <END> boolean isHeadlessMode = vm.getDefaultDisplayType() == DisplayType.none; if (videoCardOverridden) { if(isHeadlessMode) { return; } buildVmVideoDeviceOverridden(); } else { buildVmVideoDevicesFromDb(); } }</code><technical_language>I I understand this line - I fully understand change in RunVmOnce though.</technical_language>

Target:
public void buildVmVideoCards() { boolean videoCardOverridden = vm.isRunOnce() && vm.getDefaultDisplayType() != null; if (videoCardOverridden) { if (vm.getDefaultDisplayType() == DisplayType.none) { return; } buildVmVideoDeviceOverridden(); } else { buildVmVideoDevicesFromDb(); } }
Source:
<code>public void finishAnnouncing() throws SegmentLoadingException { finished = true; <START> if (startedAnnouncing != null && (startedAnnouncing.isDone() || !startedAnnouncing.cancel(false))) { <END> log.info("Waiting for background segment announcing task to complete"); try { doneAnnouncing.get(); } catch (InterruptedException e) { Thread.currentThread().interrupt(); throw new SegmentLoadingException(e, "Loading Interrupted"); } catch (ExecutionException e) { throw new SegmentLoadingException(e.getCause(), "Background Announcing Task Failed"); } } else { try { announcer.announceSegments(queue); } catch (Exception e) { throw new SegmentLoadingException(e, "Failed to announce segments[%s]", queue); } } log.info("Completed background segment announcing"); }</code><technical_language>I .cancel return true if background task is running. implementation of MoreExecutors.listeningDecorator set future state cancelled return true. background announcing ongoing conditional is false</technical_language>

Target:
public void finishAnnouncing() throws SegmentLoadingException { synchronized (lock) { finished = true; try { final List<DataSegment> segments = Lists.newLinkedList(); queue.drainTo(segments); announcer.announceSegments(segments); } catch (Exception e) { throw new SegmentLoadingException(e, "Failed to announce segments[%s]", queue); } try { if (startedAnnouncing != null) { startedAnnouncing.cancel(false); } if (doneAnnouncing.isDone()) { doneAnnouncing.get(); } } catch (InterruptedException e) { Thread.currentThread().interrupt(); throw new SegmentLoadingException(e, "Loading Interrupted"); } catch (ExecutionException e) { throw new SegmentLoadingException(e.getCause(), "Background Announcing Task Failed"); } } log.info("Completed background segment announcing"); }
Source:
<code>public boolean isSuccess(CompletionStage<Void> future) { try { FunctionalTestUtils.await(future); return true; <START> } catch (Error e) { <END> return false; } }</code><technical_language>catch Throwable ? I strange gut feelings for Error</technical_language>

Target:
public boolean isSuccess(CompletionStage<Void> future) { try { FunctionalTestUtils.await(future); return true; } catch (Throwable e) { return false; } }
Source:
<code>private static boolean isPlugin(Path path) { Path parent = path.getParent(); while (parent != null) { <START> if (parent.getName().equals("plugins")) { <END> return true; } parent = parent.getParent(); } return false; }</code><technical_language>"plugins" replaced ConfigConstants.DEFAULT_FLINK_PLUGINS_DIRS</technical_language>

Target:
private static boolean isPlugin(Path path) { Path parent = path.getParent(); while (parent != null) { if (ConfigConstants.DEFAULT_FLINK_PLUGINS_DIRS.equals(parent.getName())) { return true; } parent = parent.getParent(); } return false; }
Source:
<code>private void dispatchMethod(MicroservicesRegistryImpl currentMicroservicesRegistry, Request request, Response response) throws Exception { HttpUtil.setConnectionHeader(request, response); PatternPathRouter.RoutableDestination<HttpResourceModel> destination = currentMicroservicesRegistry. getMetadata(). getDestinationMethod(request.getUri(), request.getHttpMethod(), request.getContentType(), request.getAcceptTypes()); HttpResourceModel resourceModel = destination.getDestination(); response.setMediaType(Util.getResponseType(request.getAcceptTypes(), resourceModel.getProducesMediaTypes())); InterceptorExecutor annotationFilterExecutor = new InterceptorExecutor(); Method method = resourceModel.getMethod(); <START> annotationFilterExecutor.processRequestInterceptors(currentMicroservicesRegistry, method, request); <END> HttpMethodInfoBuilder httpMethodInfoBuilder = new HttpMethodInfoBuilder(). httpResourceModel(resourceModel). httpRequest(request). httpResponder(response). requestInfo(destination.getGroupNameValues()); HttpMethodInfo httpMethodInfo = httpMethodInfoBuilder.build(); if (httpMethodInfo.isStreamingSupported()) { while (!(request.isEmpty() && request.isEomAdded())) { httpMethodInfo.chunk(request.getMessageBody()); } httpMethodInfo.end(); } else { httpMethodInfo.invoke(request, destination); } annotationFilterExecutor.processResponseInterceptors(currentMicroservicesRegistry, method, request, response); }</code><technical_language>flow get break if returns false here</technical_language>

Target:
private void dispatchMethod(MicroservicesRegistryImpl currentMicroservicesRegistry, Request request, Response response) throws Exception { HttpUtil.setConnectionHeader(request, response); PatternPathRouter.RoutableDestination<HttpResourceModel> destination = currentMicroservicesRegistry. getMetadata(). getDestinationMethod(request.getUri(), request.getHttpMethod(), request.getContentType(), request.getAcceptTypes()); HttpResourceModel resourceModel = destination.getDestination(); response.setMediaType(Util.getResponseType(request.getAcceptTypes(), resourceModel.getProducesMediaTypes())); HttpMethodInfoBuilder httpMethodInfoBuilder = new HttpMethodInfoBuilder(). httpResourceModel(resourceModel). httpRequest(request). httpResponder(response). requestInfo(destination.getGroupNameValues()); HttpMethodInfo httpMethodInfo = httpMethodInfoBuilder.build(); if (httpMethodInfo.isStreamingSupported()) { while (!(request.isEmpty() && request.isEomAdded())) { httpMethodInfo.chunk(request.getMessageBody()); } httpMethodInfo.end(request, httpMethodInfo, currentMicroservicesRegistry); } else { httpMethodInfo.invoke(destination, request, httpMethodInfo, currentMicroservicesRegistry); } }
Source:
<code>public void activate(Context context) { super.activate(context); for (Field field : inputClass.getFields()) { try { fieldMap.put(generateGettersForField(inputClass, field.getName()), generateSettersForField(outputClass, field.getName())); } catch (NoSuchFieldException e) { <START> logger.warn("Unable to find field with name {}, ignoring that field. Exception: {}", field.getName(), e); <END> } } for (FieldInfo fieldInfo : this.includeFieldInfo) { try { includeSetters.add(generateSettersForField(outputClass, fieldInfo.getColumnName())); } catch (NoSuchFieldException e) { throw new RuntimeException("Given field name is not present in output POJO", e); } } for (FieldInfo fieldInfo : this.lookupFieldInfo) { try { lookupGetters.add(generateGettersForField(inputClass, fieldInfo.getColumnName())); } catch (NoSuchFieldException e) { throw new RuntimeException("Given lookup field is not present in POJO", e); } } }</code><technical_language>Throw runtime exception</technical_language>

Target:
public void activate(Context context) { super.activate(context); for (Field field : inputClass.getDeclaredFields()) { try { fieldMap.put(generateGettersForField(inputClass, field.getName()), generateSettersForField(outputClass, field.getName())); } catch (NoSuchFieldException e) { throw new RuntimeException("Unable to find field with name " + field.getName() + ", ignoring that field.", e); } } for (FieldInfo fieldInfo : this.includeFieldInfo) { try { includeSetters.add(generateSettersForField(outputClass, fieldInfo.getColumnName())); } catch (NoSuchFieldException e) { throw new RuntimeException("Given field name is not present in output POJO", e); } } for (FieldInfo fieldInfo : this.lookupFieldInfo) { try { lookupGetters.add(generateGettersForField(inputClass, fieldInfo.getColumnName())); } catch (NoSuchFieldException e) { throw new RuntimeException("Given lookup field is not present in POJO", e); } } }
Source:
<code>public void testWatermarkPolicy() throws WorkException, InterruptedException { <START> log.info("Running testWatermarkPolicy()"); <END> long startTime = System.currentTimeMillis(); int scheduleWorkAcceptedServer1 = server1Proxy.getScheduleWorkAccepted(); int scheduleWorkAcceptedServer2 = server2Proxy.getScheduleWorkAccepted(); int distributedScheduleWorkAccepted = server1Proxy.getDistributedScheduleWorkAccepted(); for (int i = 0; i < WATERMARK_MAX_THREADS; i++) { server1Proxy.scheduleWork(new LongWork().setName("testWatermarkPolicy-work" + (i + 1))); } Assert.assertTrue("Expected time < " + (startTime + LongWork.WORK_TIMEOUT) + ", actual: " + System.currentTimeMillis(), startTime + LongWork.WORK_TIMEOUT > System.currentTimeMillis()); Thread.sleep(LongWork.WORK_TIMEOUT * 2 + 100); logWorkStats(); Assert.assertTrue("Expected scheduleWorkAccepted = " + (scheduleWorkAcceptedServer1 + 1) + "/" + (scheduleWorkAcceptedServer2 + 1) + " but was: " + server1Proxy.getScheduleWorkAccepted() + "/" + server2Proxy.getScheduleWorkAccepted(), (server1Proxy.getScheduleWorkAccepted() == scheduleWorkAcceptedServer1 + 1) && (server2Proxy.getScheduleWorkAccepted() == scheduleWorkAcceptedServer2 + 1)); }</code><technical_language>remove</technical_language>

Target:
public void testWatermarkPolicy() throws WorkException, InterruptedException { int scheduleWorkAcceptedServer1 = server1Proxy.getScheduleWorkAccepted(); int scheduleWorkAcceptedServer2 = server2Proxy.getScheduleWorkAccepted(); int distributedScheduleWorkAccepted = server1Proxy.getDistributedScheduleWorkAccepted(); for (int i = 0; i < WATERMARK_MAX_THREADS; i++) { server1Proxy.scheduleWork(new LongWork()); } Assert.assertTrue("Work did not finish in the expected time on the expected node", waitForScheduleWork(server2Proxy, scheduleWorkAcceptedServer2 + 1, TimeoutUtil.adjust(WORK_FINISH_MAX_TIMEOUT))); Assert.assertTrue("Work did not finish in the expected time on the expected node", waitForScheduleWork(server1Proxy, scheduleWorkAcceptedServer1 + 1, TimeoutUtil.adjust(WORK_FINISH_MAX_TIMEOUT))); Assert.assertTrue("Expected distributedScheduleWorkAccepted = " + (distributedScheduleWorkAccepted + WATERMARK_MAX_THREADS) + " but was: " + server2Proxy.getDistributedScheduleWorkAccepted(), server2Proxy.getDistributedScheduleWorkAccepted() == distributedScheduleWorkAccepted + WATERMARK_MAX_THREADS); }
Source:
<code>public FormData prepareFormDataSet(FormFields form) { List<HtmlParameter> formDataSet = new LinkedList<>(); List<HtmlParameter> submitFields = new ArrayList<>(); Iterator<FormField> it = form.iterator(); while (it.hasNext()) { <START> FormField field = it.next(); <END> if (log.isDebugEnabled()) { log.debug("New form field: " + field.getDebugInfo()); } List<HtmlParameter> currentList = formDataSet; if (field.getFormControl().getFormControlType().isSubmit()) { currentList = submitFields; } for (String value : getValues(field)) { currentList.add(new HtmlParameter(Type.form, field.getName(), value)); } } return new FormData(formDataSet, submitFields); }</code><technical_language>Formatting changes occur in a separate PR: <LINK_0></technical_language>

Target:
private FormData prepareFormDataSet(FormFields form) { List<HtmlParameter> formDataSet = new LinkedList<>(); List<HtmlParameter> submitFields = new ArrayList<>(); Iterator<FormField> it = form.iterator(); while (it.hasNext()) { FormField field = it.next(); if (log.isDebugEnabled()) { log.debug("New form field: " + field.getDebugInfo()); } List<HtmlParameter> currentList = formDataSet; if (field.getFormControl().getFormControlType().isSubmit()) { currentList = submitFields; } for (String value : getDefaultTextValue(field)) { currentList.add(new HtmlParameter(Type.form, field.getName(), value)); } } return new FormData(formDataSet, submitFields); }
Source:
<code>public void testNoNodesDieOnRequest() throws Exception { Ignite srv1 = startGrid(0); replaceWithCountingMappingRequestListener(((GridKernalContext)U.field(srv1, "ctx")).io()); Ignite srv2 = startGrid(1); replaceWithCountingMappingRequestListener(((GridKernalContext)U.field(srv2, "ctx")).io()); Ignite srv3 = startGrid(2); replaceWithCountingMappingRequestListener(((GridKernalContext)U.field(srv3, "ctx")).io()); srv3.cache(DEFAULT_CACHE_NAME).put( 1, new Organization(1, "Microsoft", "One Microsoft Way Redmond, WA 98052-6399, USA")); <START> clientMode = true; <END> Ignite cl1 = startClientGrid(4); cl1.cache(DEFAULT_CACHE_NAME).get(1); int result = mappingReqsCounter.get(); assertEquals("Expected requests count is 1, actual is " + result, 1, result); }</code><technical_language>This is redundant</technical_language>

Target:
public void testNoNodesDieOnRequest() throws Exception { Ignite srv1 = startGrid(0); replaceWithCountingMappingRequestListener(((GridKernalContext)U.field(srv1, "ctx")).io()); Ignite srv2 = startGrid(1); replaceWithCountingMappingRequestListener(((GridKernalContext)U.field(srv2, "ctx")).io()); Ignite srv3 = startGrid(2); replaceWithCountingMappingRequestListener(((GridKernalContext)U.field(srv3, "ctx")).io()); srv3.cache(DEFAULT_CACHE_NAME).put( 1, new Organization(1, "Microsoft", "One Microsoft Way Redmond, WA 98052-6399, USA")); Ignite cl1 = startClientGrid(4); cl1.cache(DEFAULT_CACHE_NAME).get(1); int result = mappingReqsCounter.get(); assertEquals("Expected requests count is 1, actual is " + result, 1, result); }
Source:
<code>public ActionResult execute() { CourseArchiveRequest courseArchiveRequest = getAndValidateRequestBody(CourseArchiveRequest.class); <START> String idOfCourseToArchive = courseArchiveRequest.getCourseId(); <END> String archiveStatus = courseArchiveRequest.getArchiveStatus(); boolean isArchive = Boolean.parseBoolean(archiveStatus); try { logic.setArchiveStatusOfInstructor(userInfo.id, idOfCourseToArchive, isArchive); if (!isArchive) { return new JsonResult("The course has been unarchived.", HttpStatus.SC_OK); } } catch (InvalidParametersException e) { return new JsonResult(e.getMessage(), HttpStatus.SC_BAD_REQUEST); } catch (EntityDoesNotExistException e) { return new JsonResult(e.getMessage(), HttpStatus.SC_INTERNAL_SERVER_ERROR); } return new JsonResult("The course has been archived. It will not appear in the home page any more. " + "You can access archived courses from the 'Courses' tab.\n" + "Go there to undo the archiving and bring the course back to the home page.", HttpStatus.SC_OK); }</code><technical_language>courseId is identify resource. request body</technical_language>

Target:
public ActionResult execute() { String idOfCourseToArchive = getNonNullRequestParamValue(Const.ParamsNames.COURSE_ID); CourseArchiveRequest courseArchiveRequest = getAndValidateRequestBody(CourseArchiveRequest.class); boolean isArchive = courseArchiveRequest.getArchiveStatus(); try { logic.setArchiveStatusOfInstructor(userInfo.id, idOfCourseToArchive, isArchive); } catch (InvalidParametersException e) { return new JsonResult(e.getMessage(), HttpStatus.SC_BAD_REQUEST); } catch (EntityDoesNotExistException e) { throw new EntityNotFoundException(e); } return new JsonResult(new CourseArchiveData(idOfCourseToArchive, isArchive)); }
Source:
<code>public GameColors() { Json json = Assets.getJson("core:colorsConfig"); JSONObject rootNode = json.getJsonValue(); Validator.validate(rootNode, "engine:schemaColorsConfig"); <START> for (String s : rootNode.keySet()) { <END> Color c = load(rootNode.getString(s)); colors.put(s, c); } json.dispose(); fire = get("fire"); smoke = get("smoke"); hullLights = get("hullLights"); }</code><technical_language>Please a variable name s</technical_language>

Target:
public GameColors() { Json json = Assets.getJson("core:colorsConfig"); JSONObject rootNode = json.getJsonValue(); Validator.validate(rootNode, "engine:schemaColorsConfig"); for (String key : rootNode.keySet()) { Color c = load(rootNode.getString(key)); colors.put(key, c); } json.dispose(); fire = get("fire"); smoke = get("smoke"); hullLights = get("hullLights"); }
Source:
<code>private SafeHtml formatList(JsArrayString l) { SafeHtmlBuilder sb = new SafeHtmlBuilder(); int size = l.length(); <START> for (int i = 0; i < size; i++) { <END> sb.openSpan() .addStyleName(style.includedInElement()) .append(l.get(i)) .closeSpan(); if (i < size - 1) { sb.append(", "); } } return sb; }</code><technical_language>tags example (<LINK_0> shows a wide dropdown. Is wrap text a reasonable length entire width of screen in cases</technical_language>

Target:
private SafeHtml formatList(JsArrayString l) { SafeHtmlBuilder html = new SafeHtmlBuilder(); int size = l.length(); for (int i = 0; i < size; i++) { html.openSpan() .addStyleName(style.includedInElement()) .append(l.get(i)) .closeSpan(); if (i < size - 1) { html.append(", "); } } return html; }
Source:
<code>static String messageWithLabelAndPropertyName( TokenNameLookup tokenNameLookup, String formatString, LabelSchemaDescriptor descriptor ) { int[] propertyIds = descriptor.getPropertyIds(); if ( tokenNameLookup != null ) { <START> String propertyString = propertyIds.length == 1 ? <END> "property " + tokenNameLookup.propertyKeyGetName( descriptor.getPropertyId() ) : "properties " + Arrays.stream( propertyIds ) .mapToObj( (i) -> "'" + tokenNameLookup.propertyKeyGetName( i ) + "'") .collect( Collectors.joining( " and " )); return String.format( formatString, tokenNameLookup.labelGetName( descriptor.getLabelId() ), propertyString); } else { String keyString = propertyIds.length == 1 ? "key[" + propertyIds[0] + "]" : "keys[" + Arrays.stream( propertyIds ) .mapToObj( Integer::toString ) .collect( Collectors.joining( ", " )) + "]"; return String.format( formatString, "label[" + descriptor.getLabelId() + "]", keyString ); } }</code><technical_language>I this kind of logic exist in place. In earlier version of this code isolated construction of a property description NodePropertyDescriptor internally if is single property multi-property format accordingly. here, repeat this logic in multiple places, conditional length of property array</technical_language>

Target:
static String messageWithLabelAndPropertyName( TokenNameLookup tokenNameLookup, String formatString, LabelSchemaDescriptor descriptor ) { int[] propertyIds = descriptor.getPropertyIds(); if ( tokenNameLookup != null ) { String propertyString = propertyIds.length == 1 ? "property '" + tokenNameLookup.propertyKeyGetName( propertyIds[0]) + "'" : "properties " + Arrays.stream( propertyIds ) .mapToObj( (i) -> "'" + tokenNameLookup.propertyKeyGetName( i ) + "'") .collect( Collectors.joining( " and " )); return String.format( formatString, tokenNameLookup.labelGetName( descriptor.getLabelId() ), propertyString); } else { String keyString = propertyIds.length == 1 ? "key[" + propertyIds[0] + "]" : "keys[" + Arrays.stream( propertyIds ) .mapToObj( Integer::toString ) .collect( Collectors.joining( ", " )) + "]"; return String.format( formatString, "label[" + descriptor.getLabelId() + "]", keyString ); } }
Source:
<code>static String findVersionInClasspath(Project project, String group, String module) { return project.getBuildscript() .getConfigurations() .getByName("classpath") .getIncoming() .getArtifacts() .getArtifacts() .stream() <START> .map(artifactResult -> artifactResult.getId().getComponentIdentifier()) <END> .filter(identifier -> identifier instanceof ModuleComponentIdentifier) .map(componentIdentifier -> (ModuleComponentIdentifier) componentIdentifier) .filter(identifier -> (group.equals(identifier.getGroup()) && module.equals(identifier.getModule()))) .findFirst() .map(ModuleComponentIdentifier::getVersion) .orElse(null); }</code><technical_language>reduce amount of nested map/filters here? flat map it</technical_language>

Target:
static String findVersionInClasspath(Project project, String group, String module) { return project.getBuildscript() .getConfigurations() .getByName("classpath") .getIncoming() .getArtifacts() .getArtifacts() .stream() .flatMap(artifactResult -> artifactResult.getId().getComponentIdentifier() instanceof ModuleComponentIdentifier ? Stream.of((ModuleComponentIdentifier) artifactResult.getId().getComponentIdentifier()) : Stream.empty()) .filter(identifier -> (group.equals(identifier.getGroup()) && module.equals(identifier.getModule()))) .findFirst() .map(ModuleComponentIdentifier::getVersion) .orElse(null); }
Source:
<code>private PdpFeedGroupEntryFixture(String payeeName, String payeeIdType, String payeeId, String customerInstitutionIdentifier, EnumSet<PdpFeedDetailEntryFixture> detailEntries) { <START> this(payeeName, payeeIdType, payeeId, "xyz", customerInstitutionIdentifier, PdpFeedFileConstants.PAYMENT_DATE, PdpFeedFileConstants.COMBINE_GROUP_INDICATOR_YES, <END> PdpFeedFileConstants.BANK_CODE, detailEntries); }</code><technical_language>helpful move "xyz" literal constant</technical_language>

Target:
private PdpFeedGroupEntryFixture(String payeeName, String payeeIdType, String payeeId, String customerInstitutionIdentifier, EnumSet<PdpFeedDetailEntryFixture> detailEntries) { this(payeeName, payeeIdType, payeeId, PdpFeedFileConstants.PAYMENT_OWNERSHIP_CODE, customerInstitutionIdentifier, PdpFeedFileConstants.PAYMENT_DATE, PdpFeedFileConstants.COMBINE_GROUP_INDICATOR_YES, PdpFeedFileConstants.BANK_CODE, detailEntries); }
Source:
<code>public TerminalOpener terminalOpener() { <START> return new AutomaticTerminalOpener(terminalOpenerFactory(), operatingSystemFetcher(), <END> Optional.of(terminalCommand)); }</code><technical_language>name of command is specific Linux passed constructor instead</technical_language>

Target:
public TerminalOpener terminalOpener() { return new AutomaticTerminalOpener(terminalOpenerFactory(), operatingSystemFetcher(), Optional.of(linuxTerminalCommand)); }
Source:
<code>private void fetchRemoteData() { WordPress.getRestClientUtils().getGeneralSettings( String.valueOf(mBlog.getRemoteBlogId()), new RestRequest.Listener() { @Override public void onResponse(JSONObject response) { handleResponseToGeneralSettingsRequest(response); } }, new RestRequest.ErrorListener() { @Override public void onErrorResponse(VolleyError error) { if (isAdded()) { <START> ToastUtils.showToast(getActivity(), "Error getting site info"); <END> } } }); }</code><technical_language>Hard-coded string here. Also, good write error AppLog</technical_language>

Target:
private void fetchRemoteData() { WordPress.getRestClientUtils().getGeneralSettings( String.valueOf(mBlog.getRemoteBlogId()), new RestRequest.Listener() { @Override public void onResponse(JSONObject response) { handleResponseToGeneralSettingsRequest(response); } }, new RestRequest.ErrorListener() { @Override public void onErrorResponse(VolleyError error) { AppLog.w(AppLog.T.API, "Error GETing site settings: " + error); if (isAdded()) { ToastUtils.showToast(getActivity(), getString(R.string.error_fetch_remote_site_settings)); getActivity().finish(); } } }); }
Source:
<code>private int QueryGetData(long pFormatetc) { if (transferAgents == null) return COM.E_FAIL; TransferData transferData = new TransferData(); transferData.formatetc = new FORMATETC(); COM.MoveMemory(transferData.formatetc, pFormatetc, FORMATETC.sizeof); transferData.type = transferData.formatetc.cfFormat; for (Transfer <START> transfer : <END> transferAgents) { if (transfer != null && transfer.isSupportedType(transferData)) return COM.S_OK; } return COM.DV_E_FORMATETC; }</code><technical_language>rename transferAgent (to consistent above)</technical_language>

Target:
private int QueryGetData(long pFormatetc) { if (transferAgents == null) return COM.E_FAIL; TransferData transferData = new TransferData(); transferData.formatetc = new FORMATETC(); COM.MoveMemory(transferData.formatetc, pFormatetc, FORMATETC.sizeof); transferData.type = transferData.formatetc.cfFormat; for (Transfer transferAgent : transferAgents) { if (transferAgent != null && transferAgent.isSupportedType(transferData)) return COM.S_OK; } return COM.DV_E_FORMATETC; }
Source:
<code>public void testBookieCompaction() throws Exception { storage.setMasterKey(4, "key".getBytes()); ByteBuf entry3 = Unpooled.buffer(1024); entry3.writeLong(4); entry3.writeLong(3); entry3.writeBytes("entry-3".getBytes()); storage.addEntry(entry3); EntryLogger entryLogger = ((DbLedgerStorage) storage).getEntryLogger(); ByteBuf newEntry3 = Unpooled.buffer(1024); newEntry3.writeLong(4); newEntry3.writeLong(3); newEntry3.writeBytes("new-entry-3".getBytes()); long location = entryLogger.addEntry(4, newEntry3, false); List<EntryLocation> locations = Lists.newArrayList(new EntryLocation(4, 3, location)); storage.updateEntriesLocations(locations); ByteBuf res = storage.getEntry(4, 3); System.out.println("res: " + ByteBufUtil.hexDump(res)); System.out.println("newEntry3: " + ByteBufUtil.hexDump(newEntry3)); assertEquals(newEntry3, res); <START> storage.shutdown(); <END> }</code><technical_language>closing *storage* in teardown()</technical_language>

Target:
public void testBookieCompaction() throws Exception { storage.setMasterKey(4, "key".getBytes()); ByteBuf entry3 = Unpooled.buffer(1024); entry3.writeLong(4); entry3.writeLong(3); entry3.writeBytes("entry-3".getBytes()); storage.addEntry(entry3); EntryLogger entryLogger = ((DbLedgerStorage) storage).getEntryLogger(); ByteBuf newEntry3 = Unpooled.buffer(1024); newEntry3.writeLong(4); newEntry3.writeLong(3); newEntry3.writeBytes("new-entry-3".getBytes()); long location = entryLogger.addEntry(4, newEntry3, false); List<EntryLocation> locations = Lists.newArrayList(new EntryLocation(4, 3, location)); storage.updateEntriesLocations(locations); ByteBuf res = storage.getEntry(4, 3); System.out.println("res: " + ByteBufUtil.hexDump(res)); System.out.println("newEntry3: " + ByteBufUtil.hexDump(newEntry3)); assertEquals(newEntry3, res); }
Source:
<code>public static boolean checkInputForCollationAndLimit(RelMetadataQuery mq, RelNode input, RelCollation collation, RexNode offset, RexNode fetch) { boolean alreadySorted = collation.getFieldCollations().isEmpty(); if (!alreadySorted) { final ImmutableList<RelCollation> collations = mq.collations(input); <START> if (collations != null) { <END> for (RelCollation inputCollation : collations) { if (inputCollation.satisfies(collation)) { alreadySorted = true; break; } } } } if (!alreadySorted) { return false; } if (fetch == null) { return true; } final Double rowCount = mq.getMaxRowCount(input); if (rowCount == null) { return false; } else { final int offsetVal = offset == null ? 0 : RexLiteral.intValue(offset); final int limit = RexLiteral.intValue(fetch); return (double) offsetVal + (double) limit >= rowCount; } }</code><technical_language>if (collations == null) { return false; }</technical_language>

Target:
public static boolean checkInputForCollationAndLimit(RelMetadataQuery mq, RelNode input, RelCollation collation, RexNode offset, RexNode fetch) { return alreadySorted(mq, input, collation) && alreadySmaller(mq, input, offset, fetch); }
Source:
<code><START> public static TemporaryModel fromBundle(Bundle bundle) { <END> String mEditedModelFileName = bundle.getString(INTENT_MODEL_FILENAME); if (mEditedModelFileName == null) { Timber.d("fromBundle() - model file name under key %s", INTENT_MODEL_FILENAME); return null; } Timber.d("onCreate() loading saved model file %s", mEditedModelFileName); JSONObject tempModelJSON; try { tempModelJSON = getTempModel((mEditedModelFileName)); } catch (IOException e) { Timber.w(e, "Unable to load saved model file"); return null; } TemporaryModel model = new TemporaryModel(tempModelJSON); model.loadTemplateChanges(bundle); return model; }</code><technical_language>nit: @Nullable return</technical_language>

Target:
public static @Nullable TemporaryModel fromBundle(Bundle bundle) { String mEditedModelFileName = bundle.getString(INTENT_MODEL_FILENAME); if (mEditedModelFileName == null) { Timber.d("fromBundle() - model file name under key %s", INTENT_MODEL_FILENAME); return null; } Timber.d("onCreate() loading saved model file %s", mEditedModelFileName); JSONObject tempModelJSON; try { tempModelJSON = getTempModel((mEditedModelFileName)); } catch (IOException e) { Timber.w(e, "Unable to load saved model file"); return null; } TemporaryModel model = new TemporaryModel(tempModelJSON); model.loadTemplateChanges(bundle); return model; }
Source:
<code>private void onMatchmakerInfo(MatchmakerInfoMessage message) { List<CompletableFuture<?>> futures = new ArrayList<>(); message.getQueues().forEach(remoteQueue -> { MatchmakingQueue localQueue = matchmakingQueues.stream() <START> .filter(q -> Objects.equals(q.getQueueName(), remoteQueue.getQueueName())).findFirst().orElse(null); <END> if (localQueue == null) { queuesAdded = true; CompletableFuture<Optional<MatchmakingQueue>> future = fafService.getMatchmakingQueue(remoteQueue.getQueueName()); futures.add(future); future.thenAccept(result -> result.ifPresent( matchmakingQueue -> { matchmakingQueues.add(matchmakingQueue); matchmakingQueue.setQueuePopTime(OffsetDateTime.parse(remoteQueue.getQueuePopTime()).toInstant()); matchmakingQueue.setTeamSize(remoteQueue.getTeamSize()); matchmakingQueue.setPartiesInQueue(remoteQueue.getBoundary75s().size()); Platform.runLater(() -> matchmakingQueue.setPlayersInQueue(remoteQueue.getNumPlayers())); })); } else { localQueue.setQueuePopTime(OffsetDateTime.parse(remoteQueue.getQueuePopTime()).toInstant()); localQueue.setTeamSize(remoteQueue.getTeamSize()); localQueue.setPartiesInQueue(remoteQueue.getBoundary75s().size()); Platform.runLater(() -> localQueue.setPlayersInQueue(remoteQueue.getNumPlayers())); } }); CompletableFuture.allOf(futures.toArray(new CompletableFuture<?>[futures.size()])).thenRun(() -> { if (queuesAdded) { eventBus.post(new QueuesAddedEvent()); queuesAdded = false; } }); }</code><technical_language>line breaks stream operators</technical_language>

Target:
protected void onMatchmakerInfo(MatchmakerInfoMessage message) { List<CompletableFuture<?>> futures = new ArrayList<>(); message.getQueues().forEach(messageQueue -> { CompletableFuture<Optional<MatchmakingQueue>> future = fafService.getMatchmakingQueue(messageQueue.getQueueName()); futures.add(future.thenCompose(result -> result.map(matchmakingQueue -> copyInfoAndAddQueueIfNecessary(matchmakingQueue, messageQueue)) .orElseGet(() -> CompletableFuture.completedFuture(null)))); }); CompletableFuture.allOf(futures.toArray(new CompletableFuture<?>[futures.size()])).thenRun(() -> { queuesReadyForUpdate.set(true); }); }
Source:
<code>protected boolean validate() { StorageDomainToPoolRelationValidator storageDomainToPoolRelationValidator = new StorageDomainToPoolRelationValidator(getStorageDomain().getStorageStaticData(), getStoragePool()); boolean returnValue = checkStoragePool() && initializeVds() <START> && validate(storageDomainToPoolRelationValidator.validateDomainCanBeAttachedToPool()); <END> if (returnValue && getStoragePool().getStatus() == StoragePoolStatus.Uninitialized && getStorageDomain().getStorageDomainType() != StorageDomainType.Data) { returnValue = false; addValidationMessage(EngineMessage.ERROR_CANNOT_ADD_STORAGE_POOL_WITHOUT_DATA_DOMAIN); } if (returnValue && getStoragePool().getStatus() != StoragePoolStatus.Uninitialized) { returnValue = checkMasterDomainIsUp(); } return returnValue; }</code><technical_language>removing call checkStorageDomain(), is fine if getStorageDomain() returns null, a NullPointerException is thrown initializing storageDomainToPoolRelationValidator. harm is caused removing it, if moved beginning of method? like: if (!checkStorageDomain()){ return false; }</technical_language>

Target:
protected boolean validate() { StorageDomainToPoolRelationValidator storageDomainToPoolRelationValidator = new StorageDomainToPoolRelationValidator(getStorageDomain().getStorageStaticData(), getStoragePool()); boolean returnValue = checkStoragePool() && initializeVds() && checkStorageDomain() && validate(storageDomainToPoolRelationValidator.validateDomainCanBeAttachedToPool()); if (returnValue && getStoragePool().getStatus() == StoragePoolStatus.Uninitialized && getStorageDomain().getStorageDomainType() != StorageDomainType.Data) { returnValue = false; addValidationMessage(EngineMessage.ERROR_CANNOT_ADD_STORAGE_POOL_WITHOUT_DATA_DOMAIN); } if (returnValue && getStoragePool().getStatus() != StoragePoolStatus.Uninitialized) { returnValue = checkMasterDomainIsUp(); } return returnValue; }
Source:
<code>public String getFirstIndexForAlias(String aliasName) { <START> ImmutableOpenMap<String, List<AliasMetaData>> aliases = aliases = client.admin().indices().prepareGetAliases(aliasName).get().getAliases(); <END> if (aliases.isEmpty()) { return null; } return aliases.keysIt().next(); }</code><technical_language>Fix aliases = aliases = ..</technical_language>

Target:
public String getFirstIndexForAlias(String aliasName) { ImmutableOpenMap<String, List<AliasMetaData>> aliases = client.admin().indices().prepareGetAliases(aliasName).get().getAliases(); if (aliases.isEmpty()) { return null; } return aliases.keysIt().next(); }
Source:
<code>protected Collection<Integer> getRequiredOpenPorts() { Set<Integer> ports = MutableSet.copyOf(getConfig(REQUIRED_OPEN_LOGIN_PORTS)); Map<ConfigKey<?>, ?> allConfig = config().getBag().getAllConfigAsConfigKeyMap(); Set<ConfigKey<?>> configKeys = Sets.newHashSet(allConfig.keySet()); configKeys.addAll(getEntityType().getConfigKeys()); for (ConfigKey<?> k: configKeys) { if (PortRange.class.isAssignableFrom(k.getType())) { PortRange p = (PortRange)getConfig(k); if (p != null && !p.isEmpty()) ports.add(p.iterator().next()); } else if(k.getName().matches(".*\\.port")){ Object value = getConfig(k); if (value instanceof Integer){ ports.add((Integer)value); <START> } else if (PortRange.class.isAssignableFrom(value.getClass())) { <END> PortRange p = (PortRange)value; if (p != null && !p.isEmpty()) ports.add(p.iterator().next()); } } } log.debug("getRequiredOpenPorts detected default for {}", ports, this); return ports; }</code><technical_language>this check picked line 452, fix that</technical_language>

Target:
protected Collection<Integer> getRequiredOpenPorts() { Set<Integer> ports = MutableSet.copyOf(getConfig(REQUIRED_OPEN_LOGIN_PORTS)); Map<ConfigKey<?>, ?> allConfig = config().getBag().getAllConfigAsConfigKeyMap(); Set<ConfigKey<?>> configKeys = Sets.newHashSet(allConfig.keySet()); configKeys.addAll(getEntityType().getConfigKeys()); for (ConfigKey<?> k: configKeys) { Object value; if (PortRange.class.isAssignableFrom(k.getType()) || k.getName().matches(".*\\.port")) { value = config().get(k); } else { Maybe<Object> maybeValue = config().getRaw(k); value = maybeValue.isPresent() ? maybeValue.get() : null; } Maybe<PortRange> maybePortRange = TypeCoercions.tryCoerce(value, new TypeToken<PortRange>() {}); if (maybePortRange.isPresentAndNonNull()) { PortRange p = maybePortRange.get(); if (p != null && !p.isEmpty()) ports.add(p.iterator().next()); } } log.debug("getRequiredOpenPorts detected default for {}", ports, this); return ports; }
Source:
<code><START> public ArrayList<Map.Entry<String, EntityModel<String>>> getBondingOptionListDependingOnNetwork( <END> RefObject<Map.Entry<String, EntityModel<String>>> defaultItem, boolean hasNetworkAttached) { ArrayList<Map.Entry<String, EntityModel<String>>> list = new ArrayList<Map.Entry<String, EntityModel<String>>>(); EntityModel<String> entityModel = new EntityModel<String>(); entityModel.setEntity("(Mode 1) Active-Backup"); list.add(new KeyValuePairCompat<String, EntityModel<String>>("mode=1 miimon=100", entityModel)); entityModel = new EntityModel<String>(); entityModel.setEntity("(Mode 2) Load balance (balance-xor)"); list.add(new KeyValuePairCompat<String, EntityModel<String>>("mode=2 miimon=100", entityModel)); entityModel = new EntityModel<String>(); entityModel.setEntity("(Mode 4) Dynamic link aggregation (802.3ad)"); defaultItem.argvalue = new KeyValuePairCompat<String, EntityModel<String>>("mode=4 miimon=100", entityModel); list.add(defaultItem.argvalue); if (!hasNetworkAttached){ entityModel = new EntityModel<String>(); entityModel.setEntity("(Mode 5) Adaptive transmit load balancing (balance-tlb)"); list.add(new KeyValuePairCompat<String, EntityModel<String>>("mode=5 miimon=100", entityModel)); } entityModel = new EntityModel<String>(); entityModel.setEntity(""); list.add(new KeyValuePairCompat<String, EntityModel<String>>("custom", entityModel)); return list; }</code><technical_language>I understand bug, list dependent attached network is vm network (not is attached)</technical_language>

Target:
public ArrayList<Map.Entry<String, EntityModel<String>>> getBondingOptionListDependingOnNetwork( RefObject<Map.Entry<String, EntityModel<String>>> defaultItem, boolean hasNetworkAttached) { ArrayList<Map.Entry<String, EntityModel<String>>> list = new ArrayList<Map.Entry<String, EntityModel<String>>>(); for(BondMode mode : BondMode.values()){ if (!BondMode.BOND_MODES_VALID_FOR_NETWORK.contains(mode.getValue()) && hasNetworkAttached){ continue; } list.add(getBondOption(mode)); } EntityModel<String> entityModel = new EntityModel<String>(); entityModel.setEntity(""); list.add(new KeyValuePairCompat<String, EntityModel<String>>("custom", entityModel)); return list; }