auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public void init(IWorkbench workbench, IStructuredSelection currentSelection) { this.selection = currentSelection; List<?> selectedResources = IDE.computeSelectedResources(currentSelection); if (!selectedResources.isEmpty()) { this.selection = new StructuredSelection(selectedResources); } if (selection.isEmpty() && workbench.getActiveWorkbenchWindow() != null) { IWorkbenchPage page = workbench.getActiveWorkbenchWindow() .getActivePage(); if (page != null) { IEditorPart currentEditor = page.getActiveEditor(); if (currentEditor != null) { Object selectedResource = <START> Adapters.getAdapter(currentEditor, IResource.class, <END> true); if (selectedResource != null) { selection = new StructuredSelection(selectedResource); } } } } setWindowTitle(DataTransferMessages.DataTransfer_export); setDefaultPageImageDescriptor(IDEWorkbenchPlugin.getIDEImageDescriptor("wizban/exportdir_wiz.png")); setNeedsProgressMonitor(true); }</code><technical_language>this currentEditor.getEditorInput() instead of currentEditor</technical_language>

Target:
public void init(IWorkbench workbench, IStructuredSelection currentSelection) { this.selection = currentSelection; List<?> selectedResources = IDE.computeSelectedResources(currentSelection); if (!selectedResources.isEmpty()) { this.selection = new StructuredSelection(selectedResources); } if (selection.isEmpty() && workbench.getActiveWorkbenchWindow() != null) { IWorkbenchPage page = workbench.getActiveWorkbenchWindow() .getActivePage(); if (page != null) { IEditorPart currentEditor = page.getActiveEditor(); if (currentEditor != null) { Object selectedResource = Adapters.getAdapter(currentEditor.getEditorInput(), IResource.class, true); if (selectedResource != null) { selection = new StructuredSelection(selectedResource); } } } } setWindowTitle(DataTransferMessages.DataTransfer_export); setDefaultPageImageDescriptor(IDEWorkbenchPlugin.getIDEImageDescriptor("wizban/exportdir_wiz.png")); setNeedsProgressMonitor(true); }
Source:
<code>public void add(T pair) { if (!pairs.contains(pair)) { pairs.add(pair); } <START> if (!cleared) { <END> cleared = false; } }</code><technical_language>java if (cleared) { want set flag if List empty no</technical_language>

Target:
public void add(T pair) { if (!pairs.contains(pair)) { pairs.add(pair); } if (cleared) { cleared = false; } }
Source:
<code>public String toString() { return "TcpStat {sent=" + sent + <START> " received=" <END> + received + " lost=" + lost + " retransmit=" + retransmit + "}"; }</code><technical_language>nit: Do want add a comma SocketInfo#toString()</technical_language>

Target:
public String toString() { return "TcpStat {sent=" + nSent + ", received=" + nReceived + ", lost=" + nLost + ", retransmit=" + nRetransmit + "}"; }
Source:
<code>public void clickFanomArticleCard() { <START> fandomArticleCard.click(); <END> }</code><technical_language>wait.forElementClickable()</technical_language>

Target:
public FandomPageObject clickFanomArticleCard() { wait.forElementClickable(fandomArticleCard); fandomArticleCard.click(); return new FandomPageObject(); }
Source:
<code>private void onLeadershipAcquire() { switch (localClusterDescriptor.getRole()) { case ACTIVE: log.info("Start as Source (sender/replicator)"); if (replicationManager == null) { replicationManager = new CorfuReplicationManager(replicationContext, localNodeDescriptor, logReplicationMetadataManager, serverContext.getPluginConfigFilePath(), getCorfuRuntime()); } replicationManager.setTopology(topologyDescriptor); replicationManager.start(); break; case STANDBY: log.info("Start as Sink (receiver)"); interClusterReplicationService.getLogReplicationServer().setLeadership(true); <START> interClusterReplicationService.getLogReplicationServer().getSinkManager().reset(); <END> break; default: log.error("Log Replication not started on this cluster. Leader node belongs to cluster with role.", localEndpoint, localClusterDescriptor.getRole()); break; } }</code><technical_language>this reset negotiation? imagine case lost lock for a short period a long period writes progress, lastProcessSequence is valid continue point onwards</technical_language>

Target:
private void onLeadershipAcquire() { switch (localClusterDescriptor.getRole()) { case ACTIVE: log.info("Start as Source (sender/replicator)"); if (replicationManager == null) { replicationManager = new CorfuReplicationManager(replicationContext, localNodeDescriptor, logReplicationMetadataManager, serverContext.getPluginConfigFilePath(), getCorfuRuntime()); } replicationManager.setTopology(topologyDescriptor); replicationManager.start(); break; case STANDBY: log.info("Start as Sink (receiver)"); interClusterReplicationService.getLogReplicationServer().setLeadership(true); break; default: log.error("Log Replication not started on this cluster. Leader node belongs to cluster with role.", localEndpoint, localClusterDescriptor.getRole()); break; } }
Source:
<code>public void testDecrementNonJavaProject() throws CoreException, InvocationTargetException, InterruptedException { IFile file = nonJavaProject.getProject().getFile("foo.txt"); file.create(null, true, null); ResourceStructureBridge bridge = new ResourceStructureBridge(); <START> ResourceInteractionMonitor interactMonitor = new ResourceInteractionMonitor(); <END> interactMonitor.selectionChanged(part, new StructuredSelection(file)); IInteractionElement fileElement = ContextCore.getContextManager().getElement(bridge.getHandleIdentifier(file)); IInteractionElement projectElement = ContextCore.getContextManager().getElement( new ResourceStructureBridge().getHandleIdentifier(nonJavaProject.getProject())); assertTrue(fileElement.getInterest().isInteresting()); assertTrue(projectElement.getInterest().isInteresting()); assertTrue(ContextCorePlugin.getContextManager().manipulateInterestForElement(projectElement, false, false, false, "test")); projectElement = ContextCore.getContextManager().getElement( new ResourceStructureBridge().getHandleIdentifier(nonJavaProject.getProject())); fileElement = ContextCore.getContextManager().getElement(bridge.getHandleIdentifier(file)); assertFalse(projectElement.getInterest().isInteresting()); assertFalse(fileElement.getInterest().isInteresting()); interactMonitor.dispose(); }</code><technical_language>this a field call dispose in tearDown called if test fails</technical_language>

Target:
public void testDecrementNonJavaProject() throws CoreException, InvocationTargetException, InterruptedException { IFile file = nonJavaProject.getProject().getFile("foo.txt"); file.create(null, true, null); ResourceStructureBridge bridge = new ResourceStructureBridge(); resourceMonitor.selectionChanged(part, new StructuredSelection(file)); IInteractionElement fileElement = ContextCore.getContextManager().getElement(bridge.getHandleIdentifier(file)); IInteractionElement projectElement = ContextCore.getContextManager().getElement( new ResourceStructureBridge().getHandleIdentifier(nonJavaProject.getProject())); assertTrue(fileElement.getInterest().isInteresting()); assertTrue(projectElement.getInterest().isInteresting()); assertTrue(ContextCorePlugin.getContextManager().manipulateInterestForElement(projectElement, false, false, false, "test")); projectElement = ContextCore.getContextManager().getElement( new ResourceStructureBridge().getHandleIdentifier(nonJavaProject.getProject())); fileElement = ContextCore.getContextManager().getElement(bridge.getHandleIdentifier(file)); assertFalse(projectElement.getInterest().isInteresting()); assertFalse(fileElement.getInterest().isInteresting()); }
Source:
<code>public void onVisitorDrop(final PlayerDropItemEvent e) { if (DEBUG) { plugin.getLogger().info(e.getEventName()); } if (!IslandGuard.inWorld(e.getPlayer())) { return; } if (plugin.getGrid().isAtSpawn(e.getItemDrop().getLocation())) { if (Settings.allowSpawnVisitorItemDrop || e.getPlayer().isOp() || VaultHelper.checkPerm(e.getPlayer(), Settings.PERMPREFIX + "mod.bypassprotect") || plugin.getGrid().locationIsOnIsland(e.getPlayer(), e.getItemDrop().getLocation())) { return; } } <START> if (plugin.getGrid().getIslandAt(e.getItemDrop().getLocation()).getIgsFlag(Flags.allowVisitorItemDrop) || e.getPlayer().isOp() || VaultHelper.checkPerm(e.getPlayer(), Settings.PERMPREFIX + "mod.bypassprotect") <END> || plugin.getGrid().locationIsOnIsland(e.getPlayer(), e.getItemDrop().getLocation())) { return; } e.getPlayer().sendMessage(ChatColor.RED + plugin.myLocale(e.getPlayer().getUniqueId()).islandProtected); e.setCancelled(true); }</code><technical_language>null check required</technical_language>

Target:
public void onVisitorDrop(final PlayerDropItemEvent e) { if (DEBUG) { plugin.getLogger().info(e.getEventName()); } if (!IslandGuard.inWorld(e.getPlayer())) { return; } if (plugin.getGrid().isAtSpawn(e.getItemDrop().getLocation())) { if (Settings.allowSpawnVisitorItemDrop || e.getPlayer().isOp() || VaultHelper.checkPerm(e.getPlayer(), Settings.PERMPREFIX + "mod.bypassprotect") || plugin.getGrid().locationIsOnIsland(e.getPlayer(), e.getItemDrop().getLocation())) { return; } } if ((plugin.getGrid().getIslandAt(e.getItemDrop().getLocation()) != null && plugin.getGrid().getIslandAt(e.getItemDrop().getLocation()).getIgsFlag(Flags.allowVisitorItemDrop)) || e.getPlayer().isOp() || VaultHelper.checkPerm(e.getPlayer(), Settings.PERMPREFIX + "mod.bypassprotect") || plugin.getGrid().locationIsOnIsland(e.getPlayer(), e.getItemDrop().getLocation())) { return; } e.getPlayer().sendMessage(ChatColor.RED + plugin.myLocale(e.getPlayer().getUniqueId()).islandProtected); e.setCancelled(true); }
Source:
<code>private String getAzureSubnetToUseWithPrivateEndpoint(DetailedEnvironmentResponse detailedEnvironmentResponse, DBStack dbStack) { String subscriptionId = subnetListerService.getAzureSubscriptionId(detailedEnvironmentResponse.getCrn()); return subnetChooserService.chooseSubnetForPrivateEndpoint( detailedEnvironmentResponse.getNetwork().getSubnetMetas().values(), dbStack, detailedEnvironmentResponse.getNetwork().isExistingNetwork()) .stream() .findFirst() .map(csn -> subnetListerService.expandAzureResourceId(csn, detailedEnvironmentResponse, subscriptionId)) <START> .map(sn -> sn.getId()).orElse(null); <END> }</code><technical_language>if is handled if return is "null"</technical_language>

Target:
private String getAzureSubnetToUseWithPrivateEndpoint(DetailedEnvironmentResponse detailedEnvironmentResponse, DBStack dbStack) { String subscriptionId = subnetListerService.getAzureSubscriptionId(detailedEnvironmentResponse.getCrn()); return subnetChooserService.chooseSubnetForPrivateEndpoint( detailedEnvironmentResponse.getNetwork().getSubnetMetas().values(), dbStack, detailedEnvironmentResponse.getNetwork().isExistingNetwork()) .stream() .findFirst() .map(csn -> subnetListerService.expandAzureResourceId(csn, detailedEnvironmentResponse, subscriptionId)) .map(sn -> sn.getId()).orElseThrow(() -> new RedbeamsException("It is not possible to create private endpoints for database: " + "there are no subnets with privateEndpointNetworkPolicies disabled")); }
Source:
<code>private VendorAddress findVendorAddress(DisbursementVoucherPaymentInformationXml paymentInfo) { Collection<VendorAddress> vendorAddresses; try { String[] payeeArray = StringUtils.split(paymentInfo.getPayeeId(), KFSConstants.DASH); if (LOG.isInfoEnabled()) { LOG.info("findVendorAddress, vendorHeaderGeneratedIdentifier: " + payeeArray[0] + " vendorDetailAssignedIdentifier: " + payeeArray[1] + ", payee address id: " + paymentInfo.getPayeeAddressId()); } Map<String, String> fieldValues = new HashMap<String, String>(); fieldValues.put(KFSPropertyConstants.VENDOR_HEADER_GENERATED_ID, payeeArray[0]); fieldValues.put(KFSPropertyConstants.VENDOR_DETAIL_ASSIGNED_ID, payeeArray[1]); fieldValues.put(KFSPropertyConstants.VENDOR_ADDRESS_GENERATED_ID, paymentInfo.getPayeeAddressId()); fieldValues.put(KFSPropertyConstants.ACCOUNT_ACTIVE_INDICATOR, KFSConstants.ACTIVE_INDICATOR); vendorAddresses = businessObjectService.findMatching(VendorAddress.class, fieldValues); <START> } catch (Throwable e) { <END> LOG.error("findVendorAddress, there was an error attempting to find the vendor address", e); throw new ValidationException("Unable to find the vendor address: " + e.getMessage()); } if (CollectionUtils.isEmpty(vendorAddresses)) { throw new ValidationException("Unable to find a vendor address for vendor number " + paymentInfo.getPayeeId() + " and vendor address id " + paymentInfo.getPayeeAddressId()); } VendorAddress address = vendorAddresses.iterator().next(); return address; }</code><technical_language>Is catching a Throwable broad? this capture Exception instead</technical_language>

Target:
private VendorAddress findVendorAddress(DisbursementVoucherPaymentInformationXml paymentInfo) { Collection<VendorAddress> vendorAddresses; try { String[] payeeArray = StringUtils.split(paymentInfo.getPayeeId(), KFSConstants.DASH); if (LOG.isInfoEnabled()) { LOG.info("findVendorAddress, vendorHeaderGeneratedIdentifier: " + payeeArray[0] + " vendorDetailAssignedIdentifier: " + payeeArray[1] + ", payee address id: " + paymentInfo.getPayeeAddressId()); } Map<String, String> fieldValues = new HashMap<String, String>(); fieldValues.put(KFSPropertyConstants.VENDOR_HEADER_GENERATED_ID, payeeArray[0]); fieldValues.put(KFSPropertyConstants.VENDOR_DETAIL_ASSIGNED_ID, payeeArray[1]); fieldValues.put(KFSPropertyConstants.VENDOR_ADDRESS_GENERATED_ID, paymentInfo.getPayeeAddressId()); fieldValues.put(KFSPropertyConstants.ACCOUNT_ACTIVE_INDICATOR, KFSConstants.ACTIVE_INDICATOR); vendorAddresses = businessObjectService.findMatching(VendorAddress.class, fieldValues); } catch (Exception e) { LOG.error("findVendorAddress, there was an error attempting to find the vendor address", e); throw new ValidationException("Unable to find the vendor address: " + e.getMessage()); } if (CollectionUtils.isEmpty(vendorAddresses)) { throw new ValidationException("Unable to find a vendor address for vendor number " + paymentInfo.getPayeeId() + " and vendor address id " + paymentInfo.getPayeeAddressId()); } VendorAddress address = vendorAddresses.iterator().next(); return address; }
Source:
<code>File getStateFile() { <START> return new File(Jenkins.getInstance().getRootDir(),"last_upgrade_version"); <END> }</code><technical_language>jenkins.install.UpgradeWizard.state</technical_language>

Target:
File getStateFile() { return new File(Jenkins.getInstance().getRootDir(),"jenkins.install.UpgradeWizard.state"); }
Source:
<code>public PartitionCreator withName(String name){ <START> return withName(name, 0); <END> }</code><technical_language>constant</technical_language>

Target:
public PartitionCreator withName(String name){ return withName(name, Conglomerate.Priority.NORMAL); }
Source:
<code>public String render(Integer mtu) { <START> return mtu == null || mtu == 0 ? messages.defaultMtu(defaultMtu) : mtu.toString(); <END> }</code><technical_language>Null possible, it</technical_language>

Target:
public String render(Integer mtu) { return mtu == 0 ? messages.defaultMtu(defaultMtu) : mtu.toString(); }
Source:
<code>public Response getUiCount(@QueryParam("branchUuid") long branchUuid) throws OseeCoreException { List<ChangeItem> changes = getChanges(branchUuid); Set<Long> newArts = new HashSet<Long>(); Set<Long> modArts = new HashSet<Long>(); Set<Long> deletedArts = new HashSet<Long>(); Set<Long> types = new HashSet<Long>(); for (ChangeItem c : changes) { types.add(c.getItemTypeId()); } Map<Integer, Pair<ChangeItem, Set<ChangeItem>>> artToChanges = new HashMap<Integer, Pair<ChangeItem, Set<ChangeItem>>>(); buildArtIdToChangeMap(changes, artToChanges); buildLists(artToChanges, newArts, modArts, deletedArts); final UICountWriter writer = new UICountWriter(orcsApi); <START> final String fileName = String.format("STRS_Report_%s", System.currentTimeMillis()); <END> StreamingOutput streamingOutput = new StreamingOutput() { @Override public void write(OutputStream outputStream) throws WebApplicationException, IOException { writer.write(branchUuid, newArts, modArts, deletedArts, outputStream); outputStream.flush(); } }; String contentDisposition = String.format("attachment; filename=\"%s.xml\"; creation-date=\"%s\"", fileName, new Date()); return Response.ok(streamingOutput).header("Content-Disposition", contentDisposition).type("application/xml").build(); }</code><technical_language>Is this right file name for this report</technical_language>

Target:
public Response getUiCount(@QueryParam("branchUuid") long branchUuid) throws OseeCoreException { List<ChangeItem> changes = getChanges(branchUuid); Set<Long> newArts = new HashSet<Long>(); Set<Long> modArts = new HashSet<Long>(); Set<Long> deletedArts = new HashSet<Long>(); Set<Long> types = new HashSet<Long>(); for (ChangeItem c : changes) { types.add(c.getItemTypeId()); } Map<Integer, Pair<ChangeItem, Set<ChangeItem>>> artToChanges = new HashMap<Integer, Pair<ChangeItem, Set<ChangeItem>>>(); buildArtIdToChangeMap(changes, artToChanges); buildLists(artToChanges, newArts, modArts, deletedArts); final UICountWriter writer = new UICountWriter(orcsApi); final String fileName = String.format("UI_Couunt_Report_%s", System.currentTimeMillis()); StreamingOutput streamingOutput = new StreamingOutput() { @Override public void write(OutputStream outputStream) throws WebApplicationException, IOException { writer.write(branchUuid, newArts, modArts, deletedArts, outputStream); outputStream.flush(); } }; String contentDisposition = String.format("attachment; filename=\"%s.xml\"; creation-date=\"%s\"", fileName, new Date()); return Response.ok(streamingOutput).header("Content-Disposition", contentDisposition).type("application/xml").build(); }
Source:
<code>private void setupConsentEmailChangeTest(String originalEmail, String newEmail, boolean shouldBeChanged, boolean expectedSendEmail) { reset(sendMailService); Study original = TestUtils.getValidStudy(StudyServiceMockTest.class); original.setConsentNotificationEmail(originalEmail); when(studyDao.getStudy(any())).thenReturn(original); Study update = TestUtils.getValidStudy(StudyServiceMockTest.class); update.setConsentNotificationEmail(newEmail); update.setConsentNotificationEmailVerified(true); service.updateStudy(update, true); if (shouldBeChanged && expectedSendEmail) { <START> verify(sendMailService).sendEmail(any()); <END> } else { verify(sendMailService, never()).sendEmail(any()); } if (shouldBeChanged) { assertFalse(update.isConsentNotificationEmailVerified()); } else { assertTrue(update.isConsentNotificationEmailVerified()); } }</code><technical_language>This test key expectedSendEmail. If get a case shouldBeChanged=false expectedSendEmail=true, means incorrect assumption somewhere</technical_language>

Target:
private void setupConsentEmailChangeTest(String originalEmail, String newEmail, boolean shouldBeChanged, boolean expectedSendEmail) { reset(sendMailService); Study original = TestUtils.getValidStudy(StudyServiceMockTest.class); original.setConsentNotificationEmail(originalEmail); when(studyDao.getStudy(any())).thenReturn(original); Study update = TestUtils.getValidStudy(StudyServiceMockTest.class); update.setConsentNotificationEmail(newEmail); update.setConsentNotificationEmailVerified(true); service.updateStudy(update, true); if (expectedSendEmail) { verify(sendMailService).sendEmail(any()); } else { verify(sendMailService, never()).sendEmail(any()); } if (shouldBeChanged) { assertFalse(update.isConsentNotificationEmailVerified()); } else { assertTrue(update.isConsentNotificationEmailVerified()); } }
Source:
<code>public static boolean[] getBits(int value) { String zeroBitString = String.format("%0" + 8 + 'd', 0); String binaryString = Integer.toBinaryString(value); binaryString = zeroBitString.substring(binaryString.length()) + binaryString; boolean[] bits = new boolean[8]; for (int pos = 7; pos > 0; pos--) { bits[7 - pos] = binaryString.substring(pos, pos + 1) .equalsIgnoreCase("1") ? true : false; } for (boolean bit : bits) { String b = bit == true ? "1" : "0"; <START> System.out.print(b); <END> } return bits; }</code><technical_language>Please remove System.out implement proper (Debug)Logging instead</technical_language>

Target:
public static boolean[] getBits(int value) { String zeroBitString = String.format("%0" + 8 + 'd', 0); String binaryString = Integer.toBinaryString(value); binaryString = zeroBitString.substring(binaryString.length()) + binaryString; boolean[] bits = new boolean[8]; for (int pos = 7; pos > 0; pos--) { bits[7 - pos] = binaryString.substring(pos, pos + 1) .equalsIgnoreCase("1") ? true : false; } for (boolean bit : bits) { String b = bit == true ? "1" : "0"; } return bits; }
Source:
<code>public void onReceive(Context context, Intent intent) { ProvisionLogger.logd("ACTION_PROFILE_PROVISIONING_COMPLETE broadcast received by mdm"); final Intent primaryProfileSuccessIntent = new Intent(ACTION_MANAGED_PROFILE_PROVISIONED); primaryProfileSuccessIntent.setPackage(mMdmPackageName); primaryProfileSuccessIntent.addFlags(Intent.FLAG_INCLUDE_STOPPED_PACKAGES | Intent.FLAG_RECEIVER_FOREGROUND); primaryProfileSuccessIntent.putExtra(Intent.EXTRA_USER, mManagedUserHandle); if (mMigratedAccount != null) { primaryProfileSuccessIntent.putExtra(EXTRA_PROVISIONING_ACCOUNT_TO_MIGRATE, mMigratedAccount); <START> finishAccountMigration(context, primaryProfileSuccessIntent); <END> } else { context.sendBroadcast(primaryProfileSuccessIntent); } ProvisioningManager.getInstance(context).finalizationCompleted(); }</code><technical_language>finishAccountMigration is async, stop service finishAccountMigration is done broadcast is sent</technical_language>

Target:
public void onReceive(Context context, Intent intent) { ProvisionLogger.logd("ACTION_PROFILE_PROVISIONING_COMPLETE broadcast received by mdm"); final Intent primaryProfileSuccessIntent = new Intent(ACTION_MANAGED_PROFILE_PROVISIONED); primaryProfileSuccessIntent.setPackage(mMdmPackageName); primaryProfileSuccessIntent.addFlags(Intent.FLAG_INCLUDE_STOPPED_PACKAGES | Intent.FLAG_RECEIVER_FOREGROUND); primaryProfileSuccessIntent.putExtra(Intent.EXTRA_USER, mManagedUserHandle); if (mMigratedAccount != null) { primaryProfileSuccessIntent.putExtra(EXTRA_PROVISIONING_ACCOUNT_TO_MIGRATE, mMigratedAccount); finishAccountMigration(context, primaryProfileSuccessIntent); } else { context.sendBroadcast(primaryProfileSuccessIntent); ProvisioningManager.getInstance(context).finalizationCompleted(); } }
Source:
<code>public void childEvent(CuratorFramework client, PathChildrenCacheEvent event) throws Exception { final ChildData child = event.getData(); if (child == null) { return; } final ContainerHolder holder = containers.get(containerKey); if (holder == null) { return; } final String inventoryKey = ZKPaths.getNodeFromPath(child.getPath()); <START> if (inventoryKey == null) { <END> return; } switch (event.getType()) { case CHILD_ADDED: case CHILD_UPDATED: final InventoryClass inventory = strategy.deserializeInventory(child.getData()); synchronized (holder) { holder.setContainer(strategy.addInventory(holder.getContainer(), inventoryKey, inventory)); } break; case CHILD_REMOVED: synchronized (holder) { holder.setContainer(strategy.removeInventory(holder.getContainer(), inventoryKey)); } break; } }</code><technical_language>I ZKPaths.getNodeFromPath() return null, bug is this fixing</technical_language>

Target:
public void childEvent(CuratorFramework client, PathChildrenCacheEvent event) throws Exception { final ChildData child = event.getData(); if (child == null) { return; } final ContainerHolder holder = containers.get(containerKey); if (holder == null) { return; } final String inventoryKey = ZKPaths.getNodeFromPath(child.getPath()); switch (event.getType()) { case CHILD_ADDED: case CHILD_UPDATED: final InventoryClass inventory = strategy.deserializeInventory(child.getData()); synchronized (holder) { holder.setContainer(strategy.addInventory(holder.getContainer(), inventoryKey, inventory)); } break; case CHILD_REMOVED: synchronized (holder) { holder.setContainer(strategy.removeInventory(holder.getContainer(), inventoryKey)); } break; } }
Source:
<code>public void testProcessorIgnoresDuplicateZone() { String query = "1D 1D"; List<Suggestion> suggestions = processor.enhanceResults(new LinkedList<>(), query); List<String> detectedMgrsStrings = processor.getMgrsCoordinateStrings(query); <START> assertThat(detectedMgrsStrings, both(hasSize(2)).and(contains("1D", "1D"))); <END> assertThat( cast(suggestions).get(0).getGeo(), hasSize(4)); }</code><technical_language>This test confused me, specifically line 266. name of test suggests duplicate ignored, asserting duplicates here. If move .stream().distinct().collect(Collectors.toList()) return statement of coordinateStringsFromQuery getMgrsCoordinateStrings (or put in a Set @bdeining suggested), removal more apparent in tests pertaining duplicates</technical_language>

Target:
public void testProcessorIgnoresDuplicateZone() { List<String> detectedMgrsStrings = processor.getMgrsCoordinateStrings("1D 1D"); assertThat(detectedMgrsStrings, both(hasSize(1)).and(contains("1D"))); }
Source:
<code>public boolean apply(SamzaSqlRelMessage message) { long startProcessing = System.nanoTime(); Object[] result = new Object[1]; try { expr.execute(translatorContext.getExecutionContext(), context, translatorContext.getDataContext(), message.getSamzaSqlRelRecord().getFieldValues().toArray(), result); } catch (Exception e) { String errMsg = String.format("Handling the following rel message ran into an error. %s", message); LOG.error(errMsg, e); throw new SamzaException(errMsg, e); } if (result[0] instanceof Boolean) { boolean retVal = (Boolean) result[0]; LOG.debug( String.format("return value for input %s is %s", Arrays.asList(message.getSamzaSqlRelRecord().getFieldValues()).toString(), retVal)); updateMetrics(startProcessing, retVal, System.nanoTime()); return retVal; } else { <START> LOG.error("return value is not boolean for rel message: %s", message); <END> return false; } }</code><technical_language>this Log.error %s do format</technical_language>

Target:
public boolean apply(SamzaSqlRelMessage message) { long startProcessing = System.nanoTime(); Object[] result = new Object[1]; try { expr.execute(translatorContext.getExecutionContext(), context, translatorContext.getDataContext(), message.getSamzaSqlRelRecord().getFieldValues().toArray(), result); } catch (Exception e) { String errMsg = String.format("Handling the following rel message ran into an error. %s", message); LOG.error(errMsg, e); throw new SamzaException(errMsg, e); } if (result[0] instanceof Boolean) { boolean retVal = (Boolean) result[0]; LOG.debug( String.format("return value for input %s is %s", Arrays.asList(message.getSamzaSqlRelRecord().getFieldValues()).toString(), retVal)); updateMetrics(startProcessing, retVal, System.nanoTime()); return retVal; } else { LOG.error("return value is not boolean for rel message: {}", message); return false; } }
Source:
<code>private Drawable getServerBubble(ArrayList<String> serverList, int position) { String firstLetter = String.valueOf(serverList.get(position).charAt(0)); <START> ColorGenerator generator = ColorGenerator.MATERIAL; END> int color = generator.getColor(serverList.get(position)); TextDrawable drawable = TextDrawable.builder() .buildRound(firstLetter, color); return drawable; }</code><technical_language>random</technical_language>

Target:
private Drawable getServerBubble(ArrayList<String> serverList, int position) { String firstLetter = String.valueOf(serverList.get(position).charAt(0)); TextDrawable drawable = TextDrawable.builder() .buildRound(firstLetter, ColorGenerator.MATERIAL.getColor(serverList.get(position))); return drawable; }
Source:
<code>public <R> R computeWith( SchemaComputer<R> computer ) { <START> throw new NotImplementedException( "Not implemented" ); <END> }</code><technical_language>Please standard UnsupportedOperationException instead</technical_language>

Target:
public <R> R computeWith( SchemaComputer<R> computer ) { throw new UnsupportedOperationException( "Not an valid operation for multitoken schema" ); }
Source:
<code>protected void configure() { binder().requireExplicitBindings(); requireBinding(MidolmanConfig.class); requireBinding(DatapathConnectionPool.class); requireBinding(HostIdProviderService.class); requireBinding(UpcallDatapathConnectionManager.class); requireBinding(FlowStateStorageFactory.class); requireBinding(NetlinkChannelFactory.class); bindMidolmanActorsService(); expose(MidolmanActorsService.class); bind(NanoClock.class).toInstance(NanoClock$.MODULE$.DEFAULT()); expose(NanoClock.class); bind(UnixClock.class).toInstance(UnixClock$.MODULE$.DEFAULT()); expose(UnixClock.class); bind(SupervisorActor.class); bind(VirtualTopologyActor.class); bind(VirtualToPhysicalMapper.class); bind(DatapathController.class); bind(PacketsEntryPoint.class); bind(NetlinkCallbackDispatcher.class); bind(MetadataServiceManagerActor.class); <START> bind(FlowWriter.class); <END> bind(RoutingManagerActor.class); bind(HealthMonitor.class); }</code><technical_language>is FlowWriter actor</technical_language>

Target:
protected void configure() { binder().requireExplicitBindings(); requireBinding(MidolmanConfig.class); requireBinding(DatapathConnectionPool.class); requireBinding(HostIdProviderService.class); requireBinding(UpcallDatapathConnectionManager.class); requireBinding(FlowStateStorageFactory.class); requireBinding(NetlinkChannelFactory.class); bindMidolmanActorsService(); expose(MidolmanActorsService.class); bind(NanoClock.class).toInstance(NanoClock$.MODULE$.DEFAULT()); expose(NanoClock.class); bind(UnixClock.class).toInstance(UnixClock$.MODULE$.DEFAULT()); expose(UnixClock.class); bind(SupervisorActor.class); bind(VirtualTopologyActor.class); bind(VirtualToPhysicalMapper.class); bind(DatapathController.class); bind(PacketsEntryPoint.class); bind(NetlinkCallbackDispatcher.class); bind(MetadataServiceManagerActor.class); bind(RoutingManagerActor.class); bind(HealthMonitor.class); bind(FlowWriter.class); }
Source:
<code>private boolean minDataSpreadCheckForAfricanDiseaseGroup() { Set<Integer> distinctCountries = occurrenceCountPerCountry.keySet(); <START> boolean distinctCountriesCheck = distinctCountries.size() >= minDistinctCountries; <END> Set<Integer> highFrequencyOccurrenceCountries = extractHighFrequencyCountries(); boolean highFrequencyCountriesCheck = highFrequencyOccurrenceCountries.size() >= minHighFrequencyCountries; return (distinctCountriesCheck & highFrequencyCountriesCheck); }</code><technical_language>Personally I for brackets boolean expressions, if find this clear enough do leave :)</technical_language>

