auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>private List<String> getLocationStringList(List<Location> locationList) { List<String> list = new ArrayList<String>(); switch (edit_new) { <START> case 0: <END> list.add(getString(R.string.login_location_select)); for (int i = 0; i < locationList.size(); i++) { list.add(locationList.get(i).getDisplay()); } break; case 1: list.add(info.get(0)); for (int i = 0; i < locationList.size(); i++) { list.add(locationList.get(i).getDisplay()); } break; default: list.add(getString(R.string.login_location_select)); for (int i = 0; i < locationList.size(); i++) { list.add(locationList.get(i).getDisplay()); } break; } return list; }</code><technical_language>Again, constants nice for readability</technical_language>

Target:
private List<String> getLocationStringList(List<Location> locationList) { List<String> list = new ArrayList<String>(); switch (edit_new) { case "new_form": list.add(getString(R.string.login_location_select)); for (int i = 0; i < locationList.size(); i++) { list.add(locationList.get(i).getDisplay()); } break; case "edit_form": list.add(info.get(0)); for (int i = 0; i < locationList.size(); i++) { list.add(locationList.get(i).getDisplay()); } break; default: list.add(getString(R.string.login_location_select)); for (int i = 0; i < locationList.size(); i++) { list.add(locationList.get(i).getDisplay()); } break; } return list; }
Source:
<code>public void testProcessWithRequiredVariable() throws Exception { KieBase kbase = createKnowledgeBase("variable-tags/approval-with-required-variable-tags.bpmn2"); KieSession ksession = createKnowledgeSession(kbase); TestWorkItemHandler workItemHandler = new TestWorkItemHandler(); ksession.getWorkItemManager().registerWorkItemHandler("Human Task", workItemHandler); Map<String, Object> parameters = new HashMap<>(); parameters.put("approver", "john"); ProcessInstance processInstance = ksession.startProcess("approvals", parameters); assertTrue(processInstance.getState() == ProcessInstance.STATE_ACTIVE); ksession = restoreSession(ksession, true); ksession.getWorkItemManager().registerWorkItemHandler("Human Task", workItemHandler); WorkItem workItem = workItemHandler.getWorkItem(); assertNotNull(workItem); ksession.getWorkItemManager().completeWorkItem(workItem.getId(), null); workItem = workItemHandler.getWorkItem(); assertNotNull(workItem); ksession.getWorkItemManager().completeWorkItem(workItem.getId(), null); assertProcessInstanceFinished(processInstance, ksession); <START> ksession.dispose(); <END> }</code><technical_language>needed</technical_language>

Target:
public void testProcessWithRequiredVariable() throws Exception { ksession = createSessionAndRegisterWorkItemHandler("variable-tags/approval-with-required-variable-tags.bpmn2"); Map<String, Object> parameters = new HashMap<>(); parameters.put("approver", "john"); ProcessInstance processInstance = ksession.startProcess("approvals", parameters); assertTrue(processInstance.getState() == ProcessInstance.STATE_ACTIVE); ksession = restoreSession(ksession, true); ksession.getWorkItemManager().registerWorkItemHandler("Human Task", workItemHandler); WorkItem workItem = workItemHandler.getWorkItem(); assertNotNull(workItem); ksession.getWorkItemManager().completeWorkItem(workItem.getId(), null); workItem = workItemHandler.getWorkItem(); assertNotNull(workItem); ksession.getWorkItemManager().completeWorkItem(workItem.getId(), null); assertProcessInstanceFinished(processInstance, ksession); }
Source:
<code>protected Control createDialogArea(final Composite parent) { final Composite container = new Composite(parent, SWT.NULL); final GridLayout layout = new GridLayout(); layout.numColumns = 1; layout.marginHeight = 9; layout.marginWidth = 9; container.setLayout(layout); GridData gd = new GridData(GridData.FILL_BOTH); container.setLayoutData(gd); final Label label = new Label(container, SWT.NULL); String labelText; <START> if (getMessage() != null && getMessage().length() > 0) { <END> labelText = getMessage(); } else { labelText = "Enter new name ("; if (isCaseSensitive) { labelText += "case sensitive"; } else { labelText += "case insensitive"; } labelText += "):"; } label.setText(labelText); text = new Text(container, SWT.SINGLE | SWT.BORDER); if (newName != null) { text.setText(newName); } else { text.setText(oldName); } text.addModifyListener(new ModifyListener() { public void modifyText(final ModifyEvent e) { textChanged(text.getText()); } }); gd = new GridData(GridData.FILL_HORIZONTAL); text.setLayoutData(gd); Dialog.applyDialogFont(container); return container; }</code><technical_language>org.eclipse.sirius.common.tools.api.util.StringUtil.isEmpty(String)</technical_language>

Target:
protected Control createDialogArea(final Composite parent) { final Composite container = new Composite(parent, SWT.NULL); final GridLayout layout = new GridLayout(); layout.numColumns = 1; layout.marginHeight = 9; layout.marginWidth = 9; container.setLayout(layout); GridData gd = new GridData(GridData.FILL_BOTH); container.setLayoutData(gd); final Label label = new Label(container, SWT.NULL); String labelText; if (!StringUtil.isEmpty(getMessage())) { labelText = getMessage(); } else { labelText = "Enter new name ("; if (isCaseSensitive) { labelText += "case sensitive"; } else { labelText += "case insensitive"; } labelText += "):"; } label.setText(labelText); text = new Text(container, SWT.SINGLE | SWT.BORDER); if (newName != null) { text.setText(newName); } else { text.setText(oldName); } text.addModifyListener(new ModifyListener() { public void modifyText(final ModifyEvent e) { textChanged(text.getText()); } }); gd = new GridData(GridData.FILL_HORIZONTAL); text.setLayoutData(gd); Dialog.applyDialogFont(container); return container; }
Source:
<code>private void setGotoCurrentLocationStatus() { mBtnGotoCurrentLocation.setEnabled(mLastDeviceLocation.getValue() != null || mHasEnabledLocationProviders); int fillColor; VectorDrawableCompat icon; if (mLastDeviceLocation.getValue() != null) { <START> icon = VectorDrawableCompat.create(getResources(), R.drawable.ic_my_location_white_24dp, <END> null); fillColor = mColorPrimary; } else if (mHasEnabledLocationProviders) { icon = VectorDrawableCompat.create(getResources(), R.drawable.ic_my_location_grey600_24dp, null); fillColor = mColorPrimaryWhite; } else { icon = VectorDrawableCompat.create(getResources(), R.drawable.ic_my_location_white_24dp, null); fillColor = mColorPrimaryButtonDisable; } mBtnGotoCurrentLocation.setImageDrawable(icon); mBtnGotoCurrentLocation.setBackgroundTintList(ColorStateList.valueOf(fillColor)); }</code><technical_language>create icons in onCreateView() (or reset null in onDestroyView() create demand) s.t. do re-create time location status changes</technical_language>

