auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code><START> public void findAllTest() throws Exception { <END> getClient().perform(get("/api/config/submissioncclicenses")) .andExpect(status().isOk()) .andExpect(content().contentType(contentType)) .andExpect(jsonPath("$._embedded.submissioncclicenses", Matchers.containsInAnyOrder( SubmissionCCLicenseMatcher.matchLicenseEntry(1, new int[]{3, 2, 3}), SubmissionCCLicenseMatcher.matchLicenseEntry(2, new int[]{2}), SubmissionCCLicenseMatcher.matchLicenseEntry(3, new int[]{}) ))); }</code><technical_language>noted above, I require authentication endpoints. So, enhance tests in this file check endpoints return errors if unauthenticated</technical_language>

Target:
public void findAllTest() throws Exception { String epersonToken = getAuthToken(eperson.getEmail(), password); getClient(epersonToken).perform(get("/api/config/submissioncclicenses")) .andExpect(status().isOk()) .andExpect(content().contentType(contentType)) .andExpect(jsonPath("$._embedded.submissioncclicenses", Matchers.containsInAnyOrder( SubmissionCCLicenseMatcher.matchLicenseEntry(1, new int[]{3, 2, 3}), SubmissionCCLicenseMatcher.matchLicenseEntry(2, new int[]{2}), SubmissionCCLicenseMatcher.matchLicenseEntry(3, new int[]{}) ))); }
Source:
<code>public Object replace( Object original, Object target, SharedSessionContractImplementor session, Object owner, Map copyCache, ForeignKeyDirection foreignKeyDirection) throws HibernateException { boolean include; if ( isAssociationType()) { AssociationType atype = (AssociationType) this; <START> if ( atype instanceof OneToOneType && atype.useLHSPrimaryKey()) { <END> include = ForeignKeyDirection.FROM_PARENT ==foreignKeyDirection; } else { include = atype.getForeignKeyDirection()==foreignKeyDirection; } } else { include = ForeignKeyDirection.FROM_PARENT ==foreignKeyDirection; } return include ? replace(original, target, session, owner, copyCache) : target; }</code><technical_language>I source of bug is foreign key direction for atype is incorrect. FROM_PARENT, is TO_PARENT. sides of bidirectional associations foreign key direction set TO_PARENT, is incorrect. If foreign key direction for Segunda#parent correct, this fix necessary. I proper fix fix foreign key direction instead of disregarding it</technical_language>

Target:
public Object replace( Object original, Object target, SharedSessionContractImplementor session, Object owner, Map copyCache, ForeignKeyDirection foreignKeyDirection) throws HibernateException { boolean include; if ( isAssociationType() ) { AssociationType atype = (AssociationType) this; include = atype.getForeignKeyDirection()==foreignKeyDirection; } else { include = ForeignKeyDirection.FROM_PARENT ==foreignKeyDirection; } return include ? replace(original, target, session, owner, copyCache) : target; }
Source:
<code>public JSONPathParser(List<FieldSpec> fieldSpecs, boolean useFieldDiscovery, ObjectMapper mapper) { this.fieldSpecs = fieldSpecs; this.fieldPathMap = generateFieldPaths(fieldSpecs); this.useFieldDiscovery = useFieldDiscovery; this.mapper = mapper == null ? new ObjectMapper() : mapper; <START> this.reader = this.mapper.reader().withType(Object.class); <END> }</code><technical_language>need save ObjectReader; call readValue ObjectMapper</technical_language>

Target:
public JSONPathParser(List<FieldSpec> fieldSpecs, boolean useFieldDiscovery, ObjectMapper mapper) { this.fieldSpecs = fieldSpecs; this.fieldPathMap = generateFieldPaths(fieldSpecs); this.useFieldDiscovery = useFieldDiscovery; this.mapper = mapper == null ? new ObjectMapper() : mapper; this.jsonPathConfig = Configuration.defaultConfiguration().addOptions(Option.SUPPRESS_EXCEPTIONS); }
Source:
<code>private boolean shouldCapture(AnnotatedTypeMirror type, TypeMirror typeMirror) { if (type.getKind() != TypeKind.DECLARED && typeMirror.getKind() != TypeKind.DECLARED) { return false; } DeclaredType capturedTypeMirror = (DeclaredType) typeMirror; AnnotatedDeclaredType typeToCapture = (AnnotatedDeclaredType) type; if (typeToCapture.getTypeArguments().isEmpty() || typeToCapture.wasRaw() || typeToCapture.containsUninferredTypeArguments() <START> || (capturedTypeMirror != null <END> && capturedTypeMirror.getTypeArguments().size() != typeToCapture.getTypeArguments().size())) { return false; } for (int i = 0; i < capturedTypeMirror.getTypeArguments().size(); i++) { if (TypesUtils.isCaptured(capturedTypeMirror.getTypeArguments().get(i)) && typeToCapture.getTypeArguments().get(i).getKind() == TypeKind.WILDCARD) { return true; } } return false; }</code><technical_language>capturedTypeMirror null? is annotated @Nullable</technical_language>

Target:
private boolean shouldCapture(AnnotatedTypeMirror type, TypeMirror typeMirror) { if (type.getKind() != TypeKind.DECLARED) { return false; } if (typeMirror.getKind() != TypeKind.DECLARED) { throw new BugInCF("Expected declared type mirror: %s, type: %s", typeMirror, type); } DeclaredType capturedTypeMirror = (DeclaredType) typeMirror; AnnotatedDeclaredType uncapturedType = (AnnotatedDeclaredType) type; if (capturedTypeMirror.getTypeArguments().isEmpty()) { return false; } if (uncapturedType.wasRaw() || uncapturedType.containsUninferredTypeArguments()) { return false; } if (capturedTypeMirror.getTypeArguments().size() != uncapturedType.getTypeArguments().size()) { throw new BugInCF( "Not the same number of type arguments: capturedTypeMirror: %s uncapturedType: %s", capturedTypeMirror, uncapturedType); } for (int i = 0; i < capturedTypeMirror.getTypeArguments().size(); i++) { TypeMirror capturedTypeArgTM = capturedTypeMirror.getTypeArguments().get(i); AnnotatedTypeMirror uncapturedTypeArg = uncapturedType.getTypeArguments().get(i); if (uncapturedTypeArg.getKind() != TypeKind.WILDCARD) { continue; } if (TypesUtils.isCaptured(capturedTypeArgTM) || capturedTypeArgTM.getKind() != TypeKind.WILDCARD) { return true; } } return false; }
Source:
<code>static OverlapDetector<Chain> loadChains(final File chainFile) { <START> return loadChains(new BufferedLineReader(openFileForReading(chainFile)), chainFile.toString()); <END> }</code><technical_language>Open reader a try-with-resources block autoclosed method exits. i.e. try(final BufferedLineReader reader = new BufferedLineReader(openFileForReading(chainFile))) { return loadChains(reader, chainFile.toString()); }</technical_language>

Target:
static OverlapDetector<Chain> loadChains(final File chainFile) { IOUtil.assertFileIsReadable(chainFile); try(final BufferedLineReader reader = new BufferedLineReader(IOUtil.openFileForReading(chainFile))){ return loadChains(reader, chainFile.toString()); } }
Source:
<code>private Mono<CosmosAsyncUserDefinedFunctionResponse> readInternal(Context context) { <START> String spanName = "readUDF." + container.getId(); <END> Mono<CosmosAsyncUserDefinedFunctionResponse> responseMono = readInternal(); return this.container.getDatabase().getClient().getTracerProvider().traceEnabledCosmosResponsePublisher(responseMono, context, spanName, container.getDatabase().getId(), container.getDatabase().getClient().getServiceEndpoint()); }</code><technical_language>span name match method name is read</technical_language>

Target:
private Mono<CosmosUserDefinedFunctionResponse> readInternal(Context context) { String spanName = "readUDF." + container.getId(); Mono<CosmosUserDefinedFunctionResponse> responseMono = readInternal(); return this.container.getDatabase().getClient().getTracerProvider().traceEnabledCosmosResponsePublisher(responseMono, context, spanName, container.getDatabase().getId(), container.getDatabase().getClient().getServiceEndpoint()); }
Source:
<code>public static ShareType getShareType(String authority) { <START> if (sShareTypes.containsKey(authority)) { <END> return sShareTypes.get(authority); } return null; }</code><technical_language>This method written in a single line; check reference for HashMap#get, returns null if key exist. <LINK_0></technical_language>

Target:
public static ShareType getShareType(String authority) { return sShareTypes.get(authority); }
Source:
<code>private void compareWithAns(String doc, String ansPath) throws FileNotFoundException { Scanner in = new Scanner(new File(ansPath)); String ansDoc = ""; while (in.hasNext()) { ansDoc += in.nextLine() + "\n"; } doc = StringUtil.replace(doc, "\n", ""); <START> ansDoc = StringUtil.replace(ansDoc, "\n", ""); <END> assertEquals(doc, ansDoc); }</code><technical_language>removing \n added above? add it</technical_language>

Target:
private void compareWithAns(String doc, String ansPath) throws FileNotFoundException { assertNotNull(doc); Scanner in = new Scanner(new File(ansPath)); String ansDoc = ""; while (in.hasNext()) { ansDoc += in.nextLine(); } doc = StringUtil.replace(doc, "\n", ""); assertEquals(doc, ansDoc); }
Source:
<code><START> public void quit(boolean isLogout) { <END> if (isLogout) { browserComponent.logout(); } if (browserComponent != null) { browserComponent.onAppQuit(); } if (!isTestMode() || isTestGlobalConfig()) { panels.saveSession(); prefs.saveGlobalConfig(); } if (!isTestMode() || isCloseOnQuit()) { Platform.exit(); System.exit(0); } }</code><technical_language>I thinking java class UI { void logout() { browserComponent.cleanChromeCustomProfile(); quit(); } void quit() { browserComponent.onAppQuit(); // else is } } a minor though, cosmetic. UI interfaces browser component else involved</technical_language>

Target:
public void quit(boolean isLogout) { if (browserComponent != null) { browserComponent.onAppQuit(); if (isLogout) { browserComponent.cleanChromeCustomProfile(); } } if (!isTestMode() || isTestGlobalConfig()) { panels.saveSession(); prefs.saveGlobalConfig(); } if (!isTestMode() || isCloseOnQuit()) { Platform.exit(); System.exit(0); } }
Source:
<code>public GerritCommentCountChangeNodeDecorator(SelectedRevisions selectedRevisions) { this.selectedRevisions = selectedRevisions; this.selectedRevisions.addObserver(new Observer() { @Override public void update(Observable o, Object arg) { if (arg instanceof String && selectedChange.id.equals(arg)) { comments = setupCommentsSupplier(); drafts = setupDraftsSupplier(); <START> reviewed = setupReviewedSupplier(); <END> } } }); }</code><technical_language>need add this in onChangeSelected (yes, forgot add there, shows some flaws in this code; extract common parts)</technical_language>

Target:
public GerritCommentCountChangeNodeDecorator(SelectedRevisions selectedRevisions) { this.selectedRevisions = selectedRevisions; this.selectedRevisions.addObserver(new Observer() { @Override public void update(Observable o, Object arg) { if (arg instanceof String && selectedChange != null && selectedChange.id.equals(arg)) { refreshSuppliers(); } } }); }
Source:
<code>private void initializeAnimations(){ boolean isLTR = (ViewCompat.getLayoutDirection(getRootView()) == ViewCompat.LAYOUT_DIRECTION_LTR); <START> mForwardAnimation = new TranslateAnimation(0.0f, isLTR ? ANIMATION_DISPLACEMENT : -ANIMATION_DISPLACEMENT, <END> 0.0f, 0.0f); mForwardAnimation.setDuration(DEFAULT_ANIMATION_DURATION_MS); mForwardAnimation.setInterpolator(new DecelerateInterpolator()); mForwardAnimation.setRepeatCount(0); mForwardAnimation.setAnimationListener(new Animation.AnimationListener() { @Override public void onAnimationStart(Animation animation) { mForwardTimeTextView.setVisibility(VISIBLE); } @Override public void onAnimationEnd(Animation animation) { mForwardTimeTextView.setVisibility(GONE); } @Override public void onAnimationRepeat(Animation animation) { } }); mRewindAnimation = new TranslateAnimation(0.0f, !isLTR ? ANIMATION_DISPLACEMENT : -ANIMATION_DISPLACEMENT, 0.0f, 0.0f); mRewindAnimation.setDuration(DEFAULT_ANIMATION_DURATION_MS); mRewindAnimation.setInterpolator(new DecelerateInterpolator()); mRewindAnimation.setRepeatCount(0); mRewindAnimation.setAnimationListener(new Animation.AnimationListener() { @Override public void onAnimationStart(Animation animation) { mRewindTimeTextView.setVisibility(VISIBLE); } @Override public void onAnimationEnd(Animation animation) { mRewindTimeTextView.setVisibility(GONE); } @Override public void onAnimationRepeat(Animation animation) { } }); }</code><technical_language>a common method for animation, create instance while clicking buttons</technical_language>

Target:
private void initializeAnimations() { boolean isLTRDirection = UiUtil.isDirectionLeftToRight(); mForwardAnimation = ViewAnimationUtil.getSeekTimeAnimation(mForwardTimeTextView, isLTRDirection); mRewindAnimation = ViewAnimationUtil.getSeekTimeAnimation(mRewindTimeTextView, !isLTRDirection); }
Source:
<code>public int compareTo( DurationValue other ) { <START> return unsafeCompareTo( other ); <END> }</code><technical_language>flip unsafeCompareTo calls compareTo( (DurationValue) otherValue ), compareTo logic</technical_language>

Target:
public int compareTo( DurationValue other ) { return COMPARATOR.compare( this, other ); }
Source:
<code>private NPFPacket decipherFromSeqnum(byte[] buf, int offset, int length, SessionKey sessionKey, int sequenceNumber) { BlockCipher ivCipher = sessionKey.ivCipher; byte[] IV = new byte[ivCipher.getBlockSize() / 8]; System.arraycopy(sessionKey.ivNonce, 0, IV, 0, IV.length); IV[IV.length - 4] = (byte) (sequenceNumber >>> 24); IV[IV.length - 3] = (byte) (sequenceNumber >>> 16); IV[IV.length - 2] = (byte) (sequenceNumber >>> 8); IV[IV.length - 1] = (byte) (sequenceNumber); ivCipher.encipher(IV, IV); byte[] payload = Arrays.copyOfRange(buf, offset + hmacLength, offset + length); byte[] hash = Arrays.copyOfRange(buf, offset, offset + hmacLength); <START> if(!HMAC.verifyWithSHA256(sessionKey.hmacKey, payload, hash, HMAC_LENGTH)) return null; <END> PCFBMode payloadCipher = PCFBMode.create(sessionKey.incommingCipher, IV); payloadCipher.blockDecipher(payload, 0, payload.length); NPFPacket p = NPFPacket.create(payload, pn); NewPacketFormatKeyContext keyContext = sessionKey.packetContext; synchronized(this) { if(seqNumGreaterThan(sequenceNumber, keyContext.highestReceivedSeqNum, 31)) { keyContext.highestReceivedSeqNum = sequenceNumber; } } return p; }</code><technical_language>rest of code hmacLength, including lines this one. Please instead</technical_language>

Target:
private NPFPacket decipherFromSeqnum(byte[] buf, int offset, int length, SessionKey sessionKey, int sequenceNumber) { BlockCipher ivCipher = sessionKey.ivCipher; byte[] IV = new byte[ivCipher.getBlockSize() / 8]; System.arraycopy(sessionKey.ivNonce, 0, IV, 0, IV.length); IV[IV.length - 4] = (byte) (sequenceNumber >>> 24); IV[IV.length - 3] = (byte) (sequenceNumber >>> 16); IV[IV.length - 2] = (byte) (sequenceNumber >>> 8); IV[IV.length - 1] = (byte) (sequenceNumber); ivCipher.encipher(IV, IV); byte[] payload = Arrays.copyOfRange(buf, offset + hmacLength, offset + length); byte[] hash = Arrays.copyOfRange(buf, offset, offset + hmacLength); if(!HMAC.verifyWithSHA256(sessionKey.hmacKey, payload, hash, hmacLength)) return null; PCFBMode payloadCipher = PCFBMode.create(sessionKey.incommingCipher, IV); payloadCipher.blockDecipher(payload, 0, payload.length); NPFPacket p = NPFPacket.create(payload, pn); NewPacketFormatKeyContext keyContext = sessionKey.packetContext; synchronized(this) { if(seqNumGreaterThan(sequenceNumber, keyContext.highestReceivedSeqNum, 31)) { keyContext.highestReceivedSeqNum = sequenceNumber; } } return p; }
Source:
<code>private void onBoardSaveAs() { logger.info("Menu: Boards > Save as"); List<PanelInfo> panelList = panels.getCurrentPanelInfos(); BoardNameDialog dlg = new BoardNameDialog(prefs, mainStage); Optional<String> response = dlg.showAndWait(); ui.showMainStage(); if (panelList.isEmpty()) { <START> logger.info("Save an empty board"); <END> } else { panels.selectFirstPanel(); } if (response.isPresent()) { String boardName = response.get().trim(); prefs.addBoard(boardName, panelList); prefs.setLastOpenBoard(boardName); ui.triggerEvent(new BoardSavedEvent()); logger.info("New board " + boardName + " saved"); ui.updateTitle(); } }</code><technical_language>Save ... --> Saved ..</technical_language>

Target:
private void onBoardSaveAs() { logger.info("Menu: Boards > Save as"); List<PanelInfo> panelList = panels.getCurrentPanelInfos(); BoardNameDialog dlg = new BoardNameDialog(prefs, mainStage); Optional<String> response = dlg.showAndWait(); ui.showMainStage(); panels.selectFirstPanel(); if (response.isPresent()) { String boardName = response.get().trim(); prefs.addBoard(boardName, panelList); prefs.setLastOpenBoard(boardName); ui.triggerEvent(new BoardSavedEvent()); logger.info("New board " + boardName + " saved"); ui.updateTitle(); } }
Source:
<code>public void processNonEntityEnclosingRESTHandler(SOAPEnvelope soapEnvelope, MessageContext msgContext, boolean injectToAxis2Engine) { String soapAction = request.getHeaders().get(SOAP_ACTION_HEADER); if ((soapAction != null) && soapAction.startsWith("\"") && soapAction.endsWith("\"")) { soapAction = soapAction.substring(1, soapAction.length() - 1); } msgContext.setSoapAction(soapAction); msgContext.setTo(new EndpointReference(request.getUri())); msgContext.setServerSide(true); msgContext.setDoingREST(true); if (!(request.isEntityEnclosing())) { msgContext.setProperty(PassThroughConstants.NO_ENTITY_BODY, Boolean.TRUE); } try { if(soapEnvelope == null){ msgContext.setEnvelope(new SOAP11Factory().getDefaultEnvelope()); }else{ msgContext.setEnvelope(soapEnvelope); } if (injectToAxis2Engine) { AxisEngine.receive(msgContext); } } catch (AxisFault axisFault) { <START> consumeInputOnAxisFault(msgContext); <END> handleException("Error processing " + request.getMethod() + " request for : " + request.getUri(), axisFault); } catch (Exception e) { String encodedURL = StringEscapeUtils.escapeHtml(request.getUri()); handleException("Error processing " + request.getMethod() + " request for : " + encodedURL + ". ", e); } }</code><technical_language>move this consumeInputOnAxisFault call handleException() method cover paths this happen</technical_language>

Target:
public void processNonEntityEnclosingRESTHandler(SOAPEnvelope soapEnvelope, MessageContext msgContext, boolean injectToAxis2Engine) { String soapAction = request.getHeaders().get(SOAP_ACTION_HEADER); if ((soapAction != null) && soapAction.startsWith("\"") && soapAction.endsWith("\"")) { soapAction = soapAction.substring(1, soapAction.length() - 1); } msgContext.setSoapAction(soapAction); msgContext.setTo(new EndpointReference(request.getUri())); msgContext.setServerSide(true); msgContext.setDoingREST(true); if (!(request.isEntityEnclosing())) { msgContext.setProperty(PassThroughConstants.NO_ENTITY_BODY, Boolean.TRUE); } try { if(soapEnvelope == null){ msgContext.setEnvelope(new SOAP11Factory().getDefaultEnvelope()); }else{ msgContext.setEnvelope(soapEnvelope); } if (injectToAxis2Engine) { AxisEngine.receive(msgContext); } } catch (AxisFault axisFault) { handleException("Error processing " + request.getMethod() + " request for : " + request.getUri(), axisFault); } catch (Exception e) { String encodedURL = StringEscapeUtils.escapeHtml(request.getUri()); handleException("Error processing " + request.getMethod() + " request for : " + encodedURL + ". ", e); } }
Source:
<code>public T addHandler( final ViewEventType type, final ViewHandler<? extends ViewEvent> eventHandler ) { if ( supports( type ) ) { if ( ViewEventType.DRAG.equals( type ) ) { final HandlerRegistration[] registrations = registerDragHandler( ( DragHandler ) eventHandler ); if ( null != registrations ) { eventHandlerManager.addHandlersRegistration( type, registrations ); } } else if ( ViewEventType.RESIZE.equals( type ) ) { final HandlerRegistration[] registrations = registerResizeHandler( ( ResizeHandler ) eventHandler ); if ( null != registrations ) { eventHandlerManager.addHandlersRegistration( type, registrations ); } } if ( ViewEventType.TEXT_OVER.equals( type ) ) { textOverHandlerViewHandler = ( ViewHandler<TextOverEvent> ) eventHandler; } <START> { <END> } if ( ViewEventType.TEXT_OUT.equals( type ) ) { textOutEventViewHandler = ( ViewHandler<TextOutEvent> ) eventHandler; } else { eventHandlerManager.addHandler( type, eventHandler ); } } return ( T ) this; }</code><technical_language>need empty braces</technical_language>

Target:
public T addHandler( final ViewEventType type, final ViewHandler<? extends ViewEvent> eventHandler ) { if ( supports( type ) ) { if ( ViewEventType.DRAG.equals( type ) ) { final HandlerRegistration[] registrations = registerDragHandler( ( DragHandler ) eventHandler ); if ( null != registrations ) { eventHandlerManager.addHandlersRegistration( type, registrations ); } } else if ( ViewEventType.RESIZE.equals( type ) ) { final HandlerRegistration[] registrations = registerResizeHandler( ( ResizeHandler ) eventHandler ); if ( null != registrations ) { eventHandlerManager.addHandlersRegistration( type, registrations ); } } if ( ViewEventType.TEXT_OVER.equals( type ) ) { textOverHandlerViewHandler = ( ViewHandler<TextOverEvent> ) eventHandler; } if ( ViewEventType.TEXT_OUT.equals( type ) ) { textOutEventViewHandler = ( ViewHandler<TextOutEvent> ) eventHandler; } else { eventHandlerManager.addHandler( type, eventHandler ); } } return ( T ) this; }
Source:
<code>private HUEditorRow(@NonNull final Builder builder) { documentPath = builder.getDocumentPath(); rowId = builder.getRowId(); type = builder.getType(); topLevel = builder.isTopLevel(); processed = builder.isProcessed(); bpartnerId = builder.getBPartnerId(); huId = rowId.getHuId(); code = builder.code; huUnitType = builder.huUnitType; huStatus = builder.huStatus; huReserved = builder.huReserved; huStatusDisplay = builder.huStatusDisplay; packingInfo = builder.packingInfo; product = builder.product; isOwnPalette = builder.isOwnPalette; uom = builder.uom; qtyCU = builder.qtyCU; weightGross = builder.getWeightGross(); bestBeforeDate = builder.getBestBeforeDate(); this.locatorId = builder.locatorId; this.locator = locatorId != null ? JSONLookupValue.of(locatorId, builder.locatorCaption) : null; includedRows = builder.buildIncludedRows(); includedOrderLineReservations = builder.prepareIncludedOrderLineReservations(this); final HUEditorRowAttributesProvider attributesProvider = builder.getAttributesProviderOrNull(); if (attributesProvider != null) { attributesSupplier = Optional.of(HUEditorRowAttributesSupplier.builder() .viewRowId(rowId.toDocumentId()) .huId(huId) .provider(attributesProvider) .build()); } else { attributesSupplier = Optional.empty(); } if (hasAttributes() && attributesSupplier.get().get().hasAttribute(AttributeConstants.ATTR_SerialNo)) { serialNo = attributesSupplier.get().get().getValueAsString(AttributeConstants.ATTR_SerialNo); } else { <START> serialNo = "A"; <END> } }</code><technical_language>print A if HU serial number</technical_language>

Target:
private HUEditorRow(@NonNull final Builder builder) { documentPath = builder.getDocumentPath(); rowId = builder.getRowId(); type = builder.getType(); topLevel = builder.isTopLevel(); processed = builder.isProcessed(); bpartnerId = builder.getBPartnerId(); huId = rowId.getHuId(); code = builder.code; huUnitType = builder.huUnitType; huStatus = builder.huStatus; huReserved = builder.huReserved; huStatusDisplay = builder.huStatusDisplay; packingInfo = builder.packingInfo; product = builder.product; isOwnPalette = builder.isOwnPalette; uom = builder.uom; qtyCU = builder.qtyCU; weightGross = builder.getWeightGross(); bestBeforeDate = builder.getBestBeforeDate(); this.locatorId = builder.locatorId; this.locator = locatorId != null ? JSONLookupValue.of(locatorId, builder.locatorCaption) : null; includedRows = builder.buildIncludedRows(); includedOrderLineReservations = builder.prepareIncludedOrderLineReservations(this); final HUEditorRowAttributesProvider attributesProvider = builder.getAttributesProviderOrNull(); if (attributesProvider != null) { attributesSupplier = Optional.of(HUEditorRowAttributesSupplier.builder() .viewRowId(rowId.toDocumentId()) .huId(huId) .provider(attributesProvider) .build()); } else { attributesSupplier = Optional.empty(); } if (attributesSupplier.isPresent() && attributesSupplier.get().get().hasAttribute(AttributeConstants.ATTR_SerialNo)) { serialNo = attributesSupplier.get().get().getValueAsString(AttributeConstants.ATTR_SerialNo); } else { serialNo = null; } }
Source:
<code>private void initDimensionHandlers() { DimensionHandler timeHandler = new LongDimensionHandler(Column.TIME_COLUMN_NAME); DimensionColumnReader timeReader = timeHandler.makeColumnReader(getColumn(Column.TIME_COLUMN_NAME)); dimensionReaders.put(Column.TIME_COLUMN_NAME, timeReader); for (String dim : availableDimensions) { ColumnCapabilities capabilities = getColumn(dim).getCapabilities(); DimensionHandler handler = null; if (capabilities.getType() == ValueType.STRING && capabilities.isDictionaryEncoded()) { handler = new StringDimensionHandler(dim); dimensionHandlers.put(dim, handler); } if (capabilities.getType() == ValueType.LONG && !capabilities.isDictionaryEncoded()) { handler = new LongDimensionHandler(dim); dimensionHandlers.put(dim, handler); } <START> if (capabilities.getType() == ValueType.FLOAT && !capabilities.isDictionaryEncoded()) { <END> handler = new FloatDimensionHandler(dim); dimensionHandlers.put(dim, handler); } DimensionColumnReader reader = handler.makeColumnReader(getColumn(dim)); dimensionReaders.put(dim, reader); } }</code><technical_language>this logic C&Ped code I</technical_language>

Target:
private void initDimensionHandlers() { for (String dim : availableDimensions) { ColumnCapabilities capabilities = getColumn(dim).getCapabilities(); DimensionHandler handler = DimensionHandlerUtil.getHandlerFromCapabilities(dim, capabilities); DimensionColumnReader reader = handler.makeColumnReader(getColumn(dim)); dimensionHandlers.put(dim, handler); dimensionReaders.put(dim, reader); } }
Source:
<code>public static <START> String or(Object... <END> params) { return ""; }</code><technical_language>"String" "Object"</technical_language>

Target:
public static Object or(Object... params) { return ""; }
Source:
<code>public JcloudsSshMachineLocation obtain(Map<?,?> flags) throws NoMachinesAvailableException { ConfigBag setup = ConfigBag.newInstanceExtending(getAllConfigBag(), flags); Integer attempts = setup.get(MACHINE_CREATE_ATTEMPTS); List<Exception> exceptions = Lists.newArrayList(); if (attempts == null || attempts < 1) attempts = 1; for (int i = 1; i <= attempts; i++) { try { return obtainOnce(setup); } catch (RuntimeException e) { LOG.warn("Attempt #{}/{} to obtain machine threw error: {}", new Object[]{i, attempts, e}); exceptions.add(e); } } <START> String msg = format("Failed to get VM after %d attempt%s.", attempts, attempts == 1 ? "" : "s"); <END> Exception cause = (exceptions.size() == 1) ? exceptions.get(0) : new CompoundRuntimeException(msg + " - " + "First cause is "+exceptions.get(0)+" (listed in primary trace); " + "plus " + (exceptions.size()-1) + " more (e.g. the last is "+exceptions.get(exceptions.size()-1)+")", exceptions.get(0), exceptions); if (exceptions.get(exceptions.size()-1) instanceof NoMachinesAvailableException) { throw new NoMachinesAvailableException(msg, cause); } else { throw Exceptions.propagate(cause); } }</code><technical_language>personal preference is static imports for extremely common things, written method name. Basically Preconditions.* Assert.*. For String.format Iterables.getOnlyElement more conservative static import. Especially in a huge class this lots of methods. strong feelings though</technical_language>

Target:
public JcloudsSshMachineLocation obtain(Map<?,?> flags) throws NoMachinesAvailableException { ConfigBag setup = ConfigBag.newInstanceExtending(getAllConfigBag(), flags); Integer attempts = setup.get(MACHINE_CREATE_ATTEMPTS); List<Exception> exceptions = Lists.newArrayList(); if (attempts == null || attempts < 1) attempts = 1; for (int i = 1; i <= attempts; i++) { try { return obtainOnce(setup); } catch (RuntimeException e) { LOG.warn("Attempt #{}/{} to obtain machine threw error: {}", new Object[]{i, attempts, e}); exceptions.add(e); } } String msg = String.format("Failed to get VM after %d attempt%s.", attempts, attempts == 1 ? "" : "s"); Exception cause = (exceptions.size() == 1) ? exceptions.get(0) : new CompoundRuntimeException(msg + " - " + "First cause is "+exceptions.get(0)+" (listed in primary trace); " + "plus " + (exceptions.size()-1) + " more (e.g. the last is "+exceptions.get(exceptions.size()-1)+")", exceptions.get(0), exceptions); if (exceptions.get(exceptions.size()-1) instanceof NoMachinesAvailableException) { throw new NoMachinesAvailableException(msg, cause); } else { throw Exceptions.propagate(cause); } }
Source:
<code>public Object getParameter(String name) { if (name.equals(CriticalPathModule.PARAM_WORKER)) { final HostThread currentHostThread = fCurrentHostThread; if (currentHostThread == null) { return null; } IAnalysisModule mod = getModule(); if ((mod != null) && (mod instanceof CriticalPathModule)) { LttngWorker worker = new LttngWorker(currentHostThread, "", 0); return worker; } <START> return currentHostThread; <END> } return null; }</code><technical_language>I currentHostThread is returned (or previous entry)... critical path module needs anything. remove this line while updating this file</technical_language>

Target:
public Object getParameter(String name) { if (name.equals(CriticalPathModule.PARAM_WORKER)) { final HostThread currentHostThread = fCurrentHostThread; if (currentHostThread == null) { return null; } IAnalysisModule mod = getModule(); if ((mod != null) && (mod instanceof CriticalPathModule)) { LttngWorker worker = new LttngWorker(currentHostThread, "", 0); return worker; } } return null; }
Source:
<code><START> private byte[] readGitDirectoryFile(String filename) throws IOException { <END> File file = new File(getDirectory(), filename); byte[] raw; try { raw = IO.readFully(file); } catch (FileNotFoundException notFound) { return null; } if (raw.length == 0) return null; return raw; }</code><technical_language>short method is, this is shorter: File file = new File(getDirectory(), filename); try { byte[] raw = IO.readFully(file); return 0 < raw.length ? raw : null; } catch (FileNotFoundException notFound) { return null; } this tiny, worth hoist if of try/catch</technical_language>

Target:
private byte[] readGitDirectoryFile(String filename) throws IOException { File file = new File(getDirectory(), filename); try { byte[] raw = IO.readFully(file); return raw.length > 0 ? raw : null; } catch (FileNotFoundException notFound) { return null; } }
Source:
<code><START> public T toObject(ProtobufCodec<T> codec, Provider<T> provider) { <END> if (object == null) { this.codec = codec; if (provider == null) { object = codec.decode(buf); } else { object = provider.get(); try { codec.mergeFrom(CodedInputStream.newInstance(buf), object); } catch (IOException e) { throw new RuntimeException("Cannot decode message", e); } } buf = null; } return object; }</code><technical_language>need public</technical_language>

Target:
T toObject(ProtobufCodec<T> codec, Provider<T> provider) { if (object == null) { this.codec = codec; if (provider == null) { object = codec.decode(buf); } else { object = provider.get(); codec.mergeFrom(buf, object); } buf = null; } return object; }
Source:
<code>public int hashCode() { <START> return Objects.hash(options, readOptions, lookupOptions, physicalSchema, dialectName); <END> }</code><technical_language>please add missed limit</technical_language>

Target:
public int hashCode() { return Objects.hash(options, readOptions, lookupOptions, physicalSchema, dialectName, limit); }
Source:
<code>public void close() throws IOException { synchronized (this) { if(closed) { return; } closed = true; channelAssociation.shutdown(); if (strategy != null) { StreamUtils.safeClose(strategy); strategy = null; } final Endpoint endpoint = this.endpoint; if (endpoint != null) { this.endpoint = null; try { endpoint.closeAsync(); } catch (UnsupportedOperationException ignored) { } } channelAssociation.shutdownNow(); try { channelAssociation.awaitCompletion(1, TimeUnit.SECONDS); } catch (InterruptedException ignore) { Thread.currentThread().interrupt(); } finally { StreamUtils.safeClose(clientConfiguration); } <START> if (endpoint != null) endpoint.awaitClosedUninterruptibly(); <END> } }</code><technical_language>this endpoint.awaitClosed() a catch for InterruptedException conversion InterruptedIOException, a la EnpdointImpl.close()? able interrupt concerns me</technical_language>

Target:
public void close() throws IOException { synchronized (this) { if(closed) { return; } closed = true; channelAssociation.shutdown(); if (strategy != null) { StreamUtils.safeClose(strategy); strategy = null; } final Endpoint endpoint = this.endpoint; if (endpoint != null) { this.endpoint = null; try { endpoint.closeAsync(); } catch (UnsupportedOperationException ignored) { } } channelAssociation.shutdownNow(); try { channelAssociation.awaitCompletion(1, TimeUnit.SECONDS); } catch (InterruptedException ignore) { Thread.currentThread().interrupt(); } finally { StreamUtils.safeClose(clientConfiguration); } if (endpoint != null) try { endpoint.awaitClosed(); } catch (InterruptedException e) { final InterruptedIOException cause = new InterruptedIOException(e.getLocalizedMessage()); cause.initCause(e); throw cause; } } }
Source:
<code><START> public void testSymlinkAttributes() throws Exception { <END> if (!canCreateSymLinks()) return; makeLinkStructure(); assertFalse(iFile.getAttribute(EFS.ATTRIBUTE_SYMLINK)); assertFalse(iDir.getAttribute(EFS.ATTRIBUTE_SYMLINK)); assertTrue(ilFile.exists()); assertFalse(ilFile.isDirectory()); assertTrue(illFile.exists()); assertFalse(illFile.isDirectory()); assertTrue(ilDir.exists()); assertTrue(ilDir.isDirectory()); assertTrue(illDir.exists()); assertTrue(illDir.isDirectory()); assertEquals(iFile.getLastModified(), illFile.getLastModified()); assertEquals(iFile.getLength(), illFile.getLength()); assertEquals(iDir.getLastModified(), illDir.getLastModified()); assertEquals(iDir.getLength(), illDir.getLength()); assertTrue(ilFile.getAttribute(EFS.ATTRIBUTE_SYMLINK)); assertEquals(ilFile.getStringAttribute(EFS.ATTRIBUTE_LINK_TARGET), "aFile"); assertTrue(ilDir.getAttribute(EFS.ATTRIBUTE_SYMLINK)); assertEquals(ilDir.getStringAttribute(EFS.ATTRIBUTE_LINK_TARGET), "aDir"); assertTrue(illFile.getAttribute(EFS.ATTRIBUTE_SYMLINK)); assertEquals(illFile.getStringAttribute(EFS.ATTRIBUTE_LINK_TARGET), "lFile"); assertTrue(illDir.getAttribute(EFS.ATTRIBUTE_SYMLINK)); assertEquals(illDir.getStringAttribute(EFS.ATTRIBUTE_LINK_TARGET), "lDir"); }</code><technical_language>throws clause is needed here</technical_language>

Target:
public void testSymlinkAttributes() { if (!canCreateSymLinks()) return; makeLinkStructure(); assertFalse(iFile.getAttribute(EFS.ATTRIBUTE_SYMLINK)); assertFalse(iDir.getAttribute(EFS.ATTRIBUTE_SYMLINK)); assertTrue(ilFile.exists()); assertFalse(ilFile.isDirectory()); assertTrue(illFile.exists()); assertFalse(illFile.isDirectory()); assertTrue(ilDir.exists()); assertTrue(ilDir.isDirectory()); assertTrue(illDir.exists()); assertTrue(illDir.isDirectory()); assertEquals(iFile.getLastModified(), illFile.getLastModified()); assertEquals(iFile.getLength(), illFile.getLength()); assertEquals(iDir.getLastModified(), illDir.getLastModified()); assertEquals(iDir.getLength(), illDir.getLength()); assertTrue(ilFile.getAttribute(EFS.ATTRIBUTE_SYMLINK)); assertEquals(ilFile.getStringAttribute(EFS.ATTRIBUTE_LINK_TARGET), "aFile"); assertTrue(ilDir.getAttribute(EFS.ATTRIBUTE_SYMLINK)); assertEquals(ilDir.getStringAttribute(EFS.ATTRIBUTE_LINK_TARGET), "aDir"); assertTrue(illFile.getAttribute(EFS.ATTRIBUTE_SYMLINK)); assertEquals(illFile.getStringAttribute(EFS.ATTRIBUTE_LINK_TARGET), "lFile"); assertTrue(illDir.getAttribute(EFS.ATTRIBUTE_SYMLINK)); assertEquals(illDir.getStringAttribute(EFS.ATTRIBUTE_LINK_TARGET), "lDir"); }
Source:
<code>private void restoreDialog() { IDialogSettings dialogSettings = getDialogSettings(); if (dialogSettings != null) { try { dialogHeight = dialogSettings.getInt(DIALOG_HEIGHT); dialogWidth = dialogSettings.getInt(DIALOG_WIDTH); } catch (NumberFormatException e) { dialogHeight = -1; dialogWidth = -1; } isLoadingPreviousElements = true; UIJob refreshQuickAccessContents = new UIJob("Finish restoring quick access elements") { @Override public IStatus runInUIThread(IProgressMonitor monitor) { quickAccessContents.refresh(quickAccessContents.filterText.getText()); return Status.OK_STATUS; } }; refreshQuickAccessContents.setSystem(true); <START> restoreDialogEntriesJob = new Job("Restore quick access elements") { END> @Override protected IStatus run(IProgressMonitor monitor) { try { restoreDialogEntries(dialogSettings, monitor); return Status.OK_STATUS; } catch (OperationCanceledException e) { return Status.CANCEL_STATUS; } finally { isLoadingPreviousElements = false; refreshQuickAccessContents.schedule(); } } }; restoreDialogEntriesJob.schedule(); } }</code><technical_language>For readability, I prefer static Job.create method calling a method reference</technical_language>

Target:
private void restoreDialog() { IDialogSettings dialogSettings = getDialogSettings(); if (dialogSettings != null) { try { dialogHeight = dialogSettings.getInt(DIALOG_HEIGHT); dialogWidth = dialogSettings.getInt(DIALOG_WIDTH); } catch (NumberFormatException e) { dialogHeight = -1; dialogWidth = -1; } isLoadingPreviousElements = true; refreshQuickAccessContents = new UIJob("Finish restoring quick access elements") { @Override public IStatus runInUIThread(IProgressMonitor monitor) { quickAccessContents.refresh(quickAccessContents.filterText.getText()); return Status.OK_STATUS; } }; refreshQuickAccessContents.setSystem(true); restoreDialogEntriesJob = new Job("Restore quick access elements") { @Override protected IStatus run(IProgressMonitor monitor) { try { restoreDialogEntries(dialogSettings, monitor); return Status.OK_STATUS; } catch (OperationCanceledException e) { return Status.CANCEL_STATUS; } finally { isLoadingPreviousElements = false; refreshQuickAccessContents.schedule(); } } }; restoreDialogEntriesJob.schedule(); } }
Source:
<code>public SonarLintJobManager(Project project) { this.messageBus = project.getMessageBus(); myProject = project; Application application = ApplicationManager.getApplication(); <START> application.getMessageBus().connect(this).subscribe(ProjectManager.TOPIC, this); <END> }</code><technical_language>call myProject.getMessageBus() instead ? this simplify projectClosing (no need check if project parameter equals myProject)</technical_language>

Target:
public SonarLintJobManager(Project project) { this.messageBus = project.getMessageBus(); myProject = project; project.getMessageBus().connect().subscribe(ProjectManager.TOPIC, new ProjectManagerListener() { @Override public void projectOpened(@NotNull Project project) { if (myProject == project) { executor.shutdownNow(); } } }); }
Source:
<code>StartupConfiguration(Supplier<NodeContext> nodeContextSupplier, boolean unConfigured, boolean repairMode, ClassLoader classLoader, PathResolver pathResolver, IParameterSubstitutor substitutor, ObjectMapperFactory objectMapperFactory) { this.nodeContextSupplier = requireNonNull(nodeContextSupplier); this.unConfigured = unConfigured; this.repairMode = repairMode; this.classLoader = requireNonNull(classLoader); this.pathResolver = requireNonNull(pathResolver); this.substitutor = requireNonNull(substitutor); this.objectMapper = objectMapperFactory.create(); this.groupPortMapper = ManagedServiceLoader.loadServices(GroupPortMapper.class, GroupPortMapper.class.getClassLoader()) <START> .stream().findFirst().get(); <END> }</code><technical_language>re-using existing Sservice Classloader is this class (classLoader ) ? add service, this is in DynamicConfigConfigurationProvider: private ClassLoader getServiceClassLoader() { return ServerEnv.getServer().getServiceClassLoader(getClass().getClassLoader(), DynamicConfigExtension.class, LicenseService.class); }</technical_language>

Target:
StartupConfiguration(Supplier<NodeContext> nodeContextSupplier, boolean unConfigured, boolean repairMode, ClassLoader classLoader, PathResolver pathResolver, IParameterSubstitutor substitutor, ObjectMapperFactory objectMapperFactory) { this.nodeContextSupplier = requireNonNull(nodeContextSupplier); this.unConfigured = unConfigured; this.repairMode = repairMode; this.classLoader = requireNonNull(classLoader); this.pathResolver = requireNonNull(pathResolver); this.substitutor = requireNonNull(substitutor); this.objectMapper = objectMapperFactory.create(); this.groupPortMapper = ManagedServiceLoader.loadServices(GroupPortMapper.class, this.classLoader).stream().findFirst().get(); }
Source:
<code><START> public static boolean isIgnored(IPath path) throws IOException { <END> RepositoryMapping mapping = RepositoryMapping.getMapping(path); if (mapping == null) return true; Repository repository = mapping.getRepository(); String repoRelativePath = mapping.getRepoRelativePath(path); TreeWalk walk = new TreeWalk(repository); walk.addTree(new FileTreeIterator(repository)); walk.setFilter(PathFilter.create(repoRelativePath)); while (walk.next()) { WorkingTreeIterator workingTreeIterator = walk.getTree(0, WorkingTreeIterator.class); if (walk.getPathString().equals(repoRelativePath)) return workingTreeIterator.isEntryIgnored(); if (workingTreeIterator.getEntryFileMode().equals(FileMode.TREE)) walk.enterSubtree(); } return false; }</code><technical_language>Putting in this class API right? If yes, needs @since. put in a class in internal package</technical_language>

Target:
public static boolean isIgnored(IPath path) throws IOException { RepositoryMapping mapping = RepositoryMapping.getMapping(path); if (mapping == null) return true; Repository repository = mapping.getRepository(); String repoRelativePath = mapping.getRepoRelativePath(path); TreeWalk walk = new TreeWalk(repository); try { walk.addTree(new FileTreeIterator(repository)); walk.setFilter(PathFilter.create(repoRelativePath)); while (walk.next()) { WorkingTreeIterator workingTreeIterator = walk.getTree(0, WorkingTreeIterator.class); if (walk.getPathString().equals(repoRelativePath)) return workingTreeIterator.isEntryIgnored(); if (workingTreeIterator.getEntryFileMode() .equals(FileMode.TREE)) walk.enterSubtree(); } } finally { walk.release(); } return false; }
Source:
<code>protected int verifyDataOnly(SimpleBinaryByteBuffer inBuffer) { try { inBuffer.flip(); if (logger.isDebugEnabled()) { logger.debug("{} - Verifying data, lenght={} bytes", toString(), inBuffer.limit()); } int receivedID = inBuffer.get(); inBuffer.rewind(); SimpleBinaryMessage itemData = SimpleBinaryProtocol.decompileData(inBuffer, itemsConfig, deviceName, true); if (itemData != null) { return receivedID; } } catch (Exception ex) { logger.error("{} - Verify data error: {}", toString(), ex.getMessage()); } finally { try { inBuffer.compact(); if (logger.isDebugEnabled()) { logger.debug("{} - Verify data OK, lenght={} bytes", toString(), inBuffer.position()); } } catch (ModeChangeException e) { <START> <END> } } return -1; }</code><technical_language>Need handle this exception</technical_language>

Target:
protected SimpleBinaryMessage verifyDataOnly(SimpleBinaryByteBuffer inBuffer) { try { inBuffer.flip(); if (logger.isDebugEnabled()) { logger.debug("{} - Verifying data, lenght={} bytes", toString(), inBuffer.limit()); } byte receivedID = inBuffer.get(); inBuffer.rewind(); SimpleBinaryMessage itemData = SimpleBinaryProtocol.decompileData(inBuffer, itemsConfig, deviceName, true); if (itemData != null) { return itemData; } } catch (Exception ex) { logger.error("{} - Verify data error: {}", toString(), ex.getMessage()); } finally { try { inBuffer.compact(); if (logger.isDebugEnabled()) { logger.debug("{} - Verify data OK, lenght={} bytes", toString(), inBuffer.position()); } } catch (ModeChangeException ex) { logger.error("{} - Bad operation: {}", this.toString(), ex.getMessage()); } } return null; }
Source:
<code>private static String computeWWWAuthenticateHeaderValue(Map<String, String> parameters) { final StringBuilder wwwAuthenticate = new StringBuilder(); wwwAuthenticate.append("Bearer"); if (!parameters.isEmpty()) { wwwAuthenticate.append(" "); int i = 0; for (Map.Entry<String, String> entry : parameters.entrySet()) { wwwAuthenticate.append(entry.getKey()).append("=\"").append(entry.getValue()).append("\""); <START> if (i != parameters.size() - 1) { <END> wwwAuthenticate.append(", "); } i++; } } return wwwAuthenticate.toString(); }</code><technical_language>Please outdent this match line it. is a reason I missed</technical_language>

Target:
private static String computeWWWAuthenticateHeaderValue(Map<String, String> parameters) { StringBuilder wwwAuthenticate = new StringBuilder(); wwwAuthenticate.append("Bearer"); if (!parameters.isEmpty()) { wwwAuthenticate.append(" "); int i = 0; for (Map.Entry<String, String> entry : parameters.entrySet()) { wwwAuthenticate.append(entry.getKey()).append("=\"").append(entry.getValue()).append("\""); if (i != parameters.size() - 1) { wwwAuthenticate.append(", "); } i++; } } return wwwAuthenticate.toString(); }
Source:
<code>public List<APIObject> getEarlyStoppingCriteria() { <START> return Utils.mergeIntoList(new ArrayList<APIObject>(), this.get("early_stopping_criteria"), APIObject.class); <END> }</code><technical_language>this a more specific type</technical_language>

Target:
public List<TrainingMonitorStoppingCriteria> getEarlyStoppingCriteria() { return Utils.mergeIntoList( new ArrayList<TrainingMonitorStoppingCriteria>(), this.get("early_stopping_criteria"), TrainingMonitorStoppingCriteria.class ); }
Source:
<code>public JeeConfigurer<H> mappableAuthorities(String... mappableRoles) { this.mappableRoles.clear(); <START> this.mappableRoles.addAll(Arrays.asList(mappableRoles)); <END> return this; }</code><technical_language>This allocates additional object is preferred in turn need garbage collected</technical_language>

Target:
public JeeConfigurer<H> mappableAuthorities(String... mappableRoles) { this.mappableRoles.clear(); for (String role : mappableRoles) { this.mappableRoles.add(role); } return this; }
Source:
<code>public RollupCollector(CollectorConfig collectorConfig, Schema schema) { <START> _keySize = schema.getColumnNames().size() - schema.getMetricNames().size(); <END> _valueSize = schema.getMetricNames().size(); _keyColumns = new String[_keySize]; _valueColumns = new String[_valueSize]; _valueAggregators = new ValueAggregator[_valueSize]; _metricFieldSpecs = new MetricFieldSpec[_valueSize]; Map<String, ValueAggregatorFactory.ValueAggregatorType> aggregatorTypeMap = collectorConfig.getAggregatorTypeMap(); if (aggregatorTypeMap == null) { aggregatorTypeMap = Collections.emptyMap(); } int valIdx = 0; int keyIdx = 0; for (FieldSpec fieldSpec : schema.getAllFieldSpecs()) { if (!fieldSpec.isVirtualColumn()) { String name = fieldSpec.getName(); if (fieldSpec.getFieldType().equals(FieldSpec.FieldType.METRIC)) { _metricFieldSpecs[valIdx] = (MetricFieldSpec) fieldSpec; _valueColumns[valIdx] = name; _valueAggregators[valIdx] = ValueAggregatorFactory.getValueAggregator( aggregatorTypeMap.getOrDefault(name, ValueAggregatorFactory.ValueAggregatorType.SUM).toString()); valIdx++; } else { _keyColumns[keyIdx++] = name; } } } }</code><technical_language>So, include virtual columns here</technical_language>

Target:
public RollupCollector(CollectorConfig collectorConfig, Schema schema) { int keySize = 0; int valueSize = 0; for (FieldSpec fieldSpec : schema.getAllFieldSpecs()) { if (!fieldSpec.isVirtualColumn()) { if (fieldSpec.getFieldType() == FieldSpec.FieldType.METRIC) { valueSize ++; } else { keySize ++; } } } _keySize = keySize; _valueSize = valueSize; _keyColumns = new String[_keySize]; _valueColumns = new String[_valueSize]; _valueAggregators = new ValueAggregator[_valueSize]; Map<String, ValueAggregatorFactory.ValueAggregatorType> aggregatorTypeMap = collectorConfig.getAggregatorTypeMap(); if (aggregatorTypeMap == null) { aggregatorTypeMap = Collections.emptyMap(); } int valIdx = 0; int keyIdx = 0; for (FieldSpec fieldSpec : schema.getAllFieldSpecs()) { if (!fieldSpec.isVirtualColumn()) { String name = fieldSpec.getName(); if (fieldSpec.getFieldType() == FieldSpec.FieldType.METRIC) { _valueColumns[valIdx] = name; ValueAggregatorFactory.ValueAggregatorType aggregatorType = aggregatorTypeMap.getOrDefault(name, ValueAggregatorFactory.ValueAggregatorType.SUM); _valueAggregators[valIdx] = ValueAggregatorFactory.getValueAggregator(aggregatorType.toString(), fieldSpec.getDataType()); valIdx++; } else { _keyColumns[keyIdx++] = name; } } } List<String> sortOrder = collectorConfig.getSortOrder(); if (CollectionUtils.isNotEmpty(sortOrder)) { _sorter = new GenericRowSorter(sortOrder, schema); } else { _sorter = null; } }