auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public void testReadBytesLengthToSmall() { <START> <END> }</code><technical_language>this test filled</technical_language>

Target:
public void testReadBytesLengthToSmall() { byte[] data = new byte[]{0, 1, 2, 3}; byte[] expected = Arrays.copyOfRange(data, 0, 3); byte[] actual = IOUtility.readBytes(newInputStream(data), 3); assertArrayEquals(expected, actual); }
Source:
<code><START> public void resetPassword(final String email) <END> { restApi.resetPassword(email).enqueue(new Callback<Void>() { @Override public void onResponse(Call<Void> call, Response<Void> response) { if (response.isSuccessful()) loginView.showToastMessage("Please check your inbox."); else loginView.showToastMessage("Faced some error please try again."); } @Override public void onFailure(Call<Void> call, Throwable t) { loginView.showToastMessage("Faced some error please try later."); } }); }</code><technical_language>This method override in LoginContract</technical_language>

Target:
public void resetPassword(final String email) { restApi.resetPassword(email).enqueue(new Callback<Void>() { @Override public void onResponse(Call<Void> call, Response<Void> response) { if (response.isSuccessful()) { String message = new StringBuilder().append(Resources.getSystem().getString(R.string.check_your_email_id)).append(email).toString(); ToastUtil.success(message); } else { ToastUtil.error(Resources.getSystem().getString(R.string.error_message)); } } @Override public void onFailure(Call<Void> call, Throwable t) { ToastUtil.error(t.getMessage()); } }); }
Source:
<code>private static boolean isUsedInFunctionLike(Tree usageTree, FunctionLike functionLike) { ParameterList parameters = functionLike.parameters(); if (parameters != null && parameters.nonTuple().stream().anyMatch(p -> <START> p.defaultValue() != null && (usageTree.equals(p.defaultValue()) || TreeUtils.hasDescendant(p.defaultValue(), t -> t.equals(usageTree))))) { <END> return false; } if (functionLike.is(Tree.Kind.FUNCDEF)) { FunctionDef functionDef = (FunctionDef) functionLike; for (Decorator decorator : functionDef.decorators()) { if (TreeUtils.hasDescendant(decorator, t -> t.equals(usageTree))) { return false; } } } return TreeUtils.hasDescendant(functionLike, tree -> tree.equals(usageTree)); }</code><technical_language>I extract this lambda expression in a separated method</technical_language>

Target:
private static boolean isUsedInFunctionLike(Tree usageTree, FunctionLike functionLike) { ParameterList parameters = functionLike.parameters(); if (parameters != null && isUsedAsDefaultValue(usageTree, parameters)) { return false; } if (functionLike.is(Tree.Kind.FUNCDEF)) { FunctionDef functionDef = (FunctionDef) functionLike; for (Decorator decorator : functionDef.decorators()) { if (TreeUtils.hasDescendant(decorator, t -> t.equals(usageTree))) { return false; } } } return TreeUtils.hasDescendant(functionLike, tree -> tree.equals(usageTree)); }
Source:
<code>private void addClassLiterals(ComponentManager compMgr, List<Class<?>> allClasses) { boolean validMode = GenInputsAbstract.literals_level != ClassLiteralsMode.NONE; if (GenInputsAbstract.literals_file.size() > 0 && !validMode) { System.out.println("Invalid parameter combination: specified a class literal file but --use-class-literals=NONE"); System.exit(1); } for (String filename : GenInputsAbstract.literals_file) { MultiMap<Class<?>, PrimitiveOrStringOrNullDecl> literalmap; if (filename.equals("CLASSES")) { Collection<ClassFileConstants.ConstantSet> css = new ArrayList<ClassFileConstants.ConstantSet>(allClasses.size()); for (Class<?> clazz : allClasses) { css.add(ClassFileConstants.getConstants(clazz.getName())); } literalmap = ClassFileConstants.toMap(css); } else { literalmap = LiteralFileReader.parse(filename); } for (Class<?> cls : literalmap.keySet()) { Package pkg = (GenInputsAbstract.literals_level == ClassLiteralsMode.PACKAGE ? cls.getPackage() : null); for (PrimitiveOrStringOrNullDecl p : literalmap.getValues(cls)) { Sequence seq = Sequence.create(p); switch (GenInputsAbstract.literals_level) { case CLASS: compMgr.addClassLevelLiteral(cls, seq); break; case PACKAGE: assert pkg != null; compMgr.addPackageLevelLiteral(pkg, seq); break; case ALL: compMgr.addGeneratedSequence(seq); break; default: <START> throw new Error("Unexpected error in GenTests -- please report"); <END> } } } } }</code><technical_language>give issue tracker URL</technical_language>

Target:
private void addClassLiterals(ComponentManager compMgr, List<Class<?>> allClasses) { boolean validMode = GenInputsAbstract.literals_level != ClassLiteralsMode.NONE; if (GenInputsAbstract.literals_file.size() > 0 && !validMode) { System.out.println("Invalid parameter combination: specified a class literal file but --use-class-literals=NONE"); System.exit(1); } for (String filename : GenInputsAbstract.literals_file) { MultiMap<Class<?>, PrimitiveOrStringOrNullDecl> literalmap; if (filename.equals("CLASSES")) { Collection<ClassFileConstants.ConstantSet> css = new ArrayList<ClassFileConstants.ConstantSet>(allClasses.size()); for (Class<?> clazz : allClasses) { css.add(ClassFileConstants.getConstants(clazz.getName())); } literalmap = ClassFileConstants.toMap(css); } else { literalmap = LiteralFileReader.parse(filename); } for (Class<?> cls : literalmap.keySet()) { Package pkg = (GenInputsAbstract.literals_level == ClassLiteralsMode.PACKAGE ? cls.getPackage() : null); for (PrimitiveOrStringOrNullDecl p : literalmap.getValues(cls)) { Sequence seq = Sequence.create(p); switch (GenInputsAbstract.literals_level) { case CLASS: compMgr.addClassLevelLiteral(cls, seq); break; case PACKAGE: assert pkg != null; compMgr.addPackageLevelLiteral(pkg, seq); break; case ALL: compMgr.addGeneratedSequence(seq); break; default: throw new Error("Unexpected error in GenTests -- please report at <LINK_0>"); } } } } }
Source:
<code>public boolean isMine() { IRepository repos = getReview() != null ? getReview().getRepository() : null; return getAuthor() != null && repos != null <START> && (repos.getAccount() == getAuthor() || (repos.getAccount() != null && (repos.getAccount().getEmail().equals(getAuthor().getEmail())))); <END> }</code><technical_language>need parens repos.getAccount().getEmail().equals(getAuthor().getEmail())</technical_language>