Target:
private void setGotoCurrentLocationStatus() { mBtnGotoCurrentLocation.setEnabled(mLastDeviceLocation.getValue() != null || mHasEnabledLocationProviders); int fillColor; VectorDrawableCompat icon; if (mLastDeviceLocation.getValue() != null) { icon = mIcMyLocationWhite; fillColor = mColorPrimary; } else if (mHasEnabledLocationProviders) { icon = mIcMyLocationGrey; fillColor = mColorPrimaryWhite; } else { icon = mIcMyLocationWhite; fillColor = mColorPrimaryButtonDisable; } mBtnGotoCurrentLocation.setImageDrawable(icon); mBtnGotoCurrentLocation.setBackgroundTintList(ColorStateList.valueOf(fillColor)); }
Source:
<code><START> private void showEditorTip() { <END> Preferences prefs = ConfigurationScope.INSTANCE.getNode("org.eclipse.egerrit.prefs"); Preferences editorPrefs = prefs.node("editor"); String choice = editorPrefs.get("editortip", "false"); if (choice.compareTo("false") != 0) { return; } MessageDialogWithToggle dialog = MessageDialogWithToggle.openInformation( tableFilesViewer.getControl().getShell(), Messages.FileTabView_EGerriTip, Messages.FileTabView_EGerriTipValue, Messages.FileTabView_EGerriTipShowAgain, false, null, null); if (dialog.getToggleState()) { editorPrefs.put("editortip", "true"); } return; }</code><technical_language>need show this if user is anonymous</technical_language>

Target:
private void showEditorTip() { Preferences prefs = ConfigurationScope.INSTANCE.getNode("org.eclipse.egerrit.prefs"); Preferences editorPrefs = prefs.node("editor"); boolean choice = editorPrefs.getBoolean("editortip", false); if (choice) { return; } MessageDialogWithToggle dialog = MessageDialogWithToggle.openInformation( tableFilesViewer.getControl().getShell(), Messages.FileTabView_EGerriTip, Messages.FileTabView_EGerriTipValue, Messages.FileTabView_EGerriTipShowAgain, false, null, null); if (dialog.getToggleState()) { editorPrefs.putBoolean("editortip", true); } return; }
Source:
<code>public void onNext(final Message<ShuffleTupleMessage<Integer, Integer>> message) { for (final ShuffleTupleMessage<Integer, Integer> tupleMessage : message.getData()) { if (tupleMessage.size() == 0) { LOG.log(Level.INFO, "An empty shuffle message is arrived from {0}.", message.getSrcId()); } else { LOG.log(Level.INFO, "A shuffle message with size {0} is arrived from {1}.", new Object[]{tupleMessage.size(), message.getSrcId()}); } for (int i = 0; i < tupleMessage.size(); i++) { LOG.log(Level.INFO, tupleMessage.get(i).toString()); } } if (receivedIdSet.contains(message.getSrcId())) { throw new RuntimeException("Only one message from one task is allowed."); } else { <START> receivedIdSet.add(message.getSrcId()); <END> countDownLatch.countDown(); } }</code><technical_language>Wake BlockingEventHandler (I misspelled name)</technical_language>

Target:
public void onNext(final Message<ShuffleTupleMessage<Integer, Integer>> message) { for (final ShuffleTupleMessage<Integer, Integer> tupleMessage : message.getData()) { if (tupleMessage.size() == 0) { LOG.log(Level.INFO, "An empty shuffle message arrived from {0}.", message.getSrcId()); } else { LOG.log(Level.INFO, "A shuffle message with size {0} is arrived from {1}.", new Object[]{tupleMessage.size(), message.getSrcId()}); } for (int i = 0; i < tupleMessage.size(); i++) { LOG.log(Level.INFO, tupleMessage.get(i).toString()); } } if (receivedIdSet.contains(message.getSrcId())) { throw new RuntimeException("Only one message from one task is allowed."); } else { receivedIdSet.add(message.getSrcId()); countDownLatch.countDown(); } }
Source:
<code><START> @Override public ConnectionFactory getConnectionFactory() throws JMSConnectorException { <END> return super.getConnectionFactory(); }</code><technical_language>correct signature is @Override public ConnectionFactory getConnectionFactory() throws JMSConnectorException {..}</technical_language>

Target:
public ConnectionFactory getConnectionFactory() throws JMSConnectorException { return super.getConnectionFactory(); }
Source:
<code>public Response deleteIncomingPhoneNumber(final String accountSid, final String sid) { try{ Account operatedAccount = accountsDao.getAccount(accountSid); secure(operatedAccount, "RestComm:Delete:IncomingPhoneNumbers"); final IncomingPhoneNumber incomingPhoneNumber = dao.getIncomingPhoneNumber(new Sid(sid)); if (incomingPhoneNumber == null) { return status(NOT_FOUND).build(); } secure(operatedAccount, incomingPhoneNumber.getAccountSid(), SecuredType.SECURED_STANDARD); if(phoneNumberProvisioningManager != null && (incomingPhoneNumber.isPureSip() == null || !incomingPhoneNumber.isPureSip())) { phoneNumberProvisioningManager.cancelNumber(convertIncomingPhoneNumbertoPhoneNumber(incomingPhoneNumber)); } dao.removeIncomingPhoneNumber(new Sid(sid)); return noContent().build(); }catch(Exception e){ <START> logger.error("", e); <END> return status(INTERNAL_SERVER_ERROR).build(); } }</code><technical_language>@maria-farooq provide a description log message</technical_language>

