auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { request.setCharacterEncoding("UTF-8"); HttpSession session = request.getSession(false); UserBean user = (session != null) ? (UserBean) session.getAttribute("user") : null; if (user == null) { response.sendError(403); } else { String mainDir = "files"; <START> String saveDir = "uploadLecturesFiles"; <END> String appPath = request.getServletContext().getRealPath(""); String savePath = appPath + File.separator + mainDir + File.separator + saveDir; String fileName = null, filePath = ""; for (Part part : request.getParts()) { String name = part.getName(); if (name.equals("upload")) { fileName = extractFileName(part); if (!fileName.isEmpty()) { filePath = saveDir + File.separator + fileName; part.write(savePath + File.separator + fileName); } } } String subject = request.getParameter("subject").trim(); String title = request.getParameter("title").trim(); String body = request.getParameter("body").trim(); LecturesBean bean = new LecturesBean(user.getId(), subject, title, body, filePath); if (LecturesDAO.insert(bean)) { session.setAttribute("status", "success"); session.setAttribute("message", "Lecture has been added"); } else { session.setAttribute("status", "danger"); session.setAttribute("message", "Some troubles were occurred during creating a lecture"); } response.sendRedirect(request.getContextPath() + "/lectures"); } }</code><technical_language>Please, add indent highlight blocks avoid mess in code</technical_language>

Target:
protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { HttpSession session = request.getSession(false); UserBean user = (session != null) ? (UserBean) session.getAttribute("user") : null; if (user == null) { response.sendError(403); } else { String mainDir = "files"; String saveDir = "uploadLecturesFiles"; String appPath = request.getServletContext().getRealPath(""); String savePath = appPath + File.separator + mainDir + File.separator + saveDir; String fileName = null, filePath = ""; for (Part part : request.getParts()) { String name = part.getName(); if (name.equals("upload")) { fileName = extractFileName(part); if (!fileName.isEmpty()) { filePath = saveDir + File.separator + fileName; part.write(savePath + File.separator + fileName); } } } String subject = request.getParameter("subject").trim(); String title = request.getParameter("title").trim(); String body = request.getParameter("body").trim(); LecturesBean bean = new LecturesBean(user.getId(), subject, title, body, filePath); if (LecturesDAO.insert(bean)) { session.setAttribute("status", "success"); session.setAttribute("message", "Lecture has been added"); } else { session.setAttribute("status", "danger"); session.setAttribute("message", "Some troubles were occurred during creating a lecture"); } response.sendRedirect(request.getContextPath() + "/lectures"); } }
Source:
<code>public List<String> validatePassthroughVnics(Guid vmId, Guid hostId, List<VmNetworkInterface> vnics) { List<VmNetworkInterface> pluggedPassthroughVnics = getPluggedPassthroughVnics(vnics); if (pluggedPassthroughVnics.isEmpty()) { return Collections.emptyList(); } Map<Guid, Map<Guid, String>> hostToVnicToVfMap = vmToHostToVnicToVfMap.get(vmId); if (hostToVnicToVfMap == null) { hostToVnicToVfMap = new HashMap<>(); vmToHostToVnicToVfMap.put(vmId, hostToVnicToVfMap); } Map<Guid, List<String>> nicToUsedVfs = new HashMap<>(); Map<Guid, VdsNetworkInterface> fetchedNics = new HashMap<>(); List<String> problematicVnics = new ArrayList<>(); List<HostNicVfsConfig> vfsConfigs = vfsConfigHelper.getHostNicVfsConfigsWithNumVfsDataByHostId(hostId); Map<Guid, String> vnicToVfMap = new HashMap<>(); hostToVnicToVfMap.put(hostId, vnicToVfMap); <START> for (final VmNetworkInterface vnic : pluggedPassthroughVnics) { String freeVf = null; freeVf = findFreeVfForVnic(vfsConfigs, <END> nicToUsedVfs, fetchedNics, vnic.getNetworkName() == null ? null : networkDao.getByName(vnic.getNetworkName()), vnic.getVmId(), true); if (freeVf == null || shouldBeDirectlyAttached(freeVf, vmId)) { problematicVnics.add(vnic.getName()); } else { vnicToVfMap.put(vnic.getId(), freeVf); } } return problematicVnics; }</code><technical_language>pleas merge definition initialization of freeVf variable</technical_language>

Target:
public List<String> validatePassthroughVnics(Guid vmId, Guid hostId, List<VmNetworkInterface> vnics) { List<VmNetworkInterface> pluggedPassthroughVnics = getPluggedPassthroughVnics(vnics); if (pluggedPassthroughVnics.isEmpty()) { return Collections.emptyList(); } Map<Guid, Map<Guid, String>> hostToVnicToVfMap = vmToHostToVnicToVfMap.get(vmId); if (hostToVnicToVfMap == null) { hostToVnicToVfMap = new HashMap<>(); vmToHostToVnicToVfMap.put(vmId, hostToVnicToVfMap); } Map<Guid, List<String>> nicToUsedVfs = new HashMap<>(); Map<Guid, VdsNetworkInterface> fetchedNics = new HashMap<>(); List<String> problematicVnics = new ArrayList<>(); List<HostNicVfsConfig> vfsConfigs = networkDeviceHelper.getHostNicVfsConfigsWithNumVfsDataByHostId(hostId); Map<Guid, String> vnicToVfMap = new HashMap<>(); hostToVnicToVfMap.put(hostId, vnicToVfMap); for (final VmNetworkInterface vnic : pluggedPassthroughVnics) { String freeVf = null; freeVf = findFreeVfForVnic(vfsConfigs, nicToUsedVfs, fetchedNics, vnic.getNetworkName() == null ? null : networkDao.getByName(vnic.getNetworkName()), vnic.getVmId(), true); if (freeVf == null) { problematicVnics.add(vnic.getName()); } else { vnicToVfMap.put(vnic.getId(), freeVf); } } return problematicVnics; }
Source:
<code>protected CommandBase(T parameters, CommandContext cmdContext) { if (cmdContext == null) { cmdContext = new CommandContext().setEngineContext(new EngineContext(parameters.getSessionId())) <START> .setExecutionContext(new ExecutionContext()); <END> } this.context = cmdContext; _parameters = parameters; DbUser user = SessionDataContainer.getInstance().getUser(cmdContext.getEngineContext().getSessionId(), true); if (user != null) { setCurrentUser(user); } ExecutionContext executionContext = cmdContext.getExecutionContext(); if (executionContext.getJob() != null) { setJobId(executionContext.getJob().getId()); } else if (executionContext.getStep() != null) { setJobId(executionContext.getStep().getJobId()); } Guid commandIdFromParameters = parameters.getCommandId(); if (commandIdFromParameters == null) { commandIdFromParameters = Guid.newGuid(); getParameters().setCommandId(commandIdFromParameters); } commandId = commandIdFromParameters; taskHandlers = initTaskHandlers(); setCorrelationId(parameters.getCorrelationId()); }</code><technical_language>new CommandContext() sets some execution context context default? also, I avoid setEngineContext if possible, this in constructor of CommandContext, for reasons is setContext()</technical_language>

Target:
protected CommandBase(T parameters, CommandContext cmdContext) { if (cmdContext == null) { cmdContext = new CommandContext(new EngineContext().setSessionId(parameters.getSessionId())) .setExecutionContext(new ExecutionContext()); } this.context = cmdContext; _parameters = parameters; DbUser user = SessionDataContainer.getInstance().getUser(cmdContext.getEngineContext().getSessionId(), true); if (user != null) { setCurrentUser(user); } ExecutionContext executionContext = cmdContext.getExecutionContext(); if (executionContext.getJob() != null) { setJobId(executionContext.getJob().getId()); } else if (executionContext.getStep() != null) { setJobId(executionContext.getStep().getJobId()); } Guid commandIdFromParameters = parameters.getCommandId(); if (commandIdFromParameters == null) { commandIdFromParameters = Guid.newGuid(); getParameters().setCommandId(commandIdFromParameters); } commandId = commandIdFromParameters; taskHandlers = initTaskHandlers(); setCorrelationId(parameters.getCorrelationId()); }
Source:
<code>public void initialize(DataManager manager, ARXConfiguration config){ <START> if (config != null) { <END> return; } if (beta < 0) { ParameterCalculation pCalc = null; try { pCalc = new ParameterCalculation(epsilon, delta); } catch (IntervalArithmeticException e) { throw new RuntimeException(e); } beta = pCalc.getBeta(); k = pCalc.getK(); } if (subset == null || initialized) { Random random; if (deterministic) { random = new Random(0xDEADBEEF); } else { random = new SecureRandom(); } Set<Integer> subsetIndices = new HashSet<Integer>(); int numRecords = manager.getDataGeneralized().getDataLength(); for (int i = 0; i < numRecords; ++i) { if (random.nextDouble() < beta) { subsetIndices.add(i); } } this.subset = DataSubset.create(numRecords, subsetIndices); } initialized = true; }</code><technical_language>this is privacy model dynamically constructs a subset, need call this method twice. This is call ignored</technical_language>

Target:
public void initialize(DataManager manager, ARXConfiguration config){ if (config != null) { return; } if (beta < 0) { ParameterCalculation pCalc = null; try { pCalc = new ParameterCalculation(epsilon, delta); } catch (IntervalArithmeticException e) { throw new RuntimeException(e); } beta = pCalc.getBeta(); k = pCalc.getK(); } if (subset == null || initialized) { Random random = deterministic ? new Random(0xDEADBEEF) : new SecureRandom(); Set<Integer> subsetIndices = new HashSet<Integer>(); int numRecords = manager.getDataGeneralized().getDataLength(); for (int i = 0; i < numRecords; ++i) { if (random.nextDouble() < beta) { subsetIndices.add(i); } } this.subset = DataSubset.create(numRecords, subsetIndices); } initialized = true; }
Source:
<code>private Set<EnrichedThingDTO> convertToListBean(Collection<Thing> things, Locale locale) { Set<EnrichedThingDTO> thingBeans = new LinkedHashSet<>(); for (Thing thing : things) { EnrichedThingDTO thingBean = EnrichedThingDTOMapper.map(thing, uriInfo.getBaseUri(), locale, <START> getLinkedItemsMap(thing), thingStatusInfoI18nLocalizationService); <END> thingBeans.add(thingBean); } return thingBeans; }</code><technical_language>providing thingStatusInfoI18nLocalizationService.getLocalizedThingStatusInfo(thing, locale) a parameter? Mapper require service itself, I prefer local this class here</technical_language>

Target:
private Set<EnrichedThingDTO> convertToListBean(Collection<Thing> things, Locale locale) { Set<EnrichedThingDTO> thingBeans = new LinkedHashSet<>(); for (Thing thing : things) { ThingStatusInfo thingStatusInfo = thingStatusInfoI18nLocalizationService.getLocalizedThingStatusInfo(thing, locale); EnrichedThingDTO thingBean = EnrichedThingDTOMapper.map(thing, thingStatusInfo, getLinkedItemsMap(thing)); thingBeans.add(thingBean); } return thingBeans; }
Source:
<code>public void scrollSelectedCellIntoView_HeaderSelected_WithDeltaXScroll() { when(gridData.getSelectedHeaderCells()).thenReturn(Collections.singletonList(new GridData.SelectedCell(0,0))); when(layer.getVisibleBounds()).thenReturn(new BaseBounds(500, 0, BOUNDS_WIDTH, BOUNDS_HEIGHT)); assertTrue(baseKeyboardOperationSpy.scrollSelectedCellIntoView(gridWidget)); verify(layer, times(1)).getViewport(); <START> verify(viewport, times(1)).getTransform(); <END> }</code><technical_language>.. able assert Transform offset X is correctly set here</technical_language>

Target:
public void scrollSelectedCellIntoView_HeaderSelected_WithDeltaXScroll() { when(gridData.getSelectedHeaderCells()).thenReturn(Collections.singletonList(new GridData.SelectedCell(0,0))); when(layer.getVisibleBounds()).thenReturn(new BaseBounds(600, 0, BOUNDS_WIDTH, BOUNDS_HEIGHT)); assertTrue(baseKeyboardOperationSpy.scrollSelectedCellIntoView(gridWidget)); verify(layer, times(1)).getViewport(); verify(viewport, times(1)).getTransform(); verify(transform, times(1)).scale(1, 1); verify(transform, times(1)).translate(600, 0); }
Source:
<code>public static String[] getPluginConfiguration(MavenProject proj, String pluginGroupId, String pluginArtifactId, String key1, String key2, String childName) { Xpp3Dom dom = proj.getGoalConfiguration(pluginGroupId, pluginArtifactId, null, null); if (dom != null) { Xpp3Dom val1 = dom.getChild(key1); if (val1 != null) { Xpp3Dom val2 = null; if (key2 == null) { val2 = val1; } else { val2 = val1.getChild(key2); } if (val2 != null) { Xpp3Dom[] children = null; <START> if (childName == null) children = val2.getChildren(); else children = val2.getChildren(childName); <END> if (children != null) { String[] result = new String[children.length]; for (int i = 0; i < children.length; i++) { result[i] = children[i].getValue(); } return result; } return null; } } } return null; }</code><technical_language>For consistency rest of code, brackets in this if/else clause e.g. if (childName == null) { children = val2.getChildren(); } else { children = val2.getChildren(childName); }</technical_language>

Target:
public static String[] getPluginConfiguration(MavenProject proj, String pluginGroupId, String pluginArtifactId, String key1, String key2, String childName) { Xpp3Dom dom = proj.getGoalConfiguration(pluginGroupId, pluginArtifactId, null, null); if (dom != null) { Xpp3Dom val1 = dom.getChild(key1); if (val1 != null) { Xpp3Dom val2 = null; if (key2 == null) { val2 = val1; } else { val2 = val1.getChild(key2); } if (val2 != null) { Xpp3Dom[] children = null; if (childName == null) { children = val2.getChildren(); } else { children = val2.getChildren(childName); } if (children != null) { String[] result = new String[children.length]; for (int i = 0; i < children.length; i++) { result[i] = children[i].getValue(); } return result; } return null; } } } return null; }
Source:
<code>public void registerClassDefinitions(Collection<ClassDefinition> classDefinitions, boolean checkClassDefErrors) { Map<Integer, Map<Integer, ClassDefinition>> factoryMap = createHashMap(classDefinitions.size()); for (ClassDefinition cd : classDefinitions) { int factoryId = cd.getFactoryId(); Map<Integer, ClassDefinition> classDefMap = factoryMap.computeIfAbsent(factoryId, k -> new HashMap<>()); if (classDefMap.containsKey(cd.getClassId())) { throw new HazelcastSerializationException("Duplicate registration found for factory-id : " + factoryId + ", class-id " + cd.getClassId()); } <START> classDefMap.put(factoryId, cd); <END> } for (ClassDefinition classDefinition : classDefinitions) { registerClassDefinition(classDefinition, factoryMap, checkClassDefErrors); } }</code><technical_language>this cd.getClassId()</technical_language>

Target:
public void registerClassDefinitions(Collection<ClassDefinition> classDefinitions, boolean checkClassDefErrors) { Map<Integer, Map<Integer, ClassDefinition>> factoryMap = createHashMap(classDefinitions.size()); for (ClassDefinition cd : classDefinitions) { int factoryId = cd.getFactoryId(); Map<Integer, ClassDefinition> classDefMap = factoryMap.computeIfAbsent(factoryId, k -> new HashMap<>()); int classId = cd.getClassId(); if (classDefMap.containsKey(classId)) { throw new HazelcastSerializationException("Duplicate registration found for factory-id : " + factoryId + ", class-id " + classId); } classDefMap.put(classId, cd); } for (ClassDefinition classDefinition : classDefinitions) { registerClassDefinition(classDefinition, factoryMap, checkClassDefErrors); } }
Source:
<code>protected InterfaceList parseInterfaceList(String interfaceListName) throws TypeImportException, XMLStreamException { InterfaceList interfaceList = LibraryElementFactory.eINSTANCE.createInterfaceList(); final String inputEventListName = getEventInputElement(); final String outputEventListName = getEventOutputElement(); processChildren(interfaceListName, name -> { if <START> (name.equals(inputEventListName)) <END> { parseEventList(interfaceList.getEventInputs(), inputEventListName, true); } else if (name.equals(outputEventListName)) { parseEventList(interfaceList.getEventOutputs(), outputEventListName, false); } else { switch (name) { case LibraryElementTags.INPUT_VARS_ELEMENT: parseVariableList(LibraryElementTags.INPUT_VARS_ELEMENT, interfaceList.getInputVars()); interfaceList.getInputVars().forEach(v -> { variables.put(v.getName(), v); v.setIsInput(true); }); break; case LibraryElementTags.OUTPUT_VARS_ELEMENT: parseVariableList(LibraryElementTags.OUTPUT_VARS_ELEMENT, interfaceList.getOutputVars()); interfaceList.getOutputVars().forEach(v -> variables.put(v.getName(), v)); break; case LibraryElementTags.SOCKETS_ELEMENT: parseAdapterList(interfaceList.getSockets(), LibraryElementTags.SOCKETS_ELEMENT, true); break; case LibraryElementTags.PLUGS_ELEMENT: parseAdapterList(interfaceList.getPlugs(), LibraryElementTags.PLUGS_ELEMENT, false); break; default: return false; } } return true; }); processWiths(); return interfaceList; }</code><technical_language>call equals constant</technical_language>

Target:
protected InterfaceList parseInterfaceList(String interfaceListName) throws TypeImportException, XMLStreamException { InterfaceList interfaceList = LibraryElementFactory.eINSTANCE.createInterfaceList(); final String inputEventListName = getEventInputElement(); final String outputEventListName = getEventOutputElement(); processChildren(interfaceListName, name -> { if (inputEventListName.equals(name)) { parseEventList(interfaceList.getEventInputs(), inputEventListName, true); } else if (outputEventListName.equals(name)) { parseEventList(interfaceList.getEventOutputs(), outputEventListName, false); } else { switch (name) { case LibraryElementTags.INPUT_VARS_ELEMENT: parseVariableList(LibraryElementTags.INPUT_VARS_ELEMENT, interfaceList.getInputVars()); interfaceList.getInputVars().forEach(v -> { variables.put(v.getName(), v); v.setIsInput(true); }); break; case LibraryElementTags.OUTPUT_VARS_ELEMENT: parseVariableList(LibraryElementTags.OUTPUT_VARS_ELEMENT, interfaceList.getOutputVars()); interfaceList.getOutputVars().forEach(v -> variables.put(v.getName(), v)); break; case LibraryElementTags.SOCKETS_ELEMENT: parseAdapterList(interfaceList.getSockets(), LibraryElementTags.SOCKETS_ELEMENT, true); break; case LibraryElementTags.PLUGS_ELEMENT: parseAdapterList(interfaceList.getPlugs(), LibraryElementTags.PLUGS_ELEMENT, false); break; default: return false; } } return true; }); processWiths(); return interfaceList; }
Source:
<code>public String prettyMessages() { <START> StringBuffer message = new StringBuffer(); <END> for(String m: messages) { message.append(m); message.append("\n"); } return message.toString(); }</code><technical_language>StringBuilder instead. StringBuffer is thread safe (and slower)</technical_language>

Target:
public String prettyMessages() { return Strings.join(messages, "\n"); }
Source:
<code>boolean update(long timestamp, String taskName) { final long preWatermarkTime = watermarkTime; <START> if (taskName != null) { <END> timestamps.put(taskName, timestamp); } if (timestamps.size() == expectedTotal) { Optional<Long> min = timestamps.values().stream().min(Long::compare); watermarkTime = min.orElse(timestamp); } return preWatermarkTime != watermarkTime; }</code><technical_language>taskName null</technical_language>

Target:
synchronized void update(long timestamp, String taskName) { if (taskName != null) { Long ts = timestamps.get(taskName); if (ts != null && ts > timestamp) { LOG.warn(String.format("Incoming watermark %s is smaller than existing watermark %s for upstream task %s", timestamp, ts, taskName)); } else { timestamps.put(taskName, timestamp); } } if (timestamps.size() == expectedTotal) { Optional<Long> min = timestamps.values().stream().min(Long::compare); watermarkTime = min.orElse(timestamp); } }
Source:
<code>private Boolean doAbandonChange(final String message, final Change change, final PatchSet.Id psid, final ChangeMessage cm, final ReviewDb db, final Transaction txn) throws OrmException { if (change.getStatus() == Change.Status.NEW && change.currentPatchSetId().equals(psid)) { change.setStatus(Change.Status.ABANDONED); ChangeUtil.updated(change); <START> final ReviewDb schema = Common.getSchemaFactory().open(); <END> final List<ChangeApproval> approvals = schema.changeApprovals().byChange(change.getId()).toList(); for (ChangeApproval a : approvals) { a.cache(change); } schema.changeApprovals().update(approvals, txn); db.changeMessages().insert(Collections.singleton(cm), txn); db.changes().update(Collections.singleton(change), txn); return Boolean.TRUE; } return Boolean.FALSE; }</code><technical_language>whoa, a database connection handle passed "db", opening a new connection handle</technical_language>

Target:
private Boolean doAbandonChange(final String message, final Change change, final PatchSet.Id psid, final ChangeMessage cm, final ReviewDb db, final Transaction txn) throws OrmException { if (change.getStatus() == Change.Status.NEW && change.currentPatchSetId().equals(psid)) { change.setStatus(Change.Status.ABANDONED); ChangeUtil.updated(change); final List<ChangeApproval> approvals = db.changeApprovals().byChange(change.getId()).toList(); for (ChangeApproval a : approvals) { a.cache(change); } db.changeApprovals().update(approvals, txn); db.changeMessages().insert(Collections.singleton(cm), txn); db.changes().update(Collections.singleton(change), txn); return Boolean.TRUE; } return Boolean.FALSE; }
Source:
<code>public int archiveWorkflows(DateTime olderThan, int batchSize) { Assert.notNull(olderThan, "olderThan must not be null"); Assert.isTrue(batchSize > 0, "batchSize must be greater than 0"); archiveDao.ensureValidArchiveTablesExist(); log.info("Archiving starting. Archiving passive workflows older than {}, in batches of {}.", olderThan, batchSize); StopWatch stopWatch = new StopWatch(); stopWatch.start(); List<Integer> workflowIds; int archivedWorkflows = 0; do { workflowIds = archiveDao.listArchivableWorkflows(olderThan, batchSize); if (workflowIds.isEmpty()) { break; } archiveDao.archiveWorkflows(workflowIds); archivedWorkflows += workflowIds.size(); double timeDiff = stopWatch.getTime() / 1000.0; <START> log.debug("Archived workflows. workflows / second. Workflow ids: {}. ", workflowIds.size(), archivedWorkflows <END> / timeDiff, workflowIds); } while (!workflowIds.isEmpty()); log.info("Archiving finished. Archived workflows.", archivedWorkflows); return archivedWorkflows; }</code><technical_language>nice, if archiving "hello" periodically (info-level). For example, report total number of deleted (root) workflow instances in next iteration 1 minute elapsed previous "hello". strengthen trust long archiving process need monitor database</technical_language>

Target:
public int archiveWorkflows(DateTime olderThan, int batchSize) { Assert.notNull(olderThan, "olderThan must not be null"); Assert.isTrue(batchSize > 0, "batchSize must be greater than 0"); archiveDao.ensureValidArchiveTablesExist(); log.info("Archiving starting. Archiving passive workflows older than {}, in batches of {}.", olderThan, batchSize); StopWatch stopWatch = new StopWatch(); stopWatch.start(); List<Integer> rootWorkflowIds; PeriodicLogger periodicLogger = new PeriodicLogger(log, 60); int archivedRootWorkflows = 0; int archivedWorkflows = 0; do { rootWorkflowIds = archiveDao.listArchivableRootWorkflows(olderThan, batchSize); if (rootWorkflowIds.isEmpty()) { break; } archivedWorkflows += archiveDao.archiveRootWorkflows(rootWorkflowIds); archivedRootWorkflows += rootWorkflowIds.size(); double timeDiff = stopWatch.getTime() / 1000.0; log.debug("Archived workflow trees. workflow trees / second. Root workflow ids: {}. ", rootWorkflowIds.size(), archivedRootWorkflows / timeDiff, rootWorkflowIds); periodicLogger.log("Archived workflow trees and workflow instances (incl. child workflows) so far. " + "Archiving about workflow trees / second and workflow instances / second.", archivedRootWorkflows, archivedWorkflows, archivedRootWorkflows / timeDiff, archivedWorkflows / timeDiff); } while (!rootWorkflowIds.isEmpty()); log.info("Archiving finished. Archived workflow trees and workflow instances (incl. child workflows).", archivedRootWorkflows, archivedWorkflows); return archivedRootWorkflows; }
Source:
<code>public GradleInstallation[] getInstallations() { <START> return Jenkins.getActiveInstance().getDescriptorByType(Gradle.DescriptorImpl.class).getInstallations(); <END> }</code><technical_language>injected field static lookup if field is null? This logic extracted a getGradleDescriptor method</technical_language>

Target:
public GradleInstallation[] getInstallations() { return getGradleDescriptor().getInstallations(); }
Source:
<code>public void resendPhoneVerificationInvalid() { Identifier identifier = new Identifier(null, (Phone)null); <START> service.resendVerification(ChannelType.EMAIL, identifier); <END> }</code><technical_language>Minor: ChannelType.PHONE</technical_language>

Target:
public void resendPhoneVerificationInvalid() throws Exception { AccountId accountId = BridgeObjectMapper.get().readValue("{}", AccountId.class); service.resendVerification(ChannelType.PHONE, accountId); }
Source:
<code>public Iterator<K> iterator() { if (samIterator != null) { <START> throw new IllegalStateException("Cannot call iterator() more than once on SamLocusIterator"); <END> } CloseableIterator<SAMRecord> tempIterator; if (intervals != null) { tempIterator = new SamRecordIntervalIteratorFactory().makeSamRecordIntervalIterator(samReader, intervals, useIndex); } else { tempIterator = samReader.iterator(); } if (samFilters != null) { tempIterator = new FilteringSamIterator(tempIterator, new AggregateFilter(samFilters)); } samIterator = new PeekableIterator<>(tempIterator); return this; }</code><technical_language>fix error message. this a SamLocusIterator</technical_language>

Target:
public Iterator<K> iterator() { if (samIterator != null) { throw new IllegalStateException("Cannot call iterator() more than once on " + this.getClass().getSimpleName()); } CloseableIterator<SAMRecord> tempIterator; if (intervals != null) { tempIterator = new SamRecordIntervalIteratorFactory().makeSamRecordIntervalIterator(samReader, intervals, useIndex); } else { tempIterator = samReader.iterator(); } if (samFilters != null) { tempIterator = new FilteringSamIterator(tempIterator, new AggregateFilter(samFilters)); } samIterator = new PeekableIterator<>(tempIterator); return this; }
Source:
<code>protected int getMaxVolumeChain() { return <START> Config.<Integer> <END> getValue(ConfigValues.MaxImagesInChain); }</code><technical_language><Integer> omitted</technical_language>

Target:
protected int getMaxVolumeChain() { return Config.getValue(ConfigValues.MaxImagesInChain); }
Source:
<code>public void shutdown() { ExecutorService executor; ExecutorService secondaryExecutor; boolean shutdown; synchronized (this) { executor = this.executor; secondaryExecutor = this.secondaryExecutor; shutdown = !this.detachExecutor; this.executor = null; } if (shutdown) { <START> if (executor != null) { <END> executor.shutdownNow(); } if (secondaryExecutor != null) { secondaryExecutor.shutdownNow(); } } }</code><technical_language>Is intended, reset this.secondaryExecutor = null</technical_language>

Target:
public void shutdown() { ExecutorService executor; ExecutorService secondaryExecutor; boolean shutdown; synchronized (this) { executor = this.executor; secondaryExecutor = this.secondaryExecutor; shutdown = !this.detachExecutor; this.executor = null; this.secondaryExecutor = null; } if (shutdown) { if (executor != null) { executor.shutdownNow(); } if (secondaryExecutor != null) { secondaryExecutor.shutdownNow(); } } }
Source:
<code>public void init() { if (started) { return; } WorkManagerImpl wmi = (WorkManagerImpl) Framework.getRuntime().getComponent("org.nuxeo.ecm.core.work.service"); wmi.active = false; log.debug("Initializing"); synchronized (this) { if (started) { return; } getDescriptors(QUEUES_EP).forEach(d -> categoryToQueueId.put(d.getId(), d.getId())); index(); initTopology(); logManager = getLogManager(); streamManager = getStreamManager(); streamManager.register("SWMDisable", topologyDisabled, settings); <START> streamProcessor = streamManager.registerAndCreateProcessor("SWM", topology, settings); <END> started = true; new ComponentListener().install(); log.info("Initialized"); } }</code><technical_language>Consider full names "SWM" -> "StreamWorkManager" "SWMDisable" -> "StreamWorkManagerDisable"</technical_language>

Target:
public void init() { if (started) { return; } WorkManagerImpl wmi = (WorkManagerImpl) Framework.getRuntime().getComponent("org.nuxeo.ecm.core.work.service"); wmi.active = false; log.debug("Initializing"); synchronized (this) { if (started) { return; } getDescriptors(QUEUES_EP).forEach(d -> categoryToQueueId.put(d.getId(), d.getId())); index(); initTopology(); logManager = getLogManager(); streamManager = getStreamManager(); streamManager.register("StreamWorkManagerDisable", topologyDisabled, settings); streamProcessor = streamManager.registerAndCreateProcessor("StreamWorkManager", topology, settings); started = true; new ComponentListener().install(); log.info("Initialized"); } }
Source:
<code>private boolean areCurrentCoordinatesValid() { final Geopoint current; final String lat = getLatResult(); final String lon = getLonResult(); <START> if (lat.contains("_") || lat.contains("*") || lon.contains("_") || lon.contains("*")) { <END> return false; } final String delimiters = "[ °'\"\\.]+"; final String[] latTokens = lat.split(delimiters); final String[] lonTokens = lon.split(delimiters); try { switch (currentFormat) { case Deg: current = new Geopoint(latTokens[0], latTokens[1], latTokens[2], lonTokens[0], lonTokens[1], lonTokens[2]); break; case Min: current = new Geopoint(latTokens[0], latTokens[1], latTokens[2], latTokens[3], lonTokens[0], lonTokens[1], lonTokens[2], lonTokens[3]); break; case Sec: current = new Geopoint(latTokens[0], latTokens[1], latTokens[2], latTokens[3], latTokens[4], lonTokens[0], lonTokens[1], lonTokens[2], lonTokens[3], lonTokens[4]); break; case Plain: current = new Geopoint(lat, lon); break; default: throw new IllegalStateException("can never happen, keep tools happy"); } if (current.isValid()) { gp = current; return true; } } catch (final Geopoint.ParseException ignored) { } return false; }</code><technical_language>@S-Bartfast this changed other around</technical_language>

Target:
private boolean areCurrentCoordinatesValid() { final Geopoint current; final String lat = getLatResult(); final String lon = getLonResult(); if (currentFormat == null || lat.contains("_") || lat.contains("*") || lon.contains("_") || lon.contains("*")) { return false; } try { current = new Geopoint(lat, lon); if (current.isValid()) { gp = current; return true; } } catch (final Geopoint.ParseException ignored) { } return false; }
Source:
<code>static Block1BlockwiseStatus forOutboundRequest(final Exchange exchange, final Request request, final int preferredBlockSize) { Block1BlockwiseStatus status = new Block1BlockwiseStatus(request.getOptions().getContentFormat()); status.request = request; <START> status.setCurrentSzx(BlockOption.size2Szx(preferredBlockSize)); <END> return status; }</code><technical_language>consider adding this parameter constructor</technical_language>

Target:
static Block1BlockwiseStatus forOutboundRequest(final Exchange exchange, final Request request, final int preferredBlockSize) { Block1BlockwiseStatus status = new Block1BlockwiseStatus(0, request.getOptions().getContentFormat()); status.request = request; status.setCurrentSzx(BlockOption.size2Szx(preferredBlockSize)); return status; }
Source:
<code>protected void apply(String id, Collection<FeaturesLoader.Holder> holders, ThrowableConsumer<FeaturesLoader.Holder, Exception> consumer) { <START> log.trace("Invoke on features: {}", () -> id, () -> formatFeatures(holders)); <END> Supplier<String> msg = () -> String.format("Error while invoking %s on features: %s", id, formatFeatures(holders)); var errors = new ArrayList<Throwable>(); for (FeaturesLoader.Holder each : holders) { try { consumer.accept(each); } catch (AssumptionViolatedException cause) { log.debug("Test ignore by feature: {}", each.type); throw cause; } catch (InterruptedException cause) { Thread.currentThread().interrupt(); throw new AssertionError(msg.get(), cause); } catch (Throwable cause) { log.debug("Error while invoking on feature: {}", id, each.type); errors.add(cause); } } if (!errors.isEmpty()) { var exception = new AssertionError(msg.get()); errors.forEach(exception::addSuppressed); throw exception; } }</code><technical_language>suggestion log.trace("Invoke: features: {}", () -> id, () -> formatFeatures(holders));</technical_language>

Target:
protected void apply(String id, Collection<FeaturesLoader.Holder> holders, ThrowableConsumer<FeaturesLoader.Holder, Exception> consumer) { log.trace("Invoke: on features: {}", () -> id, () -> formatFeatures(holders)); Supplier<String> msg = () -> String.format("Error while invoking %s on features: %s", id, formatFeatures(holders)); var errors = new ArrayList<Throwable>(); for (FeaturesLoader.Holder holder : holders) { try { consumer.accept(holder); } catch (AssumptionViolatedException cause) { log.debug("Test ignored by the feature: {}", holder.type); throw cause; } catch (InterruptedException cause) { Thread.currentThread().interrupt(); throw new RuntimeServiceException(msg.get(), cause); } catch (Throwable cause) { log.debug("Error while invoking: on feature: {}", id, holder.type); throwSeriousError(cause); errors.add(cause); } } if (!errors.isEmpty()) { var exception = new AssertionError(msg.get()); errors.forEach(exception::addSuppressed); throw exception; } }
Source:
<code><START> private void updateBackup() { <END> if (getCurrentStorageItem().getRole() == StorageDomainType.ISO || getCurrentStorageItem().getRole() == StorageDomainType.ImportExport) { isBackup().setIsAvailable(false); isbackup().setEntity(false); return; } boolean backupSupported = (Boolean) AsyncDataProvider.getInstance().getConfigValuePreConverted( ConfigurationValues.BackupSupported, getDataCenter().getSelectedItem().getCompatibilityVersion().toString()); isBackup().setIsAvailable(BackupSupported); if (isBackup().getIsAvailable()) { if (isNewStorage()) { isBackup().setEntity(false); } else { isBackup().setEntity(getStorage().isBackup()); } } }</code><technical_language>Please re-format this method in IDE, I suggest Eclipse code formatter located config/engine-code-format.xml (If IntelliJ IDEA, install "Eclipse Code Formatter" plugin.)</technical_language>

Target:
private void updateBackup() { if (getCurrentStorageItem().getRole() == StorageDomainType.ISO || getCurrentStorageItem().getRole() == StorageDomainType.ImportExport) { isBackup().setIsAvailable(false); isBackup().setEntity(false); return; } boolean backupSupported = (Boolean) AsyncDataProvider.getInstance().getConfigValuePreConverted( ConfigurationValues.BackupSupported, getDataCenter().getSelectedItem().getCompatibilityVersion().toString()); isBackup().setIsAvailable(backupSupported); if (isBackup().getIsAvailable()) { if (isNewStorage()) { isBackup().setEntity(false); } else { isBackup().setEntity(getStorage().isBackup()); } } }
Source:
<code>public CharSeq filter(Predicate<? super Character> predicate) { Objects.requireNonNull(predicate, "predicate is null"); final StringBuilder sb = new StringBuilder(); for (int i = 0; i < back.length(); i++) { final char ch = back.charAt(i); if (predicate.test(ch)) { sb.append(ch); } } if (sb.length() == 0) { return EMPTY; } else if (sb.length() == length()) { return this; } else { return of(sb); <START> } <END> }</code><technical_language>I a special indentation reduce cyclomatic complexity return statement: java return sb.length() == 0 ? EMPTY : sb.length() == length() ? this : of(sb.toString()); formatter handle this sort of whitespace :) if/else if is ok</technical_language>

Target:
public CharSeq filter(Predicate<? super Character> predicate) { Objects.requireNonNull(predicate, "predicate is null"); final StringBuilder sb = new StringBuilder(); for (int i = 0; i < back.length(); i++) { final char ch = get(i); if (predicate.test(ch)) { sb.append(ch); } } if (sb.length() == 0) { return EMPTY; } else if (sb.length() == length()) { return this; } else { return of(sb); } }
Source:
<code>public void setContext(PrincipalRoleMapperContext context) { this.cacheManager = context.getCacheManager(); GlobalConfiguration globalConfiguration = cacheManager.getGlobalComponentRegistry().getGlobalConfiguration(); CacheMode cacheMode = globalConfiguration.isClustered() ? CacheMode.REPL_SYNC : CacheMode.LOCAL; <START> ConfigurationBuilder cfg = new ConfigurationBuilder(); <END> cfg.clustering().cacheMode(cacheMode).sync().stateTransfer().fetchInMemoryState(true).awaitInitialTransfer(false); InternalCacheRegistry internalCacheRegistry = cacheManager.getGlobalComponentRegistry().getComponent(InternalCacheRegistry.class); internalCacheRegistry.registerInternalCache(CLUSTER_ROLE_MAPPER_CACHE, cfg.build(), EnumSet.of(InternalCacheRegistry.Flag.PERSISTENT)); }</code><technical_language>ClusterRegistry disabled authorization for internal caches, longer here. unwanted side effect</technical_language>

Target:
public void setContext(PrincipalRoleMapperContext context) { this.cacheManager = context.getCacheManager(); GlobalConfiguration globalConfiguration = cacheManager.getGlobalComponentRegistry().getGlobalConfiguration(); CacheMode cacheMode = globalConfiguration.isClustered() ? CacheMode.REPL_SYNC : CacheMode.LOCAL; ConfigurationBuilder cfg = new ConfigurationBuilder(); cfg.clustering().cacheMode(cacheMode).sync() .stateTransfer().fetchInMemoryState(true).awaitInitialTransfer(false) .security().authorization().disable(); InternalCacheRegistry internalCacheRegistry = cacheManager.getGlobalComponentRegistry().getComponent(InternalCacheRegistry.class); internalCacheRegistry.registerInternalCache(CLUSTER_ROLE_MAPPER_CACHE, cfg.build(), EnumSet.of(InternalCacheRegistry.Flag.PERSISTENT)); }
Source:
<code><START> protected void handleRemoteServiceSelected(IRemoteConnection conn) throws CoreException { <END> final boolean enabled = fWidgetListener.isEnabled(); fWidgetListener.disable(); try { IRemoteConnectionType selectedConnectionType = getSelectedConnectionType(); if (conn != null) { selectedConnectionType = conn.getConnectionType(); } if (fDefaultConnectionType == null && conn != null) { for (int index = 0; index < fConnectionTypes.size(); index++) { if (fConnectionTypes.get(index).getId().equals(selectedConnectionType.getId())) { fServicesCombo.select(index + 1); break; } } } fConnectionCombo.removeAll(); fConnectionCombo.add(Messages.RemoteConnectionWidget_selectConnection); if (selectedConnectionType == null) { fConnectionCombo.select(0); fConnectionCombo.setEnabled(false); fNewConnectionButton.setEnabled(false); } else { fConnectionCombo.setEnabled(true); int selected = 0; int offset = 1; Set<IRemoteConnection> sorted = new TreeSet<IRemoteConnection>(selectedConnectionType.getConnections()); for (IRemoteConnection s : sorted) { fConnectionCombo.add(s.getName()); if (conn != null && s.getName().equals(conn.getName())) { selected = offset; } offset++; } fConnectionCombo.select(selected); handleConnectionSelected(); fNewConnectionButton .setEnabled((selectedConnectionType.getCapabilities() & IRemoteConnectionType.CAPABILITY_ADD_CONNECTIONS) != 0); } } finally { fWidgetListener.setEnabled(enabled); } }</code><technical_language>I reason throw CoreException here</technical_language>

Target:
protected void handleRemoteServiceSelected(IRemoteConnection conn) { final boolean enabled = fWidgetListener.isEnabled(); fWidgetListener.disable(); try { IRemoteConnectionType selectedConnectionType = getSelectedConnectionType(); if (conn != null) { selectedConnectionType = conn.getConnectionType(); } if (fDefaultConnectionType == null && conn != null) { for (int index = 0; index < fConnectionTypes.size(); index++) { if (fConnectionTypes.get(index).getId().equals(selectedConnectionType.getId())) { fServicesCombo.select(index + 1); break; } } } fConnectionCombo.removeAll(); fConnectionCombo.add(Messages.RemoteConnectionWidget_selectConnection); if (selectedConnectionType == null) { fConnectionCombo.select(0); fConnectionCombo.setEnabled(false); fNewConnectionButton.setEnabled(false); } else { fConnectionCombo.setEnabled(true); int selected = 0; int offset = 1; Set<IRemoteConnection> sorted = new TreeSet<IRemoteConnection>(selectedConnectionType.getConnections()); for (IRemoteConnection s : sorted) { fConnectionCombo.add(s.getName()); if (conn != null && s.getName().equals(conn.getName())) { selected = offset; } offset++; } fConnectionCombo.select(selected); handleConnectionSelected(); fNewConnectionButton .setEnabled((selectedConnectionType.getCapabilities() & IRemoteConnectionType.CAPABILITY_ADD_CONNECTIONS) != 0); } } finally { fWidgetListener.setEnabled(enabled); } }
Source:
<code>public void testPoll() { <START> EasyMock.expect(dbi.withHandle(EasyMock.<HandleCallback>anyObject())).andReturn(testRows); <END> EasyMock.expect(dbi.withHandle(EasyMock.<HandleCallback>anyObject())).andReturn(testRows); EasyMock.replay(dbi); manager.start(); manager.poll(); manager.stop(); }</code><technical_language>append "twice()" expect</technical_language>

Target:
public void testPoll() { EasyMock.expect(dbi.withHandle(EasyMock.<HandleCallback>anyObject())).andReturn(testRows).times(2); EasyMock.replay(dbi); manager.start(); manager.poll(); manager.stop(); }
Source:
<code>public Response getDispoItemsById(@PathParam("fileName") String fileName) { if (!fileName.endsWith(".LIS")) { fileName = <START> fileName.replaceAll("\\.(c|ad[ab])($|\\.).*", <END> ".LIS"); } DispoSet set = dispoApi.getDispoSetById(branch, setId); String fullPath = set.getImportPath() + File.separator + "vcast" + File.separator + fileName; final File result = new File(fullPath); StreamingOutput streamingOutput = new StreamingOutput() { @Override public void write(OutputStream outputStream) throws WebApplicationException { FileInputStream inputStream = null; Writer writer = null; try { inputStream = new FileInputStream(result); writer = new OutputStreamWriter(outputStream, "UTF-8"); int c; while ((c = inputStream.read()) != -1) { writer.write(c); } outputStream.flush(); } catch (IOException ex) { throw new OseeCoreException(ex); } finally { Lib.close(inputStream); Lib.close(writer); } } }; String contentDisposition = String.format("attachment; filename=\"%s\"; creation-date=\"%s\"", fileName, new Date()); return Response.ok(streamingOutput).header("Content-Disposition", contentDisposition).type( "application/text").build(); }</code><technical_language>in VCast allowed ADA file extension are: .ada .ADA .adb .ADB .a .A I suggest cover .ada, adb. planning updating this a case case basis, I advice against</technical_language>

Target:
public Response getDispoItemsById(@PathParam("fileName") String fileName) { if (!fileName.endsWith(".LIS")) { fileName = fileName.replaceAll("\\.(?i)(a|c|ad[ab])($|\\.).*", ".LIS"); } DispoSet set = dispoApi.getDispoSetById(branch, setId); String fullPath = set.getImportPath() + File.separator + "vcast" + File.separator + fileName; final File result = new File(fullPath); StreamingOutput streamingOutput = new StreamingOutput() { @Override public void write(OutputStream outputStream) throws WebApplicationException { FileInputStream inputStream = null; Writer writer = null; try { inputStream = new FileInputStream(result); writer = new OutputStreamWriter(outputStream, "UTF-8"); int c; while ((c = inputStream.read()) != -1) { writer.write(c); } outputStream.flush(); } catch (IOException ex) { throw new OseeCoreException(ex); } finally { Lib.close(inputStream); Lib.close(writer); } } }; String contentDisposition = String.format("attachment; filename=\"%s\"; creation-date=\"%s\"", fileName, new Date()); return Response.ok(streamingOutput).header("Content-Disposition", contentDisposition).type( "application/text").build(); }
Source:
<code>@Override public List<? extends ItemGroup<?>> validDestinations(Item item) { List<DirectlyModifiableTopLevelItemGroup> result = new ArrayList<DirectlyModifiableTopLevelItemGroup>(); Jenkins instance = Jenkins.getActiveInstance(); if (permitted(item, instance)) { result.add(instance); } ITEM: for (Item g : instance.getAllItems()) { if (g instanceof DirectlyModifiableTopLevelItemGroup) { DirectlyModifiableTopLevelItemGroup itemGroup = (DirectlyModifiableTopLevelItemGroup) g; if (!permitted(item, itemGroup)) { continue; } ItemGroup<?> p = itemGroup; <START> Item i = (Item) p; <END> if (i == item || i == item.getParent()) { continue ITEM; } if (i instanceof Folder) { Folder folder = (Folder) i; if (folder.getItem(item.getName()) != null) { continue ITEM; } } result.add(itemGroup); } } return result; }</code><technical_language>is normal instanceof Item in this case</technical_language>

Target:
@Override public List<? extends ItemGroup<?>> validDestinations(Item item) { List<DirectlyModifiableTopLevelItemGroup> result = new ArrayList<DirectlyModifiableTopLevelItemGroup>(); Jenkins instance = Jenkins.getActiveInstance(); if (permitted(item, instance) && (instance.getItem(item.getName()) == null) || instance.getItem(item.getName()) == item) { result.add(instance); } ITEM: for (Item g : instance.getAllItems()) { if (g instanceof DirectlyModifiableTopLevelItemGroup) { DirectlyModifiableTopLevelItemGroup itemGroup = (DirectlyModifiableTopLevelItemGroup) g; if (!permitted(item, itemGroup)) { continue; } ItemGroup<?> p = itemGroup; if (p instanceof Item) { Item i = (Item) p; if (i == item) { continue ITEM; } if (item.getParent() == i) { result.add(itemGroup); } if (i instanceof Folder) { Folder folder = (Folder) i; if (folder.getItem(item.getName()) != null) { continue ITEM; } } ItemGroup itemGroupSubElement = i.getParent(); while (itemGroupSubElement != instance) { if (itemGroupSubElement instanceof Folder) { Folder currentFolder = (Folder) itemGroupSubElement; if (item == currentFolder) { continue ITEM; } itemGroupSubElement = currentFolder.getParent(); } } result.add(itemGroup); } } } return result; }
Source:
<code>protected void doChmod(RemoteFileOperations<FTPFile> remoteFileOperations, final String path, final int chmod) { remoteFileOperations.executeWithClient((ClientCallbackWithoutResult<FTPClient>) client -> { String chModCommand = "chmod " + Integer.toOctalString(chmod) + " " + path; try { client.sendSiteCommand(chModCommand); } catch (IOException e) { <START> throw new UncheckedIOException("Failed to execute chmod", e); <END> } }); }</code><technical_language>need add a chmod path exception message well</technical_language>

Target:
protected void doChmod(RemoteFileOperations<FTPFile> remoteFileOperations, final String path, final int chmod) { remoteFileOperations.executeWithClient((ClientCallbackWithoutResult<FTPClient>) client -> { String chModCommand = "chmod " + Integer.toOctalString(chmod) + " " + path; try { client.sendSiteCommand(chModCommand); } catch (IOException e) { throw new UncheckedIOException("Failed to execute '" + chModCommand + "'", e); } }); }
Source:
<code><START> Subscriber getSubscriber() { <END> return subscriber; }</code><technical_language>remove this if is used</technical_language>

Target:
SubscriptionState getSubscriber() { return subscriber; }
Source:
<code>public String getLiteral() { <START> return ",".equals(defaultDelimiter) ? "comma" : "tab"; <END> }</code><technical_language>nit: IMO easier read if enum define delimiter literal CSV(",", "comma")</technical_language>

Target:
public String getLiteral() { return literal; }
Source:
<code>public void invoke(RowData value, Context context) throws Exception { RowKind kind = value.getRowKind(); if (value.getRowKind() == RowKind.INSERT) { Row row = (Row) converter.toExternal(value); assert row != null; if (rowtimeIndex >= 0) { <START> TimestampData rowtime = TimestampData.fromLocalDateTime((LocalDateTime) row.getField(rowtimeIndex)); <END> long mark = context.currentWatermark(); if (mark > rowtime.getMillisecond()) { return; } } localRawResult.add(kind.shortString() + "(" + row.toString() + ")"); } else { throw new RuntimeException( "AppendingSinkFunction received " + value.getRowKind() + " messages."); } }</code><technical_language>java // currently, rowtime attribute 3 precision TimestampData rowtime = value.getTimestamp(rowtimeIndex, 3);</technical_language>

Target:
public void invoke(RowData value, Context context) throws Exception { RowKind kind = value.getRowKind(); if (value.getRowKind() == RowKind.INSERT) { Row row = (Row) converter.toExternal(value); assert row != null; if (rowtimeIndex >= 0) { TimestampData rowtime = value.getTimestamp(rowtimeIndex, 3); long mark = context.currentWatermark(); if (mark > rowtime.getMillisecond()) { return; } } localRawResult.add(kind.shortString() + "(" + row.toString() + ")"); } else { throw new RuntimeException( "AppendingSinkFunction received " + value.getRowKind() + " messages."); } }