auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public void registerBeansForRoot(BeanDefinitionRegistry registry, RepositoryConfigurationSource config) { super.registerBeansForRoot(registry, config); Object source = config.getSource(); <START> this.sessionBeanName = registerWithSuggestedNameOrGenerateNewName(createSharedSessionCreatorBeanDefinition(config), <END> registry, DEFAULT_SESSION_BEAN_NAME, source); this.neo4jMappingContextBeanName = registerWithSuggestedNameOrGenerateNewName( createNeo4jMappingContextFactoryBeanDefinition(config), registry, DEFAULT_NEO4J_MAPPING_CONTEXT_BEAN_NAME, source); registerIfNotAlreadyRegistered(new RootBeanDefinition(Neo4jPersistenceExceptionTranslator.class), registry, NEO4J_PERSISTENCE_EXCEPTION_TRANSLATOR_NAME, source); if (HAS_ENTITY_INSTANTIATOR_FEATURE) { AbstractBeanDefinition rootBeanDefinition = BeanDefinitionBuilder .rootBeanDefinition(Neo4jOgmEntityInstantiatorConfigurationBean.class) .setAutowireMode(AbstractBeanDefinition.AUTOWIRE_BY_TYPE) .addConstructorArgReference(this.getSessionFactoryBeanName(config)) .addConstructorArgReference(this.neo4jMappingContextBeanName) .getBeanDefinition(); registerIfNotAlreadyRegistered(rootBeanDefinition, registry, ENTITY_INSTANTIATOR_CONFIGURATION_BEAN_NAME, source); } }</code><technical_language>Bean registration generated names provided ones, for mapping context. Mixing behavior confusing</technical_language>

Target:
public void registerBeansForRoot(BeanDefinitionRegistry registry, RepositoryConfigurationSource config) { super.registerBeansForRoot(registry, config); Object source = config.getSource(); String configuredSessionBeanName = Optional.of("sessionBeanName").flatMap(config::getAttribute) .orElse(GENERATE_BEAN_NAME); this.sessionBeanName = registerWithGeneratedNameOrUseConfigured(createSharedSessionCreatorBeanDefinition(config), registry, configuredSessionBeanName, source); String configuredMappingContextBeanName = Optional.of("mappingContextBeanName").flatMap(config::getAttribute) .orElse(GENERATE_BEAN_NAME); this.neo4jMappingContextBeanName = registerWithGeneratedNameOrUseConfigured( createNeo4jMappingContextFactoryBeanDefinition(config), registry, configuredMappingContextBeanName, source); registerIfNotAlreadyRegistered(new RootBeanDefinition(Neo4jPersistenceExceptionTranslator.class), registry, NEO4J_PERSISTENCE_EXCEPTION_TRANSLATOR_NAME, source); if (HAS_ENTITY_INSTANTIATOR_FEATURE) { AbstractBeanDefinition rootBeanDefinition = BeanDefinitionBuilder .rootBeanDefinition(Neo4jOgmEntityInstantiatorConfigurationBean.class) .setAutowireMode(AbstractBeanDefinition.AUTOWIRE_BY_TYPE) .addConstructorArgReference(getSessionFactoryBeanName(config)) .addConstructorArgReference(this.neo4jMappingContextBeanName).getBeanDefinition(); registerIfNotAlreadyRegistered(rootBeanDefinition, registry, ENTITY_INSTANTIATOR_CONFIGURATION_BEAN_NAME, source); } }
Source:
<code>public void testSetDutyCycleConnectionClosed() { Mockito.when(mockedPort.isOpen()).thenReturn(false); try { <START> xbeeDevice.setPWMDutyCycle(IOLine.DIO10_PWM0, 75); <END> fail("Duty cycle shouldn't have been set."); } catch (InvalidOperatingModeException e) { fail("This exception shouldn't be thrown now."); } catch (XBeeException e) { assertEquals(XBeeException.CONNECTION_NOT_OPEN, e.getErrorCode()); } }</code><technical_language>Extract 75 a constant, is in more places</technical_language>

Target:
public void testSetDutyCycleConnectionClosed() throws InvalidOperatingModeException, XBeeException { Mockito.when(mockedPort.isOpen()).thenReturn(false); xbeeDevice.setPWMDutyCycle(IOLine.DIO10_PWM0, DUTY_CYCLE_VALID_VALUE); }
Source:
<code>private void configurationElement(XNode context) { try { String namespace = context.getStringAttribute("namespace"); if (namespace == null || namespace.equals("")) { throw new BuilderException("Mapper's namespace cannot be empty"); } builderAssistant.setCurrentNamespace(namespace); cacheRefElement(context.evalNode("cache-ref")); cacheElement(context.evalNode("cache")); parameterMapElement(context.evalNodes("/mapper/parameterMap")); resultMapElements(context.evalNodes("/mapper/resultMap")); sqlElement(context.evalNodes("/mapper/sql")); buildStatementFromContext(context.evalNodes("select|insert|update|delete")); } catch (Exception e) { <START> throw new BuilderException("Error parsing Mapper XML." + ErrorContext.instance() + " Cause: " + e, e); <END> } }</code><technical_language>ErrorContext. mapper file location is in this.resource, please build message</technical_language>

Target:
private void configurationElement(XNode context) { try { String namespace = context.getStringAttribute("namespace"); if (namespace == null || namespace.equals("")) { throw new BuilderException("Mapper's namespace cannot be empty"); } builderAssistant.setCurrentNamespace(namespace); cacheRefElement(context.evalNode("cache-ref")); cacheElement(context.evalNode("cache")); parameterMapElement(context.evalNodes("/mapper/parameterMap")); resultMapElements(context.evalNodes("/mapper/resultMap")); sqlElement(context.evalNodes("/mapper/sql")); buildStatementFromContext(context.evalNodes("select|insert|update|delete")); } catch (Exception e) { throw new BuilderException("Error parsing Mapper XML.The XML location is " + resource + " Cause: " + e, e); } }
Source:
<code>private StoreFindToken(Type type, Offset offset, StoreKey key, UUID sessionId, UUID incarnationId, boolean inclusive, short version) { <START> if (version != VERSION_0 && version != VERSION_1 && version != VERSION_2) { <END> throw new IllegalArgumentException("Unsupported version " + version + " for StoreFindToken "); } if (!type.equals(Type.Uninitialized)) { if (offset == null || sessionId == null) { throw new IllegalArgumentException("Offset [" + offset + "] or SessionId [" + sessionId + "] cannot be null"); } else if (type.equals(Type.IndexBased) && key == null) { throw new IllegalArgumentException("StoreKey cannot be null for an index based token"); } } this.type = type; this.offset = offset; this.storeKey = key; this.sessionId = sessionId; this.inclusive = inclusive ? (byte) 1 : 0; this.incarnationId = incarnationId; this.bytesRead = -1; this.version = version; }</code><technical_language>this is a private constructor - this situation happen? constructing constructors, version is current version default. deserializing, a wrong version failed deserialization</technical_language>

