auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public DataSet<ExecRow> getDataSet(SpliceOperation op, DataSetProcessor dsp, ExecRow execRow) throws StandardException { operationContext = dsp.createOperationContext(op); ArrayList<ExecRow> items = new ArrayList<ExecRow>(); Activation activation = op.getActivation(); LanguageConnectionContext lcc = activation.getLanguageConnectionContext(); TransactionController tc = lcc.getTransactionExecute(); DataDictionaryImpl dd = (DataDictionaryImpl)lcc.getDataDictionary(); List<SchemaDescriptor> schemas= dd.getAllSchemas(tc); for(SchemaDescriptor schema: schemas) { String schemaName = schema.getSchemaName(); StatementPermission statementPermission = new StatementSchemaPermission(schemaName, null, Authorizer.ACCESS_PRIV); <START> if (!lcc.getAuthorizer().canSeeSchema(lcc.getLastActivation(), statementPermission)) { <END> ValueRow valueRow = new ValueRow(1); valueRow.setColumn(1, new SQLVarchar(schemaName)); items.add(valueRow); } } return dsp.createDataSet(items.iterator()); }</code><technical_language>Is a reason lcc.getLastActivation() instead of activation variable above? a repeat of question SYSSCHEMASRowFactory: returning non-accessible schemas instead of accessible schemas directly</technical_language>

