auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>private void loadSegments(File[] segmentFiles, long totalCapacity) throws IOException { long totalSegments = -1; for (File segmentFile : segmentFiles) { String name = LogSegmentNameHelper.nameFromFilename(segmentFile.getName()); LogSegment segment; <START> if (name.isEmpty()) { <END> totalSegments = 1; segment = new LogSegment(name, segmentFile, totalCapacity, metrics, false); } else { segment = new LogSegment(name, segmentFile, metrics); totalSegments = totalSegments == -1 ? totalCapacity / segment.getCapacityInBytes() : totalSegments; } segmentsByName.put(segment.getName(), segment); } remainingUnallocatedSegments = totalSegments - segmentsByName.size(); }</code><technical_language>if enter this loop, reasonable assume segment file right? avoid confusion, code blocks. One, deal log segment of type 2nd code block for new type. a suggestion. this java if(segmentFiles.length == 1 && (LogSegmentNameHelper.nameFromFilename(segmentFiles[0].getName()).isEmpty())){ LogSegment segment = new LogSegment(LogSegmentNameHelper.nameFromFilename(segmentFiles[0].getName()), segmentFiles[0], totalCapacity, metrics, false); segmentsByName.put(segment.getName(), segment); totalSegments = 1; } else{ for (File segmentFile : segmentFiles) { String name = LogSegmentNameHelper.nameFromFilename(segmentFile.getName()); LogSegment segment = new LogSegment(name, segmentFile, metrics); totalSegments = totalSegments == -1 ? totalCapacity / segment.getCapacityInBytes() : totalSegments; segmentsByName.put(segment.getName(), segment); } } remainingUnallocatedSegments = totalSegments - segmentsByName.size();</technical_language>

Target:
private void loadSegments(File[] segmentFiles, long totalCapacity) throws IOException { long totalSegments = -1; for (File segmentFile : segmentFiles) { String name = LogSegmentNameHelper.nameFromFilename(segmentFile.getName()); logger.info("Loading segment with name [{}]", name); LogSegment segment; if (name.isEmpty()) { totalSegments = 1; segment = new LogSegment(name, segmentFile, totalCapacity, metrics, false); } else { segment = new LogSegment(name, segmentFile, metrics); totalSegments = totalSegments == -1 ? totalCapacity / segment.getCapacityInBytes() : totalSegments; } logger.info("Segment has capacity of bytes", name, segment.getCapacityInBytes()); segmentsByName.put(segment.getName(), segment); } remainingUnallocatedSegments = totalSegments - segmentsByName.size(); }
Source:
<code>public FeatureIterator(final File inputFile, final FeatureCodec<FEATURE_TYPE, SOURCE> codec) { if (inputFile == null) { throw new IllegalArgumentException("FeatureIterator input file cannot be null"); } this.codec = codec; final String file_path = codec.getPathToDataFile(inputFile.getAbsolutePath()); <START> this.inputFile = new File(file_path.replaceFirst("^file://", "")); <END> try { if (IOUtil.hasBlockCompressedExtension(this.inputFile)) { final BlockCompressedInputStream bcs = initIndexableBlockCompressedStream(this.inputFile); source = (SOURCE) codec.makeIndexableSourceFromStream(bcs); } else { final PositionalBufferedStream ps = initIndexablePositionalStream(this.inputFile); source = (SOURCE) codec.makeIndexableSourceFromStream(ps); } this.codec.readHeader(source); readNextFeature(); } catch (final IOException e) { throw new TribbleException.InvalidHeader("Error reading header " + e.getMessage()); } }</code><technical_language>suggestion this.inputFile = new File(inputFile.toURI().getPath());</technical_language>

Target:
public FeatureIterator(final File inputFile, final FeatureCodec<FEATURE_TYPE, SOURCE> codec) { if (inputFile == null) { throw new IllegalArgumentException("FeatureIterator input file cannot be null"); } this.codec = codec; final String filePath = codec.getPathToDataFile(inputFile.getAbsolutePath()); try { this.inputFile = IOUtil.getPath(filePath).toFile(); } catch (final IOException e) { throw new TribbleException("Failed while constructing a FeatureIterator due to a problem converting String to Path", e); } try { if (IOUtil.hasBlockCompressedExtension(this.inputFile)) { final BlockCompressedInputStream bcs = initIndexableBlockCompressedStream(this.inputFile); source = (SOURCE) codec.makeIndexableSourceFromStream(bcs); } else { final PositionalBufferedStream ps = initIndexablePositionalStream(this.inputFile); source = (SOURCE) codec.makeIndexableSourceFromStream(ps); } this.codec.readHeader(source); readNextFeature(); } catch (final IOException e) { throw new TribbleException.InvalidHeader("Error reading header " + e.getMessage()); } }
Source:
<code>public void onError(List<KubernetesConfigMap> configMaps) { synchronized (lock) { if (running) { <START> fatalErrorHandler.onFatalError(new Exception("Error while watching the ConfigMap " + configMapName)); <END> } } }</code><technical_language>Dangerous call callbacks lock</technical_language>

Target:
public void onError(List<KubernetesConfigMap> configMaps) { fatalErrorHandler.onFatalError( new LeaderRetrievalException("Error while watching the ConfigMap " + configMapName)); }
Source:
<code>public DAnalysis getDAnalysis() { DAnalysis dAnalysis = null; <START> DRepresentation representation = getRepresentation().get(); <END> if (representation != null) { DRepresentationDescriptor representationDescriptor = new DRepresentationQuery(representation).getRepresentationDescriptor(); EObject rootContainer = EcoreUtil.getRootContainer(representationDescriptor, false); if (rootContainer instanceof DAnalysis) { dAnalysis = (DAnalysis) rootContainer; } } return dAnalysis; }</code><technical_language>remove</technical_language>

Target:
public DAnalysis getDAnalysis() { DAnalysis dAnalysis = null; Option<DRepresentation> representation = getRepresentation(); if (representation.some()) { DRepresentationDescriptor representationDescriptor = new DRepresentationQuery(representation.get()).getRepresentationDescriptor(); EObject rootContainer = EcoreUtil.getRootContainer(representationDescriptor, false); if (rootContainer instanceof DAnalysis) { dAnalysis = (DAnalysis) rootContainer; } } return dAnalysis; }
Source:
<code>default T findElementByCustom(String selector) { <START> return findElement(MobileSelector.IMAGE.toString(), selector); <END> }</code><technical_language>MobileSelector.IMAGE</technical_language>