Target:
private boolean minDataSpreadCheckForAfricanDiseaseGroup() { Set<Integer> distinctCountries = occurrenceCountPerCountry.keySet(); boolean distinctCountriesCheck = (distinctCountries.size() >= minDistinctCountries); Set<Integer> highFrequencyOccurrenceCountries = extractHighFrequencyCountries(); boolean highFrequencyCountriesCheck = (highFrequencyOccurrenceCountries.size() >= minHighFrequencyCountries); return (distinctCountriesCheck & highFrequencyCountriesCheck); }
Source:
<code>public <T extends Comparable<? super T>> void assertIsBetween(AssertionInfo info, T actual, T start, T end, boolean inclusiveStart, boolean inclusiveEnd) { assertNotNull(info, actual); checkNotNull(start, "The start range to compare actual with should not be null"); checkNotNull(end, "The end range to compare actual with should not be null"); <START> checkArgument(comparisonStrategy.isLessThanOrEqualTo(start, end), <END> String.format("The end value <%s> must not be less than the start value <%s>%s!", end, start, (comparisonStrategy.isStandard() ? "" : " (using " + comparisonStrategy + ")"))); boolean checkLowerBoundaryRange = inclusiveStart ? !isGreaterThan(start, actual) : isLessThan(start, actual); boolean checkUpperBoundaryRange = inclusiveEnd ? !isGreaterThan(actual, end) : isLessThan(actual, end); if (checkLowerBoundaryRange && checkUpperBoundaryRange) return; throw failures.failure(info, shouldBeBetween(actual, start, end, inclusiveStart, inclusiveEnd, comparisonStrategy)); }</code><technical_language>if isStrictlyBetween accept start == end, start == end is valid inclusiveStart inclusiveEnd true</technical_language>