Target:
public Response deleteIncomingPhoneNumber(final String accountSid, final String sid) { Account operatedAccount = accountsDao.getAccount(accountSid); secure(operatedAccount, "RestComm:Delete:IncomingPhoneNumbers"); try{ final IncomingPhoneNumber incomingPhoneNumber = dao.getIncomingPhoneNumber(new Sid(sid)); if (incomingPhoneNumber == null) { return status(NOT_FOUND).build(); } secure(operatedAccount, incomingPhoneNumber.getAccountSid(), SecuredType.SECURED_STANDARD); if(phoneNumberProvisioningManager != null && (incomingPhoneNumber.isPureSip() == null || !incomingPhoneNumber.isPureSip())) { phoneNumberProvisioningManager.cancelNumber(convertIncomingPhoneNumbertoPhoneNumber(incomingPhoneNumber)); } dao.removeIncomingPhoneNumber(new Sid(sid)); return noContent().build(); }catch(Exception e){ logger.error("Exception while performing deleteIncomingPhoneNumber: ", e); return status(INTERNAL_SERVER_ERROR).build(); } }
Source:
<code>public ChangesResult changes(PullFilter filter, Object since, Integer limit) { Map<String, Object> options = getParametrizedChangeFeedOptions(since, limit); if (filter != null) { if (filter instanceof PullDocIdsFilter) { String bodyParams = filter.getParameters().get("body"); return changesRequestWithPost(filter.getName(), bodyParams, since, limit); } else { String filterName = filter.getName(); <START> Map filterParameters = filter.getParameters(); <END> if (filterName != null) { options.put("filter", filterName); if (filterParameters != null) { options.putAll(filterParameters); } } } } return this.changes(options); }</code><technical_language>I a good idea a special case for this. POST options in body for changes requests</technical_language>

Target:
public ChangesResult changes(PullFilter filter, Object since, Integer limit) { Map<String, Object> options = getParametrizedChangeFeedOptions(since, limit); if (filter != null) { String filterName = filter.getName(); Map filterParameters = filter.getParameters(); if (filterName != null) { options.put("filter", filterName); if (filterParameters != null) { options.putAll(filterParameters); } } } return this.changesRequestWithGet(options); }
Source:
<code>public void testMapAssocSpacing() throws Exception { ErlangCodeStyleSettings erlangSettings = getErlangSettings(); <START> erlangSettings.SPACE_AROUND_ARROW = true; <END> doTest(); }</code><technical_language>restore settings back. java prev = erlangSettings.SPACE_AROUND_ARROW; try { erlangSettings.SPACE_AROUND_ARROW = true; doTest(); } finally { erlangSettings.SPACE_AROUND_ARROW = prev; }</technical_language>

