auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public void onStart() { super.onStart(); <START> PushLinkManager.INSTANCE.checkIfReceiveNotification(this, getIntent()); <END> if (Config.FabricBranchConfig.isBranchEnabled(config.getFabricConfig())) { Branch.getInstance().initSession((referringParams, error) -> { if (error == null) { if (referringParams.optBoolean(BranchLinkManager.KEY_CLICKED_BRANCH_LINK)) { try { BranchLinkManager.INSTANCE.didReceiveLink(this, referringParams); } catch (Exception e) { logger.error(e, true); } } } else { if (NetworkUtil.isConnected(getApplicationContext())) { logger.error(new Exception("Branch not configured properly, error:\n" + error.getMessage()), true); } } }, this.getIntent().getData(), this); finish(); } }</code><technical_language>IMO, pass bundle, instated of intent</technical_language>

Target:
public void onStart() { super.onStart(); PushLinkManager.INSTANCE.checkAndReactIfFCMNotificationReceived(this, getIntent().getExtras()); if (Config.FabricBranchConfig.isBranchEnabled(config.getFabricConfig())) { Branch.getInstance().initSession((referringParams, error) -> { if (error == null) { if (referringParams.optBoolean(BranchLinkManager.KEY_CLICKED_BRANCH_LINK)) { try { BranchLinkManager.INSTANCE.checkAndReactIfReceivedLink(this, referringParams); } catch (Exception e) { logger.error(e, true); } } } else { if (NetworkUtil.isConnected(getApplicationContext())) { logger.error(new Exception("Branch not configured properly, error:\n" + error.getMessage()), true); } } }, this.getIntent().getData(), this); } finish(); }
Source:
<code>public LocalPortForwarder newLocalPortForwarder(LocalPortForwarder.Parameters parameters, ServerSocket serverSocket) { <START> if (forwarders == null) { <END> forwarders = new ArrayList<LocalPortForwarder>(); } LocalPortForwarder forwarder = new LocalPortForwarder(conn, parameters, serverSocket); forwarders.add(forwarder); return forwarder; }</code><technical_language>If list is initialized this check is unnecessary</technical_language>

Target:
public LocalPortForwarder newLocalPortForwarder(LocalPortForwarder.Parameters parameters, ServerSocket serverSocket) { LocalPortForwarder forwarder = new LocalPortForwarder(conn, parameters, serverSocket); forwarders.add(forwarder); return forwarder; }
Source:
<code>public String generateModuleRewriteLog( Set<String> filesToConvert, Map<String, CollectModuleMetadata.FileModule> namespaceMap) { StringBuilder builder = new StringBuilder(); <START> for (String s : namespaceMap.keySet()) { <END> CollectModuleMetadata.FileModule tsModule = namespaceMap.get(s); String file = tsModule.file; String defaultRename = tsModule.exportedNamespacesToSymbols.getOrDefault("exports", ""); if (filesToConvert.contains(file)) { builder.append(gson.toJson(new LogItem(s, file, defaultRename))); builder.append("\n"); } } return builder.toString(); }</code><technical_language>prefer entry set instead (peformance) for (Entry<String, FileModule> entry : namespaceMap.entries())</technical_language>

Target:
String generateModuleRewriteLog( Set<String> filesToConvert, Map<String, CollectModuleMetadata.FileModule> namespaceMap) { StringBuilder builder = new StringBuilder(); for (Map.Entry<String, CollectModuleMetadata.FileModule> entry : namespaceMap.entrySet()) { String file = entry.getValue().file; String defaultRename = entry.getValue().exportedNamespacesToSymbols.getOrDefault("exports", ""); if (filesToConvert.contains(file)) { builder.append(gson.toJson(new LogItem(entry.getKey(), file, defaultRename))); builder.append("\n"); } } return builder.toString(); }
Source:
<code>private void restoreSnapshot() { if (getSelectedItem() == null) { return; } ConfirmationModel model = new ConfirmationModel(); setConfirmWindow(model); model.setTitle(ConstantsManager.getInstance().getMessages().confirmRestoreSnapshot(getEntity().getName())); model.setHelpTag(HelpTag.volume_restore_snapshot_confirmation); model.setHashName("volume_restore_snapshot_confirmation"); <START> model.setMessage(ConstantsManager.getInstance().getConstants().confirmVolumeSnapshotRestoreMesage()); <END> UICommand okCommand = UICommand.createDefaultOkUiCommand("onRestoreSnapshot", this); model.getCommands().add(okCommand); UICommand cancelCommand = UICommand.createCancelUiCommand("cancelConfirmation", this); model.getCommands().add(cancelCommand); }</code><technical_language>I wrong in understanding bug. Correct if I'am wrong. But, bug "Message in Restore Popup is correct volume is online snapshot is deactivated" lets assume snapshot is deactivated this change else is change right</technical_language>

Target:
private void restoreSnapshot() { if (getSelectedItem() == null) { return; } ConfirmationModel model = new ConfirmationModel(); setConfirmWindow(model); model.setTitle(ConstantsManager.getInstance().getMessages().confirmRestoreSnapshot(getEntity().getName())); model.setHelpTag(HelpTag.volume_restore_snapshot_confirmation); model.setHashName("volume_restore_snapshot_confirmation"); model.setMessage(ConstantsManager.getInstance().getConstants().confirmVolumeSnapshotRestoreWithStopMessage()); UICommand okCommand = UICommand.createDefaultOkUiCommand("onRestoreSnapshot", this); model.getCommands().add(okCommand); UICommand cancelCommand = UICommand.createCancelUiCommand("cancelConfirmation", this); model.getCommands().add(cancelCommand); }
Source:
<code>public void execute() throws Exception { if (!initialized) maybeSetupPaths(); Path structuredPathTmp = structuredPath.resolveSibling(structuredPath.getFileName() + ".tmp"); File output = structuredPathTmp.toFile(); output.createNewFile(); <START> Files.setPosixFilePermissions(structuredPathTmp, PosixFilePermissions.fromString("rw-------")); <END> Map<String, Object> structuredConfiguration = config.getStructuredConfiguration("all"); ObjectMapper mapper = new ObjectMapper(); ObjectWriter structuredPathTmpWriter = mapper.writer(new MinimalPrettyPrinter()); structuredPathTmpWriter.writeValue(output, structuredConfiguration); if (!structuredPathTmp.toFile().renameTo(structuredPath.toFile())) logger.warn("Failed to persist structured Priam configuration"); }</code><technical_language>I Files.createTempFile do work of opening a file desired permissions for you</technical_language>