Target:
public <T extends Comparable<? super T>> void assertIsBetween(AssertionInfo info, T actual, T start, T end, boolean inclusiveStart, boolean inclusiveEnd) { assertNotNull(info, actual); checkNotNull(start, "The start range to compare actual with should not be null"); checkNotNull(end, "The end range to compare actual with should not be null"); checkArgument(inclusiveEnd && inclusiveStart && comparisonStrategy.isLessThanOrEqualTo(start, end) || !inclusiveEnd && !inclusiveStart && comparisonStrategy.isLessThan(start, end), String.format("The end value <%s> must not be %s the start value <%s>%s!", end, (inclusiveEnd && inclusiveStart ? "less than" : "less than or equal to" ), start, (comparisonStrategy.isStandard() ? "" : " (using " + comparisonStrategy + ")"))); boolean checkLowerBoundaryRange = inclusiveStart ? !isGreaterThan(start, actual) : isLessThan(start, actual); boolean checkUpperBoundaryRange = inclusiveEnd ? !isGreaterThan(actual, end) : isLessThan(actual, end); if (checkLowerBoundaryRange && checkUpperBoundaryRange) return; throw failures.failure(info, shouldBeBetween(actual, start, end, inclusiveStart, inclusiveEnd, comparisonStrategy)); }
Source:
<code>if ((fsyncWarningThreshold = Long.getLong("zookeeper.fsync.warningthresholdms")) == null) fsyncWarningThreshold = Long.getLong("fsync.warningthresholdms", 1000); fsyncWarningThresholdMS = fsyncWarningThreshold; } <START> long lastMaxZxidSeen; <END> volatile BufferedOutputStream logStream = null; volatile OutputArchive oa; volatile FileOutputStream fos = null; File logDir; private final boolean forceSync = !System.getProperty("zookeeper.forceSync", "yes").equals("no"); long dbId; private LinkedList<FileOutputStream> streamsToFlush = new LinkedList<FileOutputStream>(); long currentSize; File logFileWrite = null; private volatile long syncElapsedMS = -1L; public FileTxnLog(File logDir) { this.logDir = logDir; }</code><technical_language>a compile error. **lastZxidSeen** is</technical_language>