Target:
public void testMapAssocSpacing() throws Exception { ErlangCodeStyleSettings erlangSettings = getErlangSettings(); boolean prev = erlangSettings.SPACE_AROUND_ARROW; try { erlangSettings.SPACE_AROUND_ARROW = true; doTest(); } finally { erlangSettings.SPACE_AROUND_ARROW = prev; } }
Source:
<code>public void handleAutoSavePostIfNotDraftResult(@NotNull AutoSavePostIfNotDraftResult result) { PostModel post = result.getPost(); SiteModel site = mSiteStore.getSiteByLocalId(post.getLocalSiteId()); if (result instanceof FetchPostStatusFailed) { mPostUploadNotifier.incrementUploadedPostCountFromForegroundNotification(post); <START> mPostUploadNotifier.updateNotificationErrorForPost(post, site, post.error.message, 0); <END> finishUpload(); } else if (result instanceof PostAutoSaveFailed) { mPostUploadNotifier.incrementUploadedPostCountFromForegroundNotification(post); mPostUploadNotifier.updateNotificationErrorForPost(post, site, post.error.message, 0); finishUpload(); } else if (result instanceof PostAutoSaved) { mPostUploadNotifier.incrementUploadedPostCountFromForegroundNotification(post); finishUpload(); } else if (result instanceof PostIsDraftInRemote) { post.setStatus(PostStatus.DRAFT.toString()); mDispatcher.dispatch(PostActionBuilder.newPushPostAction(new RemotePostPayload(post, site))); } else { throw new IllegalStateException("All AutoSavePostIfNotDraftResult types must be handled"); } }</code><technical_language>wondering if want show a notification auto-save fails (it's automatic action)? I previous implementation simply error updated post list item UI. Wdyt</technical_language>

Target:
public void handleAutoSavePostIfNotDraftResult(@NotNull AutoSavePostIfNotDraftResult result) { PostModel post = result.getPost(); if (result instanceof FetchPostStatusFailed || result instanceof PostAutoSaveFailed || result instanceof PostAutoSaved) { mPostUploadNotifier.incrementUploadedPostCountFromForegroundNotification(post); finishUpload(); } else if (result instanceof PostIsDraftInRemote) { post.setStatus(PostStatus.DRAFT.toString()); SiteModel site = mSiteStore.getSiteByLocalId(post.getLocalSiteId()); mDispatcher.dispatch(PostActionBuilder.newPushPostAction(new RemotePostPayload(post, site))); } else { throw new IllegalStateException("All AutoSavePostIfNotDraftResult types must be handled"); } }
Source:
<code><START> public static Tracker getInstance() { <END> register(); return instance; }</code><technical_language>Do need this method? people call Tracker.register()</technical_language>

Target:
public static Tracker getInstance() { return instance; }
Source:
<code>public void removeSubscription(String subscriptionId) { callbacks.remove(subscriptionId); String sitemapPage = pageOfSubscription.remove(subscriptionId); if (sitemapPage != null && !pageOfSubscription.values().contains(sitemapPage)) { PageChangeListener listener = pageChangeListeners.get(sitemapPage); if (listener != null) { <START> pageChangeListeners.remove(sitemapPage); <END> listener.dispose(); } } logger.debug("Removed subscription with id {}", subscriptionId); }</code><technical_language>want remove entry map in case simplify use: java final PageChangeListener listener = pageChangeListeners.remove(sitemapPage); if (listener != null) { listener.dispose(); }</technical_language>

Target:
public void removeSubscription(String subscriptionId) { callbacks.remove(subscriptionId); String sitemapPage = pageOfSubscription.remove(subscriptionId); if (sitemapPage != null && !pageOfSubscription.values().contains(sitemapPage)) { PageChangeListener listener = pageChangeListeners.remove(sitemapPage); if (listener != null) { listener.dispose(); } } logger.debug("Removed subscription with id {}", subscriptionId); }
Source:
<code>public static Slice allocateDirect(int capacity) { <START> checkSliceCapacity(capacity); <END> if (capacity == 0) { return EMPTY_SLICE; } return wrappedBuffer(ByteBuffer.allocateDirect(capacity)); }</code><technical_language>Move this if (capacity == 0) check. avoid extra comparison if requested capacity is 0</technical_language>

Target:
public static Slice allocateDirect(int capacity) { if (capacity == 0) { return EMPTY_SLICE; } return wrappedBuffer(ByteBuffer.allocateDirect(capacity)); }
Source:
<code>public void testStitchBytes() { ArrayList<DSTFileGenerator.StitchPoint> stitchpoints = new ArrayList<>(); stitchpoints.add(new DSTFileGenerator.StitchPoint(new PointF(0, 0))); stitchpoints.add(new DSTFileGenerator.StitchPoint(new PointF(20, 0))); stitchpoints.add(new DSTFileGenerator.StitchPoint(new PointF(20, 20))); stitchpoints.add(new DSTFileGenerator.StitchPoint(new PointF(0, 20))); stitchpoints.add(new DSTFileGenerator.StitchPoint(new PointF(0, 0))); byte[] stitchBytes = fileGenerator.getStitchesBytes(stitchpoints); PointF lastPoint = stitchpoints.get(0).point; int index = 0; <START> for (int i = 0; i < stitchBytes.length; i += 3) { <END> PointF nextPoint = getNextPointFromByte(lastPoint, stitchBytes[i], stitchBytes[i + 1], stitchBytes[i + 2]); assertEquals(stitchpoints.get(index).point, nextPoint); lastPoint = nextPoint; index++; } assertEquals(index, stitchpoints.size()); }</code><technical_language>please loops in tests, especially duplicate indices. this parameterized test 2 points same</technical_language>

Target:
public void testStitchBytes() { final byte[] expectedStitchBytes = new byte[] {0, 0, (byte) 0x3, (byte) 0xAA, (byte) 0x55, (byte) 0x03, (byte) 0x55, (byte) 0xAA, (byte) 0x03}; ArrayList<DSTFileGenerator.StitchPoint> stitchpoints = new ArrayList<>(); stitchpoints.add(new DSTFileGenerator.StitchPoint(new PointF(0, 0))); stitchpoints.add(new DSTFileGenerator.StitchPoint(new PointF(20, -20))); stitchpoints.add(new DSTFileGenerator.StitchPoint(new PointF(0, 0))); byte[] stitchBytes = fileGenerator.getStitchesBytes(stitchpoints); assertArrayEquals(expectedStitchBytes, stitchBytes); }
Source:
<code>public void breakBlock(World world, int x, int y, int z, Block block, int par6) { Utils.preDestroyBlock(world, x, y, z); TileConstructionMarker marker = (TileConstructionMarker) world.getTileEntity(x, y, z); if (marker != null && marker.itemBlueprint != null) { float f1 = 0.7F; double d = (world.rand.nextFloat() * f1) + (1.0F - f1) * 0.5D; double d1 = (world.rand.nextFloat() * f1) + (1.0F - f1) * 0.5D; double d2 = (world.rand.nextFloat() * f1) + (1.0F - f1) * 0.5D; EntityItem itemToDrop = new EntityItem(world, x + d, y + d1, z + d2, marker.itemBlueprint); itemToDrop.delayBeforeCanPickup = 10; <START> if (!world.isRemote) <END> world.spawnEntityInWorld(itemToDrop); } super.breakBlock(world, x, y, z, block, par6); }</code><technical_language>Style error: this a bracket. Also, check a lot earlier? If dropping item, need compute it</technical_language>

Target:
public void breakBlock(World world, int x, int y, int z, Block block, int par6) { Utils.preDestroyBlock(world, x, y, z); TileConstructionMarker marker = (TileConstructionMarker) world.getTileEntity(x, y, z); if (marker != null && marker.itemBlueprint != null && !world.isRemote) { float f1 = 0.7F; double d = (world.rand.nextFloat() * f1) + (1.0F - f1) * 0.5D; double d1 = (world.rand.nextFloat() * f1) + (1.0F - f1) * 0.5D; double d2 = (world.rand.nextFloat() * f1) + (1.0F - f1) * 0.5D; EntityItem itemToDrop = new EntityItem(world, x + d, y + d1, z + d2, marker.itemBlueprint); itemToDrop.delayBeforeCanPickup = 10; world.spawnEntityInWorld(itemToDrop); } super.breakBlock(world, x, y, z, block, par6); }
Source:
<code>public void testShowPartitions() { assertQueryFails("SHOW PARTITIONS FROM orders", "line \\S*: Table does not have partition columns: \\S+\\.orders"); assertQueryFails("SHOW PARTITIONS FROM orders WHERE orderkey < 10", "line \\S*: Table does not have partition columns: \\S+\\.orders"); <START> assertQueryFails("SHOW PARTITIONS FROM orders WHERE invalid_column < 10", "line 1:35: Column 'invalid_column' cannot be resolved"); <END> assertQueryFails("SHOW PARTITIONS FROM orders LIMIT 2", "line \\S*: Table does not have partition columns: \\S+\\.orders"); }</code><technical_language>this a specific line position others don't? I fine a specific position for of them, more consistent other tests in this class</technical_language>

Target:
public void testShowPartitions() { assertQueryFails("SHOW PARTITIONS FROM orders", "line 1:1: Table does not have partition columns: \\S+\\.orders"); assertQueryFails("SHOW PARTITIONS FROM orders WHERE orderkey < 10", "line 1:1: Table does not have partition columns: \\S+\\.orders"); assertQueryFails("SHOW PARTITIONS FROM orders WHERE invalid_column < 10", "line 1:35: Column 'invalid_column' cannot be resolved"); assertQueryFails("SHOW PARTITIONS FROM orders LIMIT 2", "line 1:1: Table does not have partition columns: \\S+\\.orders"); }
Source:
<code>static boolean isPackageExists(Context context, String targetPackage) { <START> List<ApplicationInfo> packages; <END> PackageManager pm; pm = context.getPackageManager(); packages = pm.getInstalledApplications(0); for (ApplicationInfo packageInfo : packages) { if (packageInfo.packageName.equals(targetPackage)) return true; } return false; }</code><technical_language>Please fix code. java PackageManager pm = context.getPackageManager(); List<ApplicationInfo> packages = pm.getInstalledApplications(0); please getInstalledApplications(0) means(flag)</technical_language>

Target:
static boolean isPackageExists(Context context, String targetPackage) { PackageManager pm = context.getPackageManager(); List<ApplicationInfo> packages = pm.getInstalledApplications(0); for (ApplicationInfo packageInfo : packages) { if (packageInfo.packageName.equals(targetPackage)) return true; } return false; }
Source:
<code>public Statement createBootstrapScriptForGroup(String group) { <START> return groupToBootScript.apply(group); <END> }</code><technical_language>Call createBootstrapScriptForGroupAndNodeName(group, null) GroupToBootScript function is changed</technical_language>

Target:
public Statement createBootstrapScriptForGroup(String group) { return groupToBootScript.apply(group, null); }
Source:
<code><START> private Map<String, Map<Long, List<VDS>>> refreshLunSizeAllVds(List<String> luns) { <END> Map<String, Map<Long, List<VDS>>> lunToSize = new HashMap<>(); for (String lun : luns) { Map<Long, List<VDS>> lunSizeToVDs = new HashMap<>(); lunToSize.put(lun, lunSizeToVDs); for (VDS vds : getAllRunningVdssInPool()) { Long size = refreshLun(vds, lun); List<VDS> vdsForSize = lunSizeToVDs.get(size); if (vdsForSize == null) { vdsForSize = new ArrayList<>(); lunSizeToVDs.put(size, vdsForSize); } vdsForSize.add(vds); } } return lunToSize; }</code><technical_language>This method get expected size of lun, vdsm reported in getDeviceList (path capacity). this call host, report hosts do expected size. nee create map of sizes, create map of luns failed hosts</technical_language>

Target:
private Map<String, List<VDS>> refreshLunSizeAllVds(List<String> luns) { Map<String, LUNs> allLuns = getLuns(); Map<String, List<VDS>> lunToVds = new HashMap<>(); for (String lun : luns) { int actualSize = allLuns.get(lun).getDeviceSize(); for (VDS vds : getAllRunningVdssInPool()) { int size = (int) (refreshLun(vds, lun) / SizeConverter.BYTES_IN_GB); if (size != actualSize) { List<VDS> vdsForSize = lunToVds.get(lun); if (vdsForSize == null) { vdsForSize = new ArrayList<>(); lunToVds.put(lun, vdsForSize); } vdsForSize.add(vds); } } } return lunToVds; }
Source:
<code>public Array<Array<T>> permutations() { <START> final Array<T> src = distinct(); <END> if (src.isEmpty()) { return Array.empty(); } else if (src.size() == 1) { return Array.of(src); } else { java.util.List<Array<T>> result = new java.util.ArrayList<>(); int[] pi = new int[src.size()]; for (int i = 0; i < pi.length; i++) { pi[i] = i; } int i, j; while (true) { Object[] next = new Object[src.size()]; for (int k = 0; k < next.length; k++) { next[k] = src.delegate[pi[k]]; } result.add(wrap(next)); i = pi.length - 2; while (i >= 0 && pi[i] > pi[i + 1]) { i--; } if (i < 0) { break; } j = pi.length - 1; while (pi[i] > pi[j]) { j--; } swapIndices(pi, i, j); i++; j = pi.length - 1; while (i < j) { swapIndices(pi, i, j); i++; j--; } } return Array.ofAll(result); } }</code><technical_language>I call distinct() later, in if branch</technical_language>

Target:
public Array<Array<T>> permutations() { if (isEmpty()) { return empty(); } else if (delegate.length == 1) { return of(this); } else { final Array<Array<T>> zero = empty(); return distinct().foldLeft(zero, (xs, x) -> { final Function<Array<T>, Array<T>> prepend = l -> l.prepend(x); return xs.appendAll(remove(x).permutations().map(prepend)); }); } }
Source:
<code>public static <T, R> Subscriber<T> subscribe(Subscriber<? super R> s, Function<? super T, ? extends Publisher<? extends R>> mapper, int prefetch, ErrorMode errorMode) { Subscriber<T> parent = null; switch (errorMode) { case BOUNDARY: <START> parent = new ConcatMapDelayed<T, R>(s, mapper, prefetch, false); <END> break; case END: parent = new ConcatMapDelayed<T, R>(s, mapper, prefetch, true); break; default: parent = new ConcatMapImmediate<T, R>(s, mapper, prefetch); } return parent; }</code><technical_language>return cases avoid local var / null initializer problem</technical_language>

Target:
public static <T, R> Subscriber<T> subscribe(Subscriber<? super R> s, Function<? super T, ? extends Publisher<? extends R>> mapper, int prefetch, ErrorMode errorMode) { switch (errorMode) { case BOUNDARY: return new ConcatMapDelayed<T, R>(s, mapper, prefetch, false); case END: return new ConcatMapDelayed<T, R>(s, mapper, prefetch, true); default: return new ConcatMapImmediate<T, R>(s, mapper, prefetch); } }
Source:
<code>public void visitToken(DetailAST ast) { final DetailAST parametersNode = ast.findFirstToken(TokenTypes.PARAMETERS); if (parametersNode == null <START> && ast.getParent().getType() != TokenTypes.SWITCH_RULE) { <END> super.visitToken(ast); } else if (parametersNode != null) { for (DetailAST parameterDef = parametersNode.getFirstChild(); parameterDef != null; parameterDef = parameterDef.getNextSibling()) { if (parameterDef.getType() == TokenTypes.PARAMETER_DEF) { super.visitToken(parameterDef); } } } }</code><technical_language>Please split this if revert else if. condition easy read. Or, condition inverted: java final DetailAST parametersNode = ast.findFirstToken(TokenTypes.PARAMETERS); if (parametersNode != null) { TokenUtil.forEachChild(parametersNode, TokenTypes.PARAMETER_DEF, super::visitToken); } else if (ast.getParent().getType() != TokenTypes.SWITCH_RULE) { super.visitToken(ast); }</technical_language>

Target:
public void visitToken(DetailAST ast) { final boolean isInSwitchRule = ast.getParent().getType() == TokenTypes.SWITCH_RULE; if (Objects.nonNull(ast.findFirstToken(TokenTypes.PARAMETERS))) { final DetailAST parametersNode = ast.findFirstToken(TokenTypes.PARAMETERS); TokenUtil.forEachChild(parametersNode, TokenTypes.PARAMETER_DEF, super::visitToken); } else if (!isInSwitchRule) { super.visitToken(ast); } }
Source:
<code>public void execute() { <START> duplicateRow(); <END> }</code><technical_language>delegating</technical_language>

Target:
public void execute() { final Setting setting = getActionContext().getSetting(); final EObject eObject = setting.getEObject(); final EStructuralFeature eStructuralFeature = setting.getEStructuralFeature(); final List<?> toDuplicate = Arrays.asList( ((IStructuredSelection) getTableViewer().getSelection()).toArray()); final Collection<Object> copies = copyElements( eObject, eStructuralFeature, getEditingDomainForContainment(), toDuplicate); getTableViewer().setSelection(new StructuredSelection(copies.iterator().next()), true); }
Source:
<code>static ClearPassword parseClearPassword(ConfigurationXMLStreamReader reader) throws ConfigXMLParseException { final int attributeCount = reader.getAttributeCount(); char[] password = null; for (int i = 0; i < attributeCount; i ++) { checkAttributeNamespace(reader, i); if (reader.getAttributeLocalName(i).equals("password")) { password = reader.getAttributeValue(i).toCharArray(); } else { throw reader.unexpectedAttribute(i); } } if (password == null) { throw missingAttribute(reader, "password"); } if (reader.hasNext()) { final int tag = reader.nextTag(); if (tag == START_ELEMENT) { throw reader.unexpectedElement(); } else if (tag == END_ELEMENT) { try { PasswordFactory factory = PasswordFactory.getInstance(ClearPassword.ALGORITHM_CLEAR); <START> return factory.generatePassword(new ClearPasswordSpec(password)).castAs(ClearPassword.class); <END> } catch (InvalidKeySpecException | NoSuchAlgorithmException cause) { throw xmlLog.xmlFailedToCreateCredential(reader.getLocation(), cause); } } else { throw reader.unexpectedContent(); } } throw reader.unexpectedDocumentEnd(); }</code><technical_language>change this, in cases this result null possible, wrap result in Assert.assertNotNull(factory.generatePassword...)</technical_language>

Target:
static ClearPassword parseClearPassword(ConfigurationXMLStreamReader reader) throws ConfigXMLParseException { final int attributeCount = reader.getAttributeCount(); char[] password = null; for (int i = 0; i < attributeCount; i ++) { checkAttributeNamespace(reader, i); if (reader.getAttributeLocalName(i).equals("password")) { password = reader.getAttributeValue(i).toCharArray(); } else { throw reader.unexpectedAttribute(i); } } if (password == null) { throw missingAttribute(reader, "password"); } if (reader.hasNext()) { final int tag = reader.nextTag(); if (tag == START_ELEMENT) { throw reader.unexpectedElement(); } else if (tag == END_ELEMENT) { try { PasswordFactory factory = PasswordFactory.getInstance(ClearPassword.ALGORITHM_CLEAR); return Assert.assertNotNull(factory.generatePassword(new ClearPasswordSpec(password)).castAs(ClearPassword.class)); } catch (InvalidKeySpecException | NoSuchAlgorithmException cause) { throw xmlLog.xmlFailedToCreateCredential(reader.getLocation(), cause); } } else { throw reader.unexpectedContent(); } } throw reader.unexpectedDocumentEnd(); }
Source:
<code>private void readNodeSourceConfigurationFile(HttpServletRequest request, HttpServletResponse response) { response.setContentType("text/html"); try { DiskFileItemFactory factory = new DiskFileItemFactory(); factory.setSizeThreshold(4096); factory.setRepository(new File(System.getProperty("java.io.tmpdir"))); ServletFileUpload upload = new ServletFileUpload(factory); upload.setSizeMax(MAX_UPLOAD_SIZE); List<FileItem> fileItems = upload.parseRequest(request); Iterator<?> i = fileItems.iterator(); while (i.hasNext()) { FileItem item = (FileItem) i.next(); String name = item.getFieldName(); InputStream stream = item.getInputStream(); ByteArrayOutputStream out = new ByteArrayOutputStream(); int len; <START> byte[] buffer = new byte[8192]; <END> while ((len = stream.read(buffer, 0, buffer.length)) != -1) { out.write(buffer, 0, len); } response.getWriter().write(new String(out.toByteArray(), StandardCharsets.UTF_8)); } } catch (Exception e) { handleNodeSourceImportException(response, e); throw new RuntimeException(e); } }</code><technical_language>please extract constant</technical_language>

Target:
private void readNodeSourceConfigurationFile(HttpServletRequest request, HttpServletResponse response) { response.setContentType("text/html"); try { for (FileItem formItem : new ServletRequestTransformer().getFormItems(request)) { try (InputStream in = formItem.getInputStream()) { ByteArrayOutputStream out = new ByteArrayOutputStream(); IOUtils.copy(in, out); response.getWriter().write(new String(out.toByteArray(), StandardCharsets.UTF_8)); } } } catch (Exception e) { handleNodeSourceImportException(response, e); throw new RuntimeException(e); } }
Source:
<code>private void generateXmlTest(XmlTest xmlTest, ITestContext context, Set<ITestResult> failedTests, Set<ITestResult> skippedTests) { if (skippedTests.size() > 0 || failedTests.size() > 0) { Set<ITestNGMethod> methodsToReRun = Sets.newHashSet(); <START> Set<ITestResult> allTests = new HashSet<>(); <END> allTests.addAll(failedTests); allTests.addAll(skippedTests); for (ITestResult failedTest : allTests) { ITestNGMethod current = failedTest.getMethod(); if (! current.isTest()) { continue; } methodsToReRun.add(current); List<ITestNGMethod> methodsDependedUpon = MethodHelper.getMethodsDependedUpon(current, context.getAllTestMethods()); for (ITestNGMethod m : methodsDependedUpon) { if (m.isTest()) { methodsToReRun.add(m); } } } List<ITestNGMethod> result = Lists.newArrayList(); Set<ITestNGMethod> relevantConfigs = Sets.newHashSet(); for (ITestNGMethod m : context.getAllTestMethods()) { if (methodsToReRun.contains(m)) { result.add(m); relevantConfigs.addAll(getAllApplicableConfigs(m.getTestClass())); } } result.addAll(relevantConfigs); createXmlTest(context, result, xmlTest); } }</code><technical_language>A solution avoid a new temp collection add a method call set. change is good is respecting initial architecture :)</technical_language>

