auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public int update() { session.commit(true); Table view = getSchema().findTableOrView(session, viewName); if (view == null) { if (!ifExists) { throw DbException.get(ErrorCode.VIEW_NOT_FOUND_1, viewName); } } else { if (TableType.VIEW != view.getTableType()) { throw DbException.get(ErrorCode.VIEW_NOT_FOUND_1, viewName); } session.getUser().checkRight(view, Right.ALL); if (dropAction == ConstraintReferential.RESTRICT) { for (DbObject child : view.getChildren()) { if (child instanceof TableView) { throw DbException.get(ErrorCode.CANNOT_DROP_2, viewName, child.getName()); } } } TableView tableView = (TableView) view; ArrayList<Table> copyOfDependencies = new ArrayList<Table>(tableView.getTables()); view.lock(session, true, true); session.getDatabase().removeSchemaObject(session, view); <START> session.getDatabase().unlockMeta(session); <END> for( Table childTable: copyOfDependencies){ if(TableType.VIEW == childTable.getTableType()){ TableView childTableView = (TableView) childTable; if(childTableView.isTableExpression() && childTableView.getName()!=null){ session.getDatabase().removeSchemaObject(session, childTableView); } } } } return 0; }</code><technical_language>move unlock removal of dependant table expressions</technical_language>

Target:
public int update() { session.commit(true); Table view = getSchema().findTableOrView(session, viewName); if (view == null) { if (!ifExists) { throw DbException.get(ErrorCode.VIEW_NOT_FOUND_1, viewName); } } else { if (TableType.VIEW != view.getTableType()) { throw DbException.get(ErrorCode.VIEW_NOT_FOUND_1, viewName); } session.getUser().checkRight(view, Right.ALL); if (dropAction == ConstraintReferential.RESTRICT) { for (DbObject child : view.getChildren()) { if (child instanceof TableView) { throw DbException.get(ErrorCode.CANNOT_DROP_2, viewName, child.getName()); } } } TableView tableView = (TableView) view; ArrayList<Table> copyOfDependencies = new ArrayList<Table>(tableView.getTables()); view.lock(session, true, true); session.getDatabase().removeSchemaObject(session, view); for (Table childTable: copyOfDependencies) { if (TableType.VIEW == childTable.getTableType()) { TableView childTableView = (TableView) childTable; if (childTableView.isTableExpression() && childTableView.getName() != null) { session.getDatabase().removeSchemaObject(session, childTableView); } } } session.getDatabase().unlockMeta(session); } return 0; }
Source:
<code>private void reportBooleanExpression(CheckerContext context, AlwaysTrueOrFalseExpressionCollector atof, Tree condition, boolean isTrue) { if (!AlwaysTrueOrFalseExpressionCollector.hasUnreachableCode(condition, isTrue)) { Set<List<JavaFileScannerContext.Location>> flows = atof.flowForExpression(condition).stream() <START> .filter(flow -> !flow.isEmpty()) <END> .map(flow -> AlwaysTrueOrFalseExpressionCollector.addIssueLocation(flow, condition, isTrue)) .collect(Collectors.toSet()); context.reportIssue(condition, this, "Remove this expression which always evaluates to \"" + isTrue + "\"", flows); } }</code><technical_language>filter out empty flows returning in flowForExpression ?</technical_language>

Target:
private void reportBooleanExpression(CheckerContext context, AlwaysTrueOrFalseExpressionCollector atof, Tree condition, boolean isTrue) { if (!AlwaysTrueOrFalseExpressionCollector.hasUnreachableCode(condition, isTrue)) { Set<List<JavaFileScannerContext.Location>> flows = atof.flowForExpression(condition).stream() .map(flow -> AlwaysTrueOrFalseExpressionCollector.addIssueLocation(flow, condition, isTrue)) .collect(Collectors.toSet()); context.reportIssue(condition, this, "Remove this expression which always evaluates to \"" + isTrue + "\"", flows); } }
Source:
<code>public static long produced(AtomicLong requested, long n) { for (;;) { long r = requested.get(); if (r == Long.MAX_VALUE) { return Long.MAX_VALUE; } long u = r - n; if (u < 0L) { RxJavaPlugins.onError(new IllegalStateException("More produced than requested: " + u)); u = 0L; } if (requested.compareAndSet(r, u)) { <START> return r; <END> } } }</code><technical_language>return u here? Separate tests for this function great, var names</technical_language>

Target:
public static long produced(AtomicLong requested, long n) { for (;;) { long current = requested.get(); if (current == Long.MAX_VALUE) { return Long.MAX_VALUE; } long update = current - n; if (update < 0L) { RxJavaPlugins.onError(new IllegalStateException("More produced than requested: " + update)); update = 0L; } if (requested.compareAndSet(current, update)) { return update; } } }
Source:
<code>public Object execute(ExecutionEvent event) throws ExecutionException { IWorkbenchWindow window = HandlerUtil.getActiveWorkbenchWindowChecked(event); String initialValue = getTransitivityDepth(); InputDialog depthInput = new InputDialog(window.getShell(), "Transitivity depth", <START> "Input the wished depth limit for transitivity. Enter 0 if no limit is wished.", initialValue, null); <END> if (depthInput.open() == Window.OK) { String depth = depthInput.getValue(); setTransitivityDepth(depth); } return null; }</code><technical_language>r/wished/desired/g</technical_language>

Target:
public Object execute(ExecutionEvent event) throws ExecutionException { IWorkbenchWindow window = HandlerUtil.getActiveWorkbenchWindowChecked(event); String initialValue = getTransitivityDepth(); InputDialog depthInput = new InputDialog(window.getShell(), "Transitivity depth", "Input the desired depth limit for transitivity. Enter 0 if no limit is desired.", initialValue, null); if (depthInput.open() == Window.OK) { String depth = depthInput.getValue(); setTransitivityDepth(depth); } return null; }
Source:
<code>public MinecraftServer getServer() { final World world = getEntityWorld(); if (world != null) { return world.getMinecraftServer(); } <START> return SpongeImpl.getServer(); <END> }</code><technical_language>Depends state of game, if is server, is server</technical_language>

Target:
public MinecraftServer getServer() { return getEntityWorld().getMinecraftServer(); }
Source:
<code>public OutputStream createOutputStream(long offset) throws IOException { if (doesExist()) { return file.createOutputStream(); } <START> StorageUtils.LOG.FINE("Uploading file '%s'", childName); <END> return parent.resolve(childName).createOutputStream(); }</code><technical_language>suggestion StorageUtils.LOG.FINE("Layer3/FTP: Uploading file '%s' in '%s'", childName, parent);</technical_language>