Target:
private StoreFindToken(Type type, Offset offset, StoreKey key, UUID sessionId, UUID incarnationId, boolean inclusive, short version) { if (!type.equals(Type.Uninitialized)) { if (offset == null || sessionId == null) { throw new IllegalArgumentException("Offset [" + offset + "] or SessionId [" + sessionId + "] cannot be null"); } else if (type.equals(Type.IndexBased) && key == null) { throw new IllegalArgumentException("StoreKey cannot be null for an index based token"); } if (version == VERSION_2 && incarnationId == null) { throw new IllegalArgumentException("IncarnationId cannot be null for StoreFindToken of version 2"); } } this.type = type; this.offset = offset; this.storeKey = key; this.sessionId = sessionId; this.inclusive = inclusive ? (byte) 1 : 0; this.incarnationId = incarnationId; this.bytesRead = -1; this.version = version; }
Source:
<code>private boolean matchDefinition(Definition definition, InetAddress inetAddress, String location) { String locationFromDefinition = definition.getLocation(); <START> if(DEFAULT_LOCATION.equals(location)) { <END> location = null; } if(DEFAULT_LOCATION.equals(definition.getLocation())) { locationFromDefinition = null; } boolean locationMatched = Objects.equals(location, locationFromDefinition); if(locationMatched) { return matchingIpAddress(inetAddress, definition); } return false; }</code><technical_language>LocationUtils here</technical_language>

Target:
private boolean matchDefinition(Definition definition, InetAddress inetAddress, String location) { boolean locationMatched = LocationUtils.doesLocationsMatch(location, definition.getLocation()); return locationMatched && matchingIpAddress(inetAddress, definition); }
Source:
<code>public void queueNextChildren2D(IntegerRangeCondition quarks, TimeRangeCondition times, Deque<Integer> queue, boolean reverse) { rwl.readLock().lock(); try { Deque<Integer> toAdd = new <START> LinkedList<>(); <END> for (int child = 0; child < fNbChildren; child++) { if (times.intersects(fChildStart[child], fChildEnd[child]) && quarks.intersects(fChildMin[child], fChildMax[child])) { int potentialNextSeqNb = fChildren[child]; if (!reverse) { toAdd.addFirst(potentialNextSeqNb); } else { toAdd.add(potentialNextSeqNb); } } } for (Integer seqNum : toAdd) { queue.addFirst(seqNum); } } finally { rwl.readLock().unlock(); } }</code><technical_language>ArrayDeque faster. Please confirm</technical_language>

Target:
public void queueNextChildren2D(IntegerRangeCondition quarks, TimeRangeCondition times, Deque<Integer> queue, boolean reverse) { rwl.readLock().lock(); try { Deque<Integer> toAdd = new ArrayDeque<>(); for (int child = 0; child < fNbChildren; child++) { if (times.intersects(fChildStart[child], fChildEnd[child]) && quarks.intersects(fChildMin[child], fChildMax[child])) { int potentialNextSeqNb = fChildren[child]; if (!reverse) { toAdd.addFirst(potentialNextSeqNb); } else { toAdd.add(potentialNextSeqNb); } } } for (Integer seqNum : toAdd) { queue.addFirst(seqNum); } } finally { rwl.readLock().unlock(); } }
Source:
<code>public void afterCommit( TransactionData data, Object state ) { try { for ( WritableFulltext nodeIndex : fulltextProvider.writableNodeIndices() ) { Map<Long,Map<String,Object>> nodeMap = ((Map<Long,Map<String,Object>>[]) state)[0]; removePropertyData( data.removedNodeProperties(), nodeMap, nodeIndex ); updatePropertyData( nodeMap, nodeIndex ); refreshIndex( nodeIndex ); } for ( WritableFulltext relationshipIndex : fulltextProvider.writableRelationshipIndices() ) { Map<Long,Map<String,Object>> relationshipMap = ((Map<Long,Map<String,Object>>[]) state)[1]; removePropertyData( data.removedRelationshipProperties(), relationshipMap, relationshipIndex ); updatePropertyData( relationshipMap, relationshipIndex ); refreshIndex( relationshipIndex ); } } catch ( IOException e ) { <START> throw new RuntimeException( "Unable to update fulltext index", e ); <END> } }</code><technical_language>exception helpful tx committed this point, while get exception transaction super confusing</technical_language>

Target:
public void afterCommit( TransactionData data, Object state ) { try { for ( WritableFulltext nodeIndex : fulltextProvider.writableNodeIndices() ) { Map<Long,Map<String,Object>> nodeMap = ((Map<Long,Map<String,Object>>[]) state)[0]; removePropertyData( data.removedNodeProperties(), nodeMap, nodeIndex ); updatePropertyData( nodeMap, nodeIndex ); refreshIndex( nodeIndex ); } for ( WritableFulltext relationshipIndex : fulltextProvider.writableRelationshipIndices() ) { Map<Long,Map<String,Object>> relationshipMap = ((Map<Long,Map<String,Object>>[]) state)[1]; removePropertyData( data.removedRelationshipProperties(), relationshipMap, relationshipIndex ); updatePropertyData( relationshipMap, relationshipIndex ); refreshIndex( relationshipIndex ); } } catch ( IOException e ) { log.error( "Unable to update fulltext index", e ); } }
Source:
<code>public void refresh(Node node) { checkNotNull(node, NULL_NODE_MSG); if (!isOrWasAttached()) { return; } NodeDescriptor nodeDescriptor = getNodeDescriptor(node); if (nodeDescriptor == null || view.getRootContainer(nodeDescriptor) == null) { return; } <START> if (!(node instanceof HasNewPresentation || node instanceof HasPresentation)) { <END> return; } if (node instanceof HasPresentation) { ((HasPresentation) node).getPresentation(true); } else { ((HasNewPresentation) node).getPresentation(); } Element el = getPresentationRenderer() .render( node, nodeDescriptor.getDomId(), getJoint(node), nodeStorage.getDepth(node) - 1); view.onElementChanged(nodeDescriptor, el); }</code><technical_language>Remove this if block. move check for instance HasNewPresentation if</technical_language>