Target:
public boolean isMine() { IRepository repos = getReview() != null ? getReview().getRepository() : null; return getAuthor() != null && repos != null && (repos.getAccount() == getAuthor() || (repos.getAccount() != null && repos.getAccount().getEmail().equals(getAuthor().getEmail()))); }
Source:
<code>public void setPageLayout(Artifact artifact, String footerMl) throws OseeCoreException { String pageTypeValue = null; if (artifact.isAttributeTypeValid(CoreAttributeTypes.PageType)) { pageTypeValue = artifact.getSoleAttributeValue(CoreAttributeTypes.PageType, "Portrait"); } boolean landscape = pageTypeValue != null && pageTypeValue.equals("Landscape"); if (landscape) { append("<w:p>"); append("<w:pPr>"); append("<w:sectPr>"); <START> append(footerMl); <END> append("<w:pgSz w:w=\"15840\" w:h=\"12240\" w:orient=\"landscape\" w:code=\"1\" />"); append("</w:sectPr>"); append("</w:pPr>"); append("</w:p>"); } }</code><technical_language>do null check do this append. append(null) append word 'null' in WordML</technical_language>

Target:
public void setPageLayout(Artifact artifact, String footerMl) throws OseeCoreException { String pageTypeValue = null; if (artifact.isAttributeTypeValid(CoreAttributeTypes.PageType)) { pageTypeValue = artifact.getSoleAttributeValue(CoreAttributeTypes.PageType, "Portrait"); } boolean landscape = pageTypeValue != null && pageTypeValue.equals("Landscape"); if (landscape) { append("<w:p>"); append("<w:pPr>"); append("<w:sectPr>"); if (Strings.isValid(footerMl)) { append(footerMl); } append("<w:pgSz w:w=\"15840\" w:h=\"12240\" w:orient=\"landscape\" w:code=\"1\" />"); append("</w:sectPr>"); append("</w:pPr>"); append("</w:p>"); } }
Source:
<code>public void migrateExternalIdentifierFromSingularToSubstudyAssociation() throws Exception { when(substudyService.getSubstudy(TestConstants.TEST_STUDY, ID, true)) .thenReturn(Substudy.create()); ExternalIdentifier extId = ExternalIdentifier.create(TestConstants.TEST_STUDY, ID); when(externalIdDao.getExternalId(TestConstants.TEST_STUDY, ID)) .thenReturn(extId); Account account = Account.create(); account.setId(USER_ID); <START> account.setExternalId(ID); <END> AccountId accountId = AccountId.forExternalId(TestConstants.TEST_STUDY_IDENTIFIER, ID); when(accountDao.getAccount(accountId)).thenReturn(account); externalIdService.migrateExternalIdentifier(study, ID, SUBSTUDY_ID); assertEquals(SUBSTUDY_ID, extId.getSubstudyId()); assertEquals(1, account.getAccountSubstudies().size()); assertEquals(ID, account.getExternalId()); AccountSubstudy acctSubstudy = Iterables.getFirst(account.getAccountSubstudies(), null); assertEquals(TestConstants.TEST_STUDY_IDENTIFIER, acctSubstudy.getStudyId()); assertEquals(ID, acctSubstudy.getExternalId()); assertEquals(SUBSTUDY_ID, acctSubstudy.getSubstudyId()); verify(externalIdDao).createExternalId(extId); verify(accountDao).updateAccount(account, null); }</code><technical_language>if this starts a external ID verify replaced</technical_language>

Target:
public void migrateExternalIdentifierFromSingularToSubstudyAssociation() throws Exception { when(substudyService.getSubstudy(TestConstants.TEST_STUDY, ID, true)) .thenReturn(Substudy.create()); ExternalIdentifier extId = ExternalIdentifier.create(TestConstants.TEST_STUDY, ID); when(externalIdDao.getExternalId(TestConstants.TEST_STUDY, ID)) .thenReturn(extId); Account account = Account.create(); account.setId(USER_ID); account.setExternalId("differentExternalId"); AccountId accountId = AccountId.forExternalId(TestConstants.TEST_STUDY_IDENTIFIER, ID); when(accountDao.getAccount(accountId)).thenReturn(account); externalIdService.migrateExternalIdentifier(study, ID, SUBSTUDY_ID); assertEquals(SUBSTUDY_ID, extId.getSubstudyId()); assertEquals(1, account.getAccountSubstudies().size()); assertEquals(ID, account.getExternalId()); AccountSubstudy acctSubstudy = Iterables.getFirst(account.getAccountSubstudies(), null); assertEquals(TestConstants.TEST_STUDY_IDENTIFIER, acctSubstudy.getStudyId()); assertEquals(ID, acctSubstudy.getExternalId()); assertEquals(SUBSTUDY_ID, acctSubstudy.getSubstudyId()); verify(externalIdDao).createExternalId(extId); verify(accountDao).updateAccount(account, null); }
Source:
<code>public static double kgToLb(double kg) { <START> return kg * 2.20462; <END> }</code><technical_language>create a constant make's sense? I idea is 18 atm for</technical_language>

Target:
public static double kgToLb(double kg) { return kg * KG_TO_LB_CONSTANT; }
Source:
<code>private static boolean isShutdownHookNeeded() { String property = AccessController.doPrivileged(new GetSystemPropertyAction(Weld.SHUTDOWN_HOOK_SYSTEM_PROPERTY)); <START> return property == null || Boolean.FALSE.equals(Boolean.valueOf(property)); <END> }</code><technical_language>TRUE</technical_language>