Target:
public OutputStream createOutputStream(long offset) throws IOException { if (doesExist()) { return file.createOutputStream(); } StorageUtils.LOG.FINE("Layer3/FTP: Uploading file '%s' in '%s'", childName, parent); return parent.resolve(childName).createOutputStream(); }
Source:
<code>private void executeNextOperation() { if (getParameters().getPhase() == StorageDomainParametersBase.Phase.PROCESS_OVF_UPDATE_FOR_STORAGE_DOMAIN) { ActionReturnValue returnValue = runInternalActionWithTasksContext(ActionType.ProcessOvfUpdateForStorageDomain, createProcessOvfUpdateForDomainParams()); if (!returnValue.getSucceeded()) { propagateFailure(returnValue); setCommandStatus(CommandStatus.FAILED); <START> setSucceeded(true); <END> throw new EngineException(returnValue.getFault().getError(), returnValue.getFault().getMessage()); } setCommandStatus(CommandStatus.SUCCEEDED); setSucceeded(true); } }</code><technical_language>a bit confusing, succeeded is true throw exception. Is neccessery if throw exception later</technical_language>

Target:
private void executeNextOperation() { if (getParameters().getPhase() == StorageDomainParametersBase.Phase.PROCESS_OVF_UPDATE_FOR_STORAGE_DOMAIN) { ActionReturnValue returnValue = runInternalActionWithTasksContext(ActionType.ProcessOvfUpdateForStorageDomain, createProcessOvfUpdateForDomainParams()); if (!returnValue.getSucceeded()) { propagateFailure(returnValue); setCommandStatus(CommandStatus.FAILED); throw new EngineException(returnValue.getFault().getError(), returnValue.getFault().getMessage()); } setCommandStatus(CommandStatus.SUCCEEDED); setSucceeded(true); } }
Source:
<code>protected BinaryBlockReader(InputStream in, BinaryConverter<M> protoConverter, boolean skipEmptyRecords) { in_ = in; protoConverter_ = protoConverter; <START> skipEmptyBlobs = skipEmptyRecords; <END> searcher_ = new StreamSearcher(Protobufs.KNOWN_GOOD_POSITION_MARKER); }</code><technical_language>difference blobs records? 2 terms</technical_language>

Target:
protected BinaryBlockReader(InputStream in, BinaryConverter<M> protoConverter, boolean skipEmptyRecords) { in_ = in; protoConverter_ = protoConverter; searcher_ = new StreamSearcher(Protobufs.KNOWN_GOOD_POSITION_MARKER); this.skipEmptyRecords = skipEmptyRecords; }
Source:
<code>protected void recreateParentService(OperationContext context, PathAddress parentAddress, ModelNode parentModel) throws OperationFailedException { <START> SubsystemAdd.INSTANCE.performRuntime(context, null, parentModel); <END> try { ServiceName name = SubsystemExtension.SERVICE_NAME; ServiceRegistry serviceRegistry = context.getServiceRegistry(true); MonitorService service = (MonitorService) serviceRegistry.getRequiredService(name).getValue(); service.startMonitorService(); } catch (Exception e) { throw new OperationFailedException("Failed to recreate Hawkular WildFly Agent service", e); } }</code><technical_language>problem is "parentModel" is model of parent resource attribute is changing. this code expects ModelNode of FULL agent (starting top level &lt;subsystem> element). Is a walk tree get top level mode new changes in parentModel</technical_language>

Target:
protected void recreateParentService(OperationContext context, PathAddress parentAddress, ModelNode parentModel) throws OperationFailedException { SubsystemAdd.INSTANCE.performRuntime(context, new ModelNode().set(ModelDescriptionConstants.OP_ADDR, parentAddress.toModelNode()), parentModel); }
Source:
<code>public final void semanticHighlights(CquerySemanticHighlights highlights) { URI uriReceived = highlights.getUri(); CquerySemanticHighlights.semanticHighlightingsMap.put(uriReceived, highlights.getSymbols()); List<PresentationReconcilerCPP> matchingReconcilers = new ArrayList<>(); for (PresentationReconcilerCPP eachReconciler: PresentationReconcilerCPP.presentationReconcilers) { IDocument currentReconcilerDoc = eachReconciler.getTextViewer().getDocument(); <START> URI currentReconcilerUri = LSPEclipseUtils.toUri(LSPEclipseUtils.getFile(currentReconcilerDoc)); <END> if (uriReceived.equals(currentReconcilerUri)) { matchingReconcilers.add(eachReconciler); } } Display.getDefault().asyncExec(new Runnable() { @Override public void run() { for (PresentationReconcilerCPP p: matchingReconcilers) { IDocument currentReconcilerDoc = p.getTextViewer().getDocument(); TextPresentation textPresentation = p.createPresentation(new Region(0, currentReconcilerDoc.getLength()), currentReconcilerDoc); p.getTextViewer().changeTextPresentation(textPresentation, false); } } }); }</code><technical_language>need null checks for this chain of function calls here, do in PresentationReconcilerCPP. Feel free create a helper function calls toUri(getFile()) easier</technical_language>

Target:
public final void semanticHighlights(CquerySemanticHighlights highlights) { URI uriReceived = highlights.getUri(); List<PresentationReconcilerCPP> matchingReconcilers = new ArrayList<>(); for (PresentationReconcilerCPP eachReconciler: PresentationReconcilerCPP.presentationReconcilers) { IDocument currentReconcilerDoc = eachReconciler.getTextViewer().getDocument(); URI currentReconcilerUri = getUri(currentReconcilerDoc); if(currentReconcilerUri == null) { continue; } if (uriReceived.equals(currentReconcilerUri)) { matchingReconcilers.add(eachReconciler); } } Display.getDefault().asyncExec(new Runnable() { @Override public void run() { for (PresentationReconcilerCPP p: matchingReconcilers) { p.setSemanticHighlights(highlights.getSymbols()); IDocument currentReconcilerDoc = p.getTextViewer().getDocument(); if (currentReconcilerDoc == null) { continue; } TextPresentation textPresentation = p.createPresentation(new Region(0, currentReconcilerDoc.getLength()), currentReconcilerDoc); p.getTextViewer().changeTextPresentation(textPresentation, false); } } }); }
Source:
<code>public void decorate(World world, Random random, Chunk source) { int sourceX = (source.getX() << 4) + random.nextInt(16); int sourceZ = (source.getZ() << 4) + random.nextInt(16); int sourceY = flowing ? 4 + random.nextInt(120) : 10 + random.nextInt(108); Block block = world.getBlockAt(sourceX, sourceY, sourceZ); if ((block.getType() == Material.NETHERRACK || block.isEmpty()) && block.getRelative(BlockFace.UP).getType() == Material.NETHERRACK) { int netherrackBlockCount = 0; for (BlockFace face : SIDES) { if (block.getRelative(face).getType() == Material.NETHERRACK) { netherrackBlockCount++; } } int airBlockCount = 0; for (BlockFace face : SIDES) { if (block.getRelative(face).isEmpty()) { airBlockCount++; } } if (netherrackBlockCount == 5 || flowing && airBlockCount == 1 && netherrackBlockCount == 4) { BlockState state = block.getState(); state.setType(Material.LAVA); state.update(true); <START> ((GlowWorld) block.getWorld()).requestSinglePulse((GlowBlock) block, 10); <END> } } }</code><technical_language>Set delay 0</technical_language>

