auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public void start(MetricRegistry registry, MetricFilter filter, Set<MetricAttribute> deniedExpansions) { log.warn("Creating Jaeger reporter"); String url = options.get(URL); <START> Duration timeout = Duration.create(Long.valueOf(options.getOrDefault(TIMEOUT_SECOND, DEFAULT_TIMEOUT_SECOND)), <END> 0); JaegerExporterConfiguration configuration = JaegerExporterConfiguration.builder() .setServiceName("nuxeo") .setThriftEndpoint(url) .setDeadline(timeout) .build(); JaegerTraceExporter.createAndRegister(configuration); activated = true; enableTracing(options); }</code><technical_language>DurationUtils.parse here, a timeout attribute a default expressed in code a Duration DEFAULT_TIMEOUT = Duration.ofSeconds(10)</technical_language>

Target:
public void start(MetricRegistry registry, MetricFilter filter, Set<MetricAttribute> deniedExpansions) { log.warn("Creating Jaeger reporter"); String url = options.get(URL); Duration timeout = Duration.create( DurationUtils.parsePositive(options.get(TIMEOUT), DEFAULT_TIMEOUT).getSeconds(), 0); JaegerExporterConfiguration configuration = JaegerExporterConfiguration.builder() .setServiceName("nuxeo") .setThriftEndpoint(url) .setDeadline(timeout) .build(); JaegerTraceExporter.createAndRegister(configuration); activated = true; enableTracing(options); }
Source:
<code>private AdColonyAppOptions buildAppOptions(MediationRewardedAdConfiguration adConfiguration) { Bundle networkExtras = adConfiguration.getMediationExtras(); <START> AdColonyAppOptions options; <END> if (appOptions != null) { options = appOptions; } else { options = new AdColonyAppOptions(); } if (networkExtras != null) { String userId = networkExtras.getString("user_id"); if (userId != null) { options.setUserID(userId); } } if (adConfiguration.isTestRequest()) { options.setTestModeEnabled(true); } AdColonyUserMetadata userMetadata = new AdColonyUserMetadata(); Location location = adConfiguration.getLocation(); if (location != null) { userMetadata.setUserLocation(location); } options.setUserMetadata(userMetadata); return options; }</code><technical_language>set appOptions default. If null, set a new instance</technical_language>

Target:
private AdColonyAppOptions buildAppOptions(MediationRewardedAdConfiguration adConfiguration) { Bundle networkExtras = adConfiguration.getMediationExtras(); AdColonyAppOptions options = AdColonyMediationAdapter.getAppOptions(); if (networkExtras != null) { String userId = networkExtras.getString("user_id"); if (userId != null) { options.setUserID(userId); } } if (adConfiguration.isTestRequest()) { options.setTestModeEnabled(true); } AdColonyUserMetadata userMetadata = new AdColonyUserMetadata(); Location location = adConfiguration.getLocation(); if (location != null) { userMetadata.setUserLocation(location); } options.setUserMetadata(userMetadata); return options; }
Source:
<code>private static PatentOrFault parse(DocumentText patent, ImportedPatent importedPatent, PatentMetadataParser parser) { Patent.Builder resultBuilder = fillDataFromImport(Patent.newBuilder(), importedPatent); try { return new PatentOrFault(parser.parse(patent.getText(), resultBuilder).build()); } catch (PatentMetadataParserException e) { log.error("error while parsing xml contents of patent id " + patent.getId() + ", text content: " + patent.getText(), e); <START> return new PatentOrFault(resultBuilder.build(), e); <END> } }</code><technical_language>in fault path creating a PatentOrFault a patent parameter exception parameter. I patent is get appln_nr processing stream. This is a bit strange, some other method get appln nr FaultUtils. I explicit field in PatentOrFault holding appln nr this code cleaner</technical_language>

Target:
private static Tuple2<Patent, Fault> parse(DocumentText patent, ImportedPatent importedPatent, PatentMetadataParser parser) { try { Patent.Builder resultBuilder = fillDataFromImport(Patent.newBuilder(), importedPatent); return new Tuple2<>(parser.parse(patent.getText(), resultBuilder).build(), null); } catch (PatentMetadataParserException e) { log.error("error while parsing xml contents of patent id " + patent.getId() + ", text content: " + patent.getText(), e); return new Tuple2<>(null, FaultUtils.exceptionToFault(importedPatent.getApplnNr(), e, null)); } }
Source:
<code>public LeafBucketCollector getLeafCollector(LeafReaderContext ctx, final LeafBucketCollector sub) throws IOException { final SortedBinaryDocValues values = valuesSource.bytesValues(ctx); return new LeafBucketCollectorBase(sub, values) { final BytesRefBuilder previous = new BytesRefBuilder(); @Override public void collect(int docId, long owningBucketOrd) throws IOException { if (false == values.advanceExact(docId)) { return; } int valuesCount = values.docValueCount(); previous.clear(); for (int i = 0; i < valuesCount; ++i) { BytesRef bytes = values.nextValue(); <START> if (filter != null && !filter.accept(bytes)) { <END> continue; } if (i > 0 && previous.get().equals(bytes)) { continue; } previous.copyBytes(bytes); long bucketOrdinal = bucketOrds.add(owningBucketOrd, bytes); if (bucketOrdinal < 0) { bucketOrdinal = -1 - bucketOrdinal; collectExistingBucket(sub, docId, bucketOrdinal); } else { collectBucket(sub, docId, bucketOrdinal); } } } }; }</code><technical_language>Nit: !filter.accept() :) (Also I realize irony original code fault :) )</technical_language>