Target:
private void generateXmlTest(XmlTest xmlTest, ITestContext context, Set<ITestResult> failedTests, Set<ITestResult> skippedTests) { if (skippedTests.size() > 0 || failedTests.size() > 0) { Set<ITestNGMethod> methodsToReRun = Sets.newHashSet(); Set<ITestResult> allTests = new HashSet<>(); allTests.addAll(failedTests); allTests.addAll(skippedTests); for (ITestResult failedTest : allTests) { ITestNGMethod current = failedTest.getMethod(); if (! current.isTest()) { continue; } methodsToReRun.add(current); List<ITestNGMethod> methodsDependedUpon = MethodHelper.getMethodsDependedUpon(current, context.getAllTestMethods()); for (ITestNGMethod m : methodsDependedUpon) { if (m.isTest()) { methodsToReRun.add(m); } } } List<ITestNGMethod> result = Lists.newArrayList(); Set<ITestNGMethod> relevantConfigs = Sets.newHashSet(); for (ITestNGMethod m : context.getAllTestMethods()) { if (methodsToReRun.contains(m)) { result.add(m); getAllApplicableConfigs(relevantConfigs, m.getTestClass()); } } result.addAll(relevantConfigs); createXmlTest(context, result, xmlTest); } }
Source:
<code>default boolean isCreated() { if (getContainerId() == null) { return false; } try { Boolean created = getCurrentContainerInfo().getState().getStatus().equalsIgnoreCase("Created"); <START> return Boolean.TRUE.equals(created); <END> } catch (DockerException e) { return false; } }</code><technical_language>In isRunning method result of getRunning() is a nullable Boolean, is do TRUE.equals call in method. Here, equalsIgnoreCase returns a primitive boolean, further, getStatus() return null. such, I safer replace lines with: return "created".equalsIgnoreCase(getCurrentContainerInfo().getState().getStatus()); Please do instead</technical_language>