Target:
public void decorate(World world, Random random, Chunk source) { int sourceX = (source.getX() << 4) + random.nextInt(16); int sourceZ = (source.getZ() << 4) + random.nextInt(16); int sourceY = flowing ? 4 + random.nextInt(120) : 10 + random.nextInt(108); Block block = world.getBlockAt(sourceX, sourceY, sourceZ); if ((block.getType() == Material.NETHERRACK || block.isEmpty()) && block.getRelative(BlockFace.UP).getType() == Material.NETHERRACK) { int netherrackBlockCount = 0; for (BlockFace face : SIDES) { if (block.getRelative(face).getType() == Material.NETHERRACK) { netherrackBlockCount++; } } int airBlockCount = 0; for (BlockFace face : SIDES) { if (block.getRelative(face).isEmpty()) { airBlockCount++; } } if (netherrackBlockCount == 5 || flowing && airBlockCount == 1 && netherrackBlockCount == 4) { BlockState state = block.getState(); state.setType(Material.LAVA); state.update(true); ((GlowWorld) block.getWorld()).requestSinglePulse((GlowBlock) block, 0); } } }
Source:
<code>public void placeBlock(GlowPlayer player, GlowBlockState state, BlockFace face, ItemStack holding, Vector clickedLoc) { GlowBlockState snowstate = state.getBlock().getRelative(BlockFace.DOWN).getState(); byte data = snowstate.getRawData(); if (snowstate.getType() == Material.SNOW && !(data >= 7)) { data++; snowstate.setRawData(data); snowstate.update(); } else if (!(snowstate.getType() == Material.SNOW)) { <START> super.placeBlock(player, state, face, holding, clickedLoc); <END> } }</code><technical_language>tabs of instead of spaces here. spaces. :)</technical_language>

Target:
public void placeBlock(GlowPlayer player, GlowBlockState state, BlockFace face, ItemStack holding, Vector clickedLoc) { GlowBlockState snowstate = state.getBlock().getRelative(BlockFace.DOWN).getState(); byte data = snowstate.getRawData(); if ((snowstate.getType() == Material.SNOW) && (data < 7)) { data++; snowstate.setRawData(data); snowstate.update(); } else if (snowstate.getType() != Material.SNOW) { super.placeBlock(player, state, face, holding, clickedLoc); } }
Source:
<code>public boolean <START> contains(IkeTsPayload <END> tsPayload) { for (IkeTrafficSelector subTs : tsPayload.trafficSelectors) { boolean hasSuperTs = false; for (IkeTrafficSelector superTs : this.trafficSelectors) { if (superTs.contains(subTs)) { hasSuperTs = true; break; } } if (!hasSuperTs) return false; } return true; }</code><technical_language>skimming RFC, do is send SINGLE_PAIR_REQUIRED. case get multiple TS ranges (at moment) is is created part of larval SA: Top of Page 45: If initiator generate request based packet, (for example) startup, specific Traffic Selectors helping responder select correct range. for responder determine pair of addresses included in this tunnel, a guess reject request a SINGLE_PAIR_REQUIRED Notify message. Overall, client, send a request triggers a new SA creation, implies is authoritative IKE daemon handle SA creation request</technical_language>

Target:
public boolean contains(IkeTsPayload tsPayload) { subTsLoop: for (IkeTrafficSelector subTs : tsPayload.trafficSelectors) { for (IkeTrafficSelector superTs : this.trafficSelectors) { if (superTs.contains(subTs)) { continue subTsLoop; } } return false; } return true; }
Source:
<code>public Client deregisterClient(String registrationId) { try (Jedis j = pool.getResource()) { if (!"OK".equals(j.rename((REG_EP + registrationId).getBytes(), ("TODELETE#" + REG_EP + registrationId).getBytes()))) { System.err.println("del meh"); return null; } byte[] key = j.get(("TODELETE#" + REG_EP + registrationId).getBytes()); if (key == null) { return null; } byte[] data = j.get(ByteArrayUtils.concatenate(EP_CLIENT.getBytes(), key)); Client c = deserialize(data); <START> j.del(("TODELETE#" + REG_EP + registrationId).getBytes()); <END> j.del(ByteArrayUtils.concatenate(EP_CLIENT.getBytes(), key)); for (ClientRegistryListener l : listeners) { l.unregistered(c); } return c; } }</code><technical_language>("TODELETE#" + REG_EP + registrationId).getBytes() -> This key is built 3 times in this method</technical_language>

Target:
public Client deregisterClient(String registrationId) { try (Jedis j = pool.getResource()) { byte[] regKey = (REG_EP + registrationId).getBytes(); byte[] delRegKey = ("TODELETE#" + REG_EP + registrationId).getBytes(); if (!"OK".equals(j.rename(regKey, delRegKey))) { return null; } byte[] key = j.get(delRegKey); if (key == null) { return null; } byte[] epKey = ByteArrayUtils.concatenate(EP_CLIENT.getBytes(), key); byte[] data = j.get(epKey); Client c = deserialize(data); j.del(delRegKey); j.del(epKey); for (ClientRegistryListener l : listeners) { l.unregistered(c); } return c; } }
Source:
<code>public void createInitialLayout(IPageLayout layout) { layout.setEditorAreaVisible(false); layout.addPerspectiveShortcut(ID); layout.addNewWizardShortcut(NewTmfProjectWizard.ID); IFolderLayout topLeftFolder = layout.createFolder( "topLeftFolder", IPageLayout.LEFT, 0.15f, IPageLayout.ID_EDITOR_AREA); topLeftFolder.addView(PROJECT_VIEW_ID); IFolderLayout topRightFolder = layout.createFolder( "topRightFolder", IPageLayout.TOP, 0.50f, IPageLayout.ID_EDITOR_AREA); topRightFolder.addView(EVENTS_VIEW_ID); IFolderLayout middleRightFolder = layout.createFolder( "middleRightFolder", IPageLayout.BOTTOM, 0.50f, "topRightFolder"); middleRightFolder.addView(STATISTICS_VIEW_ID); IFolderLayout bottomRightFolder = layout.createFolder( "bottomRightFolder", IPageLayout.BOTTOM, 0.55f, "middleRightFolder"); bottomRightFolder.addView(HISTOGRAM_VIEW_ID); bottomRightFolder.addView(PROPERTIES_VIEW_ID); bottomRightFolder.addView(BOOKMARKS_VIEW_ID); layout.addPerspectiveShortcut(ID); <START> layout.addNewWizardShortcut(NewTmfProjectWizard.ID); <END> }</code><technical_language>lines executed twice</technical_language>