Target:
if ((fsyncWarningThreshold = Long.getLong("zookeeper.fsync.warningthresholdms")) == null) fsyncWarningThreshold = Long.getLong("fsync.warningthresholdms", 1000); fsyncWarningThresholdMS = fsyncWarningThreshold; } long lastZxidSeen; volatile BufferedOutputStream logStream = null; volatile OutputArchive oa; volatile FileOutputStream fos = null; File logDir; private final boolean forceSync = !System.getProperty("zookeeper.forceSync", "yes").equals("no"); long dbId; private LinkedList<FileOutputStream> streamsToFlush = new LinkedList<FileOutputStream>(); long currentSize; File logFileWrite = null; private volatile long syncElapsedMS = -1L; public FileTxnLog(File logDir) { this.logDir = logDir; }
Source:
<code>public void validate(IValidatable<String> validatable) { String uriSpec = validatable.getValue(); try { URI uri = new URI(uriSpec); if (uri.getScheme() != null && !"file".equals(uri.getScheme())) { if (delegate != null) { delegate.validate(validatable); InputStream is = null; try { URLConnection connection = uri.toURL().openConnection(); connection.setConnectTimeout(10000); is = connection.getInputStream(); } catch (Exception e) { IValidationError err = new ValidationError("FileExistsValidator.unreachable") .addKey("FileExistsValidator.unreachable") .setVariable("file", uriSpec); validatable.error(err); } finally { IOUtils.closeQuietly(is); } } return; } else { String path = uri.getPath(); if (path != null && new File(path).exists()) { return; } } } catch (URISyntaxException e) { } File relFile = null; GeoServerResourceLoader loader = GeoServerExtensions.bean(GeoServerResourceLoader.class); if (baseDirectory != null) { relFile = Resources.find(Resources.fromURL(Files.asResource(baseDirectory), uriSpec), <START> true); <END> } else if (loader != null) { relFile = loader.url(uriSpec); } if (relFile == null || !relFile.exists()) { IValidationError err = new ValidationError("FileExistsValidator.fileNotFoundError") .addKey("FileExistsValidator.fileNotFoundError") .setVariable("file", uriSpec); validatable.error(err); } }</code><technical_language>Technically this call force file exist file system (is in configuration system)</technical_language>