Target:
default boolean isCreated() { if (getContainerId() == null) { return false; } try { String status = getCurrentContainerInfo().getState().getStatus(); return "created".equalsIgnoreCase(status) || isRunning(); } catch (DockerException e) { return false; } }
Source:
<code>public void onBuildComplete(AbstractBuild<?, ?> build, TaskListener listener, GHRepository repo) throws GhprbCommitStatusException { List<GhprbBuildResultMessage> completedStatus = getDescriptor().getCompletedStatusDefault(this); boolean showMatrixStatus = getDescriptor().getShowMatrixStatusDefault(this); GHCommitState state = Ghprb.getState(build); StringBuilder sb = new StringBuilder(); if (completedStatus == null || completedStatus.isEmpty()) { sb.append("Build finished."); } else { for (GhprbBuildResultMessage buildStatus : completedStatus) { sb.append(buildStatus.postBuildComment(build, listener)); } if (StringUtils.equals(sb.toString(), "--none--")) { return; } } sb.append(" "); GhprbTrigger trigger = Ghprb.extractTrigger(build); if (trigger == null) { listener.getLogger().println("Unable to get pull request builder trigger!!"); } else { JobConfiguration jobConfiguration = JobConfiguration.builder() .printStackTrace(trigger.getDisplayBuildErrorsOnDownstreamBuilds()).build(); GhprbBuildManager buildManager = GhprbBuildManagerFactoryUtil.getBuildManager(build, jobConfiguration); if (getAddTestResults()) { sb.append(buildManager.getOneLineTestResults()); } } <START> if((showMatrixStatus && build.getProject() instanceof MatrixProject)){ <END> return; } createCommitStatus(build, listener, sb.toString(), repo, state); }</code><technical_language>this !showMatrixStatus &&? need set of parentheses</technical_language>