Target:
public void createInitialLayout(IPageLayout layout) { layout.setEditorAreaVisible(false); IFolderLayout topLeftFolder = layout.createFolder( "topLeftFolder", IPageLayout.LEFT, 0.15f, IPageLayout.ID_EDITOR_AREA); topLeftFolder.addView(PROJECT_VIEW_ID); IFolderLayout topRightFolder = layout.createFolder( "topRightFolder", IPageLayout.TOP, 0.50f, IPageLayout.ID_EDITOR_AREA); topRightFolder.addView(EVENTS_VIEW_ID); IFolderLayout middleRightFolder = layout.createFolder( "middleRightFolder", IPageLayout.BOTTOM, 0.50f, "topRightFolder"); middleRightFolder.addView(STATISTICS_VIEW_ID); IFolderLayout bottomRightFolder = layout.createFolder( "bottomRightFolder", IPageLayout.BOTTOM, 0.55f, "middleRightFolder"); bottomRightFolder.addView(HISTOGRAM_VIEW_ID); bottomRightFolder.addView(PROPERTIES_VIEW_ID); bottomRightFolder.addView(BOOKMARKS_VIEW_ID); layout.addPerspectiveShortcut(ID); layout.addNewWizardShortcut(NewTmfProjectWizard.ID); }
Source:
<code>private void configureNetworking(VirtualMachine vm, VirtualApplianceCachingTemplate template, Datacenter datacenter, TemplateOptions options) { if (!options.getNetworks().isEmpty()) { <START> List<Ip<?, ?>> ips = Lists.newArrayList(); <END> Enterprise enterprise = adminService.getCurrentEnterprise(); Iterable<ExternalNetwork> externalNetworks = enterprise.listExternalNetworks(datacenter); for (String networkId : options.getNetworks()) { Network<?> network = template.getVirtualDatacenter().getPrivateNetwork(Ints.tryParse(networkId)); if (network == null) { network = find(externalNetworks, networkId(networkId)); } Ip<?, ?> availableIp = get(network.listUnusedIps(), 0); logger.debug(">> Found available %s ip %s", availableIp.getNetworkType().name().toLowerCase(), availableIp.getIp()); ips.add(availableIp); } vm.setNics(ips); } else { Optional<PublicIp> publicIp = tryFind(template.getVirtualDatacenter().listPurchasedPublicIps(), IpPredicates.<PublicIp> notUsed()); if (publicIp.isPresent()) { logger.debug(">> Found available public ip %s", publicIp.get().getIp()); vm.setNics(Lists.<Ip<?, ?>> newArrayList(publicIp.get())); } else { logger.debug(">> No available public ip found. Using a private ip"); } } }</code><technical_language>ImmutableList.builder()</technical_language>

Target:
private void configureNetworking(VirtualMachine vm, VirtualApplianceCachingTemplate template, Datacenter datacenter, TemplateOptions options) { if (!options.getNetworks().isEmpty()) { ImmutableList.Builder<Ip<?, ?>> ips = ImmutableList.<Ip<?, ?>> builder(); Enterprise enterprise = adminService.getCurrentEnterprise(); Iterable<ExternalNetwork> externalNetworks = enterprise.listExternalNetworks(datacenter); for (String networkId : options.getNetworks()) { Network<? extends Ip<?, ?>> network = template.getVirtualDatacenter().getPrivateNetwork( Ints.tryParse(networkId)); if (network == null) { final Integer id = Ints.tryParse(networkId); network = find(externalNetworks, new Predicate<Network<?>>() { @Override public boolean apply(final Network<?> input) { return Integer.valueOf(id).equals(input.getId()); } }, null); } checkArgument(network != null, "No network was found with id: %s", networkId); Iterable<? extends Ip<?, ?>> unusedIps = network.listUnusedIps(); checkArgument(!isEmpty(unusedIps), "There are no available ips in network: %s", networkId); Ip<?, ?> availableIp = get(unusedIps, 0); logger.debug(">> Found available ip: %s", availableIp); ips.add(availableIp); } vm.setNics(ips.build()); } else { Optional<PublicIp> publicIp = tryFind(template.getVirtualDatacenter().listPurchasedPublicIps(), IpPredicates.<PublicIp> notUsed()); if (publicIp.isPresent()) { logger.debug(">> Found available public ip %s", publicIp.get().getIp()); vm.setNics(ImmutableList.<Ip<?, ?>> of(publicIp.get())); } else { logger.debug(">> No available public ip found. Using a private ip"); } } }
Source:
<code>public void validate(final JSONObject event) { <START> final boolean allItemsPass = validators.stream().anyMatch(new Predicate<EventValidator>() { <END> @Override public boolean test(final EventValidator validator) { return !validator.accepts(event); } }); Preconditions.checkState(!allItemsPass, "Some validation failed"); }</code><technical_language>I allMatch instead of anyMatch</technical_language>

Target:
public void validate(final JSONObject event) { final boolean allItemsPass = validators.stream().anyMatch(ev -> !ev.accepts(event)); Preconditions.checkState(!allItemsPass, "Some validation failed"); }
Source:
<code>public boolean equals(final Object o) { if (this == o) { return true; } else if (o == null || getClass() != o.getClass()) { return false; } final Movement other = (Movement) o; <START> return task == other.task && source == other.source && destination == other.destination; <END> }</code><technical_language>also. IDE code generator these, correct. a configuration wrong somewhere? produces: java @Override public boolean equals(final Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; final Movement<?> movement = (Movement<?>) o; return Objects.equals(task, movement.task) && Objects.equals(source, movement.source) && Objects.equals(destination, movement.destination); }</technical_language>