Target:
private static boolean isShutdownHookNeeded() { String property = AccessController.doPrivileged(new GetSystemPropertyAction(Weld.SHUTDOWN_HOOK_SYSTEM_PROPERTY)); return property == null || Boolean.TRUE.equals(Boolean.valueOf(property)); }
Source:
<code>public void updateEntity() { super.updateEntity(); <START> if (mjStored > 0) { <END> ForgeDirection dir = getOpenOrientation(); if (dir != ForgeDirection.UNKNOWN) { Position loc = getPosition().shift(dir); Block block = loc.getBlock(getWorld()); float h = block.getBlockHardness(getWorld(), (int) loc.x, (int) loc.y, (int) loc.z); if (loc.blockExists(getWorld()) && h > 0.0F && h < 100.0F) { IStripesHandler handler = new DefaultHandler(); Item blockItem = Item.getItemFromBlock(block); if (PipeManager.stripesHandlers.containsKey(blockItem)) { handler = PipeManager.stripesHandlers.get(blockItem); } else if (blockItem instanceof IStripesHandler) { handler = (IStripesHandler) blockItem; } else if (block instanceof IStripesHandler) { handler = (IStripesHandler) block; } if (handler.behave(this, StripesAction.DESTROY, new ItemStack(block, 0, loc.getMeta(getWorld()))) == StripesBehavior.DEFAULT) { List<ItemStack> drops = block.getDrops(getWorld(), (int) loc.x, (int) loc.y, (int) loc.z, loc.getMeta(getWorld()), 0); loc.destroyBlock(getWorld(), false); for (ItemStack drop : drops) { if (drop != null) { sendItem(drop, dir.getOpposite()); } } } } } } mjStored = 0; }</code><technical_language>This code change does't sense me. Previous versions do work client - intended</technical_language>

Target:
public void updateEntity() { super.updateEntity(); if (!getWorld().isRemote && mjStored > 0) { ForgeDirection dir = getOpenOrientation(); if (dir != ForgeDirection.UNKNOWN) { Position loc = getPosition().shift(dir); Block block = loc.getBlock(getWorld()); float h = block.getBlockHardness(getWorld(), (int) loc.x, (int) loc.y, (int) loc.z); if (loc.blockExists(getWorld()) && h > 0.0F && h < 100.0F) { IStripesHandler handler = new DefaultHandler(); Item blockItem = Item.getItemFromBlock(block); if (PipeManager.stripesHandlers.containsKey(blockItem)) { handler = PipeManager.stripesHandlers.get(blockItem); } else if (blockItem instanceof IStripesHandler) { handler = (IStripesHandler) blockItem; } else if (block instanceof IStripesHandler) { handler = (IStripesHandler) block; } if (handler.behave(this, StripesAction.DESTROY, new ItemStack(block, 0, loc.getMeta(getWorld()))) == StripesBehavior.DEFAULT) { List<ItemStack> drops = block.getDrops(getWorld(), (int) loc.x, (int) loc.y, (int) loc.z, loc.getMeta(getWorld()), 0); loc.destroyBlock(getWorld(), false); for (ItemStack drop : drops) { if (drop != null) { sendItem(drop, dir.getOpposite()); } } } } } mjStored = 0; } }
Source:
<code><START> protected void updateNotPropagatedHeaders(String[] headers, boolean merge) { <END> Set<String> headerPatterns = new HashSet<>(); if (merge && this.notPropagatedHeaders != null) { headerPatterns.addAll(Arrays.asList(this.notPropagatedHeaders)); } if (!ObjectUtils.isEmpty(headers)) { Assert.noNullElements(headers, "null elements are not allowed in 'headers'"); headerPatterns.addAll(Arrays.asList(headers)); this.notPropagatedHeaders = headerPatterns.toArray(new String[0]); } boolean hasAsterisk = headerPatterns.contains("*"); if (hasAsterisk) { this.notPropagatedHeaders = new String[] { "*" }; this.noHeadersPropagation = true; } this.selectiveHeaderPropagation = !ObjectUtils.isEmpty(this.notPropagatedHeaders); }</code><technical_language>do header mapping outbound reply; headers present outbound message received gateway, want in reply message. added notPropagatedHeaders</technical_language>

Target:
protected final void updateNotPropagatedHeaders(String[] headers, boolean merge) { Set<String> headerPatterns = new HashSet<>(); if (merge && this.notPropagatedHeaders != null) { headerPatterns.addAll(Arrays.asList(this.notPropagatedHeaders)); } if (!ObjectUtils.isEmpty(headers)) { Assert.noNullElements(headers, "null elements are not allowed in 'headers'"); headerPatterns.addAll(Arrays.asList(headers)); this.notPropagatedHeaders = headerPatterns.toArray(new String[0]); } boolean hasAsterisk = headerPatterns.contains("*"); if (hasAsterisk) { this.notPropagatedHeaders = new String[] { "*" }; this.noHeadersPropagation = true; } this.selectiveHeaderPropagation = !ObjectUtils.isEmpty(this.notPropagatedHeaders); }
Source:
<code>void addContent() { final List<Customer> customers = new ArrayList<Customer>(); <START> customers.add(Customer.builder().name("Artem").surname("Zinnatullin").city("SF").build()); <END> customers.add(Customer.builder().name("Elon").surname("Musk").city("Boring").build()); customers.add(Customer.builder().name("Jake").surname("Wharton").city("Pittsburgh").build()); List<ContentValues> contentValues = new ArrayList<ContentValues>(customers.size()); for (Customer customer : customers) { contentValues.add(Customer.FACTORY.marshal(customer).asContentValues()); } storIOSQLite .put() .contentValues(contentValues) .withPutResolver(Customer.CV_PUT_RESOLVER) .prepare() .asRxCompletable() .observeOn(mainThread()) .subscribe( new Action0() { @Override public void call() { } }, new Action1<Throwable>() { @Override public void call(Throwable throwable) { safeShowShortToast(SqlDelightActivity.this, R.string.common_error); } }); }</code><technical_language>I remove :D</technical_language>

Target:
void addContent() { final List<Customer> customers = new ArrayList<Customer>(); customers.add(Customer.builder().name("Elon").surname("Musk").city("Boring").build()); customers.add(Customer.builder().name("Jake").surname("Wharton").city("Pittsburgh").build()); List<ContentValues> contentValues = new ArrayList<ContentValues>(customers.size()); for (Customer customer : customers) { contentValues.add(Customer.FACTORY.marshal(customer).asContentValues()); } storIOSQLite .put() .contentValues(contentValues) .withPutResolver(Customer.CV_PUT_RESOLVER) .prepare() .asRxCompletable() .observeOn(mainThread()) .subscribe( new Action0() { @Override public void call() { } }, new Action1<Throwable>() { @Override public void call(Throwable throwable) { safeShowShortToast(SqlDelightActivity.this, R.string.common_error); } }); }
Source:
<code>public void open() throws Exception { super.open(); bais = new ByteArrayInputStreamWithPos(); baisWrapper = new DataInputViewStreamWrapper(bais); baos = new ByteArrayOutputStreamWithPos(); baosWrapper = new DataOutputViewStreamWrapper(baos); keyTypeSerializer = PythonTypeUtils.TypeInfoToSerializerConverter.typeInfoSerializerConverter(keyTypeInfo); runnerInputSerializer = PythonTypeUtils.TypeInfoToSerializerConverter .typeInfoSerializerConverter(runnerInputTypeInfo); runnerOutputSerializer = PythonTypeUtils.TypeInfoToSerializerConverter .typeInfoSerializerConverter(runnerOutputTypeInfo); InternalTimerService<VoidNamespace> internalTimerService = getInternalTimerService("user-timers", VoidNamespaceSerializer.INSTANCE, this); <START> this.streamRecordCollector = new StreamRecordCollector(output); <END> timerservice = new SimpleTimerService(internalTimerService); reusableInput = new Row(5); reusableTimerData = new Row(5); }</code><technical_language>suggestion streamRecordCollector = new StreamRecordCollector(output); Nit: want code style consistent</technical_language>