Target:
public void onBuildComplete(AbstractBuild<?, ?> build, TaskListener listener, GHRepository repo) throws GhprbCommitStatusException { List<GhprbBuildResultMessage> completedStatus = getDescriptor().getCompletedStatusDefault(this); boolean showMatrixStatus = getDescriptor().getShowMatrixStatusDefault(this); GHCommitState state = Ghprb.getState(build); StringBuilder sb = new StringBuilder(); if (completedStatus == null || completedStatus.isEmpty()) { sb.append("Build finished."); } else { for (GhprbBuildResultMessage buildStatus : completedStatus) { sb.append(buildStatus.postBuildComment(build, listener)); } if (StringUtils.equals(sb.toString(), "--none--")) { return; } } sb.append(" "); GhprbTrigger trigger = Ghprb.extractTrigger(build); if (trigger == null) { listener.getLogger().println("Unable to get pull request builder trigger!!"); } else { JobConfiguration jobConfiguration = JobConfiguration.builder() .printStackTrace(trigger.getDisplayBuildErrorsOnDownstreamBuilds()).build(); GhprbBuildManager buildManager = GhprbBuildManagerFactoryUtil.getBuildManager(build, jobConfiguration); if (getAddTestResults()) { sb.append(buildManager.getOneLineTestResults()); } } if(showMatrixStatus && !(build.getProject() instanceof MatrixProject)){ return; } createCommitStatus(build, listener, sb.toString(), repo, state); }
Source:
<code>public double estimateRemainingWeight (State s) { final Vertex v = s.getVertex(); <START> if (v instanceof StreetLocation || v instanceof TemporaryVertex) { <END> return 0; } else if (v instanceof TransitVertex) { double h = transitVertexWeights.get(v); if (h == Double.POSITIVE_INFINITY) { return maxWeightSeen; } else { return h; } } else if (!s.isEverBoarded() && preTransitVertices.containsKey(v)) { VertexModeWeight weight = preTransitVertices.get(v); TraverseMode nonTransitMode = s.getNonTransitMode(); if (nonTransitMode != null && nonTransitMode.isDriving()) { return weight.carWeight == Double.POSITIVE_INFINITY ? Double.POSITIVE_INFINITY : 0; } else { return weight.walkWeight == Double.POSITIVE_INFINITY ? Double.POSITIVE_INFINITY : 0; } } else if (s.isEverBoarded() && postTransitVertices.containsKey(v)) { VertexModeWeight weight = postTransitVertices.get(v); TraverseMode nonTransitMode = s.getNonTransitMode(); if (nonTransitMode != null && nonTransitMode.isDriving()) { return weight.carWeight; } else { return weight.walkWeight; } } return Double.POSITIVE_INFINITY; }</code><technical_language>I helped @abyrd understand this part elaborate this check replaces instanceof checks earlier. For example, BikeRentalStationVertex isnt a TemporaryVertex is always(?) TemporaryVertex linked this work</technical_language>