Target:
public boolean equals(final Object o) { if (this == o) { return true; } if (o == null || getClass() != o.getClass()) { return false; } final Movement<?> movement = (Movement<?>) o; return Objects.equals(task, movement.task) && Objects.equals(source, movement.source) && Objects.equals(destination, movement.destination); }
Source:
<code>public static ActionInvocation loadInvocation(String key, String token) { InvocationContext invocationContext = (InvocationContext) getInvocationMap().get(key); if ((invocationContext == null) || !invocationContext.token.equals(token)) { return null; } ActionInvocation savedInvocation = null; if (invocationContext.invocation != null) { final ActionContext savedActionContext; final ActionContext previousActionContext; savedInvocation = invocationContext.invocation; savedActionContext = savedInvocation.getInvocationContext(); <START> previousActionContext = ActionContext.getContext(); <END> ActionContext.setContext(savedActionContext); savedActionContext.setValueStack(savedInvocation.getStack()); savedActionContext.setValueStack(savedInvocation.getStack()); if (previousActionContext != null) { savedActionContext.put(ServletActionContext.PAGE_CONTEXT, previousActionContext.get(ServletActionContext.PAGE_CONTEXT)); } else { savedActionContext.put(ServletActionContext.PAGE_CONTEXT, null); } } return savedInvocation; }</code><technical_language>declare contextes initialise in line</technical_language>

Target:
public static ActionInvocation loadInvocation(String key, String token) { InvocationContext invocationContext = (InvocationContext) getInvocationMap().get(key); if ((invocationContext == null) || !invocationContext.token.equals(token)) { return null; } final ActionInvocation savedInvocation = invocationContext.invocation; if (savedInvocation != null) { final ActionContext savedActionContext = savedInvocation.getInvocationContext(); final ActionContext previousActionContext = ActionContext.getContext(); ActionContext.setContext(savedActionContext); savedActionContext.setValueStack(savedInvocation.getStack()); if (previousActionContext != null) { savedActionContext.put(ServletActionContext.PAGE_CONTEXT, previousActionContext.get(ServletActionContext.PAGE_CONTEXT)); } else { savedActionContext.put(ServletActionContext.PAGE_CONTEXT, null); } } return savedInvocation; }
Source:
<code>private static void removeTokens(ArrayList<String> nameParts, PersonNameType personName) { if (!nameParts.isEmpty() && !nameParts.get(0).isEmpty()) { personName.setGivenName(nameParts.get(0)); nameParts.remove(0); if (LOG.isTraceEnabled()) { <START> LOG.trace("Assertion.userInfo.personName.givenName = " + personName.getGivenName()); <END> } } if (!nameParts.isEmpty() && !nameParts.get(nameParts.size() - 1).isEmpty()) { personName.setFamilyName(nameParts.get(nameParts.size() - 1)); nameParts.remove(nameParts.size() - 1); if (LOG.isTraceEnabled()) { LOG.trace("Assertion.userInfo.personName.familyName = " + personName.getFamilyName()); } } if (!nameParts.isEmpty()) { StringBuilder midName = new StringBuilder(); for (String name : nameParts) { midName.append(name + " "); } midName.setLength(midName.length() - 1); personName.setSecondNameOrInitials(midName.toString()); if (LOG.isTraceEnabled()) { LOG.trace( "Assertion.userInfo.personName.secondNameOrInitials = " + personName.getSecondNameOrInitials()); } } }</code><technical_language>user parametered logging</technical_language>

Target:
private static void removeTokens(ArrayList<String> nameParts, PersonNameType personName) { if (!nameParts.isEmpty() && !nameParts.get(0).isEmpty()) { personName.setGivenName(nameParts.get(0)); nameParts.remove(0); LOG.trace("Assertion.userInfo.personName.givenName = {}", personName.getGivenName()); } if (!nameParts.isEmpty() && !nameParts.get(nameParts.size() - 1).isEmpty()) { personName.setFamilyName(nameParts.get(nameParts.size() - 1)); nameParts.remove(nameParts.size() - 1); LOG.trace("Assertion.userInfo.personName.familyName = {}", personName.getFamilyName()); } if (!nameParts.isEmpty()) { StringBuilder midName = new StringBuilder(); for (String name : nameParts) { midName.append(name + " "); } midName.setLength(midName.length() - 1); personName.setSecondNameOrInitials(midName.toString()); LOG.trace("Assertion.userInfo.personName.secondNameOrInitials = {}", personName.getSecondNameOrInitials()); } }
Source:
<code>protected void updateCurrentTime(long position) { <START> if ((currentTimeTextView.getVisibility() == VISIBLE) && <END> (Math.abs(position - lastUpdatedPosition) >= 1000 || lastUpdatedPosition == 0)) { lastUpdatedPosition = position; currentTimeTextView.setText(TimeFormatUtil.formatMs(position)); } }</code><technical_language>This a delay (up a second) in updating timestamp controls shown again, please remove VISIBLE check</technical_language>

Target:
protected void updateCurrentTime(long position) { if (Math.abs(position - lastUpdatedPosition) >= 1000 || lastUpdatedPosition == 0) { lastUpdatedPosition = position; currentTimeTextView.setText(TimeFormatUtil.formatMs(position)); } }
Source:
<code>protected @Nullable Tree getEnclosingClassOrMethod(Tree tree) { TreePath path = getPath(tree); <START> Set<Tree.Kind> classAndMethodKinds = EnumSet.copyOf(TreeUtils.classTreeKinds()); <END> classAndMethodKinds.add(Kind.METHOD); classAndMethodKinds.add(Kind.TYPE_ANNOTATION); classAndMethodKinds.add(Kind.ANNOTATION); Tree enclosing = TreeUtils.enclosingOfKind(path, classAndMethodKinds); if (enclosing != null) { if (enclosing.getKind() == Kind.ANNOTATION || enclosing.getKind() == Kind.TYPE_ANNOTATION) { return null; } return enclosing; } Element e = getEnclosingElementForArtificialTree(tree); if (e != null) { Element enclosingMethodOrClass = e; while (enclosingMethodOrClass != null && enclosingMethodOrClass.getKind() != ElementKind.METHOD && !enclosingMethodOrClass.getKind().isClass() && !enclosingMethodOrClass.getKind().isInterface()) { enclosingMethodOrClass = enclosingMethodOrClass.getEnclosingElement(); } return declarationFromElement(enclosingMethodOrClass); } return getCurrentClassTree(tree); }</code><technical_language>I suggest creating TreeUtils.classAndMethodTreeKinds() add methods performade method call</technical_language>