Target:
public void validate(IValidatable<String> validatable) { String uriSpec = validatable.getValue(); try { URI uri = new URI(uriSpec); if (uri.getScheme() != null && !"file".equals(uri.getScheme())) { if (delegate != null) { delegate.validate(validatable); InputStream is = null; try { URLConnection connection = uri.toURL().openConnection(); connection.setConnectTimeout(10000); is = connection.getInputStream(); } catch (Exception e) { IValidationError err = new ValidationError("FileExistsValidator.unreachable") .addKey("FileExistsValidator.unreachable") .setVariable("file", uriSpec); validatable.error(err); } finally { IOUtils.closeQuietly(is); } } return; } else { String path = uri.getPath(); if (path != null && new File(path).exists()) { return; } } } catch (URISyntaxException e) { } File relFile = null; GeoServerResourceLoader loader = GeoServerExtensions.bean(GeoServerResourceLoader.class); if (baseDirectory != null) { relFile = Files.url(baseDirectory, uriSpec); } else if (loader != null) { relFile = Resources.find( Resources.fromURL(Files.asResource(loader.getBaseDirectory()), uriSpec), true); } if (relFile == null || !relFile.exists()) { IValidationError err = new ValidationError("FileExistsValidator.fileNotFoundError") .addKey("FileExistsValidator.fileNotFoundError") .setVariable("file", uriSpec); validatable.error(err); } }
Source:
<code>private Optimizer(PlanNodeIdAllocator idAllocator, PlanVariableAllocator variableAllocator, Metadata metadata, StandardFunctionResolution functionResolution) { this.idAllocator = requireNonNull(idAllocator, "idAllocator is null"); this.variableAllocator = requireNonNull(variableAllocator, "variableAllocator is null"); this.metadata = requireNonNull(metadata, "metadata is null"); <START> this.functionResolution = functionResolution; <END> }</code><technical_language>requireNonNull</technical_language>