Target:
public double estimateRemainingWeight (State s) { final Vertex v = s.getVertex(); if (v instanceof TransitVertex) { double h = transitVertexWeights.get(v); if (h == Double.POSITIVE_INFINITY) { return maxWeightSeen; } else { return h; } } else if (v instanceof StreetLocation || v instanceof TemporaryVertex) { return 0; } else if (!s.isEverBoarded() && preTransitVertices.containsKey(v)) { VertexModeWeight weight = preTransitVertices.get(v); TraverseMode nonTransitMode = s.getNonTransitMode(); if (nonTransitMode != null && nonTransitMode.isDriving()) { return getPreTransitRemainingWeightEstimate(v, weight.carWeight); } else { return getPreTransitRemainingWeightEstimate(v, weight.walkWeight); } } else if (s.isEverBoarded() && postTransitVertices.containsKey(v)) { VertexModeWeight weight = postTransitVertices.get(v); TraverseMode nonTransitMode = s.getNonTransitMode(); if (nonTransitMode != null && nonTransitMode.isDriving()) { return weight.carWeight; } else { return weight.walkWeight; } } return Double.POSITIVE_INFINITY; }
Source:
<code>public void loggedInUserCanVoteOnceInPollOnDesktop() { Poll poll = new PostsListPage().open().getPost().clickNthPostWithPoll(0).getPoll(); <START> Assert.assertTrue(poll.getAnswersRadioButtonsList().size() > 0); <END> poll.clickNthAnswer(0); poll.clickNthAnswer(1); poll.clickVoteButton(); Assert.assertTrue(poll.isChosenResultBarDisplayed()); Assert.assertTrue(poll.getBarResultsList().size() > 0); Assert.assertTrue(poll.isAlreadyVotedMessageVisible()); }</code><technical_language>need check for poll validity in this test - this verify voting part</technical_language>

Target:
public void loggedInUserCanVoteOnceInPollOnDesktop() { Poll poll = new PostsListPage().open().getPost().clickNthPostWithPoll(0).getPoll(); poll.clickNthAnswer(0); poll.clickVoteButton(); Assert.assertTrue(poll.isChosenResultBarDisplayed()); Assert.assertTrue(poll.getBarResultsList().size() > 0); Assert.assertTrue(poll.isAlreadyVotedMessageVisible()); }
Source:
<code>private void populateFilters() { this.testingCheck = new SidebarCheckBox(tr("Testing")); this.testingCheck.selectedProperty().bindBidirectional(filter.containTestingApplicationsProperty()); this.requiresPatchCheck = new SidebarCheckBox(tr("Patch required")); this.requiresPatchCheck.selectedProperty().bindBidirectional(filter.containRequiresPatchApplicationsProperty()); this.commercialCheck = new SidebarCheckBox(tr("Commercial")); this.commercialCheck.selectedProperty().bindBidirectional(filter.containCommercialApplicationsProperty()); this.commercialCheck.setSelected(true); this.operatingSystemCheck = new SidebarCheckBox(tr("All Operating Systems")); this.operatingSystemCheck.selectedProperty().bindBidirectional(filter.containAllOSCompatibleApplications()); this.operatingSystemCheck.setSelected(false); <START> this.filterGroup = new SidebarGroup<>("Filters"); <END> this.filterGroup.getComponents() .addAll(testingCheck, requiresPatchCheck, commercialCheck, operatingSystemCheck); }</code><technical_language>this translated</technical_language>

Target:
private void populateFilters() { this.testingCheck = new SidebarCheckBox(tr("Testing")); this.testingCheck.selectedProperty().bindBidirectional(filter.containTestingApplicationsProperty()); this.requiresPatchCheck = new SidebarCheckBox(tr("Patch required")); this.requiresPatchCheck.selectedProperty().bindBidirectional(filter.containRequiresPatchApplicationsProperty()); this.commercialCheck = new SidebarCheckBox(tr("Commercial")); this.commercialCheck.selectedProperty().bindBidirectional(filter.containCommercialApplicationsProperty()); this.commercialCheck.setSelected(true); this.operatingSystemCheck = new SidebarCheckBox(tr("All Operating Systems")); this.operatingSystemCheck.selectedProperty().bindBidirectional(filter.containAllOSCompatibleApplications()); this.operatingSystemCheck.setSelected(false); this.filterGroup = new SidebarGroup<>(tr("Filters")); this.filterGroup.getComponents() .addAll(testingCheck, requiresPatchCheck, commercialCheck, operatingSystemCheck); }
Source:
<code>static final URI hrefToUri(String href) { try { return new URI(href); } catch (URISyntaxException e) { <START> throw new IllegalArgumentException(e.getMessage(), e); <END> } }</code><technical_language>Please add error message</technical_language>

Target:
public static final URI hrefToUri(String href) { try { return new URI(href); } catch (URISyntaxException e) { throw new IllegalArgumentException("Erroneous URI: \"" + href + "\" (" + e.getMessage() + ')', e); } }
Source:
<code>public InferredType type() { <START> return ((SymbolImpl) symbol).inferredType(); <END> }</code><technical_language>I symbol null here</technical_language>

Target:
public InferredType type() { if (symbol == null) { return InferredTypes.anyType(); } return ((SymbolImpl) symbol).inferredType(); }
Source:
<code>private Journal findJournal(String journalKey) { return (Journal) DataAccessUtils.uniqueResult( hibernateTemplate.findByCriteria(DetachedCriteria .forClass(Journal.class) .add(Restrictions.eq("journalKey", journalKey)) .setResultTransformer(Criteria.DISTINCT_ROOT_ENTITY) <START> )); <END> }</code><technical_language>Please unify this getJournal in class</technical_language>

Target:
public Journal findJournal(String journalKey) { Journal journal = (Journal) DataAccessUtils.singleResult((List<?>) hibernateTemplate.findByCriteria(journalCriteria() .add(Restrictions.eq("journalKey", journalKey)) )); if (journal == null) { throw new RestClientException(journalNotFoundMessage(journalKey), HttpStatus.NOT_FOUND); } return journal; }
Source:
<code>private static void checkValidJoins(Collection<Node> g) { @SuppressWarnings("checkstyle:AbbreviationAsWordInName") <START> boolean hasDRPCSpout = false; <END> boolean hasBatchSpout = false; for (Node n : g) { if (n instanceof SpoutNode) { SpoutNode.SpoutType type = ((SpoutNode) n).type; if (type == SpoutNode.SpoutType.BATCH) { hasBatchSpout = true; } else if (type == SpoutNode.SpoutType.DRPC) { hasDRPCSpout = true; } } } if (hasBatchSpout && hasDRPCSpout) { throw new RuntimeException("Cannot join DRPC stream with streams originating from other spouts"); } }</code><technical_language>rename</technical_language>

Target:
private static void checkValidJoins(Collection<Node> g) { boolean hasDrpcSpout = false; boolean hasBatchSpout = false; for (Node n : g) { if (n instanceof SpoutNode) { SpoutNode.SpoutType type = ((SpoutNode) n).type; if (type == SpoutNode.SpoutType.BATCH) { hasBatchSpout = true; } else if (type == SpoutNode.SpoutType.DRPC) { hasDrpcSpout = true; } } } if (hasBatchSpout && hasDrpcSpout) { throw new RuntimeException("Cannot join DRPC stream with streams originating from other spouts"); } }