Target:
public void execute() throws Exception { ensurePaths(); Path tempPath = null; try { File output = File.createTempFile(structuredPath.getFileName().toString(), ".tmp", mergedConfigDirectory.toFile()); tempPath = output.toPath(); Files.setPosixFilePermissions(tempPath, PosixFilePermissions.fromString("rw-------")); Map<String, Object> structuredConfiguration = config.getStructuredConfiguration("all"); ObjectMapper mapper = new ObjectMapper(); ObjectWriter structuredPathTmpWriter = mapper.writer(new MinimalPrettyPrinter()); structuredPathTmpWriter.writeValue(output, structuredConfiguration); if (!output.renameTo(structuredPath.toFile())) logger.error("Failed to persist structured Priam configuration"); } finally { if (tempPath != null) Files.deleteIfExists(tempPath); } }
Source:
<code>public void onProjectRestoreFromDisk() { if (hasErrors(myProject)) { addOpenSdkManagerLink(); return; } findAndShowVariantConflicts(); <START> addOpenSdkManagerLink(); <END> TemplateManager.getInstance().refreshDynamicTemplateMenu(myProject); }</code><technical_language>rename this show a op (e.g. addSdkLinkIfNecessary</technical_language>

Target:
public void onProjectRestoreFromDisk() { if (hasErrors(myProject)) { addSdkLinkIfNecessary(); return; } findAndShowVariantConflicts(); addSdkLinkIfNecessary(); TemplateManager.getInstance().refreshDynamicTemplateMenu(myProject); }
Source:
<code>public <E extends Throwable> E expectError(Class<E> expected, long timeoutMillis) throws Exception { <START> return expectError(expected, timeoutMillis, "Expected onError(" + expected.getName() + ")"); <END> }</code><technical_language>I sense standardize String.format</technical_language>

Target:
public <E extends Throwable> E expectError(Class<E> expected, long timeoutMillis) throws Exception { return expectError(expected, timeoutMillis, String.format("Expected onError(%s)", expected.getName())); }
Source:
<code>public void triggered(Trigger trigger, Map<String, ?> outputs) { if (executor != null) { <START> synchronized (executor) { <END> feature = executor.submit(new TriggerData(trigger, outputs)); } } }</code><technical_language>I assume need add additional null check in synchronized statement</technical_language>

Target:
public void triggered(Trigger trigger, Map<String, ?> outputs) { if (executor != null) { synchronized (executor) { if (executor != null) { feature = executor.submit(new TriggerData(trigger, outputs)); } } } }
Source:
<code>protected static void startCollectStatistics() throws Exception { List<Ignite> grids = G.allGrids(); assertFalse(grids.isEmpty()); IgniteEx ignite = (IgniteEx)grids.get(0); <START> ignite.context().performanceStatistics().startCollectStatistics(); <END> waitForStatisticsEnabled(true); }</code><technical_language>PerformanceStatisticsMBean#start in other tests</technical_language>

Target:
protected static void startCollectStatistics() throws Exception { List<Ignite> grids = G.allGrids(); assertFalse(grids.isEmpty()); statisticsMBean(grids.get(0).name()).start(); waitForStatisticsEnabled(true); }
Source:
<code>public void run() { while (deletedCount.get() < putCount) { try { final String blobIdStr = deleteBlobIds.poll(50, TimeUnit.MILLISECONDS); if (blobIdStr != null) { deletedCount.incrementAndGet(); logger.trace("Deleting blob " + blobIdStr); FutureResult futureResult = new FutureResult(); Callback<Void> callback = new Callback<Void>() { @Override public void onCompletion(Void result, Exception exception) { logger.trace("Deletion completed for " + blobIdStr); countDownLatch.countDown(); if (exception != null) { logger.error("Deletion of " + blobIdStr + " failed with " + exception.getStackTrace()); } } }; <START> deleteConsumerJob.deleteBlobAndValidate(blobIdStr, deleteConsumerJob.getErrorCodeForNoError(), futureResult, <END> callback); } } catch (InterruptedException e) { logger.error(" Interrupted Exception thrown in , exception " + e.getStackTrace()); } } try { countDownLatch.await(); } catch (InterruptedException e) { logger.error( " Interrupted Exception thrown while waiting for deletion to complete , exception " + e.getStackTrace()); } }</code><technical_language>I suggestion for get. Simply api deleteHelper.delete(futureResult, callback), callback do validation work</technical_language>

Target:
public void run() { while (deletedCount.get() < putCount) { try { final String blobIdStr = deleteBlobIds.poll(50, TimeUnit.MILLISECONDS); if (blobIdStr != null) { deletedCount.incrementAndGet(); logger.trace("Deleting blob " + blobIdStr); Callback<Void> callback = new Callback<Void>() { @Override public void onCompletion(Void result, Exception exception) { logger.trace("Deletion completed for " + blobIdStr); countDownLatch.countDown(); if (exception != null) { logger.error("Deletion of " + blobIdStr + " failed with ", exception); } } }; deleteHelper.deleteBlobAndValidate(blobIdStr, deleteHelper.getErrorCodeForNoError(), callback); } } catch (InterruptedException e) { logger.error(" Interrupted Exception thrown in , exception ", e); } } try { countDownLatch.await(); } catch (InterruptedException e) { logger.error( " Interrupted Exception thrown while waiting for deletion to complete , exception ", e); } }
Source:
<code>public ImmutableEntityType(Class<? extends Entity> clazz) { <START> super(clazz, null); <END> }</code><technical_language>Ok, I want pass in null. instead a super constructor takes class, if calls other constructor a null entity instance fail fast</technical_language>

Target:
public ImmutableEntityType(Class<? extends Entity> clazz) { super(clazz); }
Source:
<code>private void testStudentResultsPage() throws Exception { ______TS("test rubric question simple student results page"); StudentFeedbackResultsPage simpleResultsPage = loginToStudentFeedbackResultsPage("alice.tmms@FRubricQnUiT.CS2104", "openSession2"); simpleResultsPage.verifyHtmlMainContent("/studentFeedbackResultsPageRubric.html"); ______TS("test rubric question: Check functionality of 'Excluding Self` option"); assertTrue(simpleResultsPage.checkIfExcludingSelfTableHidden()); <START> assertTrue(simpleResultsPage.isExcludingSelfOptionVisible()); <END> simpleResultsPage.clickExcludingSelfCheckbox(); assertTrue(simpleResultsPage.checkIfExcludingSelfTableShown()); ______TS("test rubric question extended student results page"); StudentFeedbackResultsPage extendedResultsPage = loginToStudentFeedbackResultsPage("alice.tmms@FRubricQnUiT.CS2104", "openSession4"); extendedResultsPage.verifyHtmlMainContent("/studentExtendedFeedbackResultsPageRubric.html"); }</code><technical_language>Test case invisible checkbox</technical_language>

Target:
private void testStudentResultsPage() throws Exception { ______TS("test rubric question simple student results page"); StudentFeedbackResultsPage simpleResultsPage = loginToStudentFeedbackResultsPage("alice.tmms@FRubricQnUiT.CS2104", "openSession2"); simpleResultsPage.verifyHtmlMainContent("/studentFeedbackResultsPageRubric.html"); ______TS("test rubric question extended student results page"); StudentFeedbackResultsPage extendedResultsPage = loginToStudentFeedbackResultsPage("alice.tmms@FRubricQnUiT.CS2104", "openSession4"); extendedResultsPage.verifyHtmlMainContent("/studentExtendedFeedbackResultsPageRubric.html"); }
Source:
<code>boolean checkKeyguardVisibility(ActivityRecord r, boolean shouldBeVisible, boolean isTop) { final boolean isInPinnedStack = r.getStack().getStackId() == PINNED_STACK_ID; final boolean keyguardShowing = mStackSupervisor.mKeyguardController.isKeyguardShowing( mDisplayId != INVALID_DISPLAY ? mDisplayId : DEFAULT_DISPLAY); final boolean keyguardLocked = mStackSupervisor.mKeyguardController.isKeyguardLocked(); boolean showWhenLocked = false; boolean dismissKeyguard = false; if (shouldBeVisible) { if (isTop || <START> keyguardLocked) { <END> showWhenLocked = r.canShowWhenLocked() && !isInPinnedStack; } dismissKeyguard = r.hasDismissKeyguardWindows(); } if (shouldBeVisible) { if (dismissKeyguard && mTopDismissingKeyguardActivity == null) { mTopDismissingKeyguardActivity = r; } if (isTop) { mTopActivityOccludesKeyguard |= showWhenLocked; } final boolean canShowWithKeyguard = canShowWithInsecureKeyguard() && mStackSupervisor.mKeyguardController.canDismissKeyguard(); if (canShowWithKeyguard) { return true; } } if (keyguardShowing) { return shouldBeVisible && mStackSupervisor.mKeyguardController .canShowActivityWhileKeyguardShowing(r, dismissKeyguard); } else if (keyguardLocked) { return shouldBeVisible && mStackSupervisor.mKeyguardController.canShowWhileOccluded( dismissKeyguard, showWhenLocked); } else { return shouldBeVisible; } }</code><technical_language>chosen other conditions part of assignment. If this change, I values in condition below. Also, if concerned calls canShowWhenLocked, I move !isInPinnedStack r.canShowWhenLocked() short circuit</technical_language>

Target:
boolean checkKeyguardVisibility(ActivityRecord r, boolean shouldBeVisible, boolean isTop) { final boolean isInPinnedStack = r.getStack().getStackId() == PINNED_STACK_ID; final boolean keyguardShowing = mStackSupervisor.mKeyguardController.isKeyguardShowing( mDisplayId != INVALID_DISPLAY ? mDisplayId : DEFAULT_DISPLAY); final boolean keyguardLocked = mStackSupervisor.mKeyguardController.isKeyguardLocked(); if (shouldBeVisible) { boolean showWhenLocked = false; if (isTop || keyguardLocked) { showWhenLocked = !isInPinnedStack && r.canShowWhenLocked(); } final boolean dismissKeyguard = r.hasDismissKeyguardWindows(); if (dismissKeyguard && mTopDismissingKeyguardActivity == null) { mTopDismissingKeyguardActivity = r; } if (isTop) { mTopActivityOccludesKeyguard |= showWhenLocked; } final boolean canShowWithKeyguard = canShowWithInsecureKeyguard() && mStackSupervisor.mKeyguardController.canDismissKeyguard(); if (canShowWithKeyguard) { return true; } if (keyguardShowing) { return mStackSupervisor.mKeyguardController .canShowActivityWhileKeyguardShowing(r, dismissKeyguard); } else if (keyguardLocked) { return mStackSupervisor.mKeyguardController.canShowWhileOccluded( dismissKeyguard, showWhenLocked); } } return false; }
Source:
<code>public static Map<String, Object> buildMvelParameters() { Map<String, Object> mvelParameters = new HashMap<String, Object>(); BroadleafRequestContext brc = BroadleafRequestContext.getBroadleafRequestContext(); if (brc != null && brc.getRequest() != null) { TimeDTO timeDto = new TimeDTO(SystemTime.asCalendar()); HttpServletRequest request = brc.getRequest(); RequestDTO requestDto = brc.getRequestDTO(); mvelParameters.put("time", timeDto); mvelParameters.put("request", requestDto); Map<String, Object> blcRuleMap = (Map<String, Object>) request.getAttribute(BLC_RULE_MAP_PARAM); if (blcRuleMap != null) { for (String mapKey : blcRuleMap.keySet()) { mvelParameters.put(mapKey, blcRuleMap.get(mapKey)); } <START> } <END> Map<String, Object> brcRuleMap = brc.getRuleMap(); if (blcRuleMap != null) { for (String mapKey : brcRuleMap.keySet()) { mvelParameters.put(mapKey, brcRuleMap.get(mapKey)); } } } return mvelParameters; }</code><technical_language>removed</technical_language>

Target:
public static Map<String, Object> buildMvelParameters() { Map<String, Object> mvelParameters = new HashMap<String, Object>(); BroadleafRequestContext brc = BroadleafRequestContext.getBroadleafRequestContext(); if (brc != null && brc.getRequest() != null) { TimeDTO timeDto = new TimeDTO(SystemTime.asCalendar()); HttpServletRequest request = brc.getRequest(); RequestDTO requestDto = brc.getRequestDTO(); mvelParameters.put("time", timeDto); mvelParameters.put("request", requestDto); Map<String, Object> blcRuleMap = (Map<String, Object>) request.getAttribute(BLC_RULE_MAP_PARAM); if (blcRuleMap != null) { for (String mapKey : blcRuleMap.keySet()) { mvelParameters.put(mapKey, blcRuleMap.get(mapKey)); } } } return mvelParameters; }
Source:
<code>public static PolicyUnit map(SchedulingPolicyUnit model, PolicyUnit template) { PolicyUnit entity = template != null ? template : new PolicyUnit(); if (model.isSetId()) { entity.setId(GuidUtils.asGuid(model.getId())); } if (model.isSetName()) { entity.setName(model.getName()); } if (model.isSetDescription()) { entity.setDescription(model.getDescription()); } if (model.isSetType()) { <START> entity.setPolicyUnitType(PolicyUnitType.valueOf(model.getType().toUpperCase())); <END> } if (model.isSetEnabled()) { entity.setEnabled(model.isEnabled()); } if (model.isSetInternal()) { entity.setInternal(model.isInternal()); } if (model.isSetRegexValidationMap()) { entity.setParameterRegExMap(CustomPropertiesParser.toMap(model.getRegexValidationMap())); } return entity; }</code><technical_language>Same, enum, map enum values</technical_language>

Target:
public static PolicyUnit map(SchedulingPolicyUnit model, PolicyUnit template) { PolicyUnit entity = template != null ? template : new PolicyUnit(); if (model.isSetId()) { entity.setId(GuidUtils.asGuid(model.getId())); } if (model.isSetName()) { entity.setName(model.getName()); } if (model.isSetDescription()) { entity.setDescription(model.getDescription()); } if (model.isSetType()) { PolicyUnitType policyUnitType = null; switch (model.getType().toUpperCase()) { case FILTER: policyUnitType = PolicyUnitType.FILTER; break; case WEIGHT: policyUnitType = PolicyUnitType.WEIGHT; break; case LOAD_BALANCING: policyUnitType = PolicyUnitType.LOAD_BALANCING; break; default: assert (false) : "unknown Policy Unit Type value: " + model.toString(); return null; } entity.setPolicyUnitType(policyUnitType); } if (model.isSetEnabled()) { entity.setEnabled(model.isEnabled()); } if (model.isSetInternal()) { entity.setInternal(model.isInternal()); } if (model.isSetPropertiesMetaData()) { entity.setParameterRegExMap(CustomPropertiesParser.toMap(model.getPropertiesMetaData())); } return entity; }
Source:
<code>public Array<T> getElementsContainingArea(Shape area, QuadTreeSearchDirection searchDirection, boolean entirelyContained) { <START> return null; <END> }</code><technical_language>return empty array instance</technical_language>

Target:
public Array<T> getElementsContainingArea(Shape area, QuadTreeSearchDirection searchDirection, boolean entirelyContained) { return new Array<>(); }
Source:
<code>private Mono<ResponseEntity<?>> toErrorResponse(int statusCode, ErrorResponse body) { <START> return Mono.just(status(statusCode).body(body)); <END> }</code><technical_language>static imports</technical_language>

Target:
private Mono<ResponseEntity<?>> toErrorResponse(int statusCode, ErrorResponse body) { return just(status(statusCode).body(body)); }
Source:
<code>private void closeMore(@PluralsRes int msgId, int countNoMedia, int countHasMedia) { try { ((MainActivity) getActivity()).showSnackbarAbovePlayer( getResources().getQuantityString(msgId, countHasMedia, (countHasMedia + countNoMedia), countHasMedia), Snackbar.LENGTH_LONG); <START> } catch (Exception e) { <END> Log.d(TAG, e.toString()); } getActivity().getSupportFragmentManager().popBackStack(); }</code><technical_language>this throw exception? cases a developer error app crash instead</technical_language>

Target:
private void closeMore(@PluralsRes int msgId, int countNoMedia, int countHasMedia) { ((MainActivity) getActivity()).showSnackbarAbovePlayer( getResources().getQuantityString(msgId, (countHasMedia + countNoMedia), (countHasMedia + countNoMedia), countHasMedia), Snackbar.LENGTH_LONG); getActivity().getSupportFragmentManager().popBackStack(); }
Source:
<code>public MethodCall(String methodName, Object[] args, Map<String, String> metaData, List<String> classes) { super(); <START> init(methodName, args, classes, metaData); <END> }</code><technical_language>this sense? of order</technical_language>

Target:
public MethodCall(String methodName, Object[] args, Map<String, String> metaData, List<String> classes) { super(); this.methodName = methodName; this.args = args; this.classes = classes; this.metaData = metaData; }
Source:
<code>public void resetHtml(@NonNull Context context, @NonNull String assetFileName, @NonNull String wikiUrl) { String html = ""; try { html = FileUtil.readFile(WikipediaApp.getInstance().getAssets().open(assetFileName)) .replace("$wikiurl", wikiUrl) .replace("$pageLibThemeClass", Theme.getThemePageLibClass(WikipediaApp.getInstance().getCurrentTheme())) <START> .replace("$pageLibDimImgClass", (WikipediaApp.getInstance().getCurrentTheme().isDark()) ? "pagelib_dim_images" : ""); <END> } catch (IOException e) { e.printStackTrace(); } isDOMReady = false; webView.loadDataWithBaseURL(wikiUrl, html, "text/html", "utf-8", ""); }</code><technical_language>parentheses removed (WikipediaApp.getInstance().getCurrentTheme().isDark())</technical_language>

Target:
public void resetHtml(@NonNull Context context, @NonNull String assetFileName, @NonNull String wikiUrl) { String html = ""; try { html = FileUtil.readFile(WikipediaApp.getInstance().getAssets().open(assetFileName)) .replace("$wikiurl", wikiUrl) .replace("$pageLibThemeClass", Theme.getThemePageLibClass(WikipediaApp.getInstance().getCurrentTheme())) .replace("$pageLibDimImgClass", WikipediaApp.getInstance().getCurrentTheme().isDark() ? "pagelib_dim_images" : ""); } catch (IOException e) { e.printStackTrace(); } isDOMReady = false; webView.loadDataWithBaseURL(wikiUrl, html, "text/html", "utf-8", ""); }
Source:
<code>public static void addProfileDataToNic(Map<String, Object> struct, VM vm, VmDevice vmDevice, VmNic nic) { VnicProfile vnicProfile = null; Network network = null; if (nic.getVnicProfileId() != null) { vnicProfile = DbFacade.getInstance().getVnicProfileDao().get(nic.getVnicProfileId()); if (vnicProfile != null) { network = DbFacade.getInstance().getNetworkDao().get(vnicProfile.getNetworkId()); addQosForDevice(struct, vnicProfile, vm.getVdsGroupCompatibilityVersion()); } } struct.put(VdsProperties.NETWORK, network == null ? "" : network.getName()); if (vnicProfile != null && vnicProfile.isPortMirroring()) { struct.put(VdsProperties.PORT_MIRRORING, network == null ? Collections.<String> emptyList() : Collections.singletonList(network.getName())); } <START> log.debugFormat("VNIC {0} is using profile {1} on network {2}", nic.getName(), vnicProfile, network.getName()); <END> addCustomPropertiesForDevice(struct, vm, vmDevice, vm.getVdsGroupCompatibilityVersion(), getVnicCustomProperties(vnicProfile)); }</code><technical_language>log is relevant vnic profile is provided. Please print log of vnicProfile != null This line shift line 551 guarantee network null</technical_language>

Target:
public static void addProfileDataToNic(Map<String, Object> struct, VM vm, VmDevice vmDevice, VmNic nic) { VnicProfile vnicProfile = null; Network network = null; if (nic.getVnicProfileId() != null) { vnicProfile = DbFacade.getInstance().getVnicProfileDao().get(nic.getVnicProfileId()); if (vnicProfile != null) { network = DbFacade.getInstance().getNetworkDao().get(vnicProfile.getNetworkId()); addQosForDevice(struct, vnicProfile, vm.getVdsGroupCompatibilityVersion()); } } String networkName = network == null ? "" : network.getName(); struct.put(VdsProperties.NETWORK, networkName); if (vnicProfile != null && vnicProfile.isPortMirroring()) { struct.put(VdsProperties.PORT_MIRRORING, network == null ? Collections.<String> emptyList() : Collections.singletonList(network.getName())); } if (vnicProfile != null) { log.debugFormat("VNIC {0} is using profile {1} on network {2}", nic.getName(), vnicProfile, networkName); } addCustomPropertiesForDevice(struct, vm, vmDevice, vm.getVdsGroupCompatibilityVersion(), getVnicCustomProperties(vnicProfile)); }
Source:
<code>public void safeUpdate() { ItemStack stackInInput = inventory.getStackInSlot(1); <START> if (!stackInInput.isEmpty()) { <END> if (FluidHelper.itemStackIsWaterContainer(stackInInput)) { ItemStack drainedItemStack = FluidHelper.fillTankFromItem(stackInInput, myTank, true); inventory.setStackInSlot(1, drainedItemStack); } } boolean isBurnTimeGreaterThanZero = burnTime > 0; if (burnTime > 0) { burnTime -= 1; } if (burnTime < 0) { burnTime = 0; } if (!world.isRemote) { if (burnTime == 0 && canSmelt()) { ItemStack stack = inventory.getStackInSlot(0); currentItemBurnTime = burnTime = getItemBurnTime(stack); if (burnTime > 0) { ItemStack container = stack.getItem().getContainerItem(stack); stack.shrink(1); if (stack.isEmpty()) { inventory.setStackInSlot(0, container); } } } if (isBurning() && canSmelt() && getNetwork() != null) { ++cookTime; if (cookTime > 0) { getNetwork().addSteam(10); myTank.drain(2, true); cookTime = 0; } } else { cookTime = 0; } if (isBurnTimeGreaterThanZero != burnTime > 0) { markForResync(); } } if (wasBurning != isBurning()) { wasBurning = isBurning(); markForResync(); } super.safeUpdate(); }</code><technical_language>This line is unnecessary, FluidHelper.itemStackIsWaterContainer(ItemStack) checks if provided ItemStack is empty</technical_language>

Target:
public void safeUpdate() { ItemStack stackInInput = inventory.getStackInSlot(1); if (FluidHelper.itemStackIsWaterContainer(stackInInput)) { ItemStack drainedItemStack = FluidHelper.fillTankFromItem(stackInInput, myTank, true); inventory.setStackInSlot(1, drainedItemStack); } boolean isBurnTimeGreaterThanZero = burnTime > 0; if (burnTime > 0) { burnTime -= 1; } if (burnTime < 0) { burnTime = 0; } if (!world.isRemote) { if (burnTime == 0 && canSmelt()) { ItemStack stack = inventory.getStackInSlot(0); currentItemBurnTime = burnTime = getItemBurnTime(stack); if (burnTime > 0) { ItemStack container = stack.getItem().getContainerItem(stack); stack.shrink(1); if (stack.isEmpty()) { inventory.setStackInSlot(0, container); } } } if (isBurning() && canSmelt() && getNetwork() != null) { ++cookTime; if (cookTime > 0) { getNetwork().addSteam(10); myTank.drain(2, true); cookTime = 0; } } else { cookTime = 0; } if (isBurnTimeGreaterThanZero != burnTime > 0) { markForResync(); } } if (wasBurning != isBurning()) { wasBurning = isBurning(); markForResync(); } super.safeUpdate(); }
Source:
<code>private void setupMessageHandlers() { bridge.addListener("requestSection", new CommunicationBridge.JSEventListener() { @Override public void onMessage(String messageType, JSONObject messagePayload) { if (!isAdded()) { return; } try { displayNonLeadSection(messagePayload.getInt("index")); } catch (JSONException e) { } } }); bridge.addListener("ipaSpan", new CommunicationBridge.JSEventListener() { @Override public void onMessage(String messageType, JSONObject messagePayload) { try { String text = messagePayload.getString("contents"); final int textSize = 30; TextView textView = new TextView(getActivity()); textView.setGravity(Gravity.CENTER); textView.setTextSize(TypedValue.COMPLEX_UNIT_SP, textSize); textView.setText(Html.fromHtml(text)); AlertDialog.Builder builder = new AlertDialog.Builder(getActivity()); builder.setView(textView); builder.show(); } catch (JSONException e) { } } }); bridge.addListener("pageLoadComplete", new CommunicationBridge.JSEventListener() { @Override public void onMessage(String messageType, JSONObject messagePayload) { if (!isAdded()) { return; } getActivity().updateProgressBar(false, true, 0); <START> if (bottomContentHandler.getTitle() != title) { <END> bottomContentHandler.setTitle(title); } bottomContentHandler.beginLayout(); } }); }</code><technical_language>In Java want compare objects equals(). == != work</technical_language>

Target:
private void setupMessageHandlers() { bridge.addListener("requestSection", new CommunicationBridge.JSEventListener() { @Override public void onMessage(String messageType, JSONObject messagePayload) { if (!isAdded()) { return; } try { displayNonLeadSection(messagePayload.getInt("index")); } catch (JSONException e) { } } }); bridge.addListener("ipaSpan", new CommunicationBridge.JSEventListener() { @Override public void onMessage(String messageType, JSONObject messagePayload) { try { String text = messagePayload.getString("contents"); final int textSize = 30; TextView textView = new TextView(getActivity()); textView.setGravity(Gravity.CENTER); textView.setTextSize(TypedValue.COMPLEX_UNIT_SP, textSize); textView.setText(Html.fromHtml(text)); AlertDialog.Builder builder = new AlertDialog.Builder(getActivity()); builder.setView(textView); builder.show(); } catch (JSONException e) { } } }); bridge.addListener("pageLoadComplete", new CommunicationBridge.JSEventListener() { @Override public void onMessage(String messageType, JSONObject messagePayload) { if (!isAdded()) { return; } getActivity().updateProgressBar(false, true, 0); if (!bottomContentHandler.getTitle().equals(title)) { bottomContentHandler.setTitle(title); } bottomContentHandler.beginLayout(); } }); }
Source:
<code>public static void transferStreams(List<InputStream> sources, OutputStream destination) throws IOException { destination = new BufferedOutputStream(destination); try { for (InputStream source2 : sources) { try (InputStream <START> source = <END> new BufferedInputStream(source2)) { byte[] buffer = new byte[8192]; while (true) { int bytesRead = -1; if ((bytesRead = source.read(buffer)) == -1) break; destination.write(buffer, 0, bytesRead); } } } } finally { try { destination.close(); } catch (IOException e) { } } }</code><technical_language>source->bufferedSource & source2->source</technical_language>

Target:
public static void transferStreams(List<InputStream> sources, OutputStream destination) throws IOException { destination = new BufferedOutputStream(destination); try { for (InputStream source : sources) { try (InputStream bufferedSource = new BufferedInputStream(source)) { byte[] buffer = new byte[8192]; while (true) { int bytesRead = -1; if ((bytesRead = bufferedSource.read(buffer)) == -1) break; destination.write(buffer, 0, bytesRead); } } } } finally { try { destination.close(); } catch (IOException e) { } } }
Source:
<code>public void onBindViewHolder(RecyclerView.ViewHolder viewHolder, int i) { ArrayList<CloudItem> items = folders.get(currentPath); CloudItem item = items.get(i); CloudListViewHolder holder = (CloudListViewHolder) viewHolder; holder.setId(i); holder.setName(item.getName()); String info = String.format("%s - %d", item.getMimetype(), item.getSize()); holder.setInfo(info); holder.setIcon(item.getThumbnail()); holder.setSelected(selected.contains(i)); holder.setOnClickListener(this); holder.setOnLongClickListener(this); String nextToken = nextTokens.get(currentPath); <START> if (!isLoading && nextToken != null && i >= LOAD_TRIGGER * items.size()) { <END> loadMoreData(); } }</code><technical_language>This slightly nervous :P a problem, add some parens delimit order of ops</technical_language>

Target:
public void onBindViewHolder(RecyclerView.ViewHolder viewHolder, int i) { ArrayList<CloudItem> items = folders.get(currentPath); CloudItem item = items.get(i); CloudListViewHolder holder = (CloudListViewHolder) viewHolder; holder.setId(i); holder.setName(item.getName()); String info = String.format("%s - %d", item.getMimetype(), item.getSize()); holder.setInfo(info); holder.setIcon(item.getThumbnail()); holder.setSelected(selected.contains(i)); holder.setOnClickListener(this); holder.setOnLongClickListener(this); String nextToken = nextTokens.get(currentPath); if (!isLoading) { if (nextToken != null && i >= (LOAD_TRIGGER * items.size())) { loadMoreData(); } } }
Source:
<code>private static byte[] shortToBytesLE(short input) { byte[] output = new byte[2]; output[1] = (byte)(0xff & (input >> 8)); <START> output[0] = (byte)(0xff & (input)); <END> return output; }</code><technical_language>Remove "()", (input) ==> input</technical_language>

Target:
private static byte[] shortToBytesLE(short input) { byte[] output = new byte[2]; output[1] = (byte)(0xff & (input >> 8)); output[0] = (byte)(0xff & input); return output; }
Source:
<code>public AbstractRestResource(T serialDeserial, IRoleCheckingStrategy roleCheckingStrategy) { <START> this.objSerialDeserial = serialDeserial; <END> this.roleCheckingStrategy = roleCheckingStrategy; configureObjSerialDeserial(serialDeserial); loadAnnotatedMethods(); }</code><technical_language>want add Args.notNull() here</technical_language>

Target:
public AbstractRestResource(T serialDeserial, IRoleCheckingStrategy roleCheckingStrategy) { Args.notNull(serialDeserial, "serialDeserial"); this.objSerialDeserial = serialDeserial; this.roleCheckingStrategy = roleCheckingStrategy; configureObjSerialDeserial(serialDeserial); loadAnnotatedMethods(); }
Source:
<code>public boolean supports(@Nonnull HttpServletRequest request) { <START> return "PUT".equalsIgnoreCase(request.getMethod()) && request.getContentType()!=null && request.getContentType().contains(MediaType.APPLICATION_JSON_VALUE) && request.getRequestURI().contains("/-/user/org.couchdb.user:"); <END> }</code><technical_language>Cosmetic: please project's coding convention: return "PUT".equalsIgnoreCase(request.getMethod()) && request.getContentType()!=null && request.getContentType().contains(MediaType.APPLICATION_JSON_VALUE) && request.getRequestURI().contains("/-/user/org.couchdb.user:");</technical_language>

Target:
public boolean supports(@Nonnull HttpServletRequest request) { if (!super.supports(request)) { return false; } return RequestMethod.PUT.name().equalsIgnoreCase(request.getMethod()) && request.getRequestURI().contains(NpmLayoutProvider.NPM_USER_PATH); }
Source:
<code>private Map<String, Serializable> csvTransformArgumentsAdapter( Map<String, Serializable> arguments) { String columnOrder = "\"columnOrder\":" + (String) mapper.toJson(arguments.get("columnOrder")); String hiddenFields = "\"hiddenFields\":" + (String) mapper.toJson(arguments.get("hiddenFields")); String columnAliasMap = "\"columnAliasMap\":" + (String) mapper.toJson(arguments.get("columnAliasMap")); String csvBody = "{" + columnOrder + "," + columnAliasMap + "," + hiddenFields + "}"; CsvTransform queryTransform = mapper.readValue(csvBody, CsvTransform.class); Set<String> hiddenFieldsSet = queryTransform.getHiddenFields() != null ? queryTransform.getHiddenFields() : Collections.emptySet(); List<String> columnOrderList = queryTransform.getColumnOrder() != null ? queryTransform.getColumnOrder() : Collections.emptyList(); Map<String, String> aliasMap = queryTransform.getColumnAliasMap() != null ? queryTransform.getColumnAliasMap() : Collections.emptyMap(); Map<String, Serializable> args = ImmutableMap.<String, Serializable>builder() <START> .put("hiddenFields", new HashSet<>(hiddenFieldsSet)) <END> .put("columnOrder", new ArrayList<>(columnOrderList)) .put("aliases", new HashMap<>(aliasMap)) .build(); return args; }</code><technical_language>do new collections for these? .put("hiddenFields", hiddenFieldsSet)</technical_language>

Target:
private Map<String, Serializable> csvTransformArgumentsAdapter( Map<String, Serializable> arguments) { String columnOrder = "\"columnOrder\":" + (String) mapper.toJson(arguments.get("columnOrder")); String hiddenFields = "\"hiddenFields\":" + (String) mapper.toJson(arguments.get("hiddenFields")); String columnAliasMap = "\"columnAliasMap\":" + (String) mapper.toJson(arguments.get("columnAliasMap")); String csvBody = String.format("{%s,%s,%s}", columnOrder, columnAliasMap, hiddenFields); CsvTransform queryTransform = mapper.readValue(csvBody, CsvTransform.class); Set<String> hiddenFieldsSet = queryTransform.getHiddenFields() != null ? queryTransform.getHiddenFields() : Collections.emptySet(); List<String> columnOrderList = queryTransform.getColumnOrder() != null ? queryTransform.getColumnOrder() : Collections.emptyList(); Map<String, String> aliasMap = queryTransform.getColumnAliasMap() != null ? queryTransform.getColumnAliasMap() : Collections.emptyMap(); Map<String, Serializable> args = ImmutableMap.<String, Serializable>builder() .put("hiddenFields", (Serializable) hiddenFieldsSet) .put("columnOrder", (Serializable) columnOrderList) .put("aliases", (Serializable) aliasMap) .build(); return args; }
Source:
<code>protected void executeVmCommand() { for (CinderDisk cinderDisk : getParameters().getCinderDisks()) { <START> ImagesContainterParametersBase params = <END> new RestoreFromSnapshotParameters(cinderDisk.getImageId(), getParameters().getVmId(), getParameters().getSnapshot(), getParameters().getRemovedSnapshotId()); params.setParentCommand(getActionType()); params.setStorageDomainId(cinderDisk.getStorageIds().get(0)); params.setParentParameters(getParameters()); if (getParameters().getSnapshot().getType() != Snapshot.SnapshotType.REGULAR) { cinderDisk.setActive(true); getImageDao().update(cinderDisk.getImage()); } restoreCinderDisk(cinderDisk, params); } setSucceeded(true); }</code><technical_language>consider extracting create params method</technical_language>

Target:
protected void executeVmCommand() { for (CinderDisk cinderDisk : getParameters().getCinderDisks()) { ImagesContainterParametersBase params = getRestoreFromSnapshotParams(cinderDisk); restoreCinderDisk(cinderDisk, params); if (getParameters().getSnapshot().getType() != Snapshot.SnapshotType.REGULAR) { cinderDisk.setActive(true); getImageDao().update(cinderDisk.getImage()); } } setSucceeded(true); }
Source:
<code>private BoolQueryBuilder buildESQuery(String tenantId, String query) { String[] queryTokens = query.split(Locator.metricTokenSeparatorRegex); String lastToken = queryTokens[queryTokens.length - 1]; <START> BoolQueryBuilder bqb = boolQuery(); <END> QueryBuilder parentQB; if (queryTokens.length == 1) { parentQB = termQuery(ESFieldLabel.parent.name(), ""); } else { String parent = Arrays.stream(queryTokens) .limit(queryTokens.length - 1) .collect(joining(Locator.metricTokenSeparator)); GlobPattern parentGlob = new GlobPattern(parent); if (parentGlob.hasWildcard()) { parentQB = regexpQuery(ESFieldLabel.parent.name(), getRegexToHandleTokens(parentGlob)); } else { parentQB = termQuery(ESFieldLabel.parent.name(), parent); } } bqb.must(termQuery(ESFieldLabel.tenantId.name(), tenantId)) .must(parentQB); if (!lastToken.equals("*")) { QueryBuilder tokenQB; GlobPattern pattern = new GlobPattern(lastToken); if (pattern.hasWildcard()) { tokenQB = regexpQuery(ESFieldLabel.token.name(), pattern.compiled().toString()); } else { tokenQB = termQuery(ESFieldLabel.token.name(), query); } bqb.must(tokenQB); } return bqb; }</code><technical_language>For a split second, I read this "BobQueryBuilder"</technical_language>

Target:
private BoolQueryBuilder buildESQuery(String tenantId, String query) { String[] queryTokens = query.split(Locator.METRIC_TOKEN_SEPARATOR_REGEX); String lastToken = queryTokens[queryTokens.length - 1]; BoolQueryBuilder bqb = boolQuery(); QueryBuilder parentQB; if (queryTokens.length == 1) { parentQB = termQuery(ESFieldLabel.parent.name(), ""); } else { String parent = Arrays.stream(queryTokens) .limit(queryTokens.length - 1) .collect(joining(Locator.METRIC_TOKEN_SEPARATOR)); GlobPattern parentGlob = new GlobPattern(parent); if (parentGlob.hasWildcard()) { parentQB = regexpQuery(ESFieldLabel.parent.name(), getRegexToHandleTokens(parentGlob)); } else { parentQB = termQuery(ESFieldLabel.parent.name(), parent); } } bqb.must(termQuery(ESFieldLabel.tenantId.name(), tenantId)) .must(parentQB); if (!lastToken.equals("*")) { QueryBuilder tokenQB; GlobPattern pattern = new GlobPattern(lastToken); if (pattern.hasWildcard()) { tokenQB = regexpQuery(ESFieldLabel.token.name(), pattern.compiled().toString()); } else { tokenQB = termQuery(ESFieldLabel.token.name(), query); } bqb.must(tokenQB); } return bqb; }
Source:
<code>public Attachment getAttachment(DocumentRevision rev, String attachmentName) { try { Cursor c = datastore.getSQLDatabase().rawQuery(SQL_ATTACHMENTS_SELECT, new String[]{attachmentName, String.valueOf(rev.getSequence())}); if (c.moveToFirst()) { int sequence = c.getInt(0); byte[] key = c.getBlob(2); String type = c.getString(3); int encoding = c.getInt(4); int length = c.getInt(5); <START> int encoded_length = c.getInt(6); <END> int revpos = c.getInt(7); File file = fileFromKey(key); return new SavedAttachment(attachmentName, revpos, sequence, key, type, file); } return null; } catch (SQLException e) { return null; } }</code><technical_language>unused vars here</technical_language>

Target:
protected Attachment getAttachment(DocumentRevision rev, String attachmentName) { try { Cursor c = datastore.getSQLDatabase().rawQuery(SQL_ATTACHMENTS_SELECT, new String[]{attachmentName, String.valueOf(rev.getSequence())}); if (c.moveToFirst()) { int sequence = c.getInt(0); byte[] key = c.getBlob(2); String type = c.getString(3); int revpos = c.getInt(7); File file = fileFromKey(key); return new SavedAttachment(attachmentName, revpos, sequence, key, type, file); } return null; } catch (SQLException e) { return null; } }
Source:
<code>protected void onDraw(Canvas canvas) { super.onDraw(canvas); final float radius = Math.min((float) canvas.getWidth(), canvas.getHeight()) / 2 - cropCirclePadding; mRectF.set((float) canvas.getWidth() / 2 - radius, (float) canvas.getHeight() / 2 - radius, (float) canvas.getWidth() / 2 + radius, (float) canvas.getHeight() / 2 + radius); circleSelectionPath.reset(); circleSelectionPath.addOval(mRectF, Path.Direction.CW); <START> canvas.clipPath(circleSelectionPath, Region.Op.DIFFERENCE); <END> canvas.drawRect(0, 0, canvas.getWidth(), canvas.getHeight(), backgroundPaint); canvas.save(); canvas.restore(); canvas.drawCircle((float) canvas.getWidth() / 2, (float) canvas.getHeight() / 2, radius, borderPaint); }</code><technical_language>Instead of this deprecated function is margin for error, clipOutPath function thing. _copied source code:_ java /** * Set clip difference of current clip path. * * @param path path in difference operation * @return true if resulting clip is non-empty */ public boolean clipOutPath(@NonNull Path path) { return clipPath(path, Region.Op.DIFFERENCE); }</technical_language>

Target:
protected void onDraw(Canvas canvas) { super.onDraw(canvas); final float radius = Math.min((float) canvas.getWidth(), canvas.getHeight()) / 2 - cropCirclePadding; mRectF.set((float) canvas.getWidth() / 2 - radius, (float) canvas.getHeight() / 2 - radius, (float) canvas.getWidth() / 2 + radius, (float) canvas.getHeight() / 2 + radius); circleSelectionPath.reset(); circleSelectionPath.addOval(mRectF, Path.Direction.CW); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) { canvas.clipOutPath(circleSelectionPath); } else { canvas.clipPath(circleSelectionPath, Region.Op.XOR); } canvas.drawRect(0, 0, canvas.getWidth(), canvas.getHeight(), backgroundPaint); canvas.save(); canvas.restore(); canvas.drawCircle((float) canvas.getWidth() / 2, (float) canvas.getHeight() / 2, radius, borderPaint); }
Source:
<code>public String apply(@Nullable String value) { if (value == null) { if (nullHandling == NullHandling.RETURNNULL) { return null; } if (nullHandling == NullHandling.EMPTYSTRING) { value = ""; } } <START> return StringUtils.emptyToNullNonDruidDataString(StringUtils.format(format, value)); <END> }</code><technical_language>question</technical_language>