Target:
private Optimizer(PlanNodeIdAllocator idAllocator, PlanVariableAllocator variableAllocator, Metadata metadata, StandardFunctionResolution functionResolution) { this.idAllocator = requireNonNull(idAllocator, "idAllocator is null"); this.variableAllocator = requireNonNull(variableAllocator, "variableAllocator is null"); this.metadata = requireNonNull(metadata, "metadata is null"); this.functionResolution = requireNonNull(functionResolution, "functionResolution is null"); }
Source:
<code>public boolean hasNext() { <START> if ( recordReader.hasNext()) { <END> return true; } return false; }</code><technical_language>return recordReader.hasNext(); works</technical_language>

Target:
public boolean hasNext() { return recordReader.hasNext(); }
Source:
<code>TableMasterClient provideCatalogMasterClient(AlluxioHiveMetastoreConfig config) { InstancedConfiguration conf = new InstancedConfiguration(ConfigurationUtils.defaults()); <START> String addr = config.getMasterAddress(); <END> String[] parts = addr.split(":", 2); conf.set(PropertyKey.MASTER_HOSTNAME, parts[0]); if (parts.length > 1) { conf.set(PropertyKey.MASTER_RPC_PORT, parts[1]); } MasterClientContext context = MasterClientContext .newBuilder(ClientContext.create(new InstancedConfiguration(ConfigurationUtils.defaults()))).build(); return new RetryHandlingTableMasterClient(context); }</code><technical_language>address</technical_language>