Target:
public void open() throws Exception { super.open(); bais = new ByteArrayInputStreamWithPos(); baisWrapper = new DataInputViewStreamWrapper(bais); baos = new ByteArrayOutputStreamWithPos(); baosWrapper = new DataOutputViewStreamWrapper(baos); keyTypeSerializer = PythonTypeUtils.TypeInfoToSerializerConverter.typeInfoSerializerConverter(keyTypeInfo); runnerInputSerializer = PythonTypeUtils.TypeInfoToSerializerConverter .typeInfoSerializerConverter(runnerInputTypeInfo); runnerOutputSerializer = PythonTypeUtils.TypeInfoToSerializerConverter .typeInfoSerializerConverter(runnerOutputTypeInfo); InternalTimerService<VoidNamespace> internalTimerService = getInternalTimerService("user-timers", VoidNamespaceSerializer.INSTANCE, this); streamRecordCollector = new StreamRecordCollector(output); timerservice = new SimpleTimerService(internalTimerService); reusableInput = new Row(5); reusableTimerData = new Row(5); }
Source:
<code>protected void onCreate(@Nullable Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.fui_auth_method_picker_layout); FlowParameters params = getFlowParams(); mHandler = ViewModelProviders.of(this).get(SocialProviderResponseHandler.class); mHandler.init(params); populateIdpList(params.providerInfo, mHandler); int logoId = params.logoId; if (logoId == AuthUI.NO_LOGO) { findViewById(R.id.logo).setVisibility(View.GONE); ConstraintLayout layout = findViewById(R.id.root); ConstraintSet constraints = new ConstraintSet(); constraints.clone(layout); constraints.setHorizontalBias(R.id.container, 0.5f); constraints.setVerticalBias(R.id.container, 0.5f); constraints.applyTo(layout); } else { ImageView logo = findViewById(R.id.logo); logo.setImageResource(logoId); } mHandler.getOperation().observe(this, new ResourceObserver<IdpResponse>( this, R.string.fui_progress_dialog_signing_in) { @Override protected void onSuccess(@NonNull IdpResponse response) { startSaveCredentials(mHandler.getCurrentUser(), response, null); } @Override protected void onFailure(@NonNull Exception e) { if (!(e instanceof UserCancellationException)) { Toast.makeText(AuthMethodPickerActivity.this, R.string.fui_error_unknown, Toast.LENGTH_SHORT).show(); } } }); TextView termsText = findViewById(R.id.main_tos_and_pp); <START> PrivacyDisclosureUtils.setupTermsOfServiceAndPrivacyPolicyText(AuthMethodPickerActivity.this, <END> getFlowParams(), termsText); }</code><technical_language>nit: do need AuthMethodPickerActivity.this this</technical_language>

Target:
protected void onCreate(@Nullable Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.fui_auth_method_picker_layout); FlowParameters params = getFlowParams(); mHandler = ViewModelProviders.of(this).get(SocialProviderResponseHandler.class); mHandler.init(params); populateIdpList(params.providerInfo, mHandler); int logoId = params.logoId; if (logoId == AuthUI.NO_LOGO) { findViewById(R.id.logo).setVisibility(View.GONE); ConstraintLayout layout = findViewById(R.id.root); ConstraintSet constraints = new ConstraintSet(); constraints.clone(layout); constraints.setHorizontalBias(R.id.container, 0.5f); constraints.setVerticalBias(R.id.container, 0.5f); constraints.applyTo(layout); } else { ImageView logo = findViewById(R.id.logo); logo.setImageResource(logoId); } mHandler.getOperation().observe(this, new ResourceObserver<IdpResponse>( this, R.string.fui_progress_dialog_signing_in) { @Override protected void onSuccess(@NonNull IdpResponse response) { startSaveCredentials(mHandler.getCurrentUser(), response, null); } @Override protected void onFailure(@NonNull Exception e) { if (!(e instanceof UserCancellationException)) { Toast.makeText(AuthMethodPickerActivity.this, R.string.fui_error_unknown, Toast.LENGTH_SHORT).show(); } } }); TextView termsText = findViewById(R.id.main_tos_and_pp); PrivacyDisclosureUtils.setupTermsOfServiceAndPrivacyPolicyText(this, getFlowParams(), termsText); }
Source:
<code>public Double getMinRowCount(Union rel, RelMetadataQuery mq) { if (rel.all) { double rowCount = 0.0; for (RelNode input : rel.getInputs()) { Double partialRowCount = mq.getMinRowCount(input); if (partialRowCount != null) { rowCount += partialRowCount; } } return rowCount; } else { boolean valid = false; double rowCount = Double.POSITIVE_INFINITY; for (RelNode input : rel.getInputs()) { Double partialRowCount = mq.getMinRowCount(input); if (partialRowCount != null && rowCount > partialRowCount) { <START> rowCount = partialRowCount; <END> valid = true; } } if (!valid) { rowCount = 0.0; } return rowCount; } }</code><technical_language>@chunweilei If I understand correctly this is basically find input number of rows, number is minimum row count. If this wrong, minimum number of rows for UNION DISTINCT 1 input number of rows duplicates in case row returned</technical_language>

Target:
public Double getMinRowCount(Union rel, RelMetadataQuery mq) { double rowCount = 0.0; for (RelNode input : rel.getInputs()) { Double partialRowCount = mq.getMinRowCount(input); if (partialRowCount != null) { rowCount += partialRowCount; } } if (rel.all) { return rowCount; } else { return Math.min(rowCount, 1d); } }
Source:
<code>public String getScript(String inMoovServiceName) { <START> return String.format((Locale)null,"%s.moveHead(%.2f,%.2f,%.2f,%.2f,%.2f,%.2f)\n", inMoovServiceName, neck.getPos(), rothead.getPos(), eyeX.getPos(), eyeY.getPos(), jaw.getPos(), rollNeck.getPos()); <END> }</code><technical_language>please fix string formatting here. this is wrong</technical_language>