Target:
protected @Nullable Tree getEnclosingClassOrMethod(Tree tree) { TreePath path = getPath(tree); Tree enclosing = TreeUtils.enclosingOfKind(path, classMethodAnnotationKinds); if (enclosing != null) { if (enclosing.getKind() == Kind.ANNOTATION || enclosing.getKind() == Kind.TYPE_ANNOTATION) { return null; } return enclosing; } Element e = getEnclosingElementForArtificialTree(tree); if (e != null) { Element enclosingMethodOrClass = e; while (enclosingMethodOrClass != null && enclosingMethodOrClass.getKind() != ElementKind.METHOD && !enclosingMethodOrClass.getKind().isClass() && !enclosingMethodOrClass.getKind().isInterface()) { enclosingMethodOrClass = enclosingMethodOrClass.getEnclosingElement(); } return declarationFromElement(enclosingMethodOrClass); } return getCurrentClassTree(tree); }
Source:
<code>public void connect() throws Exception { log.debug( String.format( "connect enter (%1$s:%2$s, %3$d, %4$d)", _host, _port, _hardTimeout, _softTimeout ) <START> ); <END> try { if (_client != null) { throw new IOException("Already connected"); } _client = _getSSHClient(); _client.setHardTimeout(_hardTimeout); _client.setSoftTimeout(_softTimeout); _client.setHost(_host, _port); log.debug("connecting"); _client.connect(); } catch(Exception e) { log.debug( String.format( "Could not connect to host %1$s", _client.getDisplayHost() ), e ); throw e; } }</code><technical_language>aware this expensive of String.format is executed time, debug is enabled</technical_language>

Target:
public void connect() throws Exception { if (log.isDebugEnabled()) { log.debug( String.format( "connect enter (%1$s:%2$s, %3$d, %4$d)", _host, _port, _hardTimeout, _softTimeout ) ); } try { if (_client != null) { throw new IOException("Already connected"); } _client = _getSSHClient(); _client.setHardTimeout(_hardTimeout); _client.setSoftTimeout(_softTimeout); _client.setHost(_host, _port); log.debug("connecting"); _client.connect(); } catch(Exception e) { log.debug( String.format( "Could not connect to host %1$s", _client.getDisplayHost() ), e ); throw e; } }
Source:
<code>public void dispose(IMediaStream stream){ if (amfInjectionListener != null){ <START> amfInjectionListener.dispose(stream); <END> } }</code><technical_language>add amfInjectionListener=null</technical_language>

Target:
public void dispose(IMediaStream stream){ if (amfInjectionListener != null){ amfInjectionListener.dispose(stream); amfInjectionListener = null; } }
Source:
<code>LRESULT wmChar (long hwnd, long wParam, long lParam) { if (ignoreCharacter) return null; LRESULT result = super.wmChar (hwnd, wParam, lParam); if (result != null) return result; switch ((int) wParam) { case SWT.DEL: if (OS.GetKeyState (OS.VK_CONTROL) < 0) { return LRESULT.ZERO; <START> } <END> } switch ((int) wParam) { case SWT.TAB: return LRESULT.ZERO; case SWT.CR: if (!ignoreDefaultSelection) sendSelectionEvent (SWT.DefaultSelection); ignoreDefaultSelection = false; if (getSelectionIndex() == -1) { if ((style & SWT.DROP_DOWN) != 0 && (style & SWT.READ_ONLY) == 0) { if (OS.SendMessage(handle, OS.CB_GETDROPPEDSTATE, 0, 0) != 0) { OS.SendMessage(handle, OS.CB_SHOWDROPDOWN, 0, 0); } return LRESULT.ZERO; } } case SWT.ESC: if ((style & SWT.DROP_DOWN) != 0) { if (OS.SendMessage (handle, OS.CB_GETDROPPEDSTATE, 0, 0) == 0) { return LRESULT.ZERO; } } } return result; }</code><technical_language>This case statement for SWT.DEL moved existing switch-case for wParam below</technical_language>

Target:
LRESULT wmChar (long hwnd, long wParam, long lParam) { if (ignoreCharacter) return null; LRESULT result = super.wmChar (hwnd, wParam, lParam); if (result != null) return result; switch ((int) wParam) { case SWT.TAB: return LRESULT.ZERO; case SWT.CR: if (!ignoreDefaultSelection) sendSelectionEvent (SWT.DefaultSelection); ignoreDefaultSelection = false; if (getSelectionIndex() == -1) { if ((style & SWT.DROP_DOWN) != 0 && (style & SWT.READ_ONLY) == 0) { if (OS.SendMessage(handle, OS.CB_GETDROPPEDSTATE, 0, 0) != 0) { OS.SendMessage(handle, OS.CB_SHOWDROPDOWN, 0, 0); } return LRESULT.ZERO; } } case SWT.ESC: if ((style & SWT.DROP_DOWN) != 0) { if (OS.SendMessage (handle, OS.CB_GETDROPPEDSTATE, 0, 0) == 0) { return LRESULT.ZERO; } } case SWT.DEL: if (OS.GetKeyState (OS.VK_CONTROL) < 0) { return LRESULT.ZERO; } } return result; }
Source:
<code>private void makeWikipediaZeroCrouton(int bgcolor, int fgcolor, String verbiage) { Style style = new Style.Builder() .setBackgroundColor(bgcolor) .setGravity(Gravity.CENTER) .setTextAppearance(android.R.attr.textAppearanceMedium) .setTextColor(fgcolor) <START> .setHeight(192) <END> .build(); Crouton.makeText(this, verbiage, style, R.id.zero_crouton_container).show(); }</code><technical_language>I sneaking feeling height is in device-specific pixels, device-independent-pixels. Need multiply a base size WikipediaApp.SCREEN_DENSITY maybe</technical_language>

Target:
private void makeWikipediaZeroCrouton(int bgcolor, int fgcolor, String verbiage) { Style style = new Style.Builder() .setBackgroundColor(bgcolor) .setGravity(Gravity.CENTER) .setTextSize(20) .setTextColor(fgcolor) .setHeight((int) Math.floor(192.0 * WikipediaApp.SCREEN_DENSITY)) .build(); Crouton.makeText(this, verbiage, style, R.id.zero_crouton_container).show(); }
Source:
<code>protected JobDesc create(QualifiedJobId qualifiedJobId, Configuration jobConf, String appId, String version, Framework framework, long submitTimeMillis) { if (null == qualifiedJobId) { throw new IllegalArgumentException( "Cannot create a JobKey from a null qualifiedJobId."); } String userName = jobConf.get(Constants.USER_CONF_KEY_HADOOP2); if (StringUtils.isBlank(userName)) { <START> userName = jobConf.get(Constants.USER_CONF_KEY); <END> } return new JobDesc(qualifiedJobId, userName, appId, version, submitTimeMillis, framework); }</code><technical_language>do check for exceptional case of hadoop1 hadoop2 user names blank. is ok if happen, I do check for this exceptional case in JobHistoryService.java</technical_language>