Target:
public String apply(@Nullable String value) { if (value == null) { if (nullHandling == NullHandling.RETURNNULL) { return null; } if (nullHandling == NullHandling.EMPTYSTRING) { value = ""; } } return io.druid.common.config.NullHandling.emptyToNullIfNeeded(StringUtils.format(format, value)); }
Source:
<code>public void testValidateValidSeedLocation() { this.errors = new MapBindingResult(new HashMap<String, String>(), LotDto.class.getName()); final Integer locationId = 6000; this.lotGeneratorInputDto.setGid(1); this.lotGeneratorInputDto.setLocationId(locationId); this.lotGeneratorInputDto.setGenerateStock(false); this.lotGeneratorInputDto.setScaleId(8264); this.lotGeneratorInputDto.setStockId("ABCD"); this.lotGeneratorInputDto.setComments("Comments"); final VariableFilter variableFilter = new VariableFilter(); variableFilter.addPropertyId(TermId.INVENTORY_AMOUNT_PROPERTY.getId()); final Location location = new Location(); final List<Location> locationList = Lists.newArrayList(location); Mockito.when(this.locationDataManager.getLocationByID(locationId)).thenReturn(location); Mockito.when(this.locationDataManager.getAllSeedingLocations(Lists.newArrayList(locationId))).thenReturn(locationList); this.locationValidator.validateSeedLocationId(this.errors, locationId); <START> Assert.assertTrue(this.errors.getAllErrors().size() == 0); <END> }</code><technical_language>@vmaletta assertEquals more elegant</technical_language>

Target:
public void testValidateValidSeedLocation() { this.errors = new MapBindingResult(new HashMap<String, String>(), LotDto.class.getName()); this.lotGeneratorInputDto.setGid(GID); this.lotGeneratorInputDto.setLocationId(LOCATION_ID); this.lotGeneratorInputDto.setGenerateStock(false); this.lotGeneratorInputDto.setScaleId(SCALE_ID); this.lotGeneratorInputDto.setStockId(STOCK_ID); this.lotGeneratorInputDto.setComments(COMMENTS); final VariableFilter variableFilter = new VariableFilter(); variableFilter.addPropertyId(TermId.INVENTORY_AMOUNT_PROPERTY.getId()); final Location location = new Location(); final List<Location> locationList = Lists.newArrayList(location); Mockito.when(this.locationDataManager.getLocationByID(LOCATION_ID)).thenReturn(location); Mockito.when(this.locationDataManager.getAllSeedingLocations(Lists.newArrayList(LOCATION_ID))).thenReturn(locationList); this.locationValidator.validateSeedLocationId(this.errors, LOCATION_ID); Assert.assertEquals(this.errors.getAllErrors().size(), 0); }