Target:
TableMasterClient provideCatalogMasterClient(AlluxioHiveMetastoreConfig config) { InstancedConfiguration conf = new InstancedConfiguration(ConfigurationUtils.defaults()); String address = config.getMasterAddress(); String[] parts = address.split(":", 2); conf.set(PropertyKey.MASTER_HOSTNAME, parts[0]); if (parts.length > 1) { conf.set(PropertyKey.MASTER_RPC_PORT, parts[1]); } MasterClientContext context = MasterClientContext.newBuilder(ClientContext.create(new InstancedConfiguration(ConfigurationUtils.defaults()))).build(); return new RetryHandlingTableMasterClient(context); }
Source:
<code>private ValidationResult hostStatusValid() { VDSStatus hostStatus = getVds().getStatus(); <START> if ((hostStatus != VDSStatus.Maintenance) && (hostStatus != VDSStatus.Up) <END> && (hostStatus != VDSStatus.NonOperational)) { addCanDoActionMessage(VdcBllMessages.VAR__HOST_STATUS__UP_MAINTENANCE_OR_NON_OPERATIONAL); new ValidationResult(VdcBllMessages.ACTION_TYPE_FAILED_VDS_STATUS_ILLEGAL); } return ValidationResult.VALID; }</code><technical_language>brackets wraps condition is redundant</technical_language>

Target:
private ValidationResult hostStatusValid() { VDSStatus hostStatus = getVds().getStatus(); if (hostStatus != VDSStatus.Maintenance && hostStatus != VDSStatus.Up && hostStatus != VDSStatus.NonOperational) { addCanDoActionMessage(VdcBllMessages.VAR__HOST_STATUS__UP_MAINTENANCE_OR_NON_OPERATIONAL); new ValidationResult(VdcBllMessages.ACTION_TYPE_FAILED_VDS_STATUS_ILLEGAL); } return ValidationResult.VALID; }
Source:
<code>public static int getZoneID(Configuration config, BridgeHandler bridge) { if (config == null || config.get(DigitalSTROMBindingConstants.ZONE_ID) == null) { <START> return -2; <END> } if (bridge == null) { return -3; } String configZoneID = config.get(DigitalSTROMBindingConstants.ZONE_ID).toString(); int zoneID; StructureManager strucMan = bridge.getStructureManager(); if (strucMan != null) { try { zoneID = Integer.parseInt(configZoneID); if (!strucMan.checkZoneID(zoneID)) { zoneID = -1; } } catch (NumberFormatException e) { zoneID = strucMan.getZoneId(configZoneID); } return zoneID; } return -1; }</code><technical_language>Encoding status a negative int is hard read, is enum here</technical_language>