Target:
protected JobDesc create(QualifiedJobId qualifiedJobId, Configuration jobConf, String appId, String version, Framework framework, long submitTimeMillis) { if (null == qualifiedJobId) { throw new IllegalArgumentException( "Cannot create a JobKey from a null qualifiedJobId."); } String userName = HadoopConfUtil.getUserNameInConf(jobConf); return new JobDesc(qualifiedJobId, userName, appId, version, submitTimeMillis, framework); }
Source:
<code>public void render(Context context, C value, SafeHtmlBuilder sb) { Integer errCount = (value != null && value.getErrorCount() != null ? value.getErrorCount() : 0); DOMTokenList tooltipClasses = tooltip.getClassList(); tooltip.setTextContent(Integer.toString(errCount)); if (errCount > 0) { tooltipClasses.add(ERROR_PRESENT_STYLE); } else { tooltipClasses.remove(ERROR_PRESENT_STYLE); } <START> if (viewPresenter.isUserAuthorizedForPerspective(EXECUTION_ERRORS) && errCount > 0) { <END> tooltip.setTitle(Constants.INSTANCE.ErrorCountNumberView(errCount)); tooltip.setAttribute(DATA_INSTANCE_ATTRIBUTE, value.getId().toString()); tooltipClasses.add(LINK_AVAILABLE_STYLE); initTooltipsAsync(); } else { tooltip.removeAttribute("title"); tooltip.removeAttribute(DATA_INSTANCE_ATTRIBUTE); tooltipClasses.remove(LINK_AVAILABLE_STYLE); } sb.appendHtmlConstant(tooltip.getOuterHTML()); }</code><technical_language>@mcivantos-tribalyte previous format a condition.test evaluate this</technical_language>

Target:
public void render(Context context, C value, SafeHtmlBuilder sb) { Integer errCount = (value != null && value.getErrorCount() != null ? value.getErrorCount() : 0); DOMTokenList tooltipClasses = tooltip.getClassList(); tooltip.setTextContent(Integer.toString(errCount)); if (errCount > 0) { tooltipClasses.add(ERROR_PRESENT_STYLE); } else { tooltipClasses.remove(ERROR_PRESENT_STYLE); } if (viewPresenter.getViewErrorsActionCondition().test(value)) { tooltip.setTitle(Constants.INSTANCE.ErrorCountNumberView(errCount)); tooltip.setAttribute(DATA_INSTANCE_ATTRIBUTE, value.getId().toString()); tooltipClasses.add(LINK_AVAILABLE_STYLE); initTooltipsAsync(); } else { tooltip.removeAttribute("title"); tooltip.removeAttribute(DATA_INSTANCE_ATTRIBUTE); tooltipClasses.remove(LINK_AVAILABLE_STYLE); } sb.appendHtmlConstant(tooltip.getOuterHTML()); }
Source:
<code>protected BasicDataSource getDatasource() { MetadataStorageConnectorConfig connectorConfig = getConfig(); BasicDataSource dataSource = new BasicDataSource(); dataSource.setUsername(connectorConfig.getUser()); dataSource.setPassword(connectorConfig.getPassword()); String uri = connectorConfig.getConnectURI(); dataSource.setUrl(uri); <START> if (connectorConfig.isUseValidationQuery()) { <END> dataSource.setValidationQuery(connectorConfig.getValidationQuery()); dataSource.setTestOnBorrow(true); } return dataSource; }</code><technical_language>i a validation query</technical_language>

Target:
protected BasicDataSource getDatasource() { MetadataStorageConnectorConfig connectorConfig = getConfig(); BasicDataSource dataSource = new BasicDataSource(); dataSource.setUsername(connectorConfig.getUser()); dataSource.setPassword(connectorConfig.getPassword()); String uri = connectorConfig.getConnectURI(); dataSource.setUrl(uri); dataSource.setValidationQuery(connectorConfig.getValidationQuery()); dataSource.setTestOnBorrow(true); return dataSource; }
Source:
<code><START> public void putObject( <END> String bucketName, String objectName, String filename, PutObjectOptions options) throws ErrorResponseException, IllegalArgumentException, InsufficientDataException, InternalException, InvalidBucketNameException, InvalidKeyException, InvalidResponseException, IOException, NoSuchAlgorithmException, ServerException, XmlParserException { UploadObjectArgs.Builder builder = UploadObjectArgs.builder().bucket(bucketName).object(objectName).filename(filename); if (!options.contentType().equals("application/octet-stream")) { builder.contentType(options.contentType()); } uploadObject(builder.build()); }</code><technical_language>is ssec</technical_language>

Target:
public void putObject( String bucketName, String objectName, String filename, PutObjectOptions options) throws ErrorResponseException, IllegalArgumentException, InsufficientDataException, InternalException, InvalidBucketNameException, InvalidKeyException, InvalidResponseException, IOException, NoSuchAlgorithmException, ServerException, XmlParserException { UploadObjectArgs.Builder builder = UploadObjectArgs.builder().bucket(bucketName).object(objectName).filename(filename); if (options != null) { builder.sse(options.sse()); if (!options.contentType().equals("application/octet-stream")) { builder.contentType(options.contentType()); } } uploadObject(builder.build()); }
Source:
<code>public void undelete(RepositoryPath path) throws IOException { Repository repository = path.getRepository(); Storage storage = repository.getStorage(); <START> logger.debug("Attempting to restore: path-[{}]; ", path); <END> super.undelete(path); repositoryEventListenerRegistry.dispatchUndeleteTrashEvent(storage.getId(), repository.getId()); logger.debug("The trash for {}:{} has been undeleted.", storage.getId(), repository.getId()); }</code><technical_language>suggestion logger.debug("Attempting restore: [{}]; ", path);</technical_language>

Target:
public void undelete(RepositoryPath path) throws IOException { Repository repository = path.getRepository(); Storage storage = repository.getStorage(); logger.debug("Attempting to restore: [{}]; ", path); super.undelete(path); repositoryEventListenerRegistry.dispatchUndeleteTrashEvent(storage.getId(), repository.getId()); logger.debug("The trash for {}:{} has been undeleted.", storage.getId(), repository.getId()); }
Source:
<code>protected KeyPair reloadClientIdentity(Path path) throws IOException, GeneralSecurityException { if (isStrict()) { PosixFilePermission violation = KeyUtils.validateStrictKeyFilePermissions(path, IoUtils.EMPTY_LINK_OPTIONS); if (violation != null) { if (log.isDebugEnabled()) { log.debug("reloadClientIdentity({}) ignore due to permission violation: {}", path, violation); } return null; } String ownerViolation = KeyUtils.validateStrictKeyFileOwner(path, IoUtils.EMPTY_LINK_OPTIONS); if (ownerViolation != null) { if (log.isDebugEnabled()) { log.debug("reloadClientIdentity({}) ignore due to owner violation: {}", path, ownerViolation); <START> } <END> return null; } } String location = path.toString(); ClientIdentityLoader idLoader = getClientIdentityLoader(); if (idLoader.isValidLocation(location)) { return idLoader.loadClientIdentity(location, getFilePasswordProvider()); } if (log.isDebugEnabled()) { log.debug("reloadClientIdentity({}) invalid location", location); } return null; }</code><technical_language>I prefer: java if (GenericUtils.length(ownerViolation) > 0) { ... } I "empty" owner expected, if IMO "no user"</technical_language>

Target:
protected KeyPair reloadClientIdentity(Path path) throws IOException, GeneralSecurityException { if (isStrict()) { Pair<String, Object> violation = KeyUtils.validateStrictKeyFilePermissions(path, IoUtils.EMPTY_LINK_OPTIONS); if (violation != null) { if (log.isDebugEnabled()) { log.debug("reloadClientIdentity({}) ignore due to {}", path, violation.getFirst()); } return null; } } String location = path.toString(); ClientIdentityLoader idLoader = getClientIdentityLoader(); if (idLoader.isValidLocation(location)) { return idLoader.loadClientIdentity(location, getFilePasswordProvider()); } if (log.isDebugEnabled()) { log.debug("reloadClientIdentity({}) invalid location", location); } return null; }
Source:
<code>public SessionFactory<F> resolve(Message<?> message) { DefaultFtpSessionFactory sessionFactory = new DefaultFtpSessionFactory(); sessionFactory.setHost(this.headerExpression.getValue(message).toString()); sessionFactory.setUsername(this.userNameExpression.getValue(message).toString()); sessionFactory.setPassword(this.passwordExpression.getValue(message).toString()); <START> sessionFactory.setPort(Integer.valueOf(this.portExpression.getValue(message).toString())); <END> return (SessionFactory<F>) sessionFactory; }</code><technical_language>No, toString(). Please, study SpEL</technical_language>

Target:
public SessionFactory<F> resolve(Message<?> message) { DefaultFtpSessionFactory sessionFactory = new DefaultFtpSessionFactory(); sessionFactory.setHost(evaluationContext != null ? this.headerExpression.getValue(evaluationContext, message, String.class) : this.headerExpression.getValue(message, String.class)); sessionFactory.setUsername(evaluationContext != null ? this.userNameExpression.getValue(evaluationContext, message, String.class) : this.userNameExpression.getValue(message, String.class)); sessionFactory.setPassword(evaluationContext != null ? this.passwordExpression.getValue(evaluationContext, message, String.class) : this.passwordExpression.getValue(message, String.class)); sessionFactory.setPort(evaluationContext != null ? this.portExpression.getValue(evaluationContext, message, Integer.class) : this.portExpression.getValue(message, Integer.class)); return (SessionFactory<F>) sessionFactory; }
Source:
<code>public Collection<ConceptName> getIndexTermsForLocale(Locale locale) { Vector<ConceptName> indexTermsForLocale = new Vector<ConceptName>(); <START> if (!getIndexTerms().isEmpty()) { <END> for (ConceptName name : getIndexTerms()) { if (name.getLocale().equals(locale)) { indexTermsForLocale.add(name); } } } return indexTermsForLocale; }</code><technical_language>CollectionUtils.isNotEmpty()</technical_language>

Target:
public Collection<ConceptName> getIndexTermsForLocale(Locale locale) { Vector<ConceptName> indexTermsForLocale = new Vector<ConceptName>(); if (CollectionUtils.isNotEmpty(getIndexTerms())) { for (ConceptName name : getIndexTerms()) { if (name.getLocale().equals(locale)) { indexTermsForLocale.add(name); } } } return indexTermsForLocale; }
Source:
<code>private static Collection<ConnectionReference> getAllFBNElementConnections(FBNetworkElement model) { List<ConnectionReference> connections = new ArrayList<>(); for (IInterfaceElement elem : model.getInterface().getAllInterfaceElements()) { connections.addAll((elem.isIsInput() ? elem.getInputConnections() : <START> elem.getOutputConnections()).stream() .map(conn -> new ConnectionReference(conn)).collect(Collectors.toList())); <END> } return connections; }</code><technical_language>putting a helper method increase readability. combination of if, conditional operator (?) a stream expression is confusing imho</technical_language>

Target:
private static Collection<ConnectionReference> getAllFBNElementConnections(FBNetworkElement model) { List<ConnectionReference> connections = new ArrayList<>(); for (IInterfaceElement elem : model.getInterface().getAllInterfaceElements()) { connections.addAll(getConnectionList(elem).stream().map(conn -> new ConnectionReference(conn)) .collect(Collectors.toList())); } return connections; }
Source:
<code>static Map<String, List<String>> addQuotaProjectIdToRequestMetadata( String quotaProjectId, Map<String, List<String>> requestMetadata) { <START> Preconditions.checkNotNull(requestMetadata, "requestMetadata"); <END> Map<String, List<String>> newRequestMetadata = new HashMap<>(requestMetadata); if (quotaProjectId != null && !requestMetadata.containsKey(QUOTA_PROJECT_ID_HEADER_KEY)) { newRequestMetadata.put( QUOTA_PROJECT_ID_HEADER_KEY, Collections.singletonList(quotaProjectId)); } return Collections.unmodifiableMap(newRequestMetadata); }</code><technical_language>nit: this exception message is useful. remove message</technical_language>

Target:
static Map<String, List<String>> addQuotaProjectIdToRequestMetadata( String quotaProjectId, Map<String, List<String>> requestMetadata) { Preconditions.checkNotNull(requestMetadata); Map<String, List<String>> newRequestMetadata = new HashMap<>(requestMetadata); if (quotaProjectId != null && !requestMetadata.containsKey(QUOTA_PROJECT_ID_HEADER_KEY)) { newRequestMetadata.put( QUOTA_PROJECT_ID_HEADER_KEY, Collections.singletonList(quotaProjectId)); } return Collections.unmodifiableMap(newRequestMetadata); }