Target:
public DataSet<ExecRow> getDataSet(SpliceOperation op, DataSetProcessor dsp, ExecRow execRow) throws StandardException { operationContext = dsp.createOperationContext(op); ArrayList<ExecRow> items = new ArrayList<ExecRow>(); Activation activation = op.getActivation(); LanguageConnectionContext lcc = activation.getLanguageConnectionContext(); TransactionController tc = lcc.getTransactionExecute(); DataDictionaryImpl dd = (DataDictionaryImpl)lcc.getDataDictionary(); List<SchemaDescriptor> schemas= dd.getAllSchemas(tc); for(SchemaDescriptor schema: schemas) { String schemaName = schema.getSchemaName(); if (lcc.getAuthorizer().canSeeSchema(activation, schemaName, schema.getAuthorizationId())) { ValueRow valueRow = new ValueRow(1); valueRow.setColumn(1, new SQLVarchar(schemaName)); items.add(valueRow); } } return dsp.createDataSet(items.iterator()); }
Source:
<code>public void testLockUseAfterPartitionWithoutMajority() throws Throwable { ClusteredLockManager clm0 = EmbeddedClusteredLockManagerFactory.from(getCacheManagers().get(0)); ClusteredLockManager clm1 = EmbeddedClusteredLockManagerFactory.from(getCacheManagers().get(1)); ClusteredLockManager clm2 = EmbeddedClusteredLockManagerFactory.from(getCacheManagers().get(2)); ClusteredLockManager clm3 = EmbeddedClusteredLockManagerFactory.from(getCacheManagers().get(3)); ClusteredLockManager clm4 = EmbeddedClusteredLockManagerFactory.from(getCacheManagers().get(4)); ClusteredLockManager clm5 = EmbeddedClusteredLockManagerFactory.from(getCacheManagers().get(5)); clm0.defineLock(LOCK_NAME); assertTrue(clm0.isDefined(LOCK_NAME)); ClusteredLock lock0 = clm0.get(LOCK_NAME); ClusteredLock lock1 = clm1.get(LOCK_NAME); ClusteredLock lock2 = clm2.get(LOCK_NAME); ClusteredLock lock3 = clm3.get(LOCK_NAME); ClusteredLock lock4 = clm4.get(LOCK_NAME); ClusteredLock lock5 = clm5.get(LOCK_NAME); splitCluster(new int[]{0, 1, 2}, new int[]{3, 4, 5}); asList(lock0, lock1, lock2, lock3, lock4, lock5).forEach(lock -> { assertNotNull(lock); assertFalse(await(lock.tryLock(100, TimeUnit.MILLISECONDS).exceptionally(ex -> { assertException(ClusteredLockException.class, ex); <START> assertException(AvailabilityException.class, ex.getCause()); <END> return Boolean.FALSE; }))); }); }</code><technical_language>assertException(ClusteredLockException.class, AvailabilityException.class, ex), betterexpectExecutionException(ClusteredLockException.class, AvailabilityException.class, lock.tryLock(100, MILLISECONDS) if expect call fail</technical_language>

Target:
public void testLockUseAfterPartitionWithoutMajority() throws Throwable { ClusteredLockManager clm0 = EmbeddedClusteredLockManagerFactory.from(getCacheManagers().get(0)); ClusteredLockManager clm1 = EmbeddedClusteredLockManagerFactory.from(getCacheManagers().get(1)); ClusteredLockManager clm2 = EmbeddedClusteredLockManagerFactory.from(getCacheManagers().get(2)); ClusteredLockManager clm3 = EmbeddedClusteredLockManagerFactory.from(getCacheManagers().get(3)); ClusteredLockManager clm4 = EmbeddedClusteredLockManagerFactory.from(getCacheManagers().get(4)); ClusteredLockManager clm5 = EmbeddedClusteredLockManagerFactory.from(getCacheManagers().get(5)); clm0.defineLock(LOCK_NAME); assertTrue(clm0.isDefined(LOCK_NAME)); ClusteredLock lock0 = clm0.get(LOCK_NAME); ClusteredLock lock1 = clm1.get(LOCK_NAME); ClusteredLock lock2 = clm2.get(LOCK_NAME); ClusteredLock lock3 = clm3.get(LOCK_NAME); ClusteredLock lock4 = clm4.get(LOCK_NAME); ClusteredLock lock5 = clm5.get(LOCK_NAME); splitCluster(new int[]{0, 1, 2}, new int[]{3, 4, 5}); asList(lock0, lock1, lock2, lock3, lock4, lock5).forEach(lock -> { assertNotNull(lock); assertFalse(await(lock.tryLock(100, TimeUnit.MILLISECONDS).exceptionally(ex -> { assertException(ClusteredLockException.class, AvailabilityException.class, ex); return Boolean.FALSE; }))); }); }
Source:
<code>protected Class<?> checkForBoundClass() { if (boundClass == null) { <START> throw new IndexOperationsException("IndexOperations are not bound"); <END> } return boundClass; }</code><technical_language>InvalidDataAccessApiUsageException</technical_language>

Target:
protected Class<?> checkForBoundClass() { if (boundClass == null) { throw new InvalidDataAccessApiUsageException("IndexOperations are not bound"); } return boundClass; }
Source:
<code>private void updateAndClearDocuments(List<Document> documentsToUpdate) { if (documentsToUpdate.isEmpty()) { return; } print("Batch updating " + documentsToUpdate.size() + " documents..."); if (!isPreview) { try { SearchManager.putDocuments(Const.SearchIndex.FEEDBACK_RESPONSE_COMMENT, documentsToUpdate); } catch (Exception e) { throw new RuntimeException("Failed to update one or more documents. Please rerun this script.", e); } } <START> println(" done."); <END> documentsToUpdate.clear(); }</code><technical_language>Is space deliberate</technical_language>

Target:
private void updateAndClearDocuments(List<Document> documentsToUpdate) { if (documentsToUpdate.isEmpty()) { return; } println("Batch updating " + documentsToUpdate.size() + " documents..."); if (!isPreview) { try { invokePutDocumentsWithRetry(Const.SearchIndex.FEEDBACK_RESPONSE_COMMENT, documentsToUpdate); println("Batch update succeeded."); } catch (PutException e) { println("Batch update failed with non-transient errors."); } catch (MaximumRetriesExceededException e) { println("Batch update failed after maximum retries."); } } documentsToUpdate.clear(); }
Source:
<code>public CsvOutputFormat(String recordDelimiter, String fieldDelimiter, Class<? extends Value> ... types) { <START> if (recordDelimiter == null) <END> throw new IllegalArgumentException("RecordDelmiter shall not be null."); if (fieldDelimiter == null) throw new IllegalArgumentException("FieldDelimiter shall not be null."); if (types.length == 0) throw new IllegalArgumentException("No field types given."); this.fieldDelimiter = fieldDelimiter; this.recordDelimiter = recordDelimiter; this.numFields = types.length; @SuppressWarnings("unchecked") Class<Value>[] classes = new Class[types.length]; this.classes = classes; this.recordPositions = new int[types.length]; this.lenient = false; for (int i = 0; i < types.length; i++) { if (types[i] == null) throw new IllegalArgumentException("Invalid Constructor Parameter: No type class for parameter " + (2 + i)); this.classes[i] = types[i]; this.recordPositions[i] = i; } genericInstantiation = false; }</code><technical_language>braces { .. } for if etc</technical_language>

Target:
public CsvOutputFormat(String recordDelimiter, String fieldDelimiter, Class<? extends Value>... types) { if (recordDelimiter == null) { throw new IllegalArgumentException("RecordDelmiter shall not be null."); } if (fieldDelimiter == null) { throw new IllegalArgumentException("FieldDelimiter shall not be null."); } if (types.length == 0) { throw new IllegalArgumentException("No field types given."); } this.fieldDelimiter = fieldDelimiter; this.recordDelimiter = recordDelimiter; this.lenient = false; setTypes(types); }
Source:
<code>public void testConvertProfileEntryDto() { final ProfileEntry result = this.mapper.map(this.profileEntryDto(), ProfileEntry.class); <START> Assert.assertTrue(result != null && result instanceof ProfileEntry); <END> }</code><technical_language>use: import static org.hamcrest.CoreMatchers.instanceOf; ... assertNotNull(result); assertThat(result, instanceOf(ClassName.class));</technical_language>

Target:
public void testConvertProfileEntryDto() { final ProfileEntry result = this.mapper.map(this.profileEntryDto(), ProfileEntry.class); assertNotNull("mapping ProfileEntryDto should not return null", result); assertThat("mapping ProfileEntryDto should return correct type", result, instanceOf(ProfileEntry.class)); }
Source:
<code>public void returnsProperResponseCodeOnNoContentLength() throws Exception { final Socket socket = Mockito.mock(Socket.class); final String requests = Joiner.on(BkBasicTest.CRLF).join( BkBasicTest.POST, BkBasicTest.HOST, "", "Hello World!" ); <START> final InputStream input = new ByteArrayInputStream(requests.getBytes()); <END> final OutputStream output = new ByteArrayOutputStream(); Mockito.when(socket.getLocalAddress()).thenReturn( InetAddress.getLocalHost() ); Mockito.when(socket.getInetAddress()).thenReturn( InetAddress.getLocalHost() ); Mockito.when(socket.getLocalPort()).thenReturn(0); Mockito.when(socket.getPort()).thenReturn(0); Mockito.when(socket.getInputStream()).thenReturn(input); Mockito.when(socket.getOutputStream()).thenReturn(output); new BkBasic(new TkText("411 Test")).accept(socket); MatcherAssert.assertThat( socket.getOutputStream().toString(), Matchers.containsString("HTTP/1.1 411 Length Required") ); }</code><technical_language>@danff get rid time variable</technical_language>

Target:
public void returnsProperResponseCodeOnNoContentLength() throws Exception { final ByteArrayOutputStream output = new ByteArrayOutputStream(); final ServerSocket server = new ServerSocket(0); try { new Thread( new Runnable() { @Override public void run() { try { new BkBasic(new TkText("411 Test")).accept( server.accept() ); } catch (final IOException exception) { throw new IllegalStateException(exception); } } } ).start(); final Socket socket = new Socket( server.getInetAddress(), server.getLocalPort() ); try { socket.getOutputStream().write( Joiner.on(BkBasicTest.CRLF).join( BkBasicTest.POST, BkBasicTest.HOST, "", "Hello World!" ).getBytes() ); final InputStream input = socket.getInputStream(); final byte[] buffer = new byte[4096]; for (int count = input.read(buffer); count != -1; count = input.read(buffer)) { output.write(buffer, 0, count); } } finally { socket.close(); } } finally { server.close(); } MatcherAssert.assertThat( output.toString(), Matchers.containsString("HTTP/1.1 411 Length Required") ); }
Source:
<code>public String toString() { StringBuilder sb = new StringBuilder(256) .append(StringUtil.simpleClassName(this)) .append("(protocolVersion: ").append(protocolVersion) .append(", command: ").append(command) .append(", proxiedProtocol: ").append(proxiedProtocol) .append(", sourceAddress: ").append(sourceAddress) .append(", destinationAddress: ").append(destinationAddress) .append(", sourcePort: ").append(sourcePort) .append(", destinationPort: ").append(destinationPort) .append(", tlvs: ["); for (HAProxyTLV tlv: tlvs) { sb.append(tlv).append(", "); } <START> if (!tlvs.isEmpty()) { <END> sb.setLength(sb.length() - 2); } sb.append("])"); return sb.toString(); }</code><technical_language>nit: move for loop this block is need do loop empty</technical_language>

Target:
public String toString() { StringBuilder sb = new StringBuilder(256) .append(StringUtil.simpleClassName(this)) .append("(protocolVersion: ").append(protocolVersion) .append(", command: ").append(command) .append(", proxiedProtocol: ").append(proxiedProtocol) .append(", sourceAddress: ").append(sourceAddress) .append(", destinationAddress: ").append(destinationAddress) .append(", sourcePort: ").append(sourcePort) .append(", destinationPort: ").append(destinationPort) .append(", tlvs: ["); if (!tlvs.isEmpty()) { for (HAProxyTLV tlv: tlvs) { sb.append(tlv).append(", "); } sb.setLength(sb.length() - 2); } sb.append("])"); return sb.toString(); }
Source:
<code>public String toString() { if (scanner != null) { <START> return "SeqScanExec:" + planInfo + "," + scanner.getClass().getName(); <END> } else { return "SeqScanExec:" + planInfo; } }</code><technical_language>do a string variable 'planInfo' instead of 'plan.toString()' directly</technical_language>

Target:
public String toString() { if (scanner != null) { return "SeqScanExec:" + plan + "," + scanner.getClass().getName(); } else { return "SeqScanExec:" + plan; } }
Source:
<code>private Naether createNaetherWithRepository(String repository, String libraryFolder) { Naether naether = new NaetherImpl(); <START> naether.setLocalRepoPath(new File(libraryFolder).toPath().toAbsolutePath().toString()); <END> try { naether.setRemoteRepositories(Sets.newHashSet( RepoBuilder.remoteRepositoryFromUrl(repository) )); } catch (MalformedURLException e) { logger.log(Level.WARNING, "Unable to resolve library dependencies. Falling back to " + "explicitly defined dependencies only.", e); return null; } return naether; }</code><technical_language>File#getAbsolutePath() simpler</technical_language>

Target:
private Naether createNaetherWithRepository(String repository, String libraryFolder) { Naether naether = new NaetherImpl(); naether.setLocalRepoPath(new File(libraryFolder).getAbsolutePath()); try { naether.setRemoteRepositories(Sets.newHashSet( RepoBuilder.remoteRepositoryFromUrl(repository) )); } catch (MalformedURLException e) { logger.log(Level.WARNING, "Unable to resolve library dependencies. Falling back to " + "explicitly defined dependencies only.", e); return null; } return naether; }
Source:
<code>public ResponseEntity<Problem> handleFeatureTurnedOff(final FeatureNotAvailableException ex, final NativeWebRequest request) { LOG.debug(ex.getMessage(), ex); <START> return Responses.create(Problem.valueOf(NOT_IMPLEMENTED, "Feature is disabled"), request); <END> }</code><technical_language>ex.getMessage() "Feature is disabled"</technical_language>

Target:
public ResponseEntity<Problem> handleFeatureTurnedOff(final FeatureNotAvailableException ex, final NativeWebRequest request) { LOG.debug(ex.getMessage(), ex); return Responses.create(Problem.valueOf(NOT_IMPLEMENTED, ex.getMessage()), request); }
Source:
<code>protected Result check() throws Exception { Response response; try { response = toolsExtendedApi.toolsIndexSearch(null, null, null); } catch (CustomWebApplicationException ex) { <START> ex.printStackTrace(); <END> return Result.unhealthy("Error contacting Elastic Search: " + ex.getResponse().getEntity()); } catch (Exception ex) { ex.printStackTrace(); return Result.unhealthy("Error contacting Elastic Search: " + ex.getMessage()); } if (response.getStatus() >= LOWER_BOUND_SUCCESS_STATUS && response.getStatus() < UPPER_BOUND_SUCCESS_STATUS) { return Result.healthy(); } else { return Result.unhealthy("Error contacting Elastic Search, got status code '" + response.getStatus() + "'."); } }</code><technical_language>a logger</technical_language>

Target:
protected Result check() throws Exception { String baseMessage = "Error contacting Elastic Search"; Response response; try { response = toolsExtendedApi.toolsIndexSearch(null, null, null); } catch (CustomWebApplicationException ex) { LOG.info(baseMessage, ex); return Result.unhealthy(baseMessage + ": " + ex.getResponse().getEntity()); } catch (Exception ex) { LOG.info(baseMessage, ex); return Result.unhealthy(baseMessage + ": " + ex.getMessage()); } if (response.getStatus() >= Response.Status.OK.getStatusCode() && response.getStatus() < Response.Status.INTERNAL_SERVER_ERROR.getStatusCode()) { return Result.healthy(); } else { return Result.unhealthy(baseMessage + ", got status code '" + response.getStatus() + "'."); } }
Source:
<code>private static boolean validateTimeRange() { boolean isEmpty = fStartTimeRangeText.getText().isEmpty() || fEndTimeRangeText.getText().isEmpty(); return parseTimeRange() && fStartTimestamp.compareTo(fEndTimestamp) <= 0 && <START> !isEmpty; <END> }</code><technical_language>in line, returns if isEmpty, parse</technical_language>

Target:
private boolean validateTimeRange() { boolean isEmpty = fStartTimeRangeText.getText().isEmpty() || fEndTimeRangeText.getText().isEmpty(); return !isEmpty && parseTimeRange() && fStartTimestamp.compareTo(fEndTimestamp) <= 0; }
Source:
<code>public AstConnectNode visitConnectNode(ConnectNodeContext ctx) { AstLocationVisitor locationVisitor = new AstLocationVisitor(elFactory, elContext); AstLocation location = locationVisitor.visit(ctx.connectURI); node = new AstConnectNode(); node.setLocation(location); node.setEnvironment(elContext); super.visitConnectNode(ctx); node.setRegionInfo(asParallelRegion(childInfos, ctx)); Token barrier = ctx.barrier; if (barrier != null) { node.setBarrier(barrier.getText()); } <START> RobotParser.LocationContext transport = ctx.value; <END> if (transport != null) { AstLocationVisitor transportVisitor = new AstLocationVisitor(elFactory, elContext); AstLocation transportLocation = transportVisitor.visit(ctx.value); node.getOptions().put("transport", transportLocation); } return node; }</code><technical_language>Update import LocationContext here, other RobotParser.* types</technical_language>

Target:
public AstConnectNode visitConnectNode(ConnectNodeContext ctx) { AstLocationVisitor locationVisitor = new AstLocationVisitor(elFactory, elContext); AstLocation location = locationVisitor.visit(ctx.connectURI); node = new AstConnectNode(); node.setLocation(location); node.setEnvironment(elContext); super.visitConnectNode(ctx); node.setRegionInfo(asParallelRegion(childInfos, ctx)); Token barrier = ctx.barrier; if (barrier != null) { node.setBarrier(barrier.getText()); } LocationContext transport = ctx.value; if (transport != null) { AstLocationVisitor transportVisitor = new AstLocationVisitor(elFactory, elContext); AstLocation transportLocation = transportVisitor.visit(ctx.value); node.getOptions().put("transport", transportLocation); } return node; }
Source:
<code><START> private void register( LuceneFulltext fulltextIndex, int side ) throws IOException <END> { configurationLock.writeLock().lock(); try { WritableFulltext writableFulltext = new WritableFulltext( fulltextIndex ); writableFulltext.open(); if ( fulltextIndex.getType() == FulltextIndexType.NODES ) { if ( !matchesConfiguration( writableFulltext ) ) { writableFulltext.drop(); writableFulltext.open(); if ( !writableFulltext.getProperties().isEmpty() ) { applier.populateNodes( writableFulltext, db ); } } writableNodeIndices[side].put( fulltextIndex.getIdentifier(), writableFulltext ); } else { if ( !matchesConfiguration( writableFulltext ) ) { writableFulltext.drop(); writableFulltext.open(); if ( !writableFulltext.getProperties().isEmpty() ) { applier.populateRelationships( writableFulltext, db ); } } writableRelationshipIndices[side].put( fulltextIndex.getIdentifier(), writableFulltext ); } } finally { configurationLock.writeLock().unlock(); } }</code><technical_language>Is a reason pass sides register call, assigned atomically configurationLock</technical_language>

Target:
private void register( LuceneFulltext fulltextIndex, int side ) throws IOException { WritableFulltext writableFulltext = new WritableFulltext( fulltextIndex ); writableFulltext.open(); if ( fulltextIndex.getType() == FulltextIndexType.NODES ) { if ( !matchesConfiguration( writableFulltext ) ) { writableFulltext.drop(); writableFulltext.open(); if ( !writableFulltext.getProperties().isEmpty() ) { applier.populateNodes( writableFulltext, db ); } } writableNodeIndices[side].put( fulltextIndex.getIdentifier(), writableFulltext ); } else { if ( !matchesConfiguration( writableFulltext ) ) { writableFulltext.drop(); writableFulltext.open(); if ( !writableFulltext.getProperties().isEmpty() ) { applier.populateRelationships( writableFulltext, db ); } } writableRelationshipIndices[side].put( fulltextIndex.getIdentifier(), writableFulltext ); } }
Source:
<code>public void dump() { <START> try (StringWriter sw = new StringWriter(); PrintWriter pw = new PrintWriter(sw)) { <END> dump(pw); pw.flush(); sw.flush(); LOGGER.info(sw.toString()); } catch (IOException e) { LOGGER.log(Level.SEVERE, e.getMessage(), e); } }</code><technical_language>This duplicate code a similar block I above. refactored</technical_language>

Target:
public void dump() { try (StringWriter sw = new StringWriter(); PrintWriter pw = new PrintWriter(sw)) { dump(pw); pw.flush(); sw.flush(); LOGGER.fine(sw.toString()); } catch (IOException e) { LOGGER.log(Level.SEVERE, e.getMessage(), e); } }
Source:
<code>private void insert(double x, double y, T item) { if (!this.mBounds.contains(x, y)) { return; } if (this.mChildren != null) { for (PointQuadTree<T> quad : mChildren) { <START> quad.insert(x, y, item); <END> } return; } if (mItems == null) { mItems = new ArrayList<T>(); } mItems.add(item); if (mItems.size() > MAX_ELEMENTS && mDepth < MAX_DEPTH) { split(); } }</code><technical_language>If I understood correctly, point inserted in of quadtree (or children), pointless insert right quadtree found. insert method return "true" if item inserted, "false" if wasn't, if quad.insert(...) returns true, simply return</technical_language>

Target:
private boolean insert(double x, double y, T item) { if (!this.mBounds.contains(x, y)) { return false; } if (this.mChildren != null) { for (PointQuadTree<T> quad : mChildren) { if (quad.insert(x, y, item)) { return true; } } return false; } if (mItems == null) { mItems = new ArrayList<T>(); } mItems.add(item); if (mItems.size() > MAX_ELEMENTS && mDepth < MAX_DEPTH) { split(); } return true; }
Source:
<code>public Integer deleteCategories(String contextInode) throws Exception { UserWebAPI uWebAPI = WebAPILocator.getUserWebAPI(); WebContext ctx = WebContextFactory.get(); HttpServletRequest request = ctx.getHttpServletRequest(); User user = uWebAPI.getLoggedInUser(request); <START> AtomicInteger returnValue = new AtomicInteger(0); <END> if (UtilMethods.isSet(contextInode)) { Category parent = categoryAPI.find(contextInode, user, false); List<Category> unableToDelete = categoryAPI.removeAllChildren(parent, user, false); if(UtilMethods.isSet(unableToDelete)) { returnValue.set(1); } } else { categoryAPI.deleteAll(user, false); } return returnValue.get(); }</code><technical_language>a AtomicInteger, code I pretty thread-safe</technical_language>

Target:
public Integer deleteCategories(String contextInode) throws Exception { UserWebAPI uWebAPI = WebAPILocator.getUserWebAPI(); WebContext ctx = WebContextFactory.get(); HttpServletRequest request = ctx.getHttpServletRequest(); User user = uWebAPI.getLoggedInUser(request); int returnValue = ALL_CATEGORIES_DELETED; if (UtilMethods.isSet(contextInode)) { Category parent = categoryAPI.find(contextInode, user, false); List<Category> unableToDelete = categoryAPI.removeAllChildren(parent, user, false); if(UtilMethods.isSet(unableToDelete)) { returnValue = SOME_CATEGORIES_DELETED; } } else { categoryAPI.deleteAll(user, false); } return returnValue; }
Source:
<code>public boolean isOpen() { <START> return connection.isOpen(); <END> }</code><technical_language>this is correct - purpose of isOpen determine if session object closed? If so, this work - connections remain open ideally for duration of users application, closing a session object simply returns connection pool reused for another session object. A test highlight case clarify this well. Ergo; a flag in StandardSession set close check in this method? That'd simplify code tracking if underlying connection is open well</technical_language>

Target:
public boolean isOpen() { return isOpen; }
Source:
<code>static boolean createPluginJSONFile(String location) { InputStream in = FileProvisionUtil.class.getResourceAsStream("/" + PLUGINS_JSON_FILENAME); File targetFile = new File(location); try { FileUtils.copyInputStreamToFile(in, targetFile); return true; } catch (IOException e) { LOG.error("Could not create " + PLUGINS_JSON_FILENAME); <START> e.printStackTrace(); <END> } return false; }</code><technical_language>Pass "e" LOG call remove explicit call print stack trace. (Avoid calling e.printStackTrace();)</technical_language>

Target:
static boolean createPluginJSONFile(String location) { InputStream in = FileProvisionUtil.class.getResourceAsStream("/" + PLUGINS_JSON_FILENAME); File targetFile = new File(location); try { FileUtils.copyInputStreamToFile(in, targetFile); return true; } catch (IOException e) { LOG.error(e.getMessage() + ". Could not create " + PLUGINS_JSON_FILENAME); } return false; }
Source:
<code>private static SSAInstruction[] makeStatements(Context context) { ArrayList<SSAInstruction> statements = new ArrayList<>(); int nextLocal = 2; int retValue = nextLocal++; TypeReference tr = ((TypeAbstraction) context.get(ContextKey.RECEIVER)).getTypeReference(); SSAInstructionFactory insts = ((TypeAbstraction) context.get(ContextKey.RECEIVER)) .getType() .getClassLoader() .getInstructionFactory(); if (tr != null) { SSALoadMetadataInstruction l = insts.LoadMetadataInstruction( statements.size(), retValue, TypeReference.JavaLangClass, tr); statements.add(l); SSAReturnInstruction R = insts.ReturnInstruction(statements.size(), retValue, false); statements.add(R); } SSAInstruction[] result = new SSAInstruction[statements.size()]; Iterator<SSAInstruction> it = statements.iterator(); <START> Arrays.setAll(result, i -> it.next()); <END> return result; }</code><technical_language>This SSAInstruction[] result = statements.toArray(new SSAInstruction[0]);</technical_language>

Target:
private static SSAInstruction[] makeStatements(Context context) { ArrayList<SSAInstruction> statements = new ArrayList<>(); int nextLocal = 2; int retValue = nextLocal++; TypeReference tr = ((TypeAbstraction) context.get(ContextKey.RECEIVER)).getTypeReference(); SSAInstructionFactory insts = ((TypeAbstraction) context.get(ContextKey.RECEIVER)) .getType() .getClassLoader() .getInstructionFactory(); if (tr != null) { SSALoadMetadataInstruction l = insts.LoadMetadataInstruction( statements.size(), retValue, TypeReference.JavaLangClass, tr); statements.add(l); SSAReturnInstruction R = insts.ReturnInstruction(statements.size(), retValue, false); statements.add(R); } return statements.toArray(new SSAInstruction[0]); }
Source:
<code>public T head() { int offset = 0; for (int i = 0; i < getWordsNum(); i++) { if(elements[i] != 0) { return fromInt.apply(offset + Long.numberOfTrailingZeros(elements[i])); } <START> offset += BITS_PER_WORD; <END> } throw new NoSuchElementException("head of empty BitSet"); }</code><technical_language>please else if this line obvious multiple exits</technical_language>

Target:
public T head() { int offset = 0; for (int i = 0; i < getWordsNum(); i++) { if(elements[i] == 0) { offset += BITS_PER_WORD; } else { return fromInt.apply(offset + Long.numberOfTrailingZeros(elements[i])); } } throw new NoSuchElementException("head of empty BitSet"); }
Source:
<code>public void run() { if (!mAlive) { return; } final View viewRoot = mViewRoot.get(); if (null == viewRoot || mDying) { cleanUp(); return; } try { mEdit.visit(viewRoot); } catch (ViewVisitor.LayoutUpdateException e) { cleanUp(); <START> throw e; <END> } mHandler.removeCallbacks(this); mHandler.postDelayed(this, 1000); }</code><technical_language>worried this rethrow crash app. LayoutUpdateException a runtime error</technical_language>

Target:
public void run() { if (!mAlive) { return; } final View viewRoot = mViewRoot.get(); if (null == viewRoot || mDying) { cleanUp(); return; } mEdit.visit(viewRoot); mHandler.removeCallbacks(this); mHandler.postDelayed(this, 1000); }
Source:
<code><START> private void setListAppearance() { <END> mList.setDivider(null); mList.setChildDivider(null); Drawable icon = mContext.getResources().getDrawable(R.drawable.snackbar_group_indicator); mList.setGroupIndicator(icon); mList.setIndicatorBounds( 1200 - Utils.getPixelFromDips(60), 1200 - Utils.getPixelFromDips(32) ); }</code><technical_language>Another create ListView is inflate XML layout. means need hard-code dimensions styles here, deal DP pixel conversion</technical_language>

Target:
private void setListAppearance() { mList.setDivider(null); mList.setChildDivider(null); }
Source:
<code>protected void sendProxyRequest( HttpServletRequest clientRequest, HttpServletResponse proxyResponse, Request proxyRequest ) { proxyRequest.timeout(httpClientConfig.getReadTimeout().getMillis(), TimeUnit.MILLISECONDS); proxyRequest.idleTimeout(httpClientConfig.getReadTimeout().getMillis(), TimeUnit.MILLISECONDS); byte[] avaticaQuery = (byte[]) clientRequest.getAttribute(AVATICA_QUERY_ATTRIBUTE); if (avaticaQuery != null) { proxyRequest.content(new BytesContentProvider(avaticaQuery)); } final Query query = (Query) clientRequest.getAttribute(QUERY_ATTRIBUTE); if (query != null) { final ObjectMapper objectMapper = (ObjectMapper) clientRequest.getAttribute(OBJECTMAPPER_ATTRIBUTE); try { proxyRequest.content(new BytesContentProvider(objectMapper.writeValueAsBytes(query))); } catch (JsonProcessingException e) { Throwables.propagate(e); } } clientRequest.setAttribute(AuthConfig.DRUID_AUTHORIZATION_CHECKED, true); <START> authenticatorMapper.getAuthenticatorChain() <END> .stream() .forEach(authenticator -> authenticator.decorateProxyRequest( clientRequest, proxyResponse, proxyRequest )); super.sendProxyRequest( clientRequest, proxyResponse, proxyRequest ); }</code><technical_language>This potentially "overdecorate" request if decorateProxyRequest is called for Authenticator, suppose authentication schemes need request decoration mutually exclusive header fields, some other conflict of nature. I change AuthenticationResult store name of Authenticator created AuthenticationResult, read name lookup single Authenticator instance authenticated request, decorate request</technical_language>

Target:
protected void sendProxyRequest( HttpServletRequest clientRequest, HttpServletResponse proxyResponse, Request proxyRequest ) { proxyRequest.timeout(httpClientConfig.getReadTimeout().getMillis(), TimeUnit.MILLISECONDS); proxyRequest.idleTimeout(httpClientConfig.getReadTimeout().getMillis(), TimeUnit.MILLISECONDS); byte[] avaticaQuery = (byte[]) clientRequest.getAttribute(AVATICA_QUERY_ATTRIBUTE); if (avaticaQuery != null) { proxyRequest.content(new BytesContentProvider(avaticaQuery)); } final Query query = (Query) clientRequest.getAttribute(QUERY_ATTRIBUTE); if (query != null) { final ObjectMapper objectMapper = (ObjectMapper) clientRequest.getAttribute(OBJECTMAPPER_ATTRIBUTE); try { proxyRequest.content(new BytesContentProvider(objectMapper.writeValueAsBytes(query))); } catch (JsonProcessingException e) { Throwables.propagate(e); } } clientRequest.setAttribute(AuthConfig.DRUID_AUTHORIZATION_CHECKED, true); AuthenticationResult authenticationResult = (AuthenticationResult) clientRequest.getAttribute( AuthConfig.DRUID_AUTHENTICATION_RESULT); if (authenticationResult != null && authenticationResult.getAuthenticatedBy() != null) { Authenticator authenticator = authenticatorMapper.getAuthenticatorMap() .get(authenticationResult.getAuthenticatedBy()); if (authenticator != null) { authenticator.decorateProxyRequest( clientRequest, proxyResponse, proxyRequest ); } else { log.error("Can not find Authenticator with Name [%s]", authenticationResult.getAuthenticatedBy()); } } super.sendProxyRequest( clientRequest, proxyResponse, proxyRequest ); }
Source:
<code><START> public boolean endTracking() { <END> if (mAutomaticTracker != null) { mAutomaticTracker.unregister(); return true; } return false; }</code><technical_language>do need return true/false this method? is contract call beginTracking() endTracking(), do call endTracking() if beginTracking() returned true</technical_language>

Target:
public boolean endTracking() { if (mAutomaticTracker != null) { mAutomaticTracker.unregister(); mAutomaticTracker = null; return true; } return false; }
Source:
<code><START> public ColumnNotFoundException(String schemaName, String tableName, String familyName, String columnName) { <END> this(schemaName, tableName, familyName, columnName, code.getSQLState()); }</code><technical_language>nice clean this a bit a single constructor</technical_language>

Target:
public ColumnNotFoundException(String schemaName, String tableName, String familyName, String columnName) { super(new SQLExceptionInfo.Builder(code).setSchemaName(schemaName).setTableName(tableName) .setFamilyName(familyName).setColumnName(columnName).build().toString(), code.getSQLState()); this.schemaName = schemaName; this.tableName = tableName; this.columnName = columnName; }
Source:
<code>protected boolean set(TileEntityEndGateway container, Map<Key<?>, Object> map) { @Nullable Vector3i exitPortal = (Vector3i) map.get(Keys.EXIT_POSITION); if (exitPortal != null) { ((IMixinTileEntityEndGateway) container).setExitPortal(exitPortal); } <START> @Nullable Boolean exactTeleport = (Boolean) map.get(Keys.EXACT_TELEPORT); <END> if (exactTeleport != null) { ((IMixinTileEntityEndGateway) container).setExactTeleport(exactTeleport); } @Nullable Long age = (Long) map.get(Keys.END_GATEWAY_AGE); if (age != null) { ((IMixinTileEntityEndGateway) container).setAge(age); } @Nullable Integer teleportCooldown = (Integer) map.get(Keys.END_GATEWAY_TELEPORT_COOLDOWN); if (teleportCooldown != null) { ((IMixinTileEntityEndGateway) container).setTeleportCooldown(teleportCooldown); } return true; }</code><technical_language>null if return is a boolean original interface</technical_language>

Target:
protected boolean set(TileEntityEndGateway container, Map<Key<?>, Object> map) { @Nullable Vector3i exitPortal = (Vector3i) map.get(Keys.EXIT_POSITION); if (exitPortal != null) { ((IMixinTileEntityEndGateway) container).setExitPortal(exitPortal); } ((IMixinTileEntityEndGateway) container).setExactTeleport((Boolean) map.get(Keys.EXACT_TELEPORT)); @Nullable Long age = (Long) map.get(Keys.END_GATEWAY_AGE); if (age != null) { ((IMixinTileEntityEndGateway) container).setAge(age); } @Nullable Integer teleportCooldown = (Integer) map.get(Keys.END_GATEWAY_TELEPORT_COOLDOWN); if (teleportCooldown != null) { ((IMixinTileEntityEndGateway) container).setTeleportCooldown(teleportCooldown); } return true; }
Source:
<code>private void filterChatUserControlsBySearchString() { synchronized (userToChatUserControls) { for (Map<Pane, ChatUserItemController> chatUserControlMap : userToChatUserControls.values()) { synchronized (chatUserControlMap) { for (Map.Entry<Pane, ChatUserItemController> chatUserControlEntry : chatUserControlMap.entrySet()) { <START> ChatUserItemController chatUserItemController = chatUserControlEntry.getValue(); <END> if (userFilterController.isFilterApplied()) { chatUserItemController.setVisible(userFilterController.filterUser(chatUserItemController)); } else { chatUserItemController.setVisible(isUsernameMatch(chatUserItemController)); } } } } } }</code><technical_language>part of PR, while it, for loop getValue() call replaced interation valueSet. (either repalce for loop chatUserControlMap.values() stream API do): chatUserControlMap.values().forEach(chatUserItemController -> { ... });</technical_language>

Target:
private void filterChatUserControlsBySearchString() { synchronized (userToChatUserControls) { userToChatUserControls.values().forEach(chatUserControlMap -> { chatUserControlMap.values().forEach(chatUserItemController -> { if (userFilterController.isFilterApplied()) { chatUserItemController.setVisible(userFilterController.filterUser(chatUserItemController)); } else { chatUserItemController.setVisible(isUsernameMatch(chatUserItemController)); } }); }); } }
Source:
<code>private void collectAltNames(Collection<List<?>> altNames, List<String> identities) { for (List item : altNames) { Integer type = (Integer) item.get(0); if (type == 0 || type == 2) { try { <START> if (item.toArray()[1] instanceof byte[]) { <END> identities.add(getIdentifyFromBytes((byte[]) item.toArray()[1])); } else if (item.toArray()[1] instanceof String) { identities.add((String) item.toArray()[1]); } } catch (Exception e) { return; } } } }</code><technical_language>avoid calling toArray[] multiple times item? do need call item.toArray()[1] instead of item.get(1). is 2 elements in item blindly retrieve 2nd element</technical_language>

Target:
private void collectAltNames(Collection<List<?>> altNames, List<String> identities) { for (List item : altNames) { Integer type = (Integer) item.get(0); if (type == 0 || type == 2) { try { Object[] objects = item.toArray(); if (objects[1] instanceof byte[]) { identities.add(getIdentifyFromBytes((byte[]) objects[1])); } else if (objects[1] instanceof String) { identities.add((String) objects[1]); } } catch (Exception e) { return; } } } }
Source:
<code>public Chat( final Messengers messengers, final String chatName, final ChatSoundProfile chatSoundProfile) { this.localPlayerName = messengers.getLocalNode().getPlayerName(); this.serverPlayerName = messengers.getServerNode().getPlayerName(); chatTransmitter = new JavaSocketChatTransmitter(this, chatName, messengers); this.chatSoundProfile = chatSoundProfile; sentMessagesHistory = new SentMessagesHistory(); <START> chatters = Optional.ofNullable(chatTransmitter.connect()).orElse(new HashMap<>()); <END> updateConnections(); }</code><technical_language>suggestion chatters = Optional.ofNullable(chatTransmitter.connect()).orElseGet(HashMap::new);</technical_language>

Target:
public Chat( final Messengers messengers, final String chatName, final ChatSoundProfile chatSoundProfile) { this.localPlayerName = messengers.getLocalNode().getPlayerName(); this.serverPlayerName = messengers.getServerNode().getPlayerName(); chatTransmitter = new JavaSocketChatTransmitter(this, chatName, messengers); this.chatSoundProfile = chatSoundProfile; sentMessagesHistory = new SentMessagesHistory(); chatters = Optional.ofNullable(chatTransmitter.connect()).orElseGet(HashMap::new); updateConnections(); }
Source:
<code>public void swipeFromCenterToDirection(String direction, int pixelPath, int duration, int waitAfter){ int centerX = appNativeWidth / 2; int centerY = (appNativeHeight / 2) + taskbarNativeHeight; int path = 0; <START> if (mobileDriver.getContext() != "NATIVE_APP") { <END> mobileDriver.context("NATIVE_APP"); } switch (direction) { case "left": if (pixelPath < centerX) { path = pixelPath; } else { path = centerX - 2; } try { mobileDriver.swipe(centerX, centerY, centerX - path, centerY, duration); } catch (Exception e) break; case "right": if (pixelPath < centerX) { path = pixelPath; } else { path = centerX - 2; } try { mobileDriver.swipe(centerX, centerY, centerX + path, centerY, duration); } catch (Exception e) break; case "up": if (pixelPath < centerY) { path = pixelPath; } else { path = centerY - 2; } try { mobileDriver.swipe(centerX, centerY, centerX, centerY - path, duration); } catch (Exception e) break; case "down": if (pixelPath < centerY) { path = pixelPath; } else { path = centerY - 2; } try { mobileDriver.swipe(centerX, centerY, centerX, centerY + path, duration); } catch (Exception e) break; default: break; } try { Thread.sleep(waitAfter); } catch (Exception e) if (mobileDriver.getContext() != "WEBVIEW_1") { mobileDriver.context("WEBVIEW_1"); } }</code><technical_language>if a String comparison, needs .equals() Right now, this comparison hold true trigger next statement</technical_language>

Target:
public void swipeFromCenterToDirection(String direction, int pixelPath, int duration, int waitAfter){ String methodName = "swipeFromCenterToDirection"; int centerX = appNativeWidth / 2; int centerY = (appNativeHeight / 2) + taskbarNativeHeight; int path = 0; switchToContext(CONTEXT_NATIVE_APP, methodName); switch (direction) { case "left": if (pixelPath < centerX) { path = pixelPath; } else { path = centerX - 2; } mobileDriver.swipe(centerX, centerY, centerX - path, centerY, duration); break; case "right": if (pixelPath < centerX) { path = pixelPath; } else { path = centerX - 2; } mobileDriver.swipe(centerX, centerY, centerX + path, centerY, duration); break; case "up": if (pixelPath < centerY) { path = pixelPath; } else { path = centerY - 2; } mobileDriver.swipe(centerX, centerY, centerX, centerY - path, duration); break; case "down": if (pixelPath < centerY) { path = pixelPath; } else { path = centerY - 2; } mobileDriver.swipe(centerX, centerY, centerX, centerY + path, duration); break; default: break; } waitForFinish(waitAfter, methodName); switchToContext(CONTEXT_WEBVIEW_1, methodName); }
Source:
<code>protected <K, V> AdvancedCache<K, V> getCacheFromPreferredPartition(AdvancedCache... caches) { Map<Address, CacheStatusResponse> statusResponses = Arrays.stream(caches).map(c -> new KeyValuePair<>(address(c), getCacheStatus(c))) <START> .collect(Collectors.toMap(KeyValuePair::getKey, KeyValuePair::getValue)); <END> LostDataCheck lostDataCheck = cacheMode.isScattered() ? ClusterTopologyManagerImpl::scatteredLostDataCheck : ClusterTopologyManagerImpl::distLostDataCheck; CacheTopology preferredTopology = new PreferAvailabilityStrategy(null, null, lostDataCheck) .computePreferredTopology(statusResponses); if (trace) log.tracef("getCacheFromPreferredPartition: partition=%s", preferredTopology.getMembers()); return Arrays.stream(caches) .filter(c -> address(c).equals(preferredTopology.getMembers().get(0))) .findFirst().get(); }</code><technical_language>just: Arrays.stream(caches).collect(Collectors.toMap(this::address, this::getCacheStatus));</technical_language>

Target:
protected <K, V> AdvancedCache<K, V> getCacheFromPreferredPartition(AdvancedCache... caches) { Map<Address, CacheStatusResponse> statusResponses = Arrays.stream(caches).collect(Collectors.toMap(this::address, this::getCacheStatus)); LostDataCheck lostDataCheck = cacheMode.isScattered() ? ClusterTopologyManagerImpl::scatteredLostDataCheck : ClusterTopologyManagerImpl::distLostDataCheck; CacheTopology preferredTopology = new PreferAvailabilityStrategy(null, null, lostDataCheck) .computePreferredTopology(statusResponses); if (trace) log.tracef("getCacheFromPreferredPartition: partition=%s", preferredTopology.getMembers()); return Arrays.stream(caches) .filter(c -> address(c).equals(preferredTopology.getMembers().get(0))) .findFirst().get(); }
Source:
<code>private String getHumanReadableAttribute(String attr) { int periodIndex = attr.lastIndexOf('.'); if (periodIndex != -1) { <START> attr = attr.substring(periodIndex + 1, attr.length()); <END> } attr = attr.replaceAll("-", " "); return WordUtils.capitalizeFully(attr); }</code><technical_language>attr.length() do here, remove it</technical_language>

Target:
private String getHumanReadableAttribute(String attr) { String readableAttr = attr; int periodIndex = readableAttr.lastIndexOf('.'); if (periodIndex != -1) { readableAttr = attr.substring(periodIndex + 1); } readableAttr = readableAttr.replaceAll("-", " "); return WordUtils.capitalizeFully(readableAttr); }
Source:
<code>public static ResteasyProviderFactory newInstance() { try { return (ResteasyProviderFactory) Thread.currentThread().getContextClassLoader() <START> .loadClass("org.jboss.resteasy.core.providerfactory.ResteasyProviderFactoryImpl").newInstance(); <END> } catch (InstantiationException | IllegalAccessException | ClassNotFoundException e) { throw new RuntimeException(e); } }</code><technical_language>change deprecated (since java 9) call .newInstance() .getDeclaredConstructor().newInstance() (and extend catch clause)</technical_language>

Target:
public static ResteasyProviderFactory newInstance() { try { return (ResteasyProviderFactory) Thread.currentThread().getContextClassLoader() .loadClass("org.jboss.resteasy.core.providerfactory.ResteasyProviderFactoryImpl").getDeclaredConstructor().newInstance(); } catch (Exception e) { throw new RuntimeException(e); } }
Source:
<code>public ComponentController(T component, Intent intent) { this(component); <START> if (intent != null) { <END> Parcel obtain = Parcel.obtain(); obtain.writeParcelable(intent, 0); obtain.setDataPosition(0); intent = obtain.readParcelable(Intent.class.getClassLoader()); obtain.recycle(); } this.intent = intent; }</code><technical_language>extract this a function call ActivityController.onNewIntent</technical_language>

Target:
public ComponentController(T component, Intent intent) { this(component); this.intent = parcelIntent(intent); }
Source:
<code>public void run() { <START> String currentThreadName = Thread.currentThread().getName(); <END> Thread.currentThread().setName(ThreadUtil.updateThreadPoolName(currentThreadName, name)); long start = Clock.currentTimeMillis(); if (statisticsEnabled) { startExecution(name, start - creationTime); } Object result = null; try { super.run(); if (!isCancelled()) { result = get(); } } catch (Exception e) { logException(e); result = e; } finally { if (uuid != null) { submittedTasks.remove(uuid); } if (!isCancelled()) { sendResponse(result); if (statisticsEnabled) { finishExecution(name, Clock.currentTimeMillis() - start); } } Thread.currentThread().setName(currentThreadName); } }</code><technical_language>change correct, I if more broad though, ie. for other Executor services advantage of it. For example, ScheduledExecutor & DurableExecutor core logic, delegating Cached Executors ExecutionServiceImpl thus, issue IExecutorService. this logic in ThreadFactory in there, complicated</technical_language>

Target:
public void run() { long start = Clock.currentTimeMillis(); if (statisticsEnabled) { startExecution(name, start - creationTime); } Object result = null; try { super.run(); if (!isCancelled()) { result = get(); } } catch (Exception e) { logException(e); result = e; } finally { if (uuid != null) { submittedTasks.remove(uuid); } if (!isCancelled()) { sendResponse(result); if (statisticsEnabled) { finishExecution(name, Clock.currentTimeMillis() - start); } } } }
Source:
<code><START> private org.eclipse.equinox.p2.repository.spi.RepositoryReference toSpiRepositoryReference(RepositoryReference rr) { <END> return new org.eclipse.equinox.p2.repository.spi.RepositoryReference(URI.create(rr.getLocation()), rr.getName(), IRepository.TYPE_METADATA, rr.isEnable() ? IRepository.ENABLED : IRepository.NONE); }</code><technical_language>static</technical_language>

Target:
private static org.eclipse.equinox.p2.repository.spi.RepositoryReference toSpiRepositoryReference( RepositoryReference rr) { return new org.eclipse.equinox.p2.repository.spi.RepositoryReference(URI.create(rr.getLocation()), rr.getName(), IRepository.TYPE_METADATA, rr.isEnable() ? IRepository.ENABLED : IRepository.NONE); }
Source:
<code>public void setRequestTarget(String target) { <START> if (target.length() > 255) <END> throw new IllegalArgumentException(ERROR_TARGET_ILLEGAL); this.target = target; }</code><technical_language>Check target is null</technical_language>

Target:
public void setRequestTarget(String target) { if (target != null && target.length() > 255) throw new IllegalArgumentException(ERROR_TARGET_ILLEGAL); this.target = target; }
Source:
<code>public void afterRun() throws Exception { <START> long elapsed = Math.max(0, Timer.nanosElapsed(startTimeNanos)); <END> MultiMapService service = getService(); service.getLocalMultiMapStatsImpl(name).incrementPutLatencyNanos(elapsed); if (Boolean.TRUE.equals(response)) { publishEvent(EntryEventType.ADDED, dataKey, value, null); } }</code><technical_language>elapsedNanos</technical_language>

Target:
public void afterRun() throws Exception { long elapsedNanos = Math.max(0, Timer.nanosElapsed(startTimeNanos)); MultiMapService service = getService(); service.getLocalMultiMapStatsImpl(name).incrementPutLatencyNanos(elapsedNanos); if (Boolean.TRUE.equals(response)) { publishEvent(EntryEventType.ADDED, dataKey, value, null); } }