Target:
public void refresh(Node node) { checkNotNull(node, NULL_NODE_MSG); if (!isOrWasAttached()) { return; } NodeDescriptor nodeDescriptor = getNodeDescriptor(node); if (nodeDescriptor == null || view.getRootContainer(nodeDescriptor) == null) { return; } if (node instanceof HasPresentation) { ((HasPresentation) node).getPresentation(true); } else if (node instanceof HasNewPresentation) { ((HasNewPresentation) node).getPresentation(); } Element el = getPresentationRenderer() .render( node, nodeDescriptor.getDomId(), getJoint(node), nodeStorage.getDepth(node) - 1); view.onElementChanged(nodeDescriptor, el); }
Source:
<code>public void testAnycastQueueToMulticastTopicBothAddress() throws Exception { String address = "testBoth"; File file = createMessageFile(); int noMessages = 10; Session session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE); connection.start(); createBothTypeAddress(address); List<Message> messages = new ArrayList<>(noMessages); for (int i = 0; i < noMessages; i++) { messages.add(session.createTextMessage(RandomUtil.randomString())); } sendMessages(session, getDestination(address), messages); exportMessages(address, noMessages, file); <START> Thread receive = new Thread(() -> { <END> try { MessageConsumer consumer = session.createConsumer(getTopicDestination(address)); assertNotNull(consumer.receive(3000)); } catch (Exception e) { e.printStackTrace(); } }); receive.start(); TimeUnit.SECONDS.sleep(1); importMessages("topic://" + address, file); receive.join(); }</code><technical_language>need threads this test.. a sequential run</technical_language>

Target:
public void testAnycastQueueToMulticastTopicBothAddress() throws Exception { String address = "testBoth"; String clientId = "test-client-id"; File file = createMessageFile(); connection.setClientID(clientId); createBothTypeAddress(address); createQueue("--anycast", address, address); Session session = createSession(connection); TopicSubscriber subscriber = session.createDurableSubscriber(session.createTopic(address), "test-subscriber"); List<Message> messages = generateTextMessages(session, address); exportMessages(address, file); importMessages("topic://" + address, file); for (int i = 0; i < TEST_MESSAGE_COUNT; i++) { TextMessage messageReceived = (TextMessage) subscriber.receive(1000); assertEquals(((TextMessage) messages.get(i)).getText(), messageReceived.getText()); } }
Source:
<code><START> protected void <END> auditLog(AuditLogableBase logable, AuditLogType logType) { auditLogDirector.log(logable, logType); }</code><technical_language>related</technical_language>

Target:
void auditLog(AuditLogableBase logable, AuditLogType logType) { auditLogDirector.log(logable, logType); }
Source:
<code>static HttpPasswordInput create() { <START> return (HttpPasswordInput) createObject(); <END> }</code><technical_language>return createObject().cast(); removes need cast. :-)</technical_language>

Target:
static HttpPasswordInput create() { return createObject().cast(); }
Source:
<code>public void onCorruptResponse(ReplicaId replicaId) { corruptRequests.add(replicaId); <START> failedRequests.add(replicaId); <END> onReplicaResponse(replicaId); }</code><technical_language>this base. is this copied</technical_language>

Target:
public void onCorruptResponse(ReplicaId replicaId) { super.onCorruptResponse(replicaId); onReplicaResponse(replicaId); }
Source:
<code>public void handleRequest(RestRequestInfo restRequestInfo) throws RestServiceException { logger.debug("Handling RestRequestInfo - {}", restRequestInfo); if (isRunning()) { if (restRequestInfo == null) { <START> logger.error("RestRequestInfo received is null. Throwing exception"); <END> restServerMetrics.asyncRequestHandlerRestRequestInfoNull.inc(); throw new RestServiceException("RestRequestInfo is null", RestServiceErrorCode.RestRequestInfoNull); } else if (restRequestInfo.getRestRequestMetadata() == null) { logger.error("RestRequestMetadata is null in received RestRequestInfo. Throwing exception"); restServerMetrics.asyncRequestHandlerRestRequestMetadataNull.inc(); throw new RestServiceException("RestRequestInfo missing RestRequestMetadata", RestServiceErrorCode.RequestMetadataNull); } else if (restRequestInfo.getRestResponseHandler() == null) { logger.error("RestResponseHandler is null in received RestRequestInfo. Throwing exception"); restServerMetrics.asyncRequestHandlerRestResponseHandlerNull.inc(); throw new RestServiceException("RestRequestInfo missing RestResponseHandler", RestServiceErrorCode.ReponseHandlerNull); } queue(restRequestInfo); } else { logger.error("DequeuedRequestHandler thread is not alive for handling requests. Throwing exception"); restServerMetrics.asyncRequestHandlerUnavailable.inc(); throw new RestServiceException("Requests cannot be handled because the AsyncRequestHandler is not available", RestServiceErrorCode.RequestHandlerUnavailable); } }</code><technical_language>point in "Throwing exception". exception right this</technical_language>

Target:
public void handleRequest(RestRequestInfo restRequestInfo) throws RestServiceException { if (isRunning()) { if (restRequestInfo == null) { restServerMetrics.asyncRequestHandlerRestRequestInfoNullError.inc(); throw new RestServiceException("RestRequestInfo received is null", RestServiceErrorCode.RestRequestInfoNull); } else if (restRequestInfo.getRestRequestMetadata() == null) { restServerMetrics.asyncRequestHandlerRestRequestMetadataNullError.inc(); throw new RestServiceException("RestRequestMetadata is null in received RestRequestInfo", RestServiceErrorCode.RequestMetadataNull); } else if (restRequestInfo.getRestResponseHandler() == null) { restServerMetrics.asyncRequestHandlerRestResponseHandlerNullError.inc(); throw new RestServiceException("RestResponseHandler is null in received RestRequestInfo", RestServiceErrorCode.ResponseHandlerNull); } queueRequest(restRequestInfo); } else { restServerMetrics.asyncRequestHandlerUnavailableError.inc(); throw new RestServiceException("Requests cannot be handled because the AsyncRequestHandler is not available", RestServiceErrorCode.RequestHandlerUnavailable); } }
Source:
<code><START> public static boolean isTypeDef(DetailAST node) { <END> return node.getType() == TokenTypes.CLASS_DEF || node.getType() == TokenTypes.ENUM_DEF || node.getType() == TokenTypes.INTERFACE_DEF; }</code><technical_language>public</technical_language>

Target:
private static boolean isTypeDef(DetailAST node) { return node.getType() == TokenTypes.CLASS_DEF || node.getType() == TokenTypes.ENUM_DEF || node.getType() == TokenTypes.INTERFACE_DEF; }
Source:
<code>private void rescheduleFindCoordinatorTask(ConsumerGroupOperationContext<?, ?> context, Supplier<Call> nextCall) { log.info("Node is no longer the Coordinator. Retrying with new coordinator.", context.node().orElse(null)); <START> context.node(null); <END> Call findCoordinatorCall = getFindCoordinatorCall(context, nextCall); runnable.call(findCoordinatorCall, time.milliseconds()); }</code><technical_language>nit: in spite of getter convention, I prefer setters prefixed set</technical_language>

Target:
private void rescheduleFindCoordinatorTask(ConsumerGroupOperationContext<?, ?> context, Supplier<Call> nextCall) { log.info("Node is no longer the Coordinator. Retrying with new coordinator.", context.node().orElse(null)); context.setNode(null); Call findCoordinatorCall = getFindCoordinatorCall(context, nextCall); runnable.call(findCoordinatorCall, time.milliseconds()); }
Source:
<code>private boolean compareEq(Object l, Object r) { if (l instanceof String && r instanceof String) { return l.equals(r); } if (l instanceof Boolean && r instanceof Boolean) { return l == r; } return l instanceof Number && r instanceof Number && !(l instanceof Float || r instanceof Float) && <START> ((Number) l).longValue() == ((Number) r).longValue(); <END> }</code><technical_language>this compare 1.0 1.1 equal. I this needs making protected some tests written</technical_language>

Target:
protected static boolean compareEq(Object l, Object r) { if (l instanceof String && r instanceof String) { return l.equals(r); } if (l instanceof Boolean && r instanceof Boolean) { return l == r; } return l instanceof Number && r instanceof Number && !(l instanceof Float || r instanceof Float) && ((Number) l).doubleValue() == ((Number) r).doubleValue(); }
Source:
<code>public final RayTraceResult collisionRayTrace(IBlockState state, World world, BlockPos pos, Vec3d start, Vec3d end) { IMicroblockContainerTile tile = getMicroblockTile(world, pos); RayTraceResult result = tile != null ? tile.getMicroblockContainer().getPartContainer().collisionRayTrace(start, end) : null; RayTraceResult hit = collisionRayTraceDefault(state, world, pos, start, end); if (result == null || (hit != null && hit.hitVec.squareDistanceTo(start) < result.hitVec.squareDistanceTo(start))) { bounds = getSelectedBoundingBoxDefault(state, world, pos).offset(-pos.getX(), -pos.getY(), -pos.getZ()); return hit; } bounds = result.boxHit; <START> return result; <END> }</code><technical_language>instance variable in a block... eww..</technical_language>

Target:
public final RayTraceResult collisionRayTrace(IBlockState state, World world, BlockPos pos, Vec3d start, Vec3d end) { IMicroblockContainerTile tile = getMicroblockTile(world, pos); RayTraceResult tileRaytrace = null; if (tile != null) { tileRaytrace = tile.getMicroblockContainer().getPartContainer().collisionRayTrace(start, end); } RayTraceResult defaultRaytrace = collisionRayTraceDefault(state, world, pos, start, end); if (tileRaytrace == null || (defaultRaytrace != null && defaultRaytrace.hitVec.squareDistanceTo(start) < tileRaytrace.hitVec.squareDistanceTo(start))) { return defaultRaytrace; } return tileRaytrace; }
Source:
<code>EvidenceVerifier toEvidenceVerifier() { return new EvidenceVerifier() { @Override public SupportLevel getEvidenceVerifySupport(final DirContextFactory contextFactory, final Class<? extends Evidence> evidenceType, final String algorithmName) throws RealmUnavailableException { <START> return getCredentialAcquireSupport(contextFactory, PasswordCredential.class, algorithmName); <END> } @Override public IdentityEvidenceVerifier forIdentity(DirContextFactory contextFactory, String distinguishedName) throws RealmUnavailableException { return new ForIdentityLoader(contextFactory, distinguishedName); } }; }</code><technical_language>This bit of code needs treatment lines 120-122 I think. If evidence type is PasswordGuessEvidence, return result of getCredentialAcquireSupport for algorithm (pass in null for argument)</technical_language>

Target:
EvidenceVerifier toEvidenceVerifier() { return new EvidenceVerifier() { @Override public SupportLevel getEvidenceVerifySupport(final DirContextFactory contextFactory, final Class<? extends Evidence> evidenceType, final String evidenceAlgorithm) throws RealmUnavailableException { if ( ! PasswordCredential.canVerifyEvidence(evidenceType, evidenceAlgorithm)) return SupportLevel.UNSUPPORTED; return getCredentialAcquireSupport(contextFactory, PasswordCredential.class, evidenceAlgorithm); } @Override public IdentityEvidenceVerifier forIdentity(DirContextFactory contextFactory, String distinguishedName) throws RealmUnavailableException { return new ForIdentityLoader(contextFactory, distinguishedName); } }; }
Source:
<code>public RuntimeInfo getRuntimeInfo(ExecutionEngine engine, ComponentProperties properties, ConnectorTopology connectorTopology) { assertEngineCompatibility(engine); <START> if (connectorTopology != ConnectorTopology.NONE) { <END> assertConnectorTopologyCompatibility(connectorTopology); } return getCommonRuntimeInfo(this.getClass().getClassLoader(), RUNTIME_SOURCE_CLASS); }</code><technical_language>ConnectorTopology.NONE is of supported connectors of this component. i understand this filter here</technical_language>

Target:
public RuntimeInfo getRuntimeInfo(ExecutionEngine engine, ComponentProperties properties, ConnectorTopology connectorTopology) { assertEngineCompatibility(engine); assertConnectorTopologyCompatibility(connectorTopology); return getCommonRuntimeInfo(this.getClass().getClassLoader(), RUNTIME_SOURCE_CLASS); }
Source:
<code>public Contentlet findContentletByIdentifier ( String identifier ) throws DotSecurityException, DotDataException { User user = APILocator.getUserAPI().getSystemUser(); Identifier contentletIdentifier = APILocator.getIdentifierAPI().find( identifier ); if ( contentletIdentifier == null ) { throw new DotContentletStateException( "Unable to find Contentle with Identifier [" + identifier + "]" ); } Language defaultLanguage = APILocator.getLanguageAPI().getDefaultLanguage(); Contentlet foundContentlet = null; List<Contentlet> allLanguages = APILocator.getContentletAPI().search( "+identifier:" + identifier, 0, 0, "moddate", user, false ); <START> if(allLanguages.size()>0) { <END> for (Contentlet contentlet : allLanguages) { if (contentlet.getLanguageId() == defaultLanguage.getId()) { foundContentlet = contentlet; } } if (foundContentlet == null) { foundContentlet = allLanguages.get(0); } } return foundContentlet; }</code><technical_language>UtilsMethod a is set for collections</technical_language>

Target:
public Contentlet findContentletByIdentifier ( String identifier ) throws DotSecurityException, DotDataException { User user = APILocator.getUserAPI().getSystemUser(); Identifier contentletIdentifier = APILocator.getIdentifierAPI().find( identifier ); if ( contentletIdentifier == null ) { throw new DotContentletStateException( "Unable to find Contentle with Identifier [" + identifier + "]" ); } Language defaultLanguage = APILocator.getLanguageAPI().getDefaultLanguage(); Contentlet foundContentlet = null; List<Contentlet> allLanguages = APILocator.getContentletAPI().search( "+identifier:" + identifier, 0, 0, "moddate", user, false ); if(!allLanguages.isEmpty()) { for (Contentlet contentlet : allLanguages) { if (contentlet.getLanguageId() == defaultLanguage.getId()) { foundContentlet = contentlet; } } if (foundContentlet == null) { foundContentlet = allLanguages.get(0); } } return foundContentlet; }
Source:
<code>public void referenceExpansionForDeletionByKey() throws Exception { final String key = randomKey(); <START> final Category parent = client().executeBlocking(CategoryCreateCommand.of(CategoryDraftBuilder.of(randomSlug(), randomSlug()).build())); <END> final Category category = client().executeBlocking(CategoryCreateCommand.of(CategoryDraftBuilder.of(randomSlug(), randomSlug()).key(key).parent(parent).build())); final CategoryDeleteCommand deleteCommand = CategoryDeleteCommand.ofKey(key, category.getVersion()).plusExpansionPaths(m -> m.parent()); final Category deletedCategory = client().executeBlocking(deleteCommand); assertThat(deletedCategory.getParent().getObj()).isNotNull().isEqualTo(parent); client().executeBlocking(CategoryDeleteCommand.of(parent)); }</code><technical_language>replacing randomSlug() call a new method SphereTestUtils.randomLocalizedString()</technical_language>

Target:
public void referenceExpansionForDeletionByKey() throws Exception { final String key = randomKey(); final Category parent = client().executeBlocking(CategoryCreateCommand.of(CategoryDraftBuilder.of(randomLocalizedString(), randomSlug()).build())); final Category category = client().executeBlocking(CategoryCreateCommand.of(CategoryDraftBuilder.of(randomLocalizedString(), randomSlug()).key(key).parent(parent).build())); final CategoryDeleteCommand deleteCommand = CategoryDeleteCommand.ofKey(key, category.getVersion()).plusExpansionPaths(m -> m.parent()); final Category deletedCategory = client().executeBlocking(deleteCommand); assertThat(deletedCategory.getParent().getObj()).isNotNull().isEqualTo(parent); client().executeBlocking(CategoryDeleteCommand.of(parent)); }
Source:
<code>private static void checkMap(String fieldName, Object mapObj, Class<?> valueType) { checkArgument(mapObj instanceof Map, "'%s' needs to be a JSON object. Found: %s", fieldName, getClassName(mapObj)); Map<?, ?> map = (Map<?, ?>)mapObj; <START> map.entrySet().forEach( entry -> { <END> checkArgument(valueType.isInstance(entry.getValue()), "Expected %s as value type, found %s, type: %s", valueType.getName(), entry.getValue(), getClassName(entry.getValue())); }); }</code><technical_language>Map.forEach() is simpler</technical_language>

Target:
private static void checkMap(String fieldName, Object mapObj, Class<?> valueType) { checkArgument(mapObj instanceof Map, "'%s' needs to be a JSON object. Found: %s", fieldName, getClassName(mapObj)); Map<?, ?> map = (Map<?, ?>)mapObj; map.forEach( (__, value) -> { checkArgument(valueType.isInstance(value), "Expected %s as value type, found %s, type: %s", valueType.getName(), value, getClassName(value)); }); }
Source:
<code><START> public String getReportTemplateHome() { <END> Path templatesPath = Paths.get(getGlobalProperty(RadiologyConstants.GP_MRRT_REPORT_TEMPLATE_DIR, true)); if (!templatesPath.isAbsolute()) { templatesPath = Paths.get(OpenmrsUtil.getApplicationDataDirectory(), templatesPath.toString()); } if (!templatesPath.toFile() .exists()) { templatesPath.toFile() .mkdirs(); } return templatesPath.toString(); }</code><technical_language>@ivange94 return a java File ? ensure exists GP_MRRT_REPORT_TEMPLATE_DIR is writable, return java file user of this method doesnt deal some of do here</technical_language>

Target:
public File getReportTemplateHome() { Path templatesPath = Paths.get(getGlobalProperty(RadiologyConstants.GP_MRRT_REPORT_TEMPLATE_DIR, true)); if (!templatesPath.isAbsolute()) { templatesPath = Paths.get(OpenmrsUtil.getApplicationDataDirectory(), templatesPath.toString()); } if (!templatesPath.toFile() .exists()) { templatesPath.toFile() .mkdirs(); } return templatesPath.toFile(); }
Source:
<code>private void walk(TypedVar symbol) { JSType type = symbol.getType(); if (!type.isInterface() && !isTypedef(type)) valueSymbolsWalked++; if (type.isFunctionType()) { FunctionType ftype = (FunctionType) type; boolean ordinaryFunctionAppearingAsClass = ftype.isConstructor() && "Function".equals(ftype.getDisplayName()); if (ftype.isOrdinaryFunction() || ordinaryFunctionAppearingAsClass) { maybeEmitJsDoc(symbol.getJSDocInfo(), false); emit("function"); emit(getUnqualifiedName(symbol)); visitFunctionDeclaration(ftype); emit(";"); emitBreak(); return; } maybeEmitJsDoc(symbol.getJSDocInfo(), true); if (!ftype.isNominalConstructor()) { visitVarDeclaration(symbol, ftype); return; } <START> if (symbol.getName().equals(ftype.getDisplayName())) { <END> visitClassOrInterface(getUnqualifiedName(symbol), ftype); } else { visitClassOrInterfaceAlias(getUnqualifiedName(symbol), ftype); } } else { maybeEmitJsDoc(symbol.getJSDocInfo(), false); if (type.isEnumType()) { visitEnumType(symbol.getName(), (EnumType) type); return; } if (isTypedef(type)) { if (isArrayLike(symbol)) { emitSkipTypeAlias(symbol); emitBreak(); return; } JSType registryType = typeRegistry.getType(symbol.getName()); if (registryType != null) { visitTypeAlias(registryType, getUnqualifiedName(symbol)); return; } } visitVarDeclaration(symbol, type); } }</code><technical_language>extract a method isAlias(symbol, ftype) code more readable</technical_language>

Target:
private void walk(TypedVar symbol) { JSType type = symbol.getType(); if (!type.isInterface() && !isTypedef(type)) valueSymbolsWalked++; if (type.isFunctionType()) { FunctionType ftype = (FunctionType) type; boolean ordinaryFunctionAppearingAsClass = ftype.isConstructor() && "Function".equals(ftype.getDisplayName()); if (ftype.isOrdinaryFunction() || ordinaryFunctionAppearingAsClass) { maybeEmitJsDoc(symbol.getJSDocInfo(), false); emit("function"); emit(getUnqualifiedName(symbol)); visitFunctionDeclaration(ftype); emit(";"); emitBreak(); return; } maybeEmitJsDoc(symbol.getJSDocInfo(), true); if (!ftype.isNominalConstructor()) { visitVarDeclaration(symbol, ftype); return; } if (isAliasedClassOrInterface(symbol, ftype)) { visitClassOrInterface(getUnqualifiedName(symbol), ftype); } else { visitClassOrInterfaceAlias(getUnqualifiedName(symbol), ftype); } } else { maybeEmitJsDoc(symbol.getJSDocInfo(), false); if (type.isEnumType()) { visitEnumType(symbol.getName(), (EnumType) type); return; } if (isTypedef(type)) { if (isArrayLike(symbol)) { emitSkipTypeAlias(symbol); emitBreak(); return; } JSType registryType = typeRegistry.getType(symbol.getName()); if (registryType != null) { visitTypeAlias(registryType, getUnqualifiedName(symbol)); return; } } visitVarDeclaration(symbol, type); } }
Source:
<code>LocalDateTime extractExpiryDate(Map<String, String> args, ZoneId effectiveTimeZone) { if (args.containsKey("se")) { val se = args.get("se"); <START> val formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd'T'HH:mm:ssX"); <END> val zdt = ZonedDateTime.parse(se, formatter); return zdt.withZoneSameInstant(ZoneId.systemDefault()).toLocalDateTime(); } else { log.error("Could not identify expected date parameters in request: {}", flattenMap(args)); throw new IllegalArgumentException( String.format("Could not parse presigned URL - missing expected expiry date parameters")); } }</code><technical_language>cache this in a field. useful expose later</technical_language>

Target:
LocalDateTime extractExpiryDate(Map<String, String> args, ZoneId effectiveTimeZone) { if (args.containsKey(QueryConstants.SIGNED_EXPIRY)) { val se = args.get(QueryConstants.SIGNED_EXPIRY); val zdt = ZonedDateTime.parse(se, formatter); return zdt.withZoneSameInstant(ZoneId.systemDefault()).toLocalDateTime(); } else { log.error("Could not identify expected date parameters in request: {}", flattenMap(args)); throw new IllegalArgumentException("Could not parse presigned URL - missing expected expiry date parameters"); } }
Source:
<code>public boolean onFling(MotionEvent e1, MotionEvent e2, float velocityX, float velocityY) { if (DEBUG) Log.d(TAG, "Fling velocity: dX=[" + velocityX + "], dY=[" + velocityY + "]"); if (playerImpl == null) return false; final float absVelocityX = Math.abs(velocityX); final float absVelocityY = Math.abs(velocityY); if (absVelocityX > shutdownFlingVelocity) { <START> closePopup(); <END> return true; } else if (Math.max(absVelocityX, absVelocityY) > tossFlingVelocity) { if (absVelocityX > tossFlingVelocity) popupLayoutParams.x = (int) velocityX; if (absVelocityY > tossFlingVelocity) popupLayoutParams.y = (int) velocityY; checkPositionBounds(); windowManager.updateViewLayout(playerImpl.getRootView(), popupLayoutParams); return true; } return false; }</code><technical_language>a proper quick close option, a good time remove this swipe close (shutdown fling) feature</technical_language>

Target:
public boolean onFling(MotionEvent e1, MotionEvent e2, float velocityX, float velocityY) { if (DEBUG) Log.d(TAG, "Fling velocity: dX=[" + velocityX + "], dY=[" + velocityY + "]"); if (playerImpl == null) return false; final float absVelocityX = Math.abs(velocityX); final float absVelocityY = Math.abs(velocityY); if (Math.max(absVelocityX, absVelocityY) > tossFlingVelocity) { if (absVelocityX > tossFlingVelocity) popupLayoutParams.x = (int) velocityX; if (absVelocityY > tossFlingVelocity) popupLayoutParams.y = (int) velocityY; checkPopupPositionBounds(); windowManager.updateViewLayout(playerImpl.getRootView(), popupLayoutParams); return true; } return false; }
Source:
<code>public void testGetContainersFromNotExistingServerInstance() { ServerInstanceKey serverInstance = new ServerInstanceKey("not-existing", "not-existing", "not-existing", "not-existing"); try { controllerClient.getContainers(serverInstance); fail("Should throw exception about the server instance not existing."); } catch (KieServerControllerClientException e) { assertNotFoundException((T) e); <START> assertEquals("Kie Services Client Provider not found for url: not-existing", e.getMessage()); <END> } }</code><technical_language>Please replace assertEquals(epxpected, actual) assertThat(actual).isEqualTo(Expected)</technical_language>

Target:
public void testGetContainersFromNotExistingServerInstance() { ServerInstanceKey serverInstance = new ServerInstanceKey("not-existing", "not-existing", "not-existing", "not-existing"); try { controllerClient.getContainers(serverInstance); fail("Should throw exception about the server instance not existing."); } catch (KieServerControllerClientException e) { assertNotFoundException((T) e); assertThat(e.getMessage()).endsWith("Kie Services Client Provider not found for url: not-existing"); } }
Source:
<code>public T createInterceptedInstance(T instance) { if (used) { throw InterceptorLogger.LOG.interceptionFactoryNotReusable(); } UnproxyableResolutionException exception = Proxies.getUnproxyableTypeException(annotatedType.getBaseType(), null, beanManager.getServices(), ignoreFinalMethods); if (exception != null) { throw exception; } Optional<InterceptionFactoryData<T>> cached = beanManager.getServices().get(InterceptionFactoryDataCache.class) .getInterceptionFactoryData(configurator != null ? configurator.complete() : annotatedType); if (!cached.isPresent()) { <START> used = true; <END> return instance; } InterceptionFactoryData<T> data = cached.get(); InterceptedProxyMethodHandler methodHandler = new InterceptedProxyMethodHandler(instance); methodHandler.setInterceptorMethodHandler(new InterceptorMethodHandler( InterceptionContext.forNonConstructorInterception(data.getInterceptionModel(), creationalContext, beanManager, data.getSlimAnnotatedType()))); T proxy = (System.getSecurityManager() == null) ? data.getInterceptedProxyFactory().run() : AccessController.doPrivileged(data.getInterceptedProxyFactory()); ((ProxyObject) proxy).setHandler(methodHandler); used = true; return proxy; }</code><technical_language>I move = true; right throw InterceptorLogger.LOG.interceptionFactoryNotReusable() remove L125</technical_language>

Target:
public T createInterceptedInstance(T instance) { if (used) { throw InterceptorLogger.LOG.interceptionFactoryNotReusable(); } UnproxyableResolutionException exception = Proxies.getUnproxyableTypeException(annotatedType.getBaseType(), null, beanManager.getServices(), ignoreFinalMethods); if (exception != null) { throw exception; } used = true; Optional<InterceptionFactoryData<T>> cached = beanManager.getServices().get(InterceptionFactoryDataCache.class) .getInterceptionFactoryData(configurator != null ? configurator.complete() : annotatedType); if (!cached.isPresent()) { return instance; } InterceptionFactoryData<T> data = cached.get(); InterceptedProxyMethodHandler methodHandler = new InterceptedProxyMethodHandler(instance); methodHandler.setInterceptorMethodHandler(new InterceptorMethodHandler( InterceptionContext.forNonConstructorInterception(data.getInterceptionModel(), creationalContext, beanManager, data.getSlimAnnotatedType()))); T proxy = (System.getSecurityManager() == null) ? data.getInterceptedProxyFactory().run() : AccessController.doPrivileged(data.getInterceptedProxyFactory()); ((ProxyObject) proxy).setHandler(methodHandler); return proxy; }
Source:
<code>private void registerTableElement(TableEditableElement tableElement) { if (!linkedEditableElements.containsKey( tableElement.getSourceName()) && hasDataSource(mapContext.getLayerModel(), tableElement.getSourceName())) { <START> LOGGER.debug(I18N.tr("Link the editable element with the toc")); <END> linkedEditableElements.put(tableElement.getSourceName(), tableElement); tableElement.addPropertyChangeListener(TableEditableElement.PROP_SELECTION, tableSelectionChangeListener); tableElement.addPropertyChangeListener(TableEditableElement.PROP_OPEN, tableEditableClose); if (!tableElement.getSelection().isEmpty()) { onTableSelectionChange(tableElement); } else { if(mapContext!=null) { ILayer[] layers = mapContext.getLayers(); Set<Integer> mergedSelection = new IntegerUnion(); for (ILayer layer : layers) { DataSource source = layer.getDataSource(); if (source != null && source.getName().equals(tableElement.getSourceName())) { mergedSelection.addAll(layer.getSelection()); } } tableElement.setSelection(mergedSelection); } } } }</code><technical_language>I prefer 'TOC' 'toc'</technical_language>

Target:
private void registerTableElement(TableEditableElement tableElement) { if (!linkedEditableElements.containsKey( tableElement.getSourceName()) && hasDataSource(mapContext.getLayerModel(), tableElement.getSourceName())) { LOGGER.debug(I18N.tr("Link the editable element with the Toc")); linkedEditableElements.put(tableElement.getSourceName(), tableElement); tableElement.addPropertyChangeListener(TableEditableElement.PROP_SELECTION, tableSelectionChangeListener); tableElement.addPropertyChangeListener(TableEditableElement.PROP_OPEN, tableEditableClose); if (!tableElement.getSelection().isEmpty()) { onTableSelectionChange(tableElement); } else { if(mapContext!=null) { ILayer[] layers = mapContext.getLayers(); Set<Integer> mergedSelection = new IntegerUnion(); for (ILayer layer : layers) { DataSource source = layer.getDataSource(); if (source != null && source.getName().equals(tableElement.getSourceName())) { mergedSelection.addAll(layer.getSelection()); } } tableElement.setSelection(mergedSelection); } } } }
Source:
<code><START> public MessageValues extractHeaders(byte[] payload, boolean copyRequestHeaders, MessageHeaders requestHeaders) throws Exception { <END> ByteBuffer byteBuffer = ByteBuffer.wrap(payload); int headerCount = byteBuffer.get() & 0xff; if (headerCount < 255) { return oldExtractHeaders(byteBuffer, payload, headerCount, copyRequestHeaders, requestHeaders); } else { headerCount = byteBuffer.get() & 0xff; Map<String, Object> headers = new HashMap<String, Object>(); for (int i = 0; i < headerCount; i++) { int len = byteBuffer.get() & 0xff; String headerName = new String(payload, byteBuffer.position(), len, "UTF-8"); byteBuffer.position(byteBuffer.position() + len); len = byteBuffer.getInt(); String headerValue = new String(payload, byteBuffer.position(), len, "UTF-8"); Object headerContent = this.objectMapper.fromJson(headerValue, Object.class); headers.put(headerName, headerContent); byteBuffer.position(byteBuffer.position() + len); } byte[] newPayload = new byte[byteBuffer.remaining()]; byteBuffer.get(newPayload); return buildMessageValues(newPayload, headers, copyRequestHeaders, requestHeaders); } }</code><technical_language>overloading anyway, a simple public MessageValues extractHeaders(byte[] payload) method extracts headers - copying of headers responsibility of this method - simply done invoker of method, result</technical_language>

Target:
private MessageValues extractHeaders(byte[] payload, boolean copyRequestHeaders, MessageHeaders requestHeaders) throws Exception { ByteBuffer byteBuffer = ByteBuffer.wrap(payload); int headerCount = byteBuffer.get() & 0xff; if (headerCount < 255) { return oldExtractHeaders(byteBuffer, payload, headerCount, copyRequestHeaders, requestHeaders); } else { headerCount = byteBuffer.get() & 0xff; Map<String, Object> headers = new HashMap<String, Object>(); for (int i = 0; i < headerCount; i++) { int len = byteBuffer.get() & 0xff; String headerName = new String(payload, byteBuffer.position(), len, "UTF-8"); byteBuffer.position(byteBuffer.position() + len); len = byteBuffer.getInt(); String headerValue = new String(payload, byteBuffer.position(), len, "UTF-8"); Object headerContent = this.objectMapper.fromJson(headerValue, Object.class); headers.put(headerName, headerContent); byteBuffer.position(byteBuffer.position() + len); } byte[] newPayload = new byte[byteBuffer.remaining()]; byteBuffer.get(newPayload); return buildMessageValues(newPayload, headers, copyRequestHeaders, requestHeaders); } }
Source:
<code>public V001() { super(); WikibaseUris <START> uris = <END> WikibaseUris.getURISystem(); addHandler(new InlineFixedWidthHexIntegerURIHandler(uris.reference(), 40)); }</code><technical_language>This is a instance parent class. care this duplication, this is run application initialization. sense move uris a class variable</technical_language>

Target:
public V001() { super(); addHandler(new InlineFixedWidthHexIntegerURIHandler(uris.reference(), 40)); }
Source:
<code><START> public void incSize(int by) { <END> size += by; }</code><technical_language>vary dangerous methods public. This lead procedural programming is difficult determine if object is in a valid state. private</technical_language>

Target:
private void incSize(int by) { size += by; }
Source:
<code>public Optional<T> nextOrEndOfStream(long timeoutMillis, String errorMsg) throws InterruptedException { Optional<T> value = abq.poll(timeoutMillis, TimeUnit.MILLISECONDS); if (value == null) { env.flop(String.format("%s within %d ms", errorMsg, timeoutMillis)); return null; } else { return value; <START> } <END> }</code><technical_language>Technically return end sich return null if is null. (i.e. need compiler happy) if (value == null) { env.flop(String.format("%s %d ms", errorMsg, timeoutMillis)); } return value;</technical_language>

Target:
public Optional<T> nextOrEndOfStream(long timeoutMillis, String errorMsg) throws InterruptedException { Optional<T> value = abq.poll(timeoutMillis, TimeUnit.MILLISECONDS); if (value == null) { env.flop(String.format("%s within %d ms", errorMsg, timeoutMillis)); } return value; }
Source:
<code>public void onRenameListConfirmed(int position, String newListName) { dataSource.renameList(nameListsAdapter.getItem(position), newListName); preferencesManager.renameList(nameListsAdapter.getItem(position), newListName); <START> nameListsAdapter.renameItem(position, newListName); <END> nameListsAdapter.notifyItemChanged(position); }</code><technical_language>renameItem() do notifyItemChanged() it. MainActivity of a "coordinator" possible, call powerful APIs leave more specific commands (like changing list UI notifyItemX) individual modules</technical_language>

Target:
public void onRenameListConfirmed(int position, String newListName) { dataSource.renameList(nameListsAdapter.getItem(position), newListName); preferencesManager.renameList(nameListsAdapter.getItem(position), newListName); nameListsAdapter.renameItem(position, newListName); }
Source:
<code>public boolean aggregate(KeyType key, int keyHash) { final ByteBuffer keyBuffer = keySerde.toByteBuffer(key); if (keyBuffer == null) { return false; } Preconditions.checkArgument( keyBuffer.remaining() == keySize, "key size[%s] != keySize[%s]", keyBuffer.remaining(), keySize ); int bucket = findBucket( tableBuffer, buckets, bucketSize, size < Math.min(maxSize, maxBufferGrouperSize), keyBuffer, keySize, keyHash ); if (bucket < 0) { if (size < maxBufferGrouperSize) { growIfPossible(); bucket = findBucket(tableBuffer, buckets, bucketSize, size < maxSize, keyBuffer, keySize, keyHash); } if (bucket < 0) { return false; } } final int offset = bucket * bucketSize; if (!isUsed(bucket)) { tableBuffer.position(offset); tableBuffer.putInt(keyHash | 0x80000000); <START> tableBuffer.put(keyBuffer); <END> for (int i = 0; i < aggregators.length; i++) { aggregators[i].init(tableBuffer, offset + aggregatorOffsets[i]); } buffer.putInt(tableArenaSize + size * Ints.BYTES, offset); size++; } for (int i = 0; i < aggregators.length; i++) { aggregators[i].aggregate(tableBuffer, offset + aggregatorOffsets[i]); } return true; }</code><technical_language>do kerSerde.toByteBuffer(key, tableBuffer, offset + Ints.size, keySize) a method keySerde boolean toByteBuffer(key, ByteBuffer, offset, size) avoid copy done here</technical_language>

Target:
public boolean aggregate(KeyType key, int keyHash) { final ByteBuffer keyBuffer = keySerde.toByteBuffer(key); if (keyBuffer == null) { return false; } Preconditions.checkArgument( keyBuffer.remaining() == keySize, "keySerde.toByteBuffer(key).remaining[%s] != keySerde.keySize[%s], buffer was the wrong size?!", keyBuffer.remaining(), keySize ); int bucket = findBucket( tableBuffer, buckets, bucketSize, size < Math.min(maxSize, bufferGrouperMaxSize), keyBuffer, keySize, keyHash ); if (bucket < 0) { if (size < bufferGrouperMaxSize) { growIfPossible(); bucket = findBucket(tableBuffer, buckets, bucketSize, size < maxSize, keyBuffer, keySize, keyHash); } if (bucket < 0) { return false; } } final int offset = bucket * bucketSize; if (!isUsed(bucket)) { tableBuffer.position(offset); tableBuffer.putInt(keyHash | 0x80000000); tableBuffer.put(keyBuffer); for (int i = 0; i < aggregators.length; i++) { aggregators[i].init(tableBuffer, offset + aggregatorOffsets[i]); } buffer.putInt(tableArenaSize + size * Ints.BYTES, offset); size++; } for (int i = 0; i < aggregators.length; i++) { aggregators[i].aggregate(tableBuffer, offset + aggregatorOffsets[i]); } return true; }