Target:
default T findElementByCustom(String selector) { return findElement(MobileSelector.CUSTOM.toString(), selector); }
Source:
<code>protected void rerunInternal() { Guid vdsId = getDestinationVds() != null ? getDestinationVds().getId() : getCurrentVdsId(); DecreasePendingVms(vdsId); setSucceeded(false); setVm(null); if (getRunVdssList().size() < Config.<Integer> GetValue(ConfigValues.MaxRerunVmOnVdsCount) && getVm().getstatus() != VMStatus.Paused) { _isRerun = true; getReturnValue().setCanDoAction(false); log(); <START> Job job = getExecutionContext().getJob(); <END> if (job != null) { JobRepositoryFactory.getJobRepository().closeCompletedJobSteps(job.getId(), JobExecutionStatus.FAILED); } ExecuteAction(); if (!getReturnValue().getCanDoAction()) { _isRerun = false; log(); FailedToRunVm(); } } else { Backend.getInstance().getResourceManager().RemoveAsyncRunningCommand(getVmId()); FailedToRunVm(); _isRerun = false; } }</code><technical_language>validate getExecutionContext() null</technical_language>

Target:
protected void rerunInternal() { Guid vdsId = getDestinationVds() != null ? getDestinationVds().getId() : getCurrentVdsId(); DecreasePendingVms(vdsId); setSucceeded(false); setVm(null); if (getRunVdssList().size() < Config.<Integer> GetValue(ConfigValues.MaxRerunVmOnVdsCount) && getVm().getstatus() != VMStatus.Paused) { _isRerun = true; getReturnValue().setCanDoAction(false); log(); if (getExecutionContext() != null) { Job job = getExecutionContext().getJob(); if (job != null) { JobRepositoryFactory.getJobRepository().closeCompletedJobSteps(job.getId(), JobExecutionStatus.FAILED); } } ExecuteAction(); if (!getReturnValue().getCanDoAction()) { _isRerun = false; log(); FailedToRunVm(); } } else { Backend.getInstance().getResourceManager().RemoveAsyncRunningCommand(getVmId()); FailedToRunVm(); _isRerun = false; } }
Source:
<code>public Message<?> receive() { <START> Deque<ChannelInterceptor> interceptorStack = new ArrayDeque<ChannelInterceptor>(); <END> try { if (!this.getInterceptors().preReceive(this, interceptorStack)) { return null; } Object object = this.getAmqpTemplate().receiveAndConvert(this.queueName); if (object == null) { return null; } Message<?> replyMessage = null; if (object instanceof Message<?>) { replyMessage = (Message<?>) object; } else { replyMessage = this.getMessageBuilderFactory().withPayload(object).build(); } replyMessage = this.getInterceptors().postReceive(replyMessage, this); this.getInterceptors().afterReceiveCompletion(replyMessage, this, null, interceptorStack); return replyMessage; } catch (RuntimeException e) { this.getInterceptors().afterReceiveCompletion(null, this, e, interceptorStack); throw e; } }</code><technical_language>avoid this object creation if necessary; like... @Override public Message<?> receive() { - Deque<ChannelInterceptor> interceptorStack = new ArrayDeque<ChannelInterceptor>(); + Deque<ChannelInterceptor> interceptorStack = null; try { - if (!this.getInterceptors().preReceive(this, interceptorStack)) { + ChannelInterceptorList interceptors = this.getInterceptors(); + if (interceptors.size() > 0) { + interceptorStack = new ArrayDeque<ChannelInterceptor>(); + } + if (!interceptors.preReceive(this, interceptorStack)) { return null; } invoke afterReceiveCompletion if null</technical_language>

Target:
public Message<?> receive() { ChannelInterceptorList interceptorList = getInterceptors(); Deque<ChannelInterceptor> interceptorStack = null; try { if (interceptorList.getInterceptors().size() > 0) { interceptorStack = new ArrayDeque<ChannelInterceptor>(); if (!interceptorList.preReceive(this, interceptorStack)) { return null; } } Object object = getAmqpTemplate().receiveAndConvert(this.queueName); if (object == null) { return null; } Message<?> message = null; if (object instanceof Message<?>) { message = (Message<?>) object; } else { message = getMessageBuilderFactory().withPayload(object).build(); } message = interceptorList.postReceive(message, this); if (interceptorStack != null) { interceptorList.afterReceiveCompletion(message, this, null, interceptorStack); } return message; } catch (RuntimeException e) { if (interceptorStack != null) { interceptorList.afterReceiveCompletion(null, this, e, interceptorStack); } throw e; } }
Source:
<code>private void initNodeCommand(SensorContext context, File scriptFile) throws IOException { nodeCommandBuilder .outputConsumer(message -> { if (message.startsWith("DEBUG")) { LOG.debug(message.substring(5).trim()); } else if (message.startsWith("WARN")) { LOG.warn(message.substring(4).trim()); } else { LOG.info(message); } }) .pathResolver(bundle) .minNodeVersion(8) .configuration(context.config()) .script(scriptFile.getAbsolutePath()) .scriptArgs(String.valueOf(port)); context.config() .getInt(MAX_OLD_SPACE_SIZE_PROPERTY) .ifPresent(nodeCommandBuilder::maxOldSpaceSize); <START> if (context.runtime().getProduct() == SonarProduct.SONARLINT || shouldDetectTypeScript(context.fileSystem())) { <END> Optional<Path> typeScriptLocation = getTypeScriptLocation(context.fileSystem().baseDir()); if (typeScriptLocation.isPresent()) { LOG.info("Using TypeScript at: '{}'", typeScriptLocation.get()); nodeCommandBuilder.addToNodePath(typeScriptLocation.get().toAbsolutePath()); } else { LOG.info("TypeScript dependency was not found inside project directory, Node.js will search TypeScript using " + "module resolution algorithm; analysis will fail without TypeScript."); } } nodeCommand = nodeCommandBuilder.build(); }</code><technical_language>I move condition shouldDetectTypescript method change parameter context</technical_language>

Target:
private void initNodeCommand(SensorContext context, File scriptFile) throws IOException { nodeCommandBuilder .outputConsumer(message -> { if (message.startsWith("DEBUG")) { LOG.debug(message.substring(5).trim()); } else if (message.startsWith("WARN")) { LOG.warn(message.substring(4).trim()); } else { LOG.info(message); } }) .pathResolver(bundle) .minNodeVersion(8) .configuration(context.config()) .script(scriptFile.getAbsolutePath()) .scriptArgs(String.valueOf(port)); context.config() .getInt(MAX_OLD_SPACE_SIZE_PROPERTY) .ifPresent(nodeCommandBuilder::maxOldSpaceSize); if (shouldDetectTypeScript(context)) { Optional<Path> typeScriptLocation = getTypeScriptLocation(context.fileSystem().baseDir()); if (typeScriptLocation.isPresent()) { LOG.info("Using TypeScript at: '{}'", typeScriptLocation.get()); nodeCommandBuilder.addToNodePath(typeScriptLocation.get().toAbsolutePath()); } else { LOG.info("TypeScript dependency was not found inside project directory, Node.js will search TypeScript using " + "module resolution algorithm; analysis will fail without TypeScript."); } } nodeCommand = nodeCommandBuilder.build(); }
Source:
<code>default ScannerHandler andThen(ScannerHandler then) { ScannerHandler thiz = this; return new ScannerHandler() { @Override public void handle(IgniteBiTuple<WALPointer, WALRecord> record) { <START> thiz.handle(record); <END> then.handle(record); } @Override public void finish() { thiz.finish(); then.finish(); } }; }</code><technical_language>I "thiz" variable inlined. replace "ScannerHandler.this"</technical_language>

Target:
default ScannerHandler andThen(ScannerHandler then) { ScannerHandler thiz = this; return new ScannerHandler() { @Override public void handle(IgniteBiTuple<WALPointer, WALRecord> record) { try { thiz.handle(record); } finally { then.handle(record); } } @Override public void finish() { try { thiz.finish(); } finally { then.finish(); } } }; }
Source:
<code>public void throwableSuppressingItselfShouldBeLoggable() { Throwable throwable = new Throwable("a exception"); throwable.addSuppressed(SuppressedException.from(throwable)); <START> LoggerFactory.getLogger("AnnotatedCallable").error("Error", throwable); <END> }</code><technical_language>nit: extract logger a constant</technical_language>

Target:
public void throwableSuppressingItselfShouldBeLoggable() { Throwable throwable = new Throwable("a exception"); throwable.addSuppressed(SuppressedException.from(throwable)); log.error("Error", throwable); }
Source:
<code>protected String[] getCollectionName(Mutable<ILogicalOperator> opRef) throws AlgebricksException { AbstractLogicalOperator op = (AbstractLogicalOperator) opRef.getValue(); if (op.getOperatorTag() != LogicalOperatorTag.UNNEST) { return null; } UnnestOperator unnest = (UnnestOperator) op; AbstractLogicalOperator op2 = (AbstractLogicalOperator) unnest.getInputs().get(0).getValue(); if (op2.getOperatorTag() != LogicalOperatorTag.ASSIGN) { return null; } AssignOperator assign = (AssignOperator) op2; ILogicalExpression logicalExpression = (ILogicalExpression) assign.getExpressions().get(0).getValue(); if (logicalExpression.getExpressionTag() != LogicalExpressionTag.FUNCTION_CALL) { return null; } AbstractFunctionCallExpression functionCall = (AbstractFunctionCallExpression) logicalExpression; if (!functionCall.getFunctionIdentifier().equals( BuiltinFunctions.FN_COLLECTIONWITHTAG_2.getFunctionIdentifier()) && !functionCall.getFunctionIdentifier().equals( BuiltinFunctions.FN_COLLECTION_1.getFunctionIdentifier())) { return null; } int size = functionCall.getArguments().size(); if (size > 0) { String args[] = new String[size]; for (int i = 0; i < size; i++) { <START> args[i] = getArgument(functionCall, opRef, i); <END> } return args; } return null; }</code><technical_language>Add a check for null result getArgument</technical_language>

Target:
protected String[] getCollectionName(Mutable<ILogicalOperator> opRef) throws AlgebricksException { VXQueryConstantValue constantValue; AbstractLogicalOperator op = (AbstractLogicalOperator) opRef.getValue(); if (op.getOperatorTag() != LogicalOperatorTag.UNNEST) { return null; } UnnestOperator unnest = (UnnestOperator) op; AbstractLogicalOperator op2 = (AbstractLogicalOperator) unnest.getInputs().get(0).getValue(); if (op2.getOperatorTag() != LogicalOperatorTag.ASSIGN) { return null; } AssignOperator assign = (AssignOperator) op2; ILogicalExpression logicalExpression = (ILogicalExpression) assign.getExpressions().get(0).getValue(); if (logicalExpression.getExpressionTag() != LogicalExpressionTag.FUNCTION_CALL) { return null; } AbstractFunctionCallExpression functionCall = (AbstractFunctionCallExpression) logicalExpression; if (!functionCall.getFunctionIdentifier() .equals(BuiltinFunctions.FN_COLLECTIONWITHTAG_2.getFunctionIdentifier()) && !functionCall.getFunctionIdentifier() .equals(BuiltinFunctions.FN_COLLECTION_1.getFunctionIdentifier())) { return null; } int size = functionCall.getArguments().size(); if (size > 0) { String args[] = new String[size]; for (int i = 0; i < size; i++) { args[i] = getArgument(functionCall, opRef, i); } return args; } return null; }
Source:
<code><START> public EventsManager() throws NotificationServiceException { <END> try { ds = new StandaloneDataSource(); } catch (SQLException e) { throw new NotificationServiceException("Failed to obtain database connectivity", e); } }</code><technical_language>do want runtime exception in signature of constructor</technical_language>

Target:
public EventsManager() { try { ds = new StandaloneDataSource(); } catch (SQLException e) { throw new NotificationServiceException("Failed to obtain database connectivity", e); } }
Source:
<code>public void afterCompletion(int status) { <START> log.infof("afterCompletion called with status '%s'", status); <END> boolean isCommitted = status == javax.transaction.Status.STATUS_COMMITTED ? true : false; checker.setSynchronizedAfter(isCommitted); }</code><technical_language>log.trace if</technical_language>

Target:
public void afterCompletion(int status) { log.tracef("afterCompletion called with status '%s'", status); boolean isCommitted = status == javax.transaction.Status.STATUS_COMMITTED ? true : false; checker.setSynchronizedAfter(isCommitted); }
Source:
<code>private void testAddResponse() throws Exception { ______TS("test new response"); submitPage.fillResponseTextBox(2, 0, "4"); <START> submitPage.chooseMcqOption(3, 0, "It's good"); <END> submitPage.clickSubmitButton(); submitPage.waitForTextsForAllStatusMessagesToUserEquals(Const.StatusMessages.FEEDBACK_RESPONSES_SAVED); FeedbackQuestionAttributes fq = BackDoor.getFeedbackQuestion("IESFPTCourse", "First feedback session", 2); FeedbackQuestionAttributes fqMcq = BackDoor.getFeedbackQuestion("IESFPTCourse", "First feedback session", 6); FeedbackResponseAttributes fr = BackDoor.getFeedbackResponse(fq.getId(), "student1InIESFPTCourse@gmail.tmt", "student1InIESFPTCourse@gmail.tmt"); FeedbackResponseAttributes frMcq = BackDoor.getFeedbackResponse(fqMcq.getId(), "student1InIESFPTCourse@gmail.tmt", "student1InIESFPTCourse@gmail.tmt"); assertEquals("4", fr.getResponseDetails().getAnswerString()); assertNotNull(frMcq); submitPage.verifyHtmlMainContent("/instructorEditStudentFeedbackPageModified.html"); submitPage.verifyAndCloseSuccessfulSubmissionModal(""); }</code><technical_language>introduce dependency this method</technical_language>

Target:
private void testAddResponse() throws Exception { ______TS("test new response"); submitPage.fillResponseTextBox(2, 0, "4"); submitPage.clickSubmitButton(); submitPage.waitForTextsForAllStatusMessagesToUserEquals(Const.StatusMessages.FEEDBACK_RESPONSES_SAVED); FeedbackQuestionAttributes fq = BackDoor.getFeedbackQuestion("IESFPTCourse", "First feedback session", 2); FeedbackResponseAttributes fr = BackDoor.getFeedbackResponse(fq.getId(), "student1InIESFPTCourse@gmail.tmt", "student1InIESFPTCourse@gmail.tmt"); assertEquals("4", fr.getResponseDetails().getAnswerString()); submitPage.verifyHtmlMainContent("/instructorEditStudentFeedbackPageModified.html"); submitPage.verifyAndCloseSuccessfulSubmissionModal(""); }
Source:
<code>public SimpleFeature next() { SimpleFeature next = super.next(); if (attributeName == null) { String fid = next.getID(); if (fid.startsWith(fidPrefix)) { fid = fid.substring(fidPrefix.length()); } return new FidAndFtOverrideFeature(next, fid, featureType); } else { Object value = next.getAttribute(attributeName); if (value == null) { <START> String fid = (next).getID().substring(fidPrefix.length()); <END> return new FidAndFtOverrideFeature(next, fid, featureType); } else { return new FidAndFtOverrideFeature(next, value.toString(), featureType); } } }</code><technical_language>Falling "normal" id a bad strategy here. refuse import nulls in selected ID field? worthwhile try detect duplicates well</technical_language>

Target:
public SimpleFeature next() { SimpleFeature next = super.next(); if (attributeName == null) { String fid = next.getID(); if (fid.startsWith(fidPrefix)) { fid = fid.substring(fidPrefix.length()); } return new FidAndFtOverrideFeature(next, fid, featureType); } else { Object value = next.getAttribute(attributeName); Preconditions.checkNotNull(value); return new FidAndFtOverrideFeature(next, value.toString(), featureType); } }
Source:
<code><START> private NetworkReceive read(SelectionKey key, Transmission transmission) throws IOException { <END> long startTimeToReadInMs = time.milliseconds(); try { boolean readComplete = transmission.read(); NetworkReceive networkReceive = transmission.getNetworkReceive(); if (readComplete) { transmission.onReceiveComplete(); transmission.clearReceive(); } return networkReceive; } catch (IOException e) { handleReadWriteIOException(e, key); return null; } finally { long readTime = time.milliseconds() - startTimeToReadInMs; logger.trace("SocketServer time spent on read per key = {}", transmission.getConnectionId(), readTime); } }</code><technical_language>read write methods remove throws IOException is exception thrown methods</technical_language>

Target:
private NetworkReceive read(SelectionKey key, Transmission transmission) { long startTimeToReadInMs = time.milliseconds(); try { boolean readComplete = transmission.read(); NetworkReceive networkReceive = transmission.getNetworkReceive(); if (readComplete) { transmission.onReceiveComplete(); transmission.clearReceive(); } return networkReceive; } catch (IOException e) { handleReadWriteIOException(e, key); return null; } finally { long readTime = time.milliseconds() - startTimeToReadInMs; logger.trace("SocketServer time spent on read per key = {}", transmission.getConnectionId(), readTime); } }
Source:
<code>public InfinispanExtension() { InfinispanExtensionEmbedded e; try { e = new InfinispanExtensionEmbedded(); } catch (Throwable t) { <START> e = null; <END> } embeddedExtension = e; InfinispanExtensionRemote r; try { r = new InfinispanExtensionRemote(); } catch (Throwable t) { r = null; } remoteExtension = r; }</code><technical_language>log here, in debug mode? situations user expects core/ dependency for reason. Debug messages diagnose issue, wdyt? for remote</technical_language>

Target:
public InfinispanExtension() { InfinispanExtensionEmbedded e; try { e = new InfinispanExtensionEmbedded(); log.debug("Enabling support for embedded CDI"); } catch (Throwable t) { e = null; log.debug("Disabling support for embedded CDI"); } embeddedExtension = e; InfinispanExtensionRemote r; try { r = new InfinispanExtensionRemote(); log.debug("Enabling support for remote CDI"); } catch (Throwable t) { r = null; log.debug("Disabling support for remote CDI"); } remoteExtension = r; }
Source:
<code><START> long getProlepticMonth() { <END> return getProlepticYear() * lengthOfYearInMonths() + getMonth() - 1; }</code><technical_language>returning values returned in getCalculatedProlepticMonth() instead (ie, leap-day is accounted 7th month, year-day 13th). Ditch other method</technical_language>

Target:
long getProlepticMonth() { return this.prolepticYear * lengthOfYearInMonths() + getInternalMonth() - 1; }
Source:
<code>public void test() throws Exception { testSetSupportedClientInfo(); testSetUnsupportedClientInfo(); testGetUnsupportedClientInfo(); testSetSupportedClientInfoProperties(); testSetUnsupportedClientInfoProperties(); testSetInternalProperty(); testSetInternalPropertyToInitialValue(); testSetGetSchema(); testCommitOnAutoCommitSet(); <START> testRollbackOnAutoCommitSet(); <END> }</code><technical_language>This good, tests testing non-default case right now, I need: SysProperties.FORCE_AUTOCOMMIT_OFF_ON_COMMIT = true try { testCommitOnAutoCommitSet(); testRollbackOnAutoCommitSet(); } finally { SysProperties.FORCE_AUTOCOMMIT_OFF_ON_COMMIT = false; } testCommitOnAutoCommitSet(); testRollbackOnAutoCommitSet(); test ways. Thanks</technical_language>

Target:
public void test() throws Exception { testSetSupportedClientInfo(); testSetUnsupportedClientInfo(); testGetUnsupportedClientInfo(); testSetSupportedClientInfoProperties(); testSetUnsupportedClientInfoProperties(); testSetInternalProperty(); testSetInternalPropertyToInitialValue(); testSetGetSchema(); testCommitOnAutoCommitSetRunner(); testRollbackOnAutoCommitSetRunner(); }
Source:
<code>private void writeMatrix() { final NumberFormat format = NumberFormat.getInstance(); format.setMaximumFractionDigits(4); try (final OutputStream stream = new FileOutputStream(MATRIX_OUTPUT); final BufferedWriter writer = new BufferedWriter(new OutputStreamWriter(stream))) { writer.write(CROSSCHECK_BY.name()); for (String rhsMatrixKey : rhsMatrixKeys) { <START> writer.write('\t' + rhsMatrixKey); <END> } writer.newLine(); for (int row = 0; row < lhsMatrixKeys.size(); row++) { writer.write(lhsMatrixKeys.get(row)); for (int col = 0; col < rhsMatrixKeys.size(); col++) { writer.write('\t' + format.format(crosscheckMatrix[col][row])); } writer.newLine(); } } catch (IOException e) { throw new RuntimeException(e); } }</code><technical_language>this change for lhsMatrixKeys</technical_language>

Target:
private void writeMatrix() { final NumberFormat format = NumberFormat.getInstance(); format.setMaximumFractionDigits(4); try (final OutputStream stream = new FileOutputStream(MATRIX_OUTPUT); final BufferedWriter writer = new BufferedWriter(new OutputStreamWriter(stream))) { writer.write(CROSSCHECK_BY.name()); for (String rhsMatrixKey : rhsMatrixKeys) { writer.write('\t' + rhsMatrixKey); } writer.newLine(); for (int row = 0; row < lhsMatrixKeys.size(); row++) { writer.write(lhsMatrixKeys.get(row)); for (final double lod : crosscheckMatrix[row]) { writer.write('\t' + format.format(lod)); } writer.newLine(); } } catch (IOException e) { throw new RuntimeException(e); } }
Source:
<code>private void writeStandardResultsToXML(Run<?, ?> run, Collection<PerformanceReport> parsedReports) throws IOException { FileWriter fw = null; BufferedWriter bw = null; try { xmlDir = run.getRootDir().getAbsolutePath(); xmlDir += "/" + archive_directory; if (!new File(xmlDir).exists()) { new File(xmlDir).mkdirs(); } xmlfile = new File(xmlDir + "/standardResults.xml"); xmlfile.createNewFile(); fw = new FileWriter(xmlfile.getAbsoluteFile()); bw = new BufferedWriter(fw); xml = "<?xml version=\"1.0\"?>\n"; <START> xml += "<results>\n"; <END> appendStandardResultsStatsToXml(parsedReports); xml += "</results>"; bw.write(xml); } finally { if (bw != null) { bw.close(); } if (fw != null) { fw.close(); } } }</code><technical_language>Please, replace String concatenation append in StringBuilder: StringBuilder xmlSB = new StringBuilder("<?xml version=\"1.0\"?>\n"); xmlSB.append("<results>\n"); appendStandardResultsStatsToXml(reports, xmlSB); xmlSB.append("</results>\n"); xml = xmlSB.toString();</technical_language>

Target:
private void writeStandardResultsToXML(Run<?, ?> run, Collection<PerformanceReport> parsedReports) throws IOException { FileWriter fw = null; BufferedWriter bw = null; try { xmlDir = run.getRootDir().getAbsolutePath(); xmlDir += File.separator + archive_directory; xmlfile = new File(xmlDir + File.separator + "standardResults.xml"); FileUtils.touch(xmlfile); fw = new FileWriter(xmlfile); bw = new BufferedWriter(fw); xml = new StringBuilder("<?xml version=\"1.0\"?>\n") .append("<results>\n") .append(appendStandardResultsStatsToXml(parsedReports)) .append("</results>\n").toString(); bw.write(xml); } finally { if (bw != null) { bw.close(); } if (fw != null) { fw.close(); } } }
Source:
<code>protected @Nonnull Set<String> loadPluginsFromWar(@Nonnull String fromPath, @CheckForNull FilenameFilter filter) { Set<String> names = new HashSet(); <START> ServletContext context = Jenkins.getInstance().servletContext; <END> Set<String> plugins = Util.fixNull((Set<String>) context.getResourcePaths(fromPath)); Set<URL> copiedPlugins = new HashSet<>(); Set<URL> dependencies = new HashSet<>(); for( String pluginPath : plugins) { String fileName = pluginPath.substring(pluginPath.lastIndexOf('/')+1); if(fileName.length()==0) { continue; } try { URL url = context.getResource(pluginPath); if (filter != null && url != null) { if (!filter.accept(new File(url.getFile()).getParentFile(), fileName)) { continue; } } names.add(fileName); copyBundledPlugin(url, fileName); copiedPlugins.add(url); try { addDependencies(url, fromPath, dependencies); } catch (Exception e) { LOGGER.log(Level.SEVERE, "Failed to resolve dependencies for the bundled plugin " + fileName, e); } } catch (IOException e) { LOGGER.log(Level.SEVERE, "Failed to extract the bundled plugin "+fileName,e); } } for (URL dependency : dependencies) { if (copiedPlugins.contains(dependency)) { continue; } String fileName = new File(dependency.getFile()).getName(); try { names.add(fileName); copyBundledPlugin(dependency, fileName); copiedPlugins.add(dependency); } catch (IOException e) { LOGGER.log(Level.SEVERE, "Failed to extract the bundled dependency plugin " + fileName, e); } } return names; }</code><technical_language>findbugs is a NPE here... Jenkins.getInstace() is checkForNull</technical_language>

Target:
protected @Nonnull Set<String> loadPluginsFromWar(@Nonnull String fromPath, @CheckForNull FilenameFilter filter) { Set<String> names = new HashSet(); ServletContext context = Jenkins.getActiveInstance().servletContext; Set<String> plugins = Util.fixNull((Set<String>) context.getResourcePaths(fromPath)); Set<URL> copiedPlugins = new HashSet<>(); Set<URL> dependencies = new HashSet<>(); for( String pluginPath : plugins) { String fileName = pluginPath.substring(pluginPath.lastIndexOf('/')+1); if(fileName.length()==0) { continue; } try { URL url = context.getResource(pluginPath); if (filter != null && url != null) { if (!filter.accept(new File(url.getFile()).getParentFile(), fileName)) { continue; } } names.add(fileName); copyBundledPlugin(url, fileName); copiedPlugins.add(url); try { addDependencies(url, fromPath, dependencies); } catch (Exception e) { LOGGER.log(Level.SEVERE, "Failed to resolve dependencies for the bundled plugin " + fileName, e); } } catch (IOException e) { LOGGER.log(Level.SEVERE, "Failed to extract the bundled plugin "+fileName,e); } } for (URL dependency : dependencies) { if (copiedPlugins.contains(dependency)) { continue; } String fileName = new File(dependency.getFile()).getName(); try { names.add(fileName); copyBundledPlugin(dependency, fileName); copiedPlugins.add(dependency); } catch (IOException e) { LOGGER.log(Level.SEVERE, "Failed to extract the bundled dependency plugin " + fileName, e); } } return names; }
Source:
<code><START> public boolean indexInScope(FormIndex formIndex){ <END> if(formIndex.isEndOfFormIndex()){ return false; } if(parentIndex.isBeginningOfFormIndex()){ return true; } return FormIndex.isSubElement(parentIndex, formIndex); }</code><technical_language>this step private</technical_language>

Target:
private boolean indexInScope(FormIndex formIndex) { if (formIndex.isEndOfFormIndex()) { return false; } if (parentIndex.isBeginningOfFormIndex()) { return true; } return FormIndex.isSubElement(parentIndex, formIndex); }
Source:
<code>private Pair<URI, Collection<String>> checkLockability(String user, URI uri, LockingMode requestedLock) { if (grantedPermissions.get(uri) == null) { <START> return null; <END> } Collection<String> conflictingUsers = grantedPermissions.get(uri).checkLockability(user, requestedLock); return conflictingUsers.isEmpty() ? null : Pair.of(uri, conflictingUsers); }</code><technical_language>Null return avoided. Pair avoided. For a cases classes better. In case return class empty collection of strings</technical_language>

Target:
private Collection<String> checkLockability(String user, URI uri, LockingMode requestedLock) { if (grantedPermissions.get(uri) == null) { return Collections.emptyList(); } return grantedPermissions.get(uri).checkLockability(user, requestedLock); }
Source:
<code>protected Object processResponseBeforeSending(Object response) { ReplicatedMapService replicatedMapService = getService(ReplicatedMapService.SERVICE_NAME); if (replicatedMapService.getReplicatedMapConfig(parameters.name).isStatisticsEnabled()) { LocalReplicatedMapStatsImpl stats = replicatedMapService.getLocalReplicatedMapStatsImpl(parameters.name); <START> stats.incrementGets(Timer.elapsedSince(startTime)); <END> } return response; }</code><technical_language>multiple problems: 1: content of stats.get field is interpreted nanoseconds. updating in miliseconds, meaning writing is 10^6 times be. if fixing problem introducing this problem. 2: loosing granularity. measure a call a submilisecond latency a decent cluster a remote call is in 100/200us range (and a hell of a lot less). 3: time unit returned elapsedSince method clear. This easy unit errors</technical_language>

Target:
protected Object processResponseBeforeSending(Object response) { ReplicatedMapService replicatedMapService = getService(ReplicatedMapService.SERVICE_NAME); if (replicatedMapService.getReplicatedMapConfig(parameters.name).isStatisticsEnabled()) { LocalReplicatedMapStatsImpl stats = replicatedMapService.getLocalReplicatedMapStatsImpl(parameters.name); stats.incrementGetsNanos(Timer.nanosElapsed(startTimeNanos)); } return response; }
Source:
<code>public List<NodePropertyDescriptor> getNodePropertiesDescriptors() { DescriptorExtensionList<NodeProperty<?>, NodePropertyDescriptor> nodePropertyDescriptors = NodeProperty.all(); return nodePropertyDescriptors.stream() .filter(npd -> npd.isApplicable(vSphereCloudSlave.class)) <START> .collect(Collectors.toList()); <END> }</code><technical_language>hugely keen of aesthetics syntax I presume this is Java-8 syntax for applying filter? (I'm asking for changes, reassurances this is "how done days" code pattern before)</technical_language>

Target:
public List<NodePropertyDescriptor> getNodePropertiesDescriptors() { List<NodePropertyDescriptor> result = new ArrayList<>(); DescriptorExtensionList<NodeProperty<?>, NodePropertyDescriptor> list = NodeProperty.all(); for (NodePropertyDescriptor npd : list) { if (npd.isApplicable(vSphereCloudSlave.class)) { result.add(npd); } } return result; }
Source:
<code>protected void ensureHashTableLoaded() { <START> if (getHashTables() == null) { <END> synchronized (this) { int[] offsets = getOffsets(); int elementCount = getRawKeyBlock().getPositionCount(); int mapCount = getPositionCount(); boolean[] mapIsNull = getMapIsNull(); if (getHashTables() == null) { int[] hashTables = new int[elementCount * HASH_MULTIPLIER]; Arrays.fill(hashTables, -1); for (int i = 0; i < mapCount; i++) { int keyOffset = offsets[i]; int keyCount = offsets[i + 1] - keyOffset; if (keyCount < 0) { throw new IllegalArgumentException(format("Offset is not monotonically ascending. offsets[%s]=%s, offsets[%s]=%s", i, offsets[i], i + 1, offsets[i + 1])); } if (mapIsNull != null && mapIsNull[i] && keyCount != 0) { throw new IllegalArgumentException("A null map must have zero entries"); } buildHashTable( getRawKeyBlock(), keyOffset, keyCount, keyBlockHashCode, hashTables, keyOffset * HASH_MULTIPLIER, keyCount * HASH_MULTIPLIER); } this.hashTables = hashTables; } } } }</code><technical_language>access this.hashTables directly? do this complete computation</technical_language>

Target:
protected void ensureHashTableLoaded() { if (this.hashTables != null) { return; } synchronized (this) { if (this.hashTables != null) { return; } int[] offsets = getOffsets(); int elementCount = getRawKeyBlock().getPositionCount(); int mapCount = getPositionCount(); boolean[] mapIsNull = getMapIsNull(); int[] hashTables = new int[elementCount * HASH_MULTIPLIER]; Arrays.fill(hashTables, -1); for (int i = 0; i < mapCount; i++) { int keyOffset = offsets[i]; int keyCount = offsets[i + 1] - keyOffset; if (keyCount < 0) { throw new IllegalArgumentException(format("Offset is not monotonically ascending. offsets[%s]=%s, offsets[%s]=%s", i, offsets[i], i + 1, offsets[i + 1])); } if (mapIsNull != null && mapIsNull[i] && keyCount != 0) { throw new IllegalArgumentException("A null map must have zero entries"); } buildHashTable( getRawKeyBlock(), keyOffset, keyCount, keyBlockHashCode, hashTables, keyOffset * HASH_MULTIPLIER, keyCount * HASH_MULTIPLIER); } this.hashTables = hashTables; } }
Source:
<code>public DisksViewRadioGroup() { FlowPanel panel = new FlowPanel(); Label label = new Label(); label.setText(constants.diskType() + ":"); label.addStyleName("disk-storage-type-group-label"); <START> panel.add(label); <END> panel.add(getRadioGroupPanel()); initWidget(panel); }</code><technical_language>move of this getRadioGroupPanel, return FlowPanel. do I explained in DiskContentRadioGroup extend FlowPanel simplify a bunch of this stuff</technical_language>

Target:
public DisksViewRadioGroup() { Label label = new Label(); label.setText(constants.diskType() + ":"); label.addStyleName("disk-storage-type-group-label"); add(label); add(getRadioGroupPanel()); }
Source:
<code>public void testRemove() throws Exception { setUriInfo(setUpBasicUriExpectations()); Network network = new Network(); network.setId(NETWORK_ID.toString()); <START> setUpCreationExpectations(VdcActionType.EditIscsiBond, <END> EditIscsiBondParameters.class, new String[] { "IscsiBond" }, new Object[] { getIscsiBondWithNoNetworks() }, true, true, null, VdcQueryType.GetIscsiBondById, IdQueryParameters.class, new String[] { "Id" }, new Object[] { ISCSI_BOND_ID }, getIscsiBondContainingNetwork()); Response response = collection.performRemove(network.getId()); assertEquals(200, response.getStatus()); }</code><technical_language>Dont setUpCreationExpectations, split expectations</technical_language>

Target:
public void testRemove() throws Exception { setUriInfo(setUpBasicUriExpectations()); Network network = new Network(); network.setId(NETWORK_ID.toString()); setUpGetEntityExpectations(VdcQueryType.GetIscsiBondById, IdQueryParameters.class, new String[] { "Id" }, new Object[] { ISCSI_BOND_ID }, getIscsiBondContainingNetwork()); setUpActionExpectations(VdcActionType.EditIscsiBond, EditIscsiBondParameters.class, new String[] { "IscsiBond" }, new Object[] { getIscsiBondWithNoNetworks() }, true, true, null); Response response = collection.performRemove(network.getId()); assertEquals(200, response.getStatus()); }
Source:
<code>public void testList() throws StripeException { final OrderReturnCollection orderReturns = OrderReturn.list(null); assertNotNull(orderReturns); <START> assertEquals(1, orderReturns.getData().size()); <END> verifyRequest( APIResource.RequestMethod.GET, "/v1/order_returns" ); }</code><technical_language>do this assert other list endpoints (I yet) do expect 1 passing a limit</technical_language>

Target:
public void testList() throws StripeException { final Map<String, Object> params = new HashMap<String, Object>(); params.put("limit", 1); final OrderReturnCollection orderReturns = OrderReturn.list(params); assertNotNull(orderReturns); verifyRequest( APIResource.RequestMethod.GET, "/v1/order_returns", params ); }
Source:
<code>public void theSetConfigurationObjectRequestIsReceived() throws Throwable { <START> PROPERTIES_MAP.put(DEVICE_IDENTIFICATION_G_LABEL, this.deviceId.getDeviceIdG()); <END> PROPERTIES_MAP.put(ORGANISATION_IDENTIFICATION_LABEL, this.organisationId.getOrganisationId()); this.RequestRunner(PROPERTIES_MAP, TEST_CASE_NAME_REQUEST, TEST_CASE_XML, TEST_SUITE_XML); }</code><technical_language>SetConfigurationObject tested E-meter DEVICE_IDENTIFICATION_G_LABEL -> DEVICE_IDENTIFICATION_E_LABEL getDeviceIdG -> getDeviceIdE</technical_language>

Target:
public void theSetConfigurationObjectRequestIsReceived() throws Throwable { PROPERTIES_MAP.put(DEVICE_IDENTIFICATION_E_LABEL, this.deviceId.getDeviceIdE()); PROPERTIES_MAP.put(ORGANISATION_IDENTIFICATION_LABEL, this.organisationId.getOrganisationId()); this.RequestRunner(PROPERTIES_MAP, TEST_CASE_NAME_REQUEST, TEST_CASE_XML, TEST_SUITE_XML); }
Source:
<code>private static String getPaddedMilliseconds(String milliseconds) { milliseconds = milliseconds == null ? "" : milliseconds; if (milliseconds.length() == MILLISECOND_PRECISION) return milliseconds; <START> else if (milliseconds.length() > MILLISECOND_PRECISION) <END> return milliseconds.substring(0, MILLISECOND_PRECISION); else { int digitsToAdd = MILLISECOND_PRECISION - milliseconds.length(); char[] zeroes = new char[digitsToAdd]; Arrays.fill(zeroes, '0'); return milliseconds + new String(zeroes); } }</code><technical_language>I prefer braces add else clause for clarity - in this scenario affect total line count</technical_language>

Target:
private static String getPaddedMilliseconds(String milliseconds) { milliseconds = milliseconds == null ? "" : milliseconds; if (milliseconds.length() == MILLISECOND_PRECISION) { return milliseconds; } else if (milliseconds.length() > MILLISECOND_PRECISION) { return milliseconds.substring(0, MILLISECOND_PRECISION); } else { int digitsToAdd = MILLISECOND_PRECISION - milliseconds.length(); char[] zeroes = new char[digitsToAdd]; Arrays.fill(zeroes, '0'); return milliseconds + new String(zeroes); } }
Source:
<code>public <START> synchronized static <END> Map<String, String> getTasksMap() { return tasksmap; }</code><technical_language>synchronized</technical_language>

Target:
public static Map<String, String> getTasksMap() { return tasksmap; }
Source:
<code>public static void setupMDC(String service) { MDC.put("dt.service", service); String value = StramClientUtils.getHostName(); MDC.put("dt.node", value == null ? "unknown" : value); <START> value = System.getenv(ApplicationConstants.Environment.USER.name()); <END> if (value != null) { MDC.put("dt.user", value); } value = System.getenv(ApplicationConstants.Environment.CONTAINER_ID.name()); if (value != null) { ContainerId containerId = ConverterUtils.toContainerId(value); ApplicationId applicationId = containerId.getApplicationAttemptId().getApplicationId(); MDC.put("dt.containerId", containerId.toString()); MDC.put("dt.applicationId", applicationId.toString()); } value = System.getProperty(APPLICATION_NAME.getLongName()); if (value != null) { MDC.put("dt.application", value); } }</code><technical_language>USER.key() USER.toString()</technical_language>

Target:
public static void setupMDC(String service) { MDC.put("apex.service", service); String value = StramClientUtils.getHostName(); MDC.put("apex.node", value == null ? "unknown" : value); value = System.getenv(Environment.USER.key()); if (value != null) { MDC.put("apex.user", value); } value = System.getenv(Environment.CONTAINER_ID.name()); if (value != null) { ContainerId containerId = ConverterUtils.toContainerId(value); ApplicationId applicationId = containerId.getApplicationAttemptId().getApplicationId(); MDC.put("apex.containerId", containerId.toString()); MDC.put("apex.applicationId", applicationId.toString()); } value = System.getProperty(APPLICATION_NAME.getLongName()); if (value != null) { MDC.put("apex.application", value); } }
Source:
<code>static SearchServiceUrlParts parseServiceUrlParts(String endpoint) { ClientLogger logger = new ClientLogger(SearchServiceUrlParser.class); <START> if (StringUtils.isBlank(endpoint)) { throw logger.logExceptionAsError( new IllegalArgumentException("Illegal endpoint URL: endpoint cannot be blank")); } <END> URL url; try { url = new URL(endpoint); } catch (MalformedURLException exc) { throw logger.logExceptionAsError(new IllegalArgumentException("Illegal endpoint URL: " + exc.getMessage())); } String extractedHost = url.getHost(); if (StringUtils.isBlank(extractedHost) || extractedHost.startsWith(".") || extractedHost.endsWith(".")) { throw logger.logExceptionAsError(new IllegalArgumentException("Illegal endpoint URL: invalid host")); } String[] tokens = StringUtils.split(extractedHost, "."); if ((tokens.length < 3) || (StringUtils.isBlank(tokens[0]))) { throw logger.logExceptionAsError(new IllegalArgumentException("Illegal endpoint URL: invalid host")); } String serviceName = tokens[0]; int index = StringUtils.indexOf(extractedHost, "."); String searchDnsSuffix = extractedHost.substring(index + 1); return new SearchServiceUrlParts(serviceName, searchDnsSuffix); }</code><technical_language>fine remove this pass a blank/null/empty endpoint URL constructor if throws a MalformedURLException</technical_language>

Target:
static SearchServiceUrlParts parseServiceUrlParts(String endpoint) { ClientLogger logger = new ClientLogger(SearchServiceUrlParser.class); URL url; try { url = new URL(endpoint); } catch (MalformedURLException exc) { throw logger.logExceptionAsError(new IllegalArgumentException("Illegal endpoint URL: " + exc.getMessage())); } String extractedHost = url.getHost(); if (CoreUtils.isNullOrEmpty(extractedHost) || extractedHost.startsWith(".") || extractedHost.endsWith(".")) { throw logger.logExceptionAsError(new IllegalArgumentException("Illegal endpoint URL: invalid host")); } String[] tokens = extractedHost.split("\\."); if ((tokens.length < 3) || (CoreUtils.isNullOrEmpty(tokens[0]))) { throw logger.logExceptionAsError(new IllegalArgumentException("Illegal endpoint URL: invalid host")); } String serviceName = tokens[0]; int index = extractedHost.indexOf("."); String searchDnsSuffix = extractedHost.substring(index + 1); return new SearchServiceUrlParts(serviceName, searchDnsSuffix); }
Source:
<code>public void testPutAll() throws Exception { final Map<String, String> originalStoreContent = getEntryMap(KEY_SET_A, KEY_SET_B); final FakeStore fakeStore = new FakeStore(originalStoreContent); this.store = spy(fakeStore); final Map<String, String> originalWriterContent = getEntryMap(KEY_SET_A, KEY_SET_B, KEY_SET_C); final FakeCacheLoaderWriter fakeLoaderWriter = new FakeCacheLoaderWriter(originalWriterContent); <START> this.cacheLoaderWriter = spy(fakeLoaderWriter); <END> final Ehcache<String, String> ehcache = this.getEhcache(this.cacheLoaderWriter); final Map<String, String> contentUpdates = getAltEntryMap("new_", fanIn(KEY_SET_A, KEY_SET_C, KEY_SET_D)); ehcache.putAll(contentUpdates); verify(testCacheEventListener,times(18)).onEvent(argThat(isCreatedOrUpdated)); }</code><technical_language>reinitialize cacheLoaderWriter mocked</technical_language>

Target:
public void testPutAll() throws Exception { final Map<String, String> originalStoreContent = getEntryMap(KEY_SET_A, KEY_SET_B); final FakeStore fakeStore = new FakeStore(originalStoreContent); this.store = spy(fakeStore); final Ehcache<String, String> ehcache = this.getEhcache(this.cacheLoaderWriter); final Map<String, String> contentUpdates = getAltEntryMap("new_", fanIn(KEY_SET_A, KEY_SET_C, KEY_SET_D)); ehcache.putAll(contentUpdates); verify(cacheEventListener,times(18)).onEvent(argThat(isCreatedOrUpdated)); try { ehcache.getRuntimeConfiguration().deregisterCacheEventListener(cacheEventListener); fail(); } catch (UnsupportedOperationException e){ } }