Target:
public static int getZoneID(Configuration config, BridgeHandler bridge) { if (config == null || config.get(DigitalSTROMBindingConstants.ZONE_ID) == null) { return ZONE_ID_NOT_SET; } if (bridge == null) { return BRIDGE_IS_NULL; } String configZoneID = config.get(DigitalSTROMBindingConstants.ZONE_ID).toString(); int zoneID; StructureManager strucMan = bridge.getStructureManager(); if (strucMan != null) { try { zoneID = Integer.parseInt(configZoneID); if (!strucMan.checkZoneID(zoneID)) { zoneID = ZONE_ID_NOT_EXISTS; } } catch (NumberFormatException e) { zoneID = strucMan.getZoneId(configZoneID); } return zoneID; } return ZONE_ID_NOT_EXISTS; }
Source:
<code>public void testInvalidTransactionAttributeWarnLogged() throws Exception { ByteArrayOutputStream baos = new ByteArrayOutputStream(); PrintStream oldOut = System.out; System.setOut(new PrintStream(baos)); deployer.deploy("invalidtransactionattribute"); <START> System.setOut(oldOut); <END> String output = new String(baos.toByteArray()); Assert.assertFalse(output.contains("WFLYEJB0463")); deployer.undeploy("invalidtransactionattribute"); }</code><technical_language>This done in a finally block</technical_language>

Target:
public void testInvalidTransactionAttributeWarnLogged() { PrintStream oldOut = System.out; ByteArrayOutputStream baos = new ByteArrayOutputStream(); try { System.setOut(new PrintStream(baos)); deployer.deploy("invalidtransactionattribute"); try { System.setOut(oldOut); String output = new String(baos.toByteArray()); Assert.assertFalse(output, output.contains("WFLYEJB0463")); Assert.assertFalse(output, output.contains("ERROR")); } finally { deployer.undeploy("invalidtransactionattribute"); } } finally { System.setOut(oldOut); } }
Source:
<code>private List<String> dereferenceAgentClasses(final Collection<String> agentClasses) { final Session internalSession = sessionFactory.getInternalSession(); final IdentifierConverter<Resource, FedoraResource> translator = new DefaultIdentifierTranslator(internalSession); final List<String> members = new ArrayList<>(); agentClasses.stream() .distinct() .forEach(x -> { if (x.startsWith(FEDORA_INTERNAL_PREFIX)) { final FedoraResource resource = nodeService.find( internalSession, x.substring(FEDORA_INTERNAL_PREFIX.length())); members.addAll(getFoafMembers(translator, resource)); <START> } else if (x.startsWith(FOAF_NAMESPACE_VALUE)) { <END> members.add(x); } else { LOGGER.info("Ignoring agentClass: {}", x); } }); if (LOGGER.isDebugEnabled() && !agentClasses.isEmpty()) { LOGGER.debug("Found members in agentClass resources", members.size(), agentClasses.size()); } return members; }</code><technical_language>this logic from? map "spec"? <LINK_0></technical_language>

Target:
private List<String> dereferenceAgentClasses(final Collection<String> agentClasses) { final Session internalSession = sessionFactory.getInternalSession(); final IdentifierConverter<Resource, FedoraResource> translator = new DefaultIdentifierTranslator(internalSession); final List<String> members = new ArrayList<>(); agentClasses.stream() .distinct() .forEach(x -> { if (x.startsWith(FEDORA_INTERNAL_PREFIX)) { final FedoraResource resource = nodeService.find( internalSession, x.substring(FEDORA_INTERNAL_PREFIX.length())); members.addAll(getAgentMembers(translator, resource)); } else if (x.equals(FOAF_AGENT_VALUE)) { members.add(x); } else { LOGGER.info("Ignoring agentClass: {}", x); } }); if (LOGGER.isDebugEnabled() && !agentClasses.isEmpty()) { LOGGER.debug("Found members in agentClass resources", members.size(), agentClasses.size()); } return members; }
Source:
<code>public GsonBuilder newGsonBuilder() { if (!isJson()) { throw new IllegalStateException(String.format("%s is not JSON", this)); } <START> GsonBuilder gb = new GsonBuilder(); <END> if (this == OutputFormat.JSON) { gb.setPrettyPrinting(); } return gb; }</code><technical_language>Is call disableHtmlEscaping() needed anymore done in previous patch set</technical_language>

Target:
public GsonBuilder newGsonBuilder() { if (!isJson()) { throw new IllegalStateException(String.format("%s is not JSON", this)); } GsonBuilder gb = new GsonBuilder() .setFieldNamingPolicy(FieldNamingPolicy.LOWER_CASE_WITH_UNDERSCORES) .registerTypeAdapter(Timestamp.class, new SqlTimestampDeserializer()); if (this == OutputFormat.JSON) { gb.setPrettyPrinting(); } return gb; }
Source:
<code>public MinPension(Context context) { super(context); TAG = "MinPension"; NAME = "Min Pension.se"; NAME_SHORT = "minpension"; BANKTYPE_ID = IBankTypes.MINPENSION; INPUT_TYPE_USERNAME = InputType.TYPE_CLASS_PHONE; <START> INPUT_TYPE_PASSWORD = InputType.TYPE_CLASS_PHONE; <END> INPUT_HINT_USERNAME = "ÅÅÅÅMMDDXXXX"; }</code><technical_language>pno? added it</technical_language>

Target:
public MinPension(Context context) { super(context); TAG = "MinPension"; NAME = "Min Pension.se"; NAME_SHORT = "minpension"; BANKTYPE_ID = IBankTypes.MINPENSION; INPUT_TYPE_USERNAME = InputType.TYPE_CLASS_PHONE; INPUT_TYPE_PASSWORD = InputType.TYPE_CLASS_PHONE | InputType.TYPE_TEXT_VARIATION_PASSWORD;; INPUT_HINT_USERNAME = res.getText(R.string.pno).toString(); }