Target:
public String getScript(String inMoovServiceName) { return String.format(Locale.ENGLISH,"%s.moveHead(%.2f,%.2f,%.2f,%.2f,%.2f,%.2f)\n", inMoovServiceName, neck.getPos(), rothead.getPos(), eyeX.getPos(), eyeY.getPos(), jaw.getPos(), rollNeck.getPos()); }
Source:
<code>public JSReference getProxy(String endpointName, String moduleId) { Endpoint e = this; <START> String proxyModuleId = new String(moduleId); <END> Proxy proxy = null; if(!endpointName.equals(this.getName())){ e = EndpointFactory.getEndpointUnchecked(endpointName); } try { proxy = ProxyFactory.getProxyConfig(e.getProxyConfig()); if(proxy != null && proxy.getProxyModule() != null){ proxyModuleId = proxy.getProxyModule(); } } catch (ProxyConfigException ex) { String thisClass = AbstractEndpoint.class.getName(); Logger logger = Logger.getLogger(thisClass); if (logger.isLoggable(Level.SEVERE)) { logger.entering(thisClass, "createProxyRef failed", ex.getMessage()); } } return new JSReference(proxyModuleId); }</code><technical_language>is new String required here</technical_language>

Target:
public JSReference getProxy(String endpointName, String moduleId) { String proxyModuleId = moduleId; Proxy proxy = null; if(this.getProxyConfig() != null){ try { proxy = ProxyFactory.getProxyConfig(this.getProxyConfig()); if(proxy != null && proxy.getProxyModule() != null){ proxyModuleId = proxy.getProxyModule(); } } catch (ProxyConfigException ex) { Logger logger = Logger.getLogger(AbstractEndpoint.class.getName()); if (logger.isLoggable(Level.SEVERE)) { logger.severe(ex.getMessage()); } } } return new JSReference(proxyModuleId); }
Source:
<code>public synchronized void commit() throws CommitException { SyncCommitObserver sco = null; try { sco = new SyncCommitObserver(); commitAsync(sco); sco.waitForCommit(); } finally { <START> sco = null; <END> } }</code><technical_language>I if this necessary, looked this [SOQ](<LINK_1> For this issue I nulling updates, weakNotifications, observedColumns, columnsRead good. starting [TransactionImpl line 109](<LINK_0></technical_language>

Target:
public synchronized void commit() throws CommitException { SyncCommitObserver sco = null; try { sco = new SyncCommitObserver(); commitAsync(sco); sco.waitForCommit(); } finally { updates.clear(); weakNotification = null; columnsRead.clear(); } }
Source:
<code>public static URL getOpenInOseeLink(final Artifact artifact, String cmd, PresentationType presentationType) { Map<String, String> parameters = new HashMap<>(); parameters.put("sessionId", ClientSessionManager.getSessionId()); parameters.put("context", "osee/loopback"); <START> parameters.put("id", artifact.getIdString()); <END> parameters.put("branchUuid", artifact.getBranch().getIdString()); parameters.put("isDeleted", String.valueOf(artifact.isDeleted())); if (artifact.isHistorical() && presentationType != PresentationType.DIFF && presentationType != PresentationType.F5_DIFF) { parameters.put("transactionId", String.valueOf(artifact.getTransaction())); } parameters.put("cmd", cmd); String urlString = getPermanentLinkBaseUrl(OseeServerContext.CLIENT_LOOPBACK_CONTEXT, parameters); URL url = null; try { url = new URL(urlString); } catch (Exception ex) { OseeCoreException.wrapAndThrow(ex); } return url; }</code><technical_language>worth changing branchUuid branchId time</technical_language>

Target:
public static URL getOpenInOseeLink(final Artifact artifact, String cmd, PresentationType presentationType) { Map<String, String> parameters = new HashMap<>(); parameters.put("sessionId", ClientSessionManager.getSessionId()); parameters.put("context", "osee/loopback"); parameters.put("id", artifact.getIdString()); parameters.put("guid", artifact.getGuid()); parameters.put("branchUuid", artifact.getBranch().getIdString()); parameters.put("isDeleted", String.valueOf(artifact.isDeleted())); if (artifact.isHistorical() && presentationType != PresentationType.DIFF && presentationType != PresentationType.F5_DIFF) { parameters.put("transactionId", String.valueOf(artifact.getTransaction())); } parameters.put("cmd", cmd); String urlString = getPermanentLinkBaseUrl(OseeServerContext.CLIENT_LOOPBACK_CONTEXT, parameters); URL url = null; try { url = new URL(urlString); } catch (Exception ex) { OseeCoreException.wrapAndThrow(ex); } return url; }
Source:
<code>public void restart() throws IOException, InterruptedException { Jenkins jenkins = Jenkins.getInstanceOrNull(); try { if (jenkins != null) { jenkins.cleanUp(); } } catch (Exception e) { LOGGER.log(Level.SEVERE, "Failed to clean up. Restart will continue.", e); } int sz = LIBC.getdtablesize(); for(int i=3; i<sz; i++) { int flags = LIBC.fcntl(i, F_GETFD); if(flags<0) continue; LIBC.fcntl(i, F_SETFD,flags| FD_CLOEXEC); } if (EXIT_ON_RESTART == null) { String exe = args.get(0); LIBC.execvp(exe, new StringArray(args.toArray(new String[args.size()]))); throw new IOException("Failed to exec '"+exe+"' "+LIBC.strerror(Native.getLastError())); } else { <START> System.exit(Integer.parseInt(EXIT_ON_RESTART)); <END> } }</code><technical_language>field Integer then. need parse in runtime risk logic blows in case of typo in argument</technical_language>

Target:
public void restart() throws IOException, InterruptedException { Jenkins jenkins = Jenkins.getInstanceOrNull(); try { if (jenkins != null) { jenkins.cleanUp(); } } catch (Exception e) { LOGGER.log(Level.SEVERE, "Failed to clean up. Restart will continue.", e); } int sz = LIBC.getdtablesize(); for(int i=3; i<sz; i++) { int flags = LIBC.fcntl(i, F_GETFD); if(flags<0) continue; LIBC.fcntl(i, F_SETFD,flags| FD_CLOEXEC); } String exe = args.get(0); LIBC.execvp(exe, new StringArray(args.toArray(new String[args.size()]))); throw new IOException("Failed to exec '"+exe+"' "+LIBC.strerror(Native.getLastError())); }
Source:
<code>public static JobValidationData validateJob(String jobFilePath, Map<String, String> jobVariables, Scheduler scheduler, SchedulerSpaceInterface space) { JobValidationData data = new JobValidationData(); Job job = null; try { JobFactory factory = JobFactory.getFactory(); job = factory.createJob(jobFilePath, jobVariables, null, scheduler, space); if (job instanceof TaskFlowJob) { validateJob((TaskFlowJob) job, data); fillUpdatedVariables((TaskFlowJob) job, data); } else { data.setValid(true); } } catch (JobCreationException e) { data.setTaskName(e.getTaskName()); data.setErrorMessage(e.getMessage()); data.setStackTrace(getStackTrace(e)); if (job != null && job instanceof TaskFlowJob) { fillUpdatedVariables((TaskFlowJob) job, data); <START> } <END> } return data; }</code><technical_language>do in a finally block calling fillUpdatedVariables requires conditions (not null & TaskFlowJob)</technical_language>

Target:
public static JobValidationData validateJob(String jobFilePath, Map<String, String> jobVariables, Scheduler scheduler, SchedulerSpaceInterface space) { JobValidationData data = new JobValidationData(); Job job = null; try { JobFactory factory = JobFactory.getFactory(); job = factory.createJob(jobFilePath, jobVariables, null, scheduler, space); if (job instanceof TaskFlowJob) { validateJob((TaskFlowJob) job, data); } else { data.setValid(true); } } catch (JobCreationException e) { data.setTaskName(e.getTaskName()); data.setErrorMessage(e.getMessage()); data.setStackTrace(getStackTrace(e)); } finally { if (job != null && job instanceof TaskFlowJob) { fillUpdatedVariables((TaskFlowJob) job, data); } } return data; }
Source:
<code>public Monitor getMonitor(URL url) { url = url.setPath(MonitorService.class.getName()).addParameter(Constants.INTERFACE_KEY, MonitorService.class.getName()); String key = url.toServiceStringWithoutResolving(); Monitor monitor = MONITORS.get(key); Future<Monitor> future = FUTURES.get(key); if (monitor != null || future != null) { return monitor; } LOCK.lock(); try { monitor = MONITORS.get(key); future = FUTURES.get(key); if (monitor != null || future != null) { return monitor; } final URL monitorUrl = url; final CompletableFuture<Monitor> completableFuture = CompletableFuture.supplyAsync(()->{ Monitor newMonitor = AbstractMonitorFactory.this.createMonitor(monitorUrl); return newMonitor; },executor); <START> completableFuture.thenRunAsync(new MonitorListener(key)); <END> FUTURES.put(key, completableFuture); return null; } finally { LOCK.unlock(); } }</code><technical_language>defined executor, this executor for thenRunAsync better</technical_language>

Target:
public Monitor getMonitor(URL url) { url = url.setPath(MonitorService.class.getName()).addParameter(Constants.INTERFACE_KEY, MonitorService.class.getName()); String key = url.toServiceStringWithoutResolving(); Monitor monitor = MONITORS.get(key); Future<Monitor> future = FUTURES.get(key); if (monitor != null || future != null) { return monitor; } LOCK.lock(); try { monitor = MONITORS.get(key); future = FUTURES.get(key); if (monitor != null || future != null) { return monitor; } final URL monitorUrl = url; final CompletableFuture<Monitor> completableFuture = CompletableFuture.supplyAsync(() -> AbstractMonitorFactory.this.createMonitor(monitorUrl)); completableFuture.thenRunAsync(new MonitorListener(key), executor); FUTURES.put(key, completableFuture); return null; } finally { LOCK.unlock(); } }
Source:
<code>public Collection readObject(ObjectInput input) throws IOException, ClassNotFoundException { int magicNumber = input.readUnsignedByte(); switch (magicNumber) { case ARRAY_LIST: return MarshallUtil.unmarshallCollection(input, ArrayList::new); case LINKED_LIST: <START> return MarshallUtil.unmarshallCollection(input, s -> new LinkedList<>()); <END> case SINGLETON_LIST: return Collections.singletonList(input.readObject()); case EMPTY_LIST: return Collections.emptyList(); case HASH_SET: return MarshallUtil.unmarshallCollection(input, s -> new HashSet<>()); case TREE_SET: Comparator<Object> comparator = (Comparator<Object>) input.readObject(); return MarshallUtil.unmarshallCollection(input, s -> new TreeSet<>(comparator)); case SINGLETON_SET: return Collections.singleton(input.readObject()); case SYNCHRONIZED_SET: return Collections.synchronizedSet( MarshallUtil.unmarshallCollection(input, s -> new HashSet<>())); case ARRAY_DEQUE: return MarshallUtil.unmarshallCollection(input, ArrayDeque::new); case READ_ONLY_SEGMENT_AWARE_COLLECTION: return MarshallUtil.unmarshallCollection(input, ArrayList::new); default: throw new IllegalStateException("Unknown Set type: " + magicNumber); } }</code><technical_language>unmarshallCollectionUnbounded() collection constructor need size</technical_language>

Target:
public Collection readObject(ObjectInput input) throws IOException, ClassNotFoundException { int magicNumber = input.readUnsignedByte(); switch (magicNumber) { case ARRAY_LIST: return MarshallUtil.unmarshallCollection(input, ArrayList::new); case LINKED_LIST: return MarshallUtil.unmarshallCollectionUnbounded(input, LinkedList::new); case SINGLETON_LIST: return Collections.singletonList(input.readObject()); case EMPTY_LIST: return Collections.emptyList(); case HASH_SET: return MarshallUtil.unmarshallCollection(input, s -> new HashSet<>()); case TREE_SET: Comparator<Object> comparator = (Comparator<Object>) input.readObject(); return MarshallUtil.unmarshallCollection(input, s -> new TreeSet<>(comparator)); case SINGLETON_SET: return Collections.singleton(input.readObject()); case SYNCHRONIZED_SET: return Collections.synchronizedSet( MarshallUtil.unmarshallCollection(input, s -> new HashSet<>())); case ARRAY_DEQUE: return MarshallUtil.unmarshallCollection(input, ArrayDeque::new); case READ_ONLY_SEGMENT_AWARE_COLLECTION: return MarshallUtil.unmarshallCollection(input, ArrayList::new); default: throw new IllegalStateException("Unknown Set type: " + magicNumber); } }
Source:
<code>private void prepareMariaDB() throws IllegalStateException { boolean initDbSuccess = false; int i = 0; while (i < 3) { try { db = DB.newEmbeddedDB(DBConfigurationBuilder.newBuilder().build()); db.start(); dbUrl = db.getConfiguration().getURL(DEFAULT_DB_NAME); connection = DriverManager.getConnection(dbUrl); try (Statement statement = connection.createStatement()) { statement.execute("CREATE DATABASE IF NOT EXISTS `" + DEFAULT_DB_NAME + "`;"); ResultSet resultSet = statement.executeQuery("SELECT SCHEMA_NAME FROM " + "INFORMATION_SCHEMA.SCHEMATA WHERE SCHEMA_NAME = '" + DEFAULT_DB_NAME + "';"); if (resultSet.next()) { String dbName = resultSet.getString(1); initDbSuccess = DEFAULT_DB_NAME.equalsIgnoreCase(dbName); } } } catch (Exception e) { <START> log.info("Initialize DB fail caused by {}", e); <END> } if (initDbSuccess) { break; } i++; } if (!initDbSuccess) { throw new IllegalStateException("Initialize MySQL database instance failed after 3 attempts," + " please open an issue."); } }</code><technical_language>log.warn</technical_language>

Target:
public static void prepareMariaDB() throws IllegalStateException { boolean initDbSuccess = false; int i = 0; while (i < INITIALIZE_DB_MAX_RETRY) { try { db = DB.newEmbeddedDB(DBConfigurationBuilder.newBuilder().build()); db.start(); dbUrl = db.getConfiguration().getURL(DEFAULT_DB_NAME); connection = DriverManager.getConnection(dbUrl); try (Statement statement = connection.createStatement()) { statement.execute("CREATE DATABASE IF NOT EXISTS `" + DEFAULT_DB_NAME + "`;"); ResultSet resultSet = statement.executeQuery("SELECT SCHEMA_NAME FROM " + "INFORMATION_SCHEMA.SCHEMATA WHERE SCHEMA_NAME = '" + DEFAULT_DB_NAME + "';"); if (resultSet.next()) { String dbName = resultSet.getString(1); initDbSuccess = DEFAULT_DB_NAME.equalsIgnoreCase(dbName); } } } catch (Exception e) { logger.warn("Initialize DB fail caused by {}", e); stopDb(); } if (initDbSuccess) { break; } i++; } if (!initDbSuccess) { throw new IllegalStateException(String.format("Initialize MySQL database instance failed after attempts," + " please open an issue.", INITIALIZE_DB_MAX_RETRY)); } }
Source:
<code>public ValueHolder<V> get(final K key) throws CacheAccessException { try { final ValueHolder<V> valueHolder = cachingTier.getOrComputeIfAbsent(key, new Function<K, ValueHolder<V>>() { @Override public ValueHolder<V> apply(K key) { try { return authoritativeTier.getAndFault(key); } catch (CacheAccessException cae) { throw new ComputationException(cae); } } }); if(valueHolder != null && valueHolder.isExpired(timeSource.getTimeMillis(), TimeUnit.MILLISECONDS)) { authoritativeTier.flush(key, valueHolder); <START> return null; <END> } return valueHolder; } catch (ComputationException ce) { throw ce.getCacheAccessException(); } }</code><technical_language>Missing cachingTier.remove(key) return</technical_language>

Target:
public ValueHolder<V> get(final K key) throws CacheAccessException { try { final ValueHolder<V> valueHolder = cachingTier.getOrComputeIfAbsent(key, new Function<K, ValueHolder<V>>() { @Override public ValueHolder<V> apply(K key) { try { return authoritativeTier.getAndFault(key); } catch (CacheAccessException cae) { throw new ComputationException(cae); } } }); return valueHolder; } catch (ComputationException ce) { throw ce.getCacheAccessException(); } }
Source:
<code>public <T> void post(TypeReference<T> typeReference, ResultCallback<T> resultCallback, InputStream body) { HttpRequestProvider requestProvider = httpPostRequestProvider(null); Channel channel = getChannel(); HttpResponseHandler responseHandler = new HttpResponseHandler(requestProvider, resultCallback); channel.pipeline().addLast(new ChunkedWriteHandler()); channel.pipeline().addLast(responseHandler); <START> if (!Void.class.equals(typeReference.getType())) { <END> JsonResponseCallbackHandler<T> jsonResponseHandler = new JsonResponseCallbackHandler<T>(typeReference, resultCallback); channel.pipeline().addLast(new JsonObjectDecoder()); channel.pipeline().addLast(jsonResponseHandler); } HttpRequest request = requestProvider.getHttpRequest(resource); if (request instanceof FullHttpRequest) { throw new DockerClientException("fatal: request is instance of FullHttpRequest"); } request.headers().set(HttpHeaderNames.TRANSFER_ENCODING, HttpHeaderValues.CHUNKED); request.headers().remove(HttpHeaderNames.CONTENT_LENGTH); channel.write(request); channel.write(new ChunkedStream(new BufferedInputStream(body, 1024 * 1024), 1024 * 1024)); channel.write(LastHttpContent.EMPTY_LAST_CONTENT); channel.flush(); }</code><technical_language>instanceof check</technical_language>

Target:
public <T> void post(TypeReference<T> typeReference, ResultCallback<T> resultCallback, InputStream body) { HttpRequestProvider requestProvider = httpPostRequestProvider(null); Channel channel = getChannel(); JsonResponseCallbackHandler<T> jsonResponseHandler = new JsonResponseCallbackHandler<T>(typeReference, resultCallback); HttpResponseHandler responseHandler = new HttpResponseHandler(requestProvider, resultCallback); channel.pipeline().addLast(new ChunkedWriteHandler()); channel.pipeline().addLast(responseHandler); channel.pipeline().addLast(new JsonObjectDecoder()); channel.pipeline().addLast(jsonResponseHandler); postChunkedStreamRequest(requestProvider, channel, body); }
Source:
<code>@Test public void shouldOpenCompareEditorInGitChangeSet() throws Exception { resetRepository(PROJ1); createTag(PROJ1, "compare1"); changeFilesInProject(); showDialog(PROJ1, "Team", "Synchronize..."); bot.shell("Synchronize repository: " + REPO1 + File.separator + ".git") .activate(); bot.comboBox(2) .setSelection(UIText.SynchronizeWithAction_tagsName); bot.comboBox(3).setSelection("compare1"); bot.button(IDialogConstants.OK_LABEL).click(); SWTBotTree syncViewTree = bot.viewByTitle("Synchronize").bot().tree(); <START> syncViewTree.getTreeItem("<working tree>"); <END> syncViewTree.getAllItems()[0].collapse().doubleClick(); syncViewTree.getAllItems()[0].getItems()[0].getNode(FOLDER) .getNode(FILE1).doubleClick(); SWTBot compare = bot.editorByTitle(FILE1).bot(); assertNotNull(compare); }</code><technical_language>I prefer UIText.GitModelWorkingTree_workingTree instead of hardcoding this in test</technical_language>

Target:
@Test public void shouldOpenCompareEditorInGitChangeSet() throws Exception { resetRepository(PROJ1); createTag(PROJ1, "compare1"); changeFilesInProject(); showDialog(PROJ1, "Team", "Synchronize..."); bot.shell("Synchronize repository: " + REPO1 + File.separator + ".git") .activate(); bot.comboBox(2) .setSelection(UIText.SynchronizeWithAction_tagsName); bot.comboBox(3).setSelection("compare1"); bot.button(IDialogConstants.OK_LABEL).click(); SWTBotTree syncViewTree = bot.viewByTitle("Synchronize").bot().tree(); syncViewTree.getTreeItem(UIText.GitModelWorkingTree_workingTree); syncViewTree.getAllItems()[0].collapse().doubleClick(); syncViewTree.getAllItems()[0].getItems()[0].getNode(FOLDER) .getNode(FILE1).doubleClick(); SWTBot compare = bot.editorByTitle(FILE1).bot(); assertNotNull(compare); }
Source:
<code>public void mapClick(final double lat, final double lng) { <START> Log.d(TAG, "mapClick - " + lat + ", " + lng); <END> handler.post(new Runnable() { @Override public void run() { if (mOnMapClickListener != null) { mOnMapClickListener.onMapClick(new LatLng(lat, lng)); } if (mInfoWindowView != null) { mLayout.removeView(mInfoWindowView); } } }); }</code><technical_language>remove this log line</technical_language>

Target:
public void mapClick(final double lat, final double lng) { handler.post(new Runnable() { @Override public void run() { if (mOnMapClickListener != null) { mOnMapClickListener.onMapClick(new LatLng(lat, lng)); } if (mInfoWindowView != null) { mLayout.removeView(mInfoWindowView); } } }); }
Source:
<code>public static void main(String[] args) { ArgsHolder.init(args, ArgsHolder.ArgType.SLAVE); RestartHelper.init(); if (ArgsHolder.getMasterHost() == null) { ArgsHolder.printUsageAndExit(ArgsHolder.ArgType.SLAVE); } Slave slave = new Slave(new RemoteMasterConnection(ArgsHolder.getMasterHost(), ArgsHolder.getMasterPort())); try { slave.run(ArgsHolder.getSlaveIndex()); <START> } catch (IOException e) { <END> System.err.println("Communication with master failed"); e.printStackTrace(); ShutDownHook.exit(127); } catch (Exception e) { System.err.println("Unexpected error in scenario"); e.printStackTrace(); ShutDownHook.exit(127); } }</code><technical_language>printing exception out, I guess this collapsed catch (Exception e) (without catching IOException)</technical_language>

Target:
public static void main(String[] args) { ArgsHolder.init(args, ArgsHolder.ArgType.SLAVE); RestartHelper.init(); if (ArgsHolder.getMasterHost() == null) { ArgsHolder.printUsageAndExit(ArgsHolder.ArgType.SLAVE); } Slave slave = new Slave(new RemoteMasterConnection(ArgsHolder.getMasterHost(), ArgsHolder.getMasterPort())); try { slave.run(ArgsHolder.getSlaveIndex()); } catch (Exception e) { System.err.println("Unexpected error in scenario"); e.printStackTrace(); ShutDownHook.exit(127); } }
Source:
<code>protected void executeQueryCommand() { List<VDS> vdsList = getDbFacade().getVdsDao() .getAllForNetwork(getParameters().getId()); List<VdsNetworkInterface> vdsNetworkInterfaceList = getDbFacade().getInterfaceDao() .getVdsInterfacesByNetworkId(getParameters().getId()); final Map<Guid, VDS> vdsById = Entities.businessEntitiesById(vdsList); List<PairQueryable<VdsNetworkInterface, VDS>> vdsInterfaceVdsPairs = <START> new ArrayList<PairQueryable<VdsNetworkInterface, VDS>>(); <END> Network network = getDbFacade().getNetworkDao().get(getParameters().getId()); HostNetworkQos qos = getDbFacade().getHostNetworkQosDao().get(network.getQosId()); for (final VdsNetworkInterface vdsNetworkInterface : vdsNetworkInterfaceList) { vdsInterfaceVdsPairs.add(new PairQueryable<VdsNetworkInterface, VDS>(vdsNetworkInterface, vdsById.get(vdsNetworkInterface.getVdsId()))); vdsNetworkInterface.setNetworkImplementationDetails(NetworkUtils.calculateNetworkImplementationDetails(network, qos, vdsNetworkInterface)); } getQueryReturnValue().setReturnValue(vdsInterfaceVdsPairs); }</code><technical_language>now, injectable DAO, please declare @Inject instance level variable</technical_language>

Target:
protected void executeQueryCommand() { List<VDS> vdsList = getVdsDAO().getAllForNetwork(getParameters().getId()); List<VdsNetworkInterface> vdsNetworkInterfaceList = getInterfaceDao().getVdsInterfacesByNetworkId(getParameters().getId()); final Map<Guid, VDS> vdsById = Entities.businessEntitiesById(vdsList); List<PairQueryable<VdsNetworkInterface, VDS>> vdsInterfaceVdsPairs = new ArrayList<PairQueryable<VdsNetworkInterface, VDS>>(); Network network = getNetworkDao().get(getParameters().getId()); HostNetworkQos qos = getHostNetworkQosDao().get(network.getQosId()); for (final VdsNetworkInterface vdsNetworkInterface : vdsNetworkInterfaceList) { vdsInterfaceVdsPairs.add(new PairQueryable<VdsNetworkInterface, VDS>(vdsNetworkInterface, vdsById.get(vdsNetworkInterface.getVdsId()))); VdsNetworkInterface.NetworkImplementationDetails vdsInterfaceNetworkImplementationDetails = NetworkUtils.calculateNetworkImplementationDetails(network, qos, vdsNetworkInterface); vdsNetworkInterface.setNetworkImplementationDetails(vdsInterfaceNetworkImplementationDetails); } getQueryReturnValue().setReturnValue(vdsInterfaceVdsPairs); }