Target:
public LeafBucketCollector getLeafCollector(LeafReaderContext ctx, final LeafBucketCollector sub) throws IOException { final SortedBinaryDocValues values = valuesSource.bytesValues(ctx); return new LeafBucketCollectorBase(sub, values) { final BytesRefBuilder previous = new BytesRefBuilder(); @Override public void collect(int docId, long owningBucketOrd) throws IOException { if (false == values.advanceExact(docId)) { return; } int valuesCount = values.docValueCount(); previous.clear(); for (int i = 0; i < valuesCount; ++i) { BytesRef bytes = values.nextValue(); if (filter != null && false == filter.accept(bytes)) { continue; } if (i > 0 && previous.get().equals(bytes)) { continue; } previous.copyBytes(bytes); long bucketOrdinal = bucketOrds.add(owningBucketOrd, bytes); if (bucketOrdinal < 0) { bucketOrdinal = -1 - bucketOrdinal; collectExistingBucket(sub, docId, bucketOrdinal); } else { collectBucket(sub, docId, bucketOrdinal); } } } }; }
Source:
<code>private TmfXYChartViewer getChartViewer() throws NoSuchMethodException, SecurityException, IllegalAccessException, IllegalArgumentException, InvocationTargetException { SWTBotView viewBot = fBot.viewById(VIEW_ID); final IViewReference viewReference = viewBot.getViewReference(); IViewPart viewPart = UIThreadRunnable.syncExec(new Result<IViewPart>() { @Override public IViewPart run() { return viewReference.getView(true); } }); assertNotNull(viewPart); <START> if (!(viewPart instanceof PatternScatterGraphView)) { fail("Could not instanciate view"); } <END> TmfChartView chartView = (TmfChartView) viewPart; Method viewer = TmfChartView.class.getDeclaredMethod("getChartViewer"); viewer.setAccessible(true); TmfXYChartViewer chartViewer = (TmfXYChartViewer) viewer.invoke(chartView); fScatterChart = viewBot.bot().widget(WidgetOfType.widgetOfType(Chart.class)); assertNotNull(fScatterChart); return chartViewer; }</code><technical_language>assertTrue("Could instanciate view", viewPart instanceof PatternScatterGraphView)</technical_language>

Target:
private TmfXYChartViewer getChartViewer() throws NoSuchMethodException, SecurityException, IllegalAccessException, IllegalArgumentException, InvocationTargetException { SWTBotView viewBot = fBot.viewById(VIEW_ID); final IViewReference viewReference = viewBot.getViewReference(); IViewPart viewPart = UIThreadRunnable.syncExec(new Result<IViewPart>() { @Override public IViewPart run() { return viewReference.getView(true); } }); assertNotNull(viewPart); assertTrue("Could not instanciate view", viewPart instanceof PatternScatterGraphView); TmfChartView chartView = (TmfChartView) viewPart; Method viewer = TmfChartView.class.getDeclaredMethod("getChartViewer"); viewer.setAccessible(true); TmfXYChartViewer chartViewer = (TmfXYChartViewer) viewer.invoke(chartView); fScatterChart = viewBot.bot().widget(WidgetOfType.widgetOfType(Chart.class)); assertNotNull(fScatterChart); return chartViewer; }
Source:
<code>public void testDebugContextRsAllocationCopy2D_Short_Normal() { setupAllocationCopyTests AC = new setupAllocationCopyTests(this, 2, 128, (RenderScript rs)-> new Type.Builder(rs, Element.I16(rs))); int xOff = AC.RN.nextInt(AC.Width); int yOff = AC.RN.nextInt(AC.Height); int xCount = AC.RN.nextInt(AC.Width - xOff); int yCount = AC.RN.nextInt(AC.Height - yOff); <START> Soob.set_dstXOff(xOff); Soob.set_srcXOff(xOff); Soob.set_yOff(yOff); Soob.set_xCount(xCount); <END> Soob.set_yCount(yCount); Soob.set_srcMip(0); Soob.set_dstMip(0); Soob.invoke_test2D(); AC.finishAllocationCopyTests(); boolean result = true; short[] inArray = new short[AC.ArrLen]; short[] outArray = new short[AC.ArrLen]; AC.aIn.copyTo(inArray); AC.aOut.copyTo(outArray); for (int i = 0; i < AC.Height; i++) { for (int j = 0; j < AC.Width; j++) { int pos = i * AC.Width + j; if (yOff <= i && i < yOff + yCount && xOff <= j && j < xOff + xCount) { if (inArray[pos] != outArray[pos]) { result = false; break; } } else { if (outArray[pos] != 0) { result = false; break; } } } } assertTrue(result); RenderScript.releaseAllContexts(); }</code><technical_language>a stronger test if cases: - xrange out-of-range in y dimension - yrange out-of-range in x dimension about</technical_language>

Target:
public void testDebugContextRsAllocationCopy2D_Short_Normal() { SetupAllocationCopyTests AC = new SetupAllocationCopyTests(2, 128, (RenderScript rs)-> new Type.Builder(rs, Element.I16(rs)), 0x172d8aba); int xOff = AC.RN.nextInt(AC.Width-AC.Height) + AC.Height; int yOff = AC.RN.nextInt(AC.Height); int xCount = AC.RN.nextInt(AC.Width - xOff); int yCount = AC.RN.nextInt(AC.Height - yOff); Soob.set_dstXOff(xOff); Soob.set_srcXOff(xOff); Soob.set_yOff(yOff); Soob.set_xCount(xCount); Soob.set_yCount(yCount); Soob.set_srcMip(0); Soob.set_dstMip(0); Soob.invoke_test2D(); AC.finishAllocationCopyTests(); boolean result = true; short[] inArray = new short[AC.ArrLen]; short[] outArray = new short[AC.ArrLen]; AC.aIn.copyTo(inArray); AC.aOut.copyTo(outArray); for (int i = 0; i < AC.Height; i++) { for (int j = 0; j < AC.Width; j++) { int pos = i * AC.Width + j; if (yOff <= i && i < yOff + yCount && xOff <= j && j < xOff + xCount) { if (inArray[pos] != outArray[pos]) { result = false; break; } } else { if (outArray[pos] != 0) { result = false; break; } } } } assertTrue(result); RenderScript.releaseAllContexts(); }
Source:
<code>public void close() { try { <START> Thread.sleep(1000); <END> } catch (InterruptedException e) { } isOpened = false; }</code><technical_language>Instead of sleep, replacing CountDownLatch? unblock code depending timing schedule</technical_language>

Target:
public void close() { try { Thread.sleep(1000); } catch (InterruptedException e) { } isOpened = false; closeLatch.countDown(); }
Source:
<code>private void deflaterSetInputJdk11(ByteBuf uncompressed, ByteBuf out, int len) { if (uncompressed.isDirect()) { if (writeHeader) { writeHeader = false; if (wrapper == ZlibWrapper.GZIP) { out.writeBytes(gzipHeader); } } try { if (wrapper == ZlibWrapper.GZIP) { CRC32_UPDATE_BYTEBUFFER.invoke(crc, uncompressed.nioBuffer()); } <START> DEFLATER_SET_INPUT_BYTEBUFFER.invoke(deflater, uncompressed.nioBuffer()); <END> } catch (IllegalAccessException e) { throw new Error(e); } catch (InvocationTargetException e) { throw new Error(e); } } else { deflaterSetInputJdk6(uncompressed, out, len); } }</code><technical_language>nit: sense store ByteBuffer in a variable reduce GC ? like: java ByteBuffer nioBuffer = uncompressed.nioBuffer(); if (wrapper == ZlibWrapper.GZIP) { int position = nioBuffer.position(); int limit = nioBuffer.limit(); CRC32_UPDATE_BYTEBUFFER.invoke(crc, nioBuffer); nioBuffer.position(position).limit(limit); } DEFLATER_SET_INPUT_BYTEBUFFER.invoke(deflater, nioBuffer());</technical_language>

Target:
private void deflaterSetInputJdk11(ByteBuf uncompressed, ByteBuf out, int len) { if (uncompressed.isDirect()) { if (writeHeader) { writeHeader = false; if (wrapper == ZlibWrapper.GZIP) { out.writeBytes(gzipHeader); } } try { ByteBuffer nioBuffer = uncompressed.nioBuffer(); if (wrapper == ZlibWrapper.GZIP) { int position = nioBuffer.position(); int limit = nioBuffer.limit(); CRC32_UPDATE_BYTEBUFFER.invoke(crc, nioBuffer); nioBuffer.position(position).limit(limit); } DEFLATER_SET_INPUT_BYTEBUFFER.invoke(deflater, nioBuffer); } catch (IllegalAccessException e) { throw new Error(e); } catch (InvocationTargetException e) { throw new Error(e); } } else { deflaterSetInputJdk6(uncompressed, out, len); } }
Source:
<code>public void handlePostEntitlement(PoolManager manager, Consumer consumer, Map<String, Entitlement> entitlements) { Set<String> stackIds = new HashSet<String>(); for (Entitlement entitlement : entitlements.values()) { if (entitlement.getPool().isStacked()) { stackIds.add(entitlement.getPool().getStackId()); } } List<Pool> subPoolsForStackIds = null; <START> if (!stackIds.isEmpty() && !consumer.isShare() && !consumer.getType().isManifest()) { <END> subPoolsForStackIds = poolCurator.getSubPoolForStackIds(consumer, stackIds); if (CollectionUtils.isNotEmpty(subPoolsForStackIds)) { poolRules.updatePoolsFromStack(consumer, subPoolsForStackIds, false); poolCurator.mergeAll(subPoolsForStackIds, false); } } else { subPoolsForStackIds = new ArrayList<Pool>(); } enforcer.postEntitlement(manager, consumer, entitlements, subPoolsForStackIds); }</code><technical_language>fixed this</technical_language>

Target:
public void handlePostEntitlement(PoolManager manager, Consumer consumer, Map<String, Entitlement> entitlements) { Set<String> stackIds = new HashSet<String>(); for (Entitlement entitlement : entitlements.values()) { if (entitlement.getPool().isStacked()) { stackIds.add(entitlement.getPool().getStackId()); } } List<Pool> subPoolsForStackIds = null; if (!stackIds.isEmpty() && !consumer.isShare() && !consumer.isManifestDistributor()) { subPoolsForStackIds = poolCurator.getSubPoolForStackIds(consumer, stackIds); if (CollectionUtils.isNotEmpty(subPoolsForStackIds)) { poolRules.updatePoolsFromStack(consumer, subPoolsForStackIds, false); poolCurator.mergeAll(subPoolsForStackIds, false); } } else { subPoolsForStackIds = new ArrayList<Pool>(); } enforcer.postEntitlement(manager, consumer, entitlements, subPoolsForStackIds); }
Source:
<code>public void getAllRecipesIfRecipeNamesAreNullTest() { DistroXV1Request distroXV1Request = new DistroXV1Request(); InstanceGroupV1Request instanceGroupV1Request = new InstanceGroupV1Request(); instanceGroupV1Request.setRecipeNames(null); distroXV1Request.setInstanceGroups(Collections.singleton(instanceGroupV1Request)); <START> distroXV1Request.getAllRecipes(); <END> }</code><technical_language>verify result is empty set</technical_language>

Target:
public void getAllRecipesIfRecipeNamesAreNullTest() { DistroXV1Request distroXV1Request = new DistroXV1Request(); InstanceGroupV1Request instanceGroupV1Request = new InstanceGroupV1Request(); instanceGroupV1Request.setRecipeNames(null); distroXV1Request.setInstanceGroups(Collections.singleton(instanceGroupV1Request)); Set<String> allRecipes = distroXV1Request.getAllRecipes(); assertEquals(0, allRecipes.size()); }
Source:
<code>private String getNotificationMessage(LCNotification schedulerBean) { String[] pathParams = schedulerBean.getRegPath().split("/"); String resourceName = pathParams[pathParams.length - 1]; StringBuilder stringBuilder = new StringBuilder("Resource '").append(resourceName).append ("'s lifecycle '").append(schedulerBean.getLcName()).append("' is reaching ").append("lifecycle " <START> + "checkpoint '").append(schedulerBean.getLcCheckpointId()).append("' on ") <END> .append(schedulerBean.getNotificationDate()).append("."); return stringBuilder.toString(); }</code><technical_language>Instead of StringBuilder.append(expr1 + expr2), a good practice StringBuilder.append(expr1).append(expr2) explanation [1]. This code creates another StringBuilder do job of "+". [1] <LINK_0></technical_language>

Target:
private String getNotificationMessage(LCNotification schedulerBean) { String[] pathParams = schedulerBean.getRegPath().split("/"); String resourceName = pathParams[pathParams.length - 1]; StringBuilder stringBuilder = new StringBuilder("Resource '").append(resourceName).append("'s lifecycle '") .append(schedulerBean.getLcName()).append("' is reaching lifecycle checkpoint '") .append(schedulerBean.getLcCheckpointId()).append("' on ").append(schedulerBean.getNotificationDate()) .append("."); return stringBuilder.toString(); }
Source:
<code>public Builder() { super(ChromeScreenshotReportSource::new); <START> _ignoreCertificateErrors = false; <END> }</code><technical_language>nit: Move default variable declaration bottom</technical_language>

Target:
public Builder() { super(ChromeScreenshotReportSource::new); }
Source:
<code>public void savingTemplate() { InfoboxBuilder builder = new InfoboxBuilder(); TemplatePage templatePage = builder.open("savingTemplate") .switchToIFrame() .addRowComponent() .addImageComponent() .save(); <START> builder.verifyCreatedTemplateName("savingTemplate", templatePage); <END> }</code><technical_language>Change assertion</technical_language>

Target:
public void savingTemplate() { TemplatePage templatePage = new InfoboxBuilderPage() .open("savingTemplate") .switchToIFrame() .addRowComponent() .addImageComponent() .save(); Assertion.assertEquals("savingtemplate", templatePage.getHeaderText().toLowerCase()); }
Source:
<code>public void testBasicClass() { compiler.getOptions().setLanguageIn(CompilerOptions.LanguageMode.ECMASCRIPT_2015); PolymerClassDefinition def = parseAndExtractClassDefFromClass( LINE_JOINER.join( "class A extends Polymer.Element {", " static get is() { return 'x-element'; }", " static get config() {", " return {", " properties: {", " pets: {", " type: Array,", " notify: true,", " },", " name: String,", " },", " };", " }", "}")); assertNotNull(def); assertEquals(2, def.version); assertTrue(def.target.isName()); assertEquals("A", def.target.getString()); assertNotNull(def.descriptor); assertTrue(def.descriptor.isObjectLit()); <START> assertNull(def.nativeBaseElement); <END> assertNull(def.behaviors); assertThat(def.props).hasSize(2); }</code><technical_language>checking for null, mark this field @nullable</technical_language>

Target:
public void testBasicClass() { compiler.getOptions().setLanguageIn(CompilerOptions.LanguageMode.ECMASCRIPT_2015); PolymerClassDefinition def = parseAndExtractClassDefFromClass( LINE_JOINER.join( "class A extends Polymer.Element {", " static get is() { return 'x-element'; }", " static get properties() {", " return {", " pets: {", " type: Array,", " notify: true,", " },", " name: String", " };", " }", "}")); assertNotNull(def); assertEquals(PolymerClassDefinition.DefinitionType.ES6Class, def.defType); NodeSubject.assertNode(def.target).hasType(Token.NAME); assertEquals("A", def.target.getString()); assertNotNull(def.descriptor); NodeSubject.assertNode(def.descriptor).hasType(Token.OBJECTLIT); assertNull(def.nativeBaseElement); assertNull(def.behaviors); assertThat(def.props).hasSize(2); }
Source:
<code><START> public void pickFreePort() { <END> for (Iterator<Integer> iter = DEFAULT_HTTP_PORT_RANGE.iterator(); iter.hasNext();) { Integer port = iter.next(); if (Networking.isPortAvailable(port)) { httpPort = port; return; } } fail("someone is already listening on ports "+DEFAULT_HTTP_PORT_RANGE+"; tests assume that port is free on localhost"); }</code><technical_language>move body of this a common untility, similar Networking.nextAvailablePort(int port). For example code below: public static int firstAvailablePort(PortRange range) { for (Integer port : range) { if (Networking.isPortAvailable(port)) { return port; } } fail("someone is listening ports "+range+" localhost"); } in Networking PortRange visible. consider moving PortRange PortRanges brooklyn-utils-common, next Networking. in this PR</technical_language>

Target:
public void pickFreePort() { for (Iterator<Integer> iter = DEFAULT_PORT_RANGE.iterator(); iter.hasNext();) { Integer port = iter.next(); if (Networking.isPortAvailable(port)) { httpPort = port; return; } } fail("someone is already listening on ports "+DEFAULT_PORT_RANGE+"; tests assume that port is free on localhost"); }
Source:
<code>public void register(Set<Macro> macros) { for (Macro macro : macros) { final String name = macro.getName(); if (!this.macros.containsKey(name)) { this.macros.put(name, macro); <START> } <END> } }</code><technical_language>Please, remove it. This **really** useful find out some **Macro** registered in IDE needing launch SuperDevMode</technical_language>

Target:
public void register(Set<Macro> macros) { for (Macro macro : macros) { final String name = macro.getName(); if (this.macros.containsKey(name)) { Log.warn(MacroRegistryImpl.class, "Command macro '" + name + "' is already registered."); } else { this.macros.put(name, macro); } } }
Source:
<code>public long saveProject(Project project) throws IOException { if (projectStore != null) { ValidationResult shortNameValidation = namingScheme.validateProjectShortName(project.getShortName()); if (!shortNameValidation.isValid()) { throw new IOException("Cannot save project - invalid shortName: " + shortNameValidation.getMessage()); } if (project.getId() == AbstractProject.UNSAVED_ID) { project.setName(generateTemporaryName()); projectStore.save(project); try { project.setName(namingScheme.generateNameFor(project)); } catch (MisoNamingException e) { throw new IOException("Cannot save Project - issue with naming scheme", e); } <START> } <END> LimsUtils.validateNameOrThrow(project, namingScheme); return projectStore.save(project); } else { throw new IOException("No projectStore available. Check that it has been declared in the Spring config."); } }</code><technical_language>Need add else clause fetches Hibernate-persisted Project replaces updateable values passed-in project</technical_language>

Target:
public long saveProject(Project project) throws IOException { if (projectStore != null) { ValidationResult shortNameValidation = namingScheme.validateProjectShortName(project.getShortName()); if (!shortNameValidation.isValid()) { throw new IOException("Cannot save project - invalid shortName: " + shortNameValidation.getMessage()); } if (project.getId() == AbstractProject.UNSAVED_ID) { project.setName(generateTemporaryName()); projectStore.save(project); try { project.setName(namingScheme.generateNameFor(project)); } catch (MisoNamingException e) { throw new IOException("Cannot save Project - issue with naming scheme", e); } LimsUtils.validateNameOrThrow(project, namingScheme); } else { Project original = projectStore.get(project.getId()); original.setAlias(project.getAlias()); original.setDescription(project.getDescription()); original.setIssueKeys(project.getIssueKeys()); original.setLastUpdated(project.getLastUpdated()); original.setProgress(project.getProgress()); original.setReferenceGenome(referenceGenomeDao.getReferenceGenome(project.getReferenceGenome().getId())); original.setShortName(project.getShortName()); for (ProjectOverview po : project.getOverviews()) { if (po.getId() == ProjectOverview.UNSAVED_ID) { original.getOverviews().add(po); } } project = original; } return projectStore.save(project); } else { throw new IOException("No projectStore available. Check that it has been declared in the Spring config."); } }
Source:
<code>private void makeEmailStateConsistent(FeedbackSessionAttributes oldSession, FeedbackSessionAttributes newSession) { if (oldSession.isSentOpenEmail()) { newSession.setSentOpenEmail(newSession.isOpened()); } if (oldSession.isSentClosedEmail()) { newSession.setSentClosedEmail(newSession.isClosed()); newSession.setSentClosingEmail( newSession.isClosed() <START> || !newSession.isClosingWithinTimeLimit(SystemParams.NUMBER_OF_HOURS_BEFORE_CLOSING_ALERT)); <END> } if (oldSession.isSentPublishedEmail()) { newSession.setSentPublishedEmail(newSession.isPublished()); } }</code><technical_language>code for isClosingWithinTimeLimit() appears check if session is closing 23 24 hours (given current parameters) now, result in incorrectly setting this value. Example cases: Session closed - sentClosingEmail is true (expected) Session is closing in 10 hours - sentClosingEmail is true (expected) Session is closing in 23.5 hours - sentClosingEmail is false (expected? feels correct output, certain) Session is closing in 48 hours - sentClosingEmail is true (unexpected)</technical_language>

Target:
private void makeEmailStateConsistent(FeedbackSessionAttributes oldSession, FeedbackSessionAttributes newSession) { if (oldSession.isSentOpenEmail()) { newSession.setSentOpenEmail(newSession.isOpened()); } if (oldSession.isSentClosedEmail()) { newSession.setSentClosedEmail(newSession.isClosed()); newSession.setSentClosingEmail( newSession.isClosed() || !newSession.isClosedAfter(SystemParams.NUMBER_OF_HOURS_BEFORE_CLOSING_ALERT)); } if (oldSession.isSentPublishedEmail()) { newSession.setSentPublishedEmail(newSession.isPublished()); } }
Source:
<code>private void updateGeoRepStatus(GlusterVolumeEntity volume, GlusterGeoRepSession session) { <START> if (!areAllBricksActiveInVolume(volume)) { <END> log.info("Not all bricks are up for this volume '{}' ", volume.getName()); throw new EngineException(EngineError.GlusterVolumeGeoRepSyncFailed, "Not all bricks are up for this volume"); } List<Set<GeoRepSessionStatus>> list = new ArrayList<>(); int replicaCount = volume.getReplicaCount() == 0 ? 1 : volume.getReplicaCount(); for (int i = 0; i < volume.getBricks().size(); i = i + replicaCount) { Set<GeoRepSessionStatus> subVolumeStatusSet = new HashSet<>(); int j = 0; while (j < replicaCount) { Guid brickId = volume.getBricks().get(i + j).getId(); subVolumeStatusSet.add(getStatusForBrickFromSession(session, brickId)); j++; } list.add(subVolumeStatusSet); } session.setStatus(GeoRepSessionStatus.ACTIVE); for (Set<GeoRepSessionStatus> subVolumeStatusValues : list) { if (subVolumeStatusValues.contains(GeoRepSessionStatus.ACTIVE)) { continue; } else if (subVolumeStatusValues.contains(GeoRepSessionStatus.FAULTY)) { session.setStatus(GeoRepSessionStatus.FAULTY); return; } if (ArrayUtils.contains(overridableStatuses, session.getStatus())) { if (subVolumeStatusValues.size() == 1) { session.setStatus((GeoRepSessionStatus) subVolumeStatusValues.toArray()[0]); } else { log.info("Multiple status values found in volume '{}'", session.getMasterVolumeName()); } } } }</code><technical_language>this fix issue - bricks need online for georep work. bug reported is IndexOutOfBoundsException - this occur engine is aware of bricks , i.e replicaCount > volume.getBricks().size</technical_language>

Target:
private void updateGeoRepStatus(GlusterVolumeEntity volume, GlusterGeoRepSession session) { List<Set<GeoRepSessionStatus>> list = new ArrayList<>(); int replicaCount = volume.getReplicaCount() == 0 ? 1 : volume.getReplicaCount(); if (replicaCount > volume.getBricks().size()) { throw new EngineException(EngineError.GlusterVolumeGeoRepSyncFailed, "Not all bricks are up for this volume"); } for (int i = 0; i < volume.getBricks().size(); i = i + replicaCount) { Set<GeoRepSessionStatus> subVolumeStatusSet = new HashSet<>(); int j = 0; while (j < replicaCount) { Guid brickId = volume.getBricks().get(i + j).getId(); subVolumeStatusSet.add(getStatusForBrickFromSession(session, brickId)); j++; } list.add(subVolumeStatusSet); } session.setStatus(GeoRepSessionStatus.ACTIVE); for (Set<GeoRepSessionStatus> subVolumeStatusValues : list) { if (subVolumeStatusValues.contains(GeoRepSessionStatus.ACTIVE)) { continue; } else if (subVolumeStatusValues.contains(GeoRepSessionStatus.FAULTY)) { session.setStatus(GeoRepSessionStatus.FAULTY); return; } if (ArrayUtils.contains(overridableStatuses, session.getStatus())) { if (subVolumeStatusValues.size() == 1) { session.setStatus((GeoRepSessionStatus) subVolumeStatusValues.toArray()[0]); } else { log.info("Multiple status values found in volume '{}'", session.getMasterVolumeName()); } } } }
Source:
<code>public boolean createNewFile(File lock) throws IOException { if (!lock.createNewFile()) { return false; } if (supportsAtomicCreateNewFile() || !supportsUnixView) { return true; } Path lockPath = lock.toPath(); Path link = Files.createLink(Paths.get(lock.getAbsolutePath() + ".lnk"), lockPath); try { Integer nlink = (Integer) (Files.getAttribute(lockPath, "unix:nlink")); if (nlink == 2) { return true; <START> } else { LOG.warn("nlink of link to lock file {0} was not 2 but {1}", lock.getPath(), nlink); } <END> return (nlink == 2); } catch (UnsupportedOperationException e) { supportsUnixView = false; return true; } finally { Files.delete(link); } }</code><technical_language>else block is unnecessary here</technical_language>

Target:
public boolean createNewFile(File lock) throws IOException { if (!lock.createNewFile()) { return false; } if (supportsAtomicCreateNewFile() || !supportsUnixView) { return true; } Path lockPath = lock.toPath(); Path link = Files.createLink(Paths.get(lock.getAbsolutePath() + ".lnk"), lockPath); try { Integer nlink = (Integer) (Files.getAttribute(lockPath, "unix:nlink")); if (nlink != 2) { LOG.warn("nlink of link to lock file {0} was not 2 but {1}", lock.getPath(), nlink); return false; } return true; } catch (UnsupportedOperationException e) { supportsUnixView = false; return true; } finally { Files.delete(link); } }
Source:
<code>protected StorageDomain deprecatedPopulate(StorageDomain model, storage_domains entity) { if (StorageDomainSharedStatus.Unattached.equals(entity.getstorage_domain_shared_status())) { model.setStatus(StatusUtils.create(StorageDomainStatus.UNATTACHED)); } else { model.setStatus(null); } <START> return model; <END> }</code><technical_language>need return super.deprecatedPopulate()</technical_language>

Target:
protected StorageDomain deprecatedPopulate(StorageDomain model, storage_domains entity) { if (StorageDomainSharedStatus.Unattached.equals(entity.getstorage_domain_shared_status())) { model.setStatus(StatusUtils.create(StorageDomainStatus.UNATTACHED)); } else { model.setStatus(null); } return super.deprecatedPopulate(model, entity); }
Source:
<code>public void testIsMultipart() throws Exception { <START> Assert.assertEquals(false, MultipartFormDataParser.isMultipart(null)); <END> Assert.assertEquals(false, MultipartFormDataParser.isMultipart("blah")); Assert.assertEquals(true, MultipartFormDataParser.isMultipart("multipart/form-data")); Assert.assertEquals(true, MultipartFormDataParser.isMultipart("multipart/form-data;")); Assert.assertEquals(true, MultipartFormDataParser.isMultipart("multipart/form-data; boundary=----WebKitFormBoundary8OOwv1Xp4c5XkBmD")); }</code><technical_language>assertTrue assertFalse equals. add a message if fails failed</technical_language>

Target:
public void testIsMultipart() throws Exception { Assert.assertFalse("Wrongly identified \"multipart/form-data\"", MultipartFormDataParser.isMultiPartForm(null)); Assert.assertFalse("Wrongly identified \"multipart/form-data\"", MultipartFormDataParser.isMultiPartForm("blah")); Assert.assertTrue("Failed to identify \"multipart/form-data\"", MultipartFormDataParser.isMultiPartForm("multipart/form-data")); Assert.assertTrue("Failed to identify \"multipart/form-data\"", MultipartFormDataParser.isMultiPartForm("multipart/form-data;")); Assert.assertTrue("Failed to identify \"multipart/form-data\"", MultipartFormDataParser.isMultiPartForm("multipart/form-data; boundary=----WebKitFormBoundary8OOwv1Xp4c5XkBmD")); }
Source:
<code>private static void checkRx() { if (!Utils.hasRxJavaOnClasspath()) { <START> throw new NullPointerException("RxJava is not on classpath, " + <END> "make sure that you have it in your dependencies"); } }</code><technical_language>instead of null pointer exception ClassNotFoundException more sense I</technical_language>

Target:
private static void checkRx() { if (!Utils.hasRxJavaOnClasspath()) { throw new NoClassDefFoundError("RxJava is not on classpath, " + "make sure that you have it in your dependencies"); } }
Source:
<code>public VXQueryIndexingOperatorDescriptor(IOperatorDescriptorRegistry spec, VXQueryIndexingDataSource ds, RecordDescriptor rDesc) { super(spec, 1, 1); this.functionCall = ds.getFunctionCall(); collectionPartitions = ds.getPartitions(); dataSourceId = (short) ds.getDataSourceId(); totalDataSources = (short) ds.getTotalDataSources(); recordDescriptors[0] = rDesc; childSeq = ds.getChildSeq(); <START> indexSeq=ds.getIndexSeq(); <END> }</code><technical_language>formatting</technical_language>

Target:
public VXQueryIndexingOperatorDescriptor(IOperatorDescriptorRegistry spec, VXQueryIndexingDataSource ds, RecordDescriptor rDesc) { super(spec, 1, 1); this.functionCall = ds.getFunctionCall(); collectionPartitions = ds.getPartitions(); dataSourceId = (short) ds.getDataSourceId(); totalDataSources = (short) ds.getTotalDataSources(); recordDescriptors[0] = rDesc; childSeq = ds.getChildSeq(); indexChildSeq = ds.getIndexChildSeq(); indexAttsSeq = ds.getIndexAttsSeq(); indexSeq = ds.getIndexValueSeq(); }
Source:
<code>private static void logGcConfiguration(Project.NameKey projectName, Repository repo, boolean aggressive) { StringBuilder b = new StringBuilder(); Config cfg = repo.getConfig(); <START> b.append("gc.aggressive="); b.append(aggressive); b.append("; "); b.append(formatConfigValues(cfg, <END> ConfigConstants.CONFIG_GC_SECTION, null)); for (String subsection : cfg.getSubsections(ConfigConstants.CONFIG_GC_SECTION)) { b.append(formatConfigValues(cfg, ConfigConstants.CONFIG_GC_SECTION, subsection)); } if (b.length() == 0) { b.append("no set"); } logGcInfo(projectName, "gc config: " + b.toString()); logGcInfo(projectName, "pack config: " + (new PackConfig(repo)).toString()); }</code><technical_language>[optional] calls append chained in a single statement, i.e.: b.append("gc.aggressive=") .append("aggressive") .append("; ") .append(formatConfigValeus(...)));</technical_language>

Target:
private static void logGcConfiguration(Project.NameKey projectName, Repository repo, boolean aggressive) { StringBuilder b = new StringBuilder(); Config cfg = repo.getConfig(); b.append("gc.aggressive=").append(aggressive).append("; "); b.append(formatConfigValues(cfg, ConfigConstants.CONFIG_GC_SECTION, null)); for (String subsection : cfg.getSubsections(ConfigConstants.CONFIG_GC_SECTION)) { b.append(formatConfigValues(cfg, ConfigConstants.CONFIG_GC_SECTION, subsection)); } if (b.length() == 0) { b.append("no set"); } logGcInfo(projectName, "gc config: " + b.toString()); logGcInfo(projectName, "pack config: " + (new PackConfig(repo)).toString()); }
Source:
<code><START> public static boolean isJetpackUser(SiteStore siteStore) { <END> return siteStore.getSitesAccessedViaWPComRestCount() - siteStore.getWPComSitesCount() > 0; }</code><technical_language>remove public static boolean isJetpackUser(SiteStore siteStore) instead package-private. This stop bugging it. However, do often, matter much</technical_language>

Target:
static boolean isJetpackUser(SiteStore siteStore) { return siteStore.getSitesAccessedViaWPComRestCount() - siteStore.getWPComSitesCount() > 0; }
Source:
<code>public InputColumn<?>[] getInputColumns(InputColumn<?>[] allInputColumns) { if (_inputColumns == null) { _inputColumns = new InputColumn[_inputColumnNames.length]; for (int i = 0; i < _inputColumnNames.length; i++) { boolean found = false; final String name = _inputColumnNames[i]; for (int j = 0; j < allInputColumns.length; j++) { InputColumn<?> inputColumn = allInputColumns[j]; if (name.equals(inputColumn.getName())) { _inputColumns[i] = inputColumn; found = true; } } if (!found) { for (int j = 0; j < allInputColumns.length; j++) { <START> InputColumn<?> inputColumn = allInputColumns[j]; <END> if (name.trim().equalsIgnoreCase(inputColumn.getName().trim())) { _inputColumns[i] = inputColumn; found = true; } } } if (!found) { List<String> names = CollectionUtils.map(allInputColumns, new HasNameMapper()); throw new IllegalStateException("Column '" + name + "' not found. Available columns: " + names); } } } return _inputColumns; }</code><technical_language>Final! :)</technical_language>

Target:
public InputColumn<?>[] getInputColumns(InputColumn<?>[] allInputColumns) { if (_inputColumns == null) { _inputColumns = new InputColumn[_inputColumnNames.length]; for (int i = 0; i < _inputColumnNames.length; i++) { boolean found = false; final String name = _inputColumnNames[i]; for (int j = 0; j < allInputColumns.length; j++) { final InputColumn<?> inputColumn = allInputColumns[j]; if (name.equals(inputColumn.getName())) { _inputColumns[i] = inputColumn; found = true; } } if (!found) { for (int j = 0; j < allInputColumns.length; j++) { final InputColumn<?> inputColumn = allInputColumns[j]; if (name.trim().equalsIgnoreCase(inputColumn.getName().trim())) { _inputColumns[i] = inputColumn; found = true; } } } if (!found) { final List<String> names = CollectionUtils.map(allInputColumns, new HasNameMapper()); throw new IllegalStateException("Column '" + name + "' not found. Available columns: " + names); } } } return _inputColumns; }
Source:
<code>public String dump() { List<Map.Entry<String, Pair<Long, Long>>> list = new ArrayList<>(this.ruleAttempts.entrySet()); Collections.sort(list, (left, right) -> right.getValue().left.compareTo(left.getValue().left)); StringBuilder sb = new StringBuilder(); sb.append(String .format(Locale.ROOT, "%n%-60s%20s%20s%n", "Rules", "Attempts", "Time (us)")); for (Map.Entry<String, Pair<Long, Long>> entry : list) { sb.append( String.format(Locale.ROOT, "%-60s%20s%20s%n", entry.getKey(), <START> NumberFormat.getNumberInstance(Locale.US).format(entry.getValue().left), NumberFormat.getNumberInstance(Locale.US).format(entry.getValue().right))); <END> } return sb.toString(); }</code><technical_language>Please move NumberFormat.getNumberInstance(Locale.US) out of loop</technical_language>

Target:
public String dump() { List<Map.Entry<String, Pair<Long, Long>>> list = new ArrayList<>(this.ruleAttempts.entrySet()); Collections.sort(list, (left, right) -> { int res = right.getValue().left.compareTo(left.getValue().left); if (res == 0) { res = right.getValue().right.compareTo(left.getValue().right); } if (res == 0) { res = left.getKey().compareTo(right.getKey()); } return res; }); StringBuilder sb = new StringBuilder(); sb.append(String .format(Locale.ROOT, "%n%-60s%20s%20s%n", "Rules", "Attempts", "Time (us)")); NumberFormat usFormat = NumberFormat.getNumberInstance(Locale.US); for (Map.Entry<String, Pair<Long, Long>> entry : list) { sb.append( String.format(Locale.ROOT, "%-60s%20s%20s%n", entry.getKey(), usFormat.format(entry.getValue().left), usFormat.format(entry.getValue().right))); } return sb.toString(); }
Source:
<code>private void updateUI(int orientation) { if (orientation == Configuration.ORIENTATION_LANDSCAPE) { messageContainer.setVisibility(View.GONE); transcriptListView.setVisibility(View.GONE); } else { if (transcriptAdapter == null) { messageContainer.setVisibility(View.VISIBLE); transcriptListView.setVisibility(View.GONE); initTranscriptListView(); } else { messageContainer.setVisibility(View.GONE); transcriptListView.setVisibility(View.VISIBLE); transcriptListLayoutListener = new ViewTreeObserver.OnGlobalLayoutListener() { public void onGlobalLayout() { <START> if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) { <END> transcriptListView.getViewTreeObserver().removeOnGlobalLayoutListener(this); } else { transcriptListView.getViewTreeObserver().removeGlobalOnLayoutListener(this); } final float transcriptRowHeight = getResources().getDimension(R.dimen.transcript_row_height); final float listviewHeight = transcriptListView.getHeight(); topOffset = (listviewHeight / 2) - (transcriptRowHeight / 2); } }; transcriptListView.getViewTreeObserver().addOnGlobalLayoutListener(transcriptListLayoutListener); } } }</code><technical_language>longer supporting JellyBean users, this check related logic removed</technical_language>

Target:
private void updateUI(int orientation) { if (orientation == Configuration.ORIENTATION_LANDSCAPE) { messageContainer.setVisibility(View.GONE); transcriptListView.setVisibility(View.GONE); } else { if (transcriptAdapter == null) { messageContainer.setVisibility(View.VISIBLE); transcriptListView.setVisibility(View.GONE); initTranscriptListView(); } else { messageContainer.setVisibility(View.GONE); transcriptListView.setVisibility(View.VISIBLE); transcriptListLayoutListener = new ViewTreeObserver.OnGlobalLayoutListener() { public void onGlobalLayout() { transcriptListView.getViewTreeObserver().removeOnGlobalLayoutListener(this); final float transcriptRowHeight = getResources().getDimension(R.dimen.transcript_row_height); final float listviewHeight = transcriptListView.getHeight(); topOffset = (listviewHeight / 2) - (transcriptRowHeight / 2); } }; transcriptListView.getViewTreeObserver().addOnGlobalLayoutListener(transcriptListLayoutListener); } } }
Source:
<code>public MutableBoundedValue<Integer> fireTicks() { <START> return new SpongeBoundedValue<Integer>(Keys.FIRE_TICKS, this.fireTicks, intComparator(), 0, this.fireTicks); <END> }</code><technical_language>maximum Integer.MAX_VALUE</technical_language>

Target:
public MutableBoundedValue<Integer> fireTicks() { return new SpongeBoundedValue<Integer>(Keys.FIRE_TICKS, this.fireTicks, intComparator(), 0, Integer.MAX_VALUE); }
Source:
<code>public void removeObserver( <START> RemoteEmfObserver<EParentObjectType, EObjectType, LocalKeyType, ObjectCurrentType> observer) { <END> if (observer != null) { RemoteEmfObserver<EParentObjectType, EObjectType, LocalKeyType, ObjectCurrentType> remoteEmfObserver = observer; if (remoteEmfObserver.getConsumer() == this) { remoteEmfObserver.internalSetConsumer(null); } } remoteEmfObservers.remove(observer); release(); }</code><technical_language>#addObserver, call it</technical_language>

Target:
public void removeObserver( RemoteEmfObserver<EParentObjectType, EObjectType, LocalKeyType, ObjectCurrentType> observer) { if (observer != null) { RemoteEmfObserver<EParentObjectType, EObjectType, LocalKeyType, ObjectCurrentType> remoteEmfObserver = observer; if (remoteEmfObserver.getConsumer() == this) { remoteEmfObserver.internalSetConsumer(null); } remoteEmfObservers.remove(observer); } release(); }
Source:
<code>public void defineStream(StreamDefinition streamDefinition) { DefinitionParserHelper.validateDefinition(streamDefinition, streamDefinitionMap, tableDefinitionMap, windowDefinitionMap); <START> streamDefinitionMap.put(streamDefinition.getId(), streamDefinition); <END> DefinitionParserHelper.addStreamJunction(streamDefinition, streamJunctionMap, executionPlanContext); DefinitionParserHelper.addEventSource(streamDefinition, eventSourceMap, executionPlanContext); DefinitionParserHelper.addEventSink(streamDefinition, eventSinkMap, executionPlanContext); }</code><technical_language>No, do this. In definition add annotation in one, annotation inferred definition. need putIfAbsent()</technical_language>

Target:
public void defineStream(StreamDefinition streamDefinition) { DefinitionParserHelper.validateDefinition(streamDefinition, streamDefinitionMap, tableDefinitionMap, windowDefinitionMap); AbstractDefinition currentDefinition = streamDefinitionMap .putIfAbsent(streamDefinition.getId(), streamDefinition); if (currentDefinition != null) { streamDefinition = (StreamDefinition) currentDefinition; } DefinitionParserHelper.addStreamJunction(streamDefinition, streamJunctionMap, executionPlanContext); DefinitionParserHelper.addEventSource(streamDefinition, eventSourceMap, executionPlanContext); DefinitionParserHelper.addEventSink(streamDefinition, eventSinkMap, executionPlanContext); }
Source:
<code>public Object execute(Map<String, ?> lookupMap, QueryParams queryParams) { List<Object> args = getLookupArgs(lookupMap); List<Class> argTypes = buildArgTypes(); if (queryParams != null) { args.add(queryParams); argTypes.add(QueryParams.class); } try { return MethodUtils.invokeMethod(dataService, lookup.getMethodName(), args.toArray(new Object[args.size()]), argTypes.toArray(new Class[argTypes.size()])); } catch (NoSuchMethodException | IllegalAccessException e) { throw new LookupExecutorException("Unable to execute lookup " + lookup.getLookupName(), e); } catch (InvocationTargetException e) { <START> throw new LookupExecutorException("Unable to execute lookup " + lookup.getLookupName() + ". " + e.getTargetException().getMessage() + ".", e); <END> } }</code><technical_language>retrieve localizable message underlying exception display user. verify problem is connected lookup execution wrap own, localizable exception, explains problem</technical_language>

Target:
public Object execute(Map<String, ?> lookupMap, QueryParams queryParams) { List<Object> args = getLookupArgs(lookupMap); List<Class> argTypes = buildArgTypes(); String lookupExceptionMessage = "Unable to execute lookup "; String lookupExceptionMessageKey = "mds.error.lookupExecError"; if (queryParams != null) { args.add(queryParams); argTypes.add(QueryParams.class); } try { return MethodUtils.invokeMethod(dataService, lookup.getMethodName(), args.toArray(new Object[args.size()]), argTypes.toArray(new Class[argTypes.size()])); } catch (NoSuchMethodException | IllegalAccessException e) { throw new LookupExecutorException(lookupExceptionMessage + lookup.getLookupName() + ".", e, null); } catch (InvocationTargetException e) { if (e.getTargetException() instanceof JDOUserException) { JDOUserException userException = (JDOUserException) e.getTargetException(); lookupExceptionMessageKey = "mds.error.lookupExecUserError"; for (Throwable exception : userException.getNestedExceptions()) { if (exception instanceof QueryNotUniqueException) { lookupExceptionMessageKey = "mds.error.lookupExecNotUniqueError"; } } } throw new LookupExecutorException(lookupExceptionMessage + lookup.getLookupName() + ".", e, lookupExceptionMessageKey); } }
Source:
<code>private void execute(Ignite node, BiFunction<IgniteEvents, String, UUID> func, boolean isForbiddenCase) { final String cacheName = "test_cache_" + INDEX.getAndIncrement(); grid(SRV).createCache(new CacheConfiguration<>(cacheName).setCacheMode(CacheMode.REPLICATED)); IgniteEvents evts = node.events(node.cluster().forNodeId(grid(SRV).localNode().id())); UUID id = func.apply(evts, cacheName); try { GridTestUtils.RunnableX r = () -> { error = null; latch = new CountDownLatch(1); grid(SRV).cache(cacheName).put("key", "value"); latch.await(10, TimeUnit.SECONDS); if (error != null) throw error; }; if (isForbiddenCase) runForbiddenOperation(r, AccessControlException.class); else runOperation(r); <START> } <END> finally { evts.stopRemoteListen(id); } }</code><technical_language>check put operation is successful, please add assertEquals("value", grid(SRV).cache(cacheName).get("key")); run r</technical_language>

Target:
private void execute(Ignite node, BiFunction<IgniteEvents, String, UUID> func, boolean isForbiddenCase) { final String cacheName = "test_cache_" + INDEX.getAndIncrement(); grid(SRV).createCache(new CacheConfiguration<>(cacheName).setCacheMode(CacheMode.REPLICATED)); IgniteEvents evts = node.events(node.cluster().forNodeId(grid(SRV).localNode().id())); UUID id = func.apply(evts, cacheName); try { GridTestUtils.RunnableX r = () -> { error = null; latch = new CountDownLatch(1); grid(SRV).cache(cacheName).put("key", "value"); latch.await(10, TimeUnit.SECONDS); if (error != null) throw error; }; if (isForbiddenCase) runForbiddenOperation(r, AccessControlException.class); else runOperation(r); assertEquals("value", grid(SRV).cache(cacheName).get("key")); } finally { evts.stopRemoteListen(id); } }