auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public void addSize(final int size) { <START> boolean globalFull = !ignoreGlobalMaxSize && pagingManager.addSize(size).isGlobalFull(); <END> long newSize = sizeInBytes.addAndGet(size); if (newSize < 0) { ActiveMQServerLogger.LOGGER.negativeAddressSize(newSize, address.toString()); } if (addressFullMessagePolicy == AddressFullMessagePolicy.BLOCK || addressFullMessagePolicy == AddressFullMessagePolicy.FAIL) { if (usingGlobalMaxSize && !globalFull || maxSize != -1) { checkReleaseMemory(globalFull, newSize); } return; } else if (addressFullMessagePolicy == AddressFullMessagePolicy.PAGE) { if (size > 0) { if (maxSize != -1 && newSize > maxSize || globalFull) { if (startPaging()) { ActiveMQServerLogger.LOGGER.pageStoreStart(storeName, newSize, maxSize, pagingManager.getGlobalSize()); } } } return; } }</code><technical_language>This affect reported size though, for operating broker is important returns a correct valid value</technical_language>

Target:
public void addSize(final int size) { boolean globalFull = pagingManager.addSize(size).isGlobalFull() && !ignoreGlobalMaxSize; long newSize = sizeInBytes.addAndGet(size); if (newSize < 0) { ActiveMQServerLogger.LOGGER.negativeAddressSize(newSize, address.toString()); } if (addressFullMessagePolicy == AddressFullMessagePolicy.BLOCK || addressFullMessagePolicy == AddressFullMessagePolicy.FAIL) { if (usingGlobalMaxSize && !globalFull || maxSize != -1) { checkReleaseMemory(globalFull, newSize); } return; } else if (addressFullMessagePolicy == AddressFullMessagePolicy.PAGE) { if (size > 0) { if (maxSize != -1 && newSize > maxSize || globalFull) { if (startPaging()) { ActiveMQServerLogger.LOGGER.pageStoreStart(storeName, newSize, maxSize, pagingManager.getGlobalSize()); } } } return; } }
Source:
<code>public void close() throws IOException { <START> _dataBuffer.close(); <END> }</code><technical_language>Do close buffer (see #5400)</technical_language>

Target:
public void close() throws IOException { }
Source:
<code>public CPPASTLiteralExpression copy(CopyStyle style) { CPPASTLiteralExpression copy = <START> new CPPASTLiteralExpression(fKind, getValue(), fNumericCompilerSuffixes); <END> copy.fStringLiteralSize = fStringLiteralSize; copy.fEvaluation = fEvaluation; copy.fUserDefinedLiteralOperator = fUserDefinedLiteralOperator; copy.fImplicitNames = fImplicitNames; return copy(copy, style); }</code><technical_language>Alternatively, copy method a private constructor parameters: int kind, char[] literal, char[] suffix, char[] numericCompilerSuffixes</technical_language>

Target:
public CPPASTLiteralExpression copy(CopyStyle style) { return copy(new CPPASTLiteralExpression(this), style); }
Source:
<code>public LRUCache() { <START> setCache(this.MAX_ENTRIES); <END> }</code><technical_language>is static, class name (LRUCache.MAX_ENTRIES) omit this</technical_language>

Target:
public LRUCache() { setCache(MAX_ENTRIES); }
Source:
<code>public void onResult(Activity activity, int requestCode, int resultCode, Intent data) { if (resultCode != Activity.RESULT_OK && resultCode != Activity.RESULT_CANCELED) { processFailed(resultCode); return; } else if (resultCode == Activity.RESULT_CANCELED) { processCanceled(resultCode); return; } try { processResult(data.getStringExtra(Intents.Scan.RESULT_FORMAT), data.getStringExtra(Intents.Scan.RESULT), resultCode); } catch (Exception e) { Log.e(LCAT, "Hit exception while processing barcode! " + e.toString()); e.printStackTrace(); processFailed(resultCode); } <START> Log.w(LCAT, "--> from module :: keepOpen value: " + keepOpen); <END> if (!keepOpen) { _instance = null; } }</code><technical_language>remove this</technical_language>

Target:
public void onResult(Activity activity, int requestCode, int resultCode, Intent data) { if (resultCode != Activity.RESULT_OK && resultCode != Activity.RESULT_CANCELED) { processFailed(resultCode); return; } else if (resultCode == Activity.RESULT_CANCELED) { processCanceled(resultCode); return; } try { processResult(data.getStringExtra(Intents.Scan.RESULT_FORMAT), data.getStringExtra(Intents.Scan.RESULT), resultCode); } catch (Exception e) { Log.e(LCAT, "Hit exception while processing barcode! " + e.toString()); e.printStackTrace(); processFailed(resultCode); } if (!keepOpen) { _instance = null; } }
Source:
<code>public void failPreservesStdout() { <START> ProcessResult result = new ProcessResult(0, fail, ""); <END> RunResult parsed = parser.parse(result); assertTrue(parsed.logs.containsKey(SpecialLogs.STDOUT)); assertEquals(fail, new String(parsed.logs.get(SpecialLogs.STDOUT))); }</code><technical_language>create ProcessResult in setUp</technical_language>

Target:
public void failPreservesStdout() { RunResult parsed = parser.parse(failResult); assertTrue(parsed.logs.containsKey(SpecialLogs.STDOUT)); assertEquals(fail, new String(parsed.logs.get(SpecialLogs.STDOUT))); }
Source:
<code>public void panelsTest() { UI.events.registerEvent((PanelClickedEventHandler) e -> eventTriggered.set(true)); pushKeys(MAXIMIZE_WINDOW); pushKeys(CREATE_RIGHT_PANEL); pushKeys(CREATE_RIGHT_PANEL); waitUntilNodeAppears(getPanel(0).getFilterTextField()); type("repo:dummy2/dummy2"); push(KeyCode.ENTER); selectPanel(1); final FilterPanel panel0 = getPanel(0); final FilterPanel panel1 = getPanel(1); final FilterPanel panel2 = getPanel(2); reorderPanelsByDragging(panel0, panel1, panel2); reorderPanelsViaHotkeys(panel0, panel1); click(panel0.getCloseButton()); waitUntilNodeDisappears(panel0); doubleClick("#repositorySelector"); doubleClick(); type("dummy2/dummy2"); push(KeyCode.ENTER); pushKeys(CREATE_RIGHT_PANEL); <START> waitUntilNodeAppears(panel1); <END> }</code><technical_language>Is this original? originally want assert a panel created dragging other panels. in this wait, check if original panel is present creating a new panel</technical_language>

Target:
public void panelsTest() { UI.events.registerEvent((PanelClickedEventHandler) e -> eventTriggered.set(true)); pushKeys(MAXIMIZE_WINDOW); pushKeys(CREATE_RIGHT_PANEL); pushKeys(CREATE_RIGHT_PANEL); waitUntilNodeAppears(getPanel(0).getFilterTextField()); type("repo:dummy2/dummy2"); push(KeyCode.ENTER); selectPanel(1); final FilterPanel panel0 = getPanel(0); final FilterPanel panel1 = getPanel(1); final FilterPanel panel2 = getPanel(2); reorderPanelsByDragging(panel0, panel1, panel2); reorderPanelsViaHotkeys(panel0, panel1); click(panel0.getCloseButton()); waitUntilNodeDisappears(panel0); doubleClick("#repositorySelector"); doubleClick(); type("dummy2/dummy2"); push(KeyCode.ENTER); pushKeys(CREATE_RIGHT_PANEL); awaitCondition(() -> existsQuiet("#dummy2/dummy2_col2")); }
Source:
<code>public String toString() { <START> return getClass().getName() + "@" + Integer.toHexString(hashCode()) + <END> "identifier=" + identifier + ", upstream=" + upstream + ", group=" + group + ", partitions=" + partitions + ", iterator=" + iterator + '}'; }</code><technical_language>getSimpleName instead</technical_language>

Target:
public String toString() { return "LogicalNode@" + Integer.toHexString(hashCode()) + "identifier=" + identifier + ", upstream=" + upstream + ", group=" + group + ", partitions=" + partitions + ", iterator=" + iterator + '}'; }
Source:
<code>protected IASTTranslationUnit parseAndCheckImplicitNameBindings() throws Exception { <START> IASTTranslationUnit tu = parse(getAboveComment(), CPP, false, true, Integer.MAX_VALUE); <END> NameCollector col = new NameCollector(true ); tu.accept(col); assertNoProblemBindings(col); return tu; }</code><technical_language>parameter safely omitted default</technical_language>

Target:
protected IASTTranslationUnit parseAndCheckImplicitNameBindings() throws Exception { IASTTranslationUnit tu = parse(getAboveComment(), CPP, false, true); NameCollector col = new NameCollector(true ); tu.accept(col); assertNoProblemBindings(col); return tu; }
Source:
<code>private static Filter doubleRangeToFilter(Range range, boolean nullAllowed) { Marker low = range.getLow(); Marker high = range.getHigh(); <START> double lowerDouble = low.isLowerUnbounded() ? Double.MIN_VALUE : ((Double) low.getValue()).doubleValue(); <END> double upperDouble = high.isUpperUnbounded() ? Double.MAX_VALUE : ((Double) high.getValue()).doubleValue(); return new Filters.DoubleRange( lowerDouble, low.isLowerUnbounded(), low.getBound() == Marker.Bound.ABOVE, upperDouble, high.isUpperUnbounded(), high.getBound() == Marker.Bound.BELOW, nullAllowed); }</code><technical_language>I understand cast boxed type Double, call doubleValue, code reverted. Double Long, autoboxing work magic in Filters constructors below</technical_language>

Target:
private static Filter doubleRangeToFilter(Range range, boolean nullAllowed) { Marker low = range.getLow(); Marker high = range.getHigh(); double lowerDouble = low.isLowerUnbounded() ? Double.MIN_VALUE : (double) low.getValue(); double upperDouble = high.isUpperUnbounded() ? Double.MAX_VALUE : (double) high.getValue(); return new Filters.DoubleRange( lowerDouble, low.isLowerUnbounded(), low.getBound() == Marker.Bound.ABOVE, upperDouble, high.isUpperUnbounded(), high.getBound() == Marker.Bound.BELOW, nullAllowed); }
Source:
<code>private List<CapacityHeatmapSceneBuilder.Resource> getResources() { HumanResource[] humanResources = ((ChartModelResource) getChartModel()).getVisibleResources(); List<CapacityHeatmapSceneBuilder.Resource> resources = new ArrayList<>(); for (HumanResource humanResource : humanResources) { List<CapacityHeatmapSceneBuilder.Load> loads = new ArrayList<>(); <START> List<Load> tasksLoads = humanResource.getLoadDistribution().getTasksLoads(); <END> for (Load taskLoad : tasksLoads) { Integer taskId = null; if (taskLoad.refTask != null) { taskId = taskLoad.refTask.getTaskID(); } CapacityHeatmapSceneBuilder.Load load = new CapacityHeatmapSceneBuilder.Load(toTs(taskLoad.startDate), toTs(taskLoad.endDate), taskLoad.load, taskId); loads.add(load); } boolean isExpanded = myResourcechart.isExpanded(humanResource); CapacityHeatmapSceneBuilder.Resource resource = new CapacityHeatmapSceneBuilder.Resource(loads, isExpanded); resources.add(resource); } return resources; }</code><technical_language>Apparently LoadDistribution do stuff do in biz.ganttproject.core.chart.scene.CapacityHeatmapSceneBuilder#calcLoadDistribution ? add TODO remove this work duplication</technical_language>

Target:
private List<CapacityHeatmapSceneBuilder.Resource> getResources() { HumanResource[] humanResources = ((ChartModelResource) getChartModel()).getVisibleResources(); List<CapacityHeatmapSceneBuilder.Resource> resources = new ArrayList<>(); for (HumanResource humanResource : humanResources) { List<CapacityHeatmapSceneBuilder.Load> loads = new ArrayList<>(); List<Load> tasksLoads = humanResource.getLoadDistribution().getTasksLoads(); for (Load taskLoad : tasksLoads) { Integer taskId = null; if (taskLoad.refTask != null) { taskId = taskLoad.refTask.getTaskID(); } CapacityHeatmapSceneBuilder.Load load = new CapacityHeatmapSceneBuilder.Load(taskLoad.startDate.getTime(), taskLoad.endDate.getTime(), taskLoad.load, taskId); loads.add(load); } boolean isExpanded = myResourcechart.isExpanded(humanResource); CapacityHeatmapSceneBuilder.Resource resource = new CapacityHeatmapSceneBuilder.Resource(loads, isExpanded); resources.add(resource); } return resources; }
Source:
<code><START> public String toString() { <END> return "SubnetRequest{" + "publicSubnetCidr='" + publicSubnetCidr + '\'' + ", privateSubnetCidr='" + privateSubnetCidr + '\'' + ", availabilityZone='" + availabilityZone + '\'' + ", type=" + type + '}'; }</code><technical_language>field in toString. is purpose</technical_language>

Target:
public String toString() { return "SubnetRequest{" + "publicSubnetCidr='" + publicSubnetCidr + '\'' + ", privateSubnetCidr='" + privateSubnetCidr + '\'' + ", availabilityZone='" + availabilityZone + '\'' + ", subnetGroup=" + subnetGroup + ", index=" + index + ", type=" + type + '}'; }
Source:
<code>public DynamicMBeanProvider register() throws JMException { List<DynamicMetric<?, ?>> attributeList = new ArrayList<>(); attributeList.add(_dataChangeEventCounter); attributeList.add(_outstandingRequestGauge); attributeList.add(_stateChangeEventCounter); attributeList.add(_expiredSessionCounter); if (_zkEventThreadMetric != null) { attributeList.add(_zkEventThreadMetric); } doRegister(attributeList, MBEAN_DESCRIPTION, getObjectName(_monitorType, _monitorKey, _monitorInstanceName)); <START> for (ZkClientPathMonitor.PredefinedPath path : ZkClientPathMonitor.PredefinedPath.values()) { if (_zkClientPathMonitorMap.get(path) != null) { _zkClientPathMonitorMap.get(path).register(); <END> } } return this; }</code><technical_language>nit, simpler be: _zkClientPathMonitorMap.values().stream().foreach(...);</technical_language>

Target:
public DynamicMBeanProvider register() throws JMException { List<DynamicMetric<?, ?>> attributeList = new ArrayList<>(); attributeList.add(_dataChangeEventCounter); attributeList.add(_outstandingRequestGauge); attributeList.add(_stateChangeEventCounter); attributeList.add(_expiredSessionCounter); if (_zkEventThreadMetric != null) { attributeList.add(_zkEventThreadMetric); } doRegister(attributeList, MBEAN_DESCRIPTION, getObjectName(_monitorType, _monitorKey, _monitorInstanceName)); _zkClientPathMonitorMap.values().stream().forEach( monitor -> { if (monitor != null) { try { monitor.register(); } catch (JMException e) { _logger.error(" failed registration", monitor, e); } } }); return this; }
Source:
<code>public ITmfTrace openMinimalTrace(String projectName, String traceName, Boolean isExperiment) throws FileNotFoundException, InstantiationException, IllegalAccessException, TmfTraceException, CoreException, TmfTraceImportException { String path = getFile(projectName, traceName, isExperiment).getLocationURI().getPath(); if (path == null) { throw new FileNotFoundException(); } <START> ITmfTrace trace; trace = put(path, <END> traceName, ""); return trace; }</code><technical_language>line</technical_language>

Target:
public ITmfTrace openMinimalTrace(String projectName, String traceName, Boolean isExperiment) throws FileNotFoundException, InstantiationException, IllegalAccessException, TmfTraceException, CoreException, TmfTraceImportException { String path = getTracePath(projectName, traceName, isExperiment); IFile file = getFile(path); String location = file.getLocationURI().getPath(); return openAndInitializeTrace(file, location, traceName, ""); }
Source:
<code>void onImageSizeSelected(int position) { <START> if (trackChanges) { <END> if (trackingHelper != null) { trackingHelper.logImageSizeChanged(position); } presenter.saveImageSize(position); } }</code><technical_language>I checking for tracking is enabled logging event. clear checking is handled in other places</technical_language>

Target:
void onImageSizeSelected(int position) { if (listenersEnabled) { if (trackingHelper != null) { trackingHelper.logImageSizeChanged(position); } presenter.saveImageSize(position); } }
Source:
<code>public void create() throws ResourceAllocationException { NicSecondaryIp result; <START> boolean isIpv4 = true; <END> if (ipAddr != null) { if (!NetUtils.isValidIp4(ipAddr)) { isIpv4 = false; } if (!NetUtils.isValidIp6(ipAddr) && !isIpv4) { throw new InvalidParameterValueException("Invalid ip address " + ipAddr); } } IpAddresses requestedIpPair = new IpAddresses(ipAddr, null); if (!isIpv4) { requestedIpPair = new IpAddresses(null, ipAddr); } try { result = _networkService.allocateSecondaryGuestIP(getNicId(), requestedIpPair); if (result != null) { setEntityId(result.getId()); setEntityUuid(result.getUuid()); } } catch (InsufficientAddressCapacityException e) { throw new InvalidParameterValueException("Allocating guest ip for nic failed : " + e.getMessage()); } if (result == null) { throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to assign secondary ip to nic"); } }</code><technical_language>moving this validation a "service" layer? This is "view/controller" part of design. receive request, get data dispatch service layer business done</technical_language>

Target:
public void create() throws ResourceAllocationException { NicSecondaryIp result; IpAddresses requestedIpPair = new IpAddresses(ipAddr, null); if (!NetUtils.isIpv4(ipAddr)) { requestedIpPair = new IpAddresses(null, ipAddr); } try { result = _networkService.allocateSecondaryGuestIP(getNicId(), requestedIpPair); if (result != null) { setEntityId(result.getId()); setEntityUuid(result.getUuid()); } } catch (InsufficientAddressCapacityException e) { throw new InvalidParameterValueException("Allocating guest ip for nic failed : " + e.getMessage()); } if (result == null) { throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to assign secondary ip to nic"); } }
Source:
<code>public boolean equals(Object obj) { <START> if (obj == null) { <END> return false; } if (obj == this) { return true; } if (!(obj instanceof GroupChatInvitation)) { return false; } GroupChatInvitation other = (GroupChatInvitation) obj; return Objects.equals(getRoomAddressJid(), other.getRoomAddressJid()) && Objects.equals(getPassword(), other.getPassword()) && Objects.equals(getReason(), other.getReason()) && isContinue() == other.isContinue() && Objects.equals(getThread(), other.getThread()); }</code><technical_language>o.j.s.util.EqualsUtil here</technical_language>

Target:
public boolean equals(Object obj) { return EqualsUtil.equals(this, obj, (equalsBuilder, other) -> equalsBuilder .append(getRoomAddressJid(), other.getRoomAddressJid()) .append(getPassword(), other.getPassword()) .append(getReason(), other.getReason()) .append(isContinue(), other.isContinue()) .append(getThread(), other.getThread())); }
Source:
<code>public void invalidateCacheOnUpdate() throws Exception { EventTypeCache etc = new EventTypeCache(dbRepo, client); EventType et = buildEventType(); Mockito .doReturn(et) .when(dbRepo) .findByName(et.getName()); etc.created(et); etc.get(et.getName()); etc.updated(et.getName()); executeWithRetry(() -> { try { etc.get(et.getName()); verify(dbRepo, times(2)).findByName(et.getName()); } catch (NoSuchEventTypeException e) { fail(); } catch (ExecutionException e) { fail(); <START> } catch (Exception e) { <END> fail(); } }, new RetryForSpecifiedTimeStrategy<Void>(5000).withExceptionsThatForceRetry(AssertionError.class) .withWaitBetweenEachTry(500)); }</code><technical_language>collapsed catch</technical_language>

Target:
public void invalidateCacheOnUpdate() throws Exception { final EventTypeCache etc = new EventTypeCache(dbRepo, client); final EventType et = buildEventType(); Mockito .doReturn(et) .when(dbRepo) .findByName(et.getName()); etc.created(et.getName()); etc.get(et.getName()); etc.updated(et.getName()); executeWithRetry(() -> { try { etc.get(et.getName()); verify(dbRepo, times(2)).findByName(et.getName()); } catch (Exception e) { fail(); } }, new RetryForSpecifiedTimeStrategy<Void>(5000).withExceptionsThatForceRetry(AssertionError.class) .withWaitBetweenEachTry(500)); }
Source:
<code>public final String getAttribute(String attr) { Supplier<String> attribute = internalGetAttribute(attr); return attribute != null ? <START> attribute.get() : <END> ""; }</code><technical_language>add Assert.isNotNull() check here, new contract hasAttribute getAttribute is broken unintentionally</technical_language>

Target:
public final String getAttribute(String attr) { Supplier<String> attribute = internalGetAttribute(attr); if (attribute != null) { String attributeValue = attribute.get(); Assert.isNotNull(attributeValue); return attributeValue; } return ""; }
Source:
<code>private UserClient(final String url) { MongoClient mongoClient = null; try { mongoClient = new MongoClient(url); } catch (UnknownHostException e) { <START> LOG.info("Exception: {}", e); <END> } if (mongoClient == null) { return; } database = mongoClient.getDB(DATABASE); }</code><technical_language>this error constant</technical_language>

Target:
private UserClient(final String url) { MongoClient mongoClient = null; try { mongoClient = new MongoClient(url); } catch (UnknownHostException e) { LOG.error(LoggingConstants.EXCEPTION_MESSAGE, e); } if (mongoClient == null) { return; } database = mongoClient.getDB(DATABASE); }
Source:
<code>public void setUp() { httpClient = createMock(HttpClient.class); taskInfoProvider = createMock(TaskInfoProvider.class); responseHolder = createMock(FullResponseHolder.class); response = createMock(HttpResponse.class); headers = createMock(HttpHeaders.class); <START> client = new TestableKafkaIndexTaskClient(httpClient, objectMapper, taskInfoProvider); <END> expect(taskInfoProvider.getTaskLocation(TEST_ID)) .andReturn(new TaskLocation(TEST_HOST, TEST_PORT, TEST_TLS_PORT)) .anyTimes(); expect(taskInfoProvider.getTaskStatus(TEST_ID)) .andReturn(Optional.of(TaskStatus.running(TEST_ID))) .anyTimes(); for (String testId : TEST_IDS) { expect(taskInfoProvider.getTaskLocation(testId)) .andReturn(new TaskLocation(TEST_HOST, TEST_PORT, TEST_TLS_PORT)) .anyTimes(); expect(taskInfoProvider.getTaskStatus(testId)) .andReturn(Optional.of(TaskStatus.running(testId))) .anyTimes(); } }</code><technical_language>TestableKafkaIndexTaskClient renamed Kinesis</technical_language>

Target:
public void setUp() { httpClient = createMock(HttpClient.class); taskInfoProvider = createMock(TaskInfoProvider.class); responseHolder = createMock(FullResponseHolder.class); response = createMock(HttpResponse.class); headers = createMock(HttpHeaders.class); client = new TestableKinesisIndexTaskClient(httpClient, objectMapper, taskInfoProvider); expect(taskInfoProvider.getTaskLocation(TEST_ID)) .andReturn(new TaskLocation(TEST_HOST, TEST_PORT, TEST_TLS_PORT)) .anyTimes(); expect(taskInfoProvider.getTaskStatus(TEST_ID)) .andReturn(Optional.of(TaskStatus.running(TEST_ID))) .anyTimes(); for (String testId : TEST_IDS) { expect(taskInfoProvider.getTaskLocation(testId)) .andReturn(new TaskLocation(TEST_HOST, TEST_PORT, TEST_TLS_PORT)) .anyTimes(); expect(taskInfoProvider.getTaskStatus(testId)) .andReturn(Optional.of(TaskStatus.running(testId))) .anyTimes(); } }
Source:
<code>protected void validate() { getFileSystemProperties(); if (!CombinePathTrackingInputFormat.class.getName().equals(inputFormatClass) && pathField != null) { throw new IllegalArgumentException("pathField can only be used if inputFormatClass is " + CombinePathTrackingInputFormat.class.getName()); } <START> if (!format.matches("[a-zA-Z]+") && !(format.equalsIgnoreCase("text") || (format.equalsIgnoreCase("avro")) || <END> format.equalsIgnoreCase("parquet"))) { throw new IllegalArgumentException("format can only be 'text', 'avro' or 'parquet'"); } }</code><technical_language>need comparison, comparisons text, avro, parquet</technical_language>

Target:
protected void validate() { getFileSystemProperties(); if (!CombinePathTrackingInputFormat.class.getName().equals(inputFormatClass) && pathField != null) { throw new IllegalArgumentException("pathField can only be used if inputFormatClass is " + CombinePathTrackingInputFormat.class.getName()); } if (format == null || !(format.equalsIgnoreCase("text") || (format.equalsIgnoreCase("avro")) || format.equalsIgnoreCase("parquet"))) { throw new IllegalArgumentException("Format can only be 'text', 'avro' or 'parquet'"); } if (!format.equalsIgnoreCase("text")) { try { new Schema.Parser().parse(inputSchema); } catch (Exception e){ throw new IllegalArgumentException("Unable to parse schema with error: " + e.getMessage(), e); } } }
Source:
<code>public Map<String, Locale> getLocales() { <START> return Locale.getLocaleMap("en-US", "fr-FR", "es-ES", "de-DE", "nl-NL", "ru-RU", "hi-IN", "it-IT", "fi-FI", "pt-PT"); <END> }</code><technical_language>This method returns non-sense.. list of locales this instance of ProgramAB supports list of locales for of bots currently available.. this list. return null.. something.. this list is wrong</technical_language>

Target:
public Map<String, Locale> getLocales() { Map<String, Locale> ret = new TreeMap<>(); for (BotInfo botInfo : bots.values()) { ret.put(botInfo.locale.getTag(), botInfo.locale); } return ret; }
Source:
<code>public Control createContents(Composite parent) { ScrolledPageContent scrolled = new ScrolledPageContent(parent, SWT.H_SCROLL | SWT.V_SCROLL); scrolled.setExpandHorizontal(true); scrolled.setExpandVertical(true); Composite control = new Composite(scrolled, SWT.NONE); GridLayout layout = new GridLayout(); control.setLayout(layout); Composite composite = addSubsection(control, PreferencesMessages.CodeStyleBlock_class_member_order); fillClassMemberOrderSection(composite); composite = addSubsection(control, PreferencesMessages.CodeStyleBlock_function_parameter_order); fillFunctionParameterOrderSection(composite); composite = addSubsection(control, PreferencesMessages.CodeStyleBlock_function_output_parameter_style); fillFunctionOutputParameterStyleSection(composite); composite = addSubsection(control, PreferencesMessages.CodeStyleBlock_const_keyword_placement); fillConstPlacementsSections(composite); <START> composite = addSubsection(control, PreferencesMessages.CodeStyleBlock_function_overrdden_methods); <END> fillOverriddenSection(composite); scrolled.setContent(control); final Point size = control.computeSize(SWT.DEFAULT, SWT.DEFAULT); scrolled.setMinSize(size.x, size.y); return scrolled; }</code><technical_language>overridden</technical_language>

Target:
public Control createContents(Composite parent) { ScrolledPageContent scrolled = new ScrolledPageContent(parent, SWT.H_SCROLL | SWT.V_SCROLL); scrolled.setExpandHorizontal(true); scrolled.setExpandVertical(true); Composite control = new Composite(scrolled, SWT.NONE); GridLayout layout = new GridLayout(); control.setLayout(layout); Composite composite = addSubsection(control, PreferencesMessages.CodeStyleBlock_class_member_order); fillClassMemberOrderSection(composite); composite = addSubsection(control, PreferencesMessages.CodeStyleBlock_function_parameter_order); fillFunctionParameterOrderSection(composite); composite = addSubsection(control, PreferencesMessages.CodeStyleBlock_function_output_parameter_style); fillFunctionOutputParameterStyleSection(composite); composite = addSubsection(control, PreferencesMessages.CodeStyleBlock_const_keyword_placement); fillConstPlacementsSections(composite); composite = addSubsection(control, PreferencesMessages.CodeStyleBlock_function_overridden_methods); fillOverriddenSection(composite); scrolled.setContent(control); final Point size = control.computeSize(SWT.DEFAULT, SWT.DEFAULT); scrolled.setMinSize(size.x, size.y); return scrolled; }
Source:
<code>public void testAddRegexRoleMapperAggregate() throws Exception { init("TestDomain10"); ServiceName serviceName = Capabilities.SECURITY_DOMAIN_RUNTIME_CAPABILITY.getCapabilityServiceName("TestDomain10"); Assert.assertNotNull(services.getContainer()); Assert.assertNotNull(services.getContainer().getService(serviceName)); SecurityDomain domain = (SecurityDomain) services.getContainer().getService(serviceName).getValue(); Assert.assertNotNull(domain); ServerAuthenticationContext context = domain.createNewAuthenticationContext(); context.setAuthenticationName("user5"); Assert.assertTrue(context.exists()); Assert.assertTrue(context.authorize()); context.succeed(); SecurityIdentity identity = context.getAuthorizedIdentity(); Assert.assertEquals("user5", identity.getPrincipal().getName()); Roles roles = identity.getRoles(); Assert.assertTrue(roles.contains("admin")); <START> Assert.assertTrue(roles.contains("admin")); <END> Assert.assertTrue(roles.contains("guest")); Assert.assertFalse(roles.contains("1-user")); Assert.assertFalse(roles.contains("user")); context = domain.createNewAuthenticationContext(); context.setAuthenticationName("user6"); Assert.assertTrue(context.exists()); Assert.assertTrue(context.authorize()); context.succeed(); identity = context.getAuthorizedIdentity(); Assert.assertEquals("user6", identity.getPrincipal().getName()); roles = identity.getRoles(); Assert.assertFalse(roles.contains("admin")); Assert.assertFalse(roles.contains("random")); }</code><technical_language>duplicated line here? test domain definition I ca user5 roles, resulting AggregateRoleMapper1 processing: * 1-user-1: match, translated admin * joe: match, * 2-guest-2: match, translated guest result {admin, guest}. WDYT</technical_language>

Target:
public void testAddRegexRoleMapperAggregate() throws Exception { init("TestDomain10"); ServiceName serviceName = Capabilities.SECURITY_DOMAIN_RUNTIME_CAPABILITY.getCapabilityServiceName("TestDomain10"); Assert.assertNotNull(services.getContainer()); Assert.assertNotNull(services.getContainer().getService(serviceName)); SecurityDomain domain = (SecurityDomain) services.getContainer().getService(serviceName).getValue(); Assert.assertNotNull(domain); ServerAuthenticationContext context = domain.createNewAuthenticationContext(); context.setAuthenticationName("user5"); Assert.assertTrue(context.exists()); Assert.assertTrue(context.authorize()); context.succeed(); SecurityIdentity identity = context.getAuthorizedIdentity(); Assert.assertEquals("user5", identity.getPrincipal().getName()); Roles roles = identity.getRoles(); Assert.assertTrue(roles.contains("admin")); Assert.assertTrue(roles.contains("guest")); Assert.assertFalse(roles.contains("1-user")); Assert.assertFalse(roles.contains("user")); context = domain.createNewAuthenticationContext(); context.setAuthenticationName("user6"); Assert.assertTrue(context.exists()); Assert.assertTrue(context.authorize()); context.succeed(); identity = context.getAuthorizedIdentity(); Assert.assertEquals("user6", identity.getPrincipal().getName()); roles = identity.getRoles(); Assert.assertFalse(roles.contains("admin")); Assert.assertFalse(roles.contains("random")); }
Source:
<code>public void throwOnRecordValidationFailure() { final File refFile = new File("src/test/resources/htsjdk/samtools/cram/ce.fa"); final File cramFileWithInvalidRecs = new File("src/test/resources/htsjdk/samtools/cram/ce#containsInvalidRecords.3.0.cram"); final ReferenceSource source = new ReferenceSource(refFile); final SAMRecordIterator cramIteratorOverInvalidRecords = getCramFileIterator(cramFileWithInvalidRecs, source, ValidationStringency.STRICT); <START> try{ <END> while (cramIteratorOverInvalidRecords.hasNext()) { cramIteratorOverInvalidRecords.next(); } } finally { cramIteratorOverInvalidRecords.close(); } }</code><technical_language>try-with-resources</technical_language>

Target:
public void throwOnRecordValidationFailure() { try (SAMRecordIterator cramIteratorOverInvalidRecords = getCramFileIterator(ValidationStringency.STRICT)) { while (cramIteratorOverInvalidRecords.hasNext()) { cramIteratorOverInvalidRecords.next(); } } }
Source:
<code>public List<AuditLog> getAuditLogs() { <START> return ImmutableList.<AuditLog>copyOf(accountAuditLogs); <END> }</code><technical_language>change for free definition of accountAuditLogs private final List<AuditLog> accountAuditLogs; avoid copy</technical_language>

Target:
public List<AuditLog> getAuditLogs() { return accountAuditLogs; }
Source:
<code>public static long extractOffset(String filename) { Matcher m = HdfsSinkConnectorConstants.COMMITTED_FILENAME_PATTERN.matcher(filename); if (!m.matches()) { throw new IllegalArgumentException(filename + " does not match COMMITTED_FILENAME_PATTERN"); } <START> return Long.parseLong(m.group(4)); <END> }</code><technical_language>change this a named constant in HdfsSinkConnectorConstants change if, e.g. grouping adjusted in COMMITTED_FILENAME_PATTERN</technical_language>

Target:
public static long extractOffset(String filename) { Matcher m = HdfsSinkConnectorConstants.COMMITTED_FILENAME_PATTERN.matcher(filename); if (!m.matches()) { throw new IllegalArgumentException(filename + " does not match COMMITTED_FILENAME_PATTERN"); } return Long.parseLong(m.group(HdfsSinkConnectorConstants.PATTERN_END_OFFSET_GROUP)); }
Source:
<code>public RawPacket reverseTransform(RawPacket pkt) { Integer mediaSSRC = pkt.getSSRC(); <START> ReplayContext replayContext = replayContexts.get(mediaSSRC); <END> if (replayContext == null) { replayContext = new ReplayContext(); replayContexts.put(mediaSSRC, replayContext); } return replayContext.isSeen(pkt) ? null : pkt; }</code><technical_language>this is ignorance showing, is this detect a padding packet? is this real (non-padding) packets passed srtp replay context? srtp replay context filter out (i.e. padding packets)</technical_language>

Target:
public RawPacket reverseTransform(RawPacket pkt) { Long mediaSSRC = pkt.getSSRCAsLong(); Set<Integer> replayContext = replayContexts.get(mediaSSRC); if (replayContext == null) { replayContext = Collections.newSetFromMap( new LRUCache<Integer, Boolean>(SEEN_SET_SZ)); replayContexts.put(mediaSSRC, replayContext); } return replayContext.add(pkt.getSequenceNumber()) ? pkt : null; }
Source:
<code>private void stopWatchSafe(IProject project, IOpenShiftConnection connection, String... kinds) { <START> for (String kind : KINDS) { <END> AtomicReference<IWatcher> watcherRef = watches.remove(new WatchKey(connection, project, kind)); if((watcherRef != null) && (watcherRef.get() != null)) { watcherRef.get().stop(); } } }</code><technical_language>'kinds' instead of 'KINDS' in startWatchSafe(), is left intentionally watches removed</technical_language>

Target:
private void stopWatchSafe(IProject project, IOpenShiftConnection connection, String... kinds) { for (String kind : kinds) { AtomicReference<IWatcher> watcherRef = watches.remove(new WatchKey(connection, project, kind)); if((watcherRef != null) && (watcherRef.get() != null)) { watcherRef.get().stop(); } } }
Source:
<code>public void startGanache() throws Exception { String OS = System.getProperty("os.name").toLowerCase(); ProcessBuilder processBuilder = new ProcessBuilder(); final String blockGasLimit = "471238800"; final String blockGasPrice = "1"; final String initialBalanceWei = "100000000000000000000"; final String command = String.format("ganache-cli -l %s -v -g %s --keepAliveTimeout 15000 --account=\"%s,%s\"", blockGasLimit, blockGasPrice, this.privateKey, initialBalanceWei); if (OS.contains("win")) { processBuilder.command("cmd.exe", "/c", command); } else { processBuilder.command("bash", "-c", command); } this.process = processBuilder.start(); <START> Thread.sleep(20000); <END> }</code><technical_language>change 20000 a literal a class private final static attribute</technical_language>

Target:
public void startGanache() throws Exception { String OS = System.getProperty("os.name").toLowerCase(); ProcessBuilder processBuilder = new ProcessBuilder(); final String blockGasLimit = "471238800"; final String blockGasPrice = "1"; final String initialBalanceWei = "100000000000000000000"; final String command = String.format("ganache-cli -l %s -v -g %s --keepAliveTimeout 15000 --account=\"%s,%s\"", blockGasLimit, blockGasPrice, this.privateKey, initialBalanceWei); if (OS.contains("win")) { processBuilder.command("cmd.exe", "/c", command); } else { processBuilder.command("bash", "-c", command); } this.process = processBuilder.start(); Thread.sleep(SLEEP_TIME_MILLIS); }
Source:
<code>public void init(Map<String, Object> conf) { <START> LOG.info("Initialing... Config: " + conf.toString()); <END> LOG.info("Class path: " + System.getProperty("java.class.path")); checkpointRootPath = (String) conf.get(ROOT_PATH_KEY); Configuration hadoopConfig = new Configuration(); try { fileSystem = FileSystem.get(hadoopConfig); LOG.info("URI: " + fileSystem.getUri() + " ; Home Dir: " + fileSystem.getHomeDirectory()); } catch (IOException e) { throw new RuntimeException("Failed to get hadoop file system", e); } }</code><technical_language>omit: Initialing..</technical_language>

Target:
public void init(Map<String, Object> conf) throws StatefulStorageException { LOG.info("Initializing... Config: " + conf.toString()); LOG.info("Class path: " + System.getProperty("java.class.path")); checkpointRootPath = (String) conf.get(ROOT_PATH_KEY); Configuration hadoopConfig = new Configuration(); try { fileSystem = FileSystem.get(hadoopConfig); LOG.info("Hadoop FileSystem URI: " + fileSystem.getUri() + " ; Home Dir: " + fileSystem.getHomeDirectory()); } catch (IOException e) { throw new StatefulStorageException("Failed to get hadoop file system", e); } }
Source:
<code>public boolean removeHeader(Chain header) { long suffixHead = chain + CHAIN_HEADER_SIZE; long prefixTail; Iterator<Element> iterator = header.iterator(); do { if (!compare(iterator.next(), suffixHead)) { return true; } prefixTail = suffixHead; suffixHead = storage.readLong(suffixHead + ELEMENT_HEADER_NEXT_OFFSET); } while (iterator.hasNext()); if (suffixHead == chain) { int slot = owner.getSlotForHashAndEncoding(readKeyHash(chain), chain, ~0); if (!owner.evict(slot, true)) { <START> throw new AssertionError(); <END> } return true; } else { int hash = readKeyHash(chain); int elemSize = storage.readInt(suffixHead + ELEMENT_HEADER_LENGTH_OFFSET); ByteBuffer elemBuffer = storage.readBuffer(suffixHead + ELEMENT_HEADER_SIZE, elemSize); Long newChainAddress = createAttachedChain(readKeyBuffer(chain), hash, elemBuffer); if (newChainAddress == null) { return false; } else { AttachedInternalChain newChain = new AttachedInternalChain(newChainAddress); try { long next = storage.readLong(suffixHead + ELEMENT_HEADER_NEXT_OFFSET); long tail = storage.readLong(chain + CHAIN_HEADER_TAIL_OFFSET); if (next != chain) { newChain.append(next, tail); } if (owner.updateEncoding(hash, chain, newChainAddress, ~0)) { storage.writeLong(prefixTail + ELEMENT_HEADER_NEXT_OFFSET, chain); free(); return true; } else { newChain.free(); throw new AssertionError("Encoding update failure - impossible!"); } } finally { newChain.close(); } } } }</code><technical_language>I presume this is a "should happen" case is output error diagnose fault</technical_language>

Target:
public boolean removeHeader(Chain header) { long suffixHead = chain + CHAIN_HEADER_SIZE; long prefixTail; Iterator<Element> iterator = header.iterator(); do { if (!compare(iterator.next(), suffixHead)) { return true; } prefixTail = suffixHead; suffixHead = storage.readLong(suffixHead + ELEMENT_HEADER_NEXT_OFFSET); } while (iterator.hasNext()); if (suffixHead == chain) { int slot = owner.getSlotForHashAndEncoding(readKeyHash(chain), chain, ~0); if (!owner.evict(slot, true)) { throw new AssertionError("Unexpected failure to evict slot " + slot); } return true; } else { int hash = readKeyHash(chain); int elemSize = storage.readInt(suffixHead + ELEMENT_HEADER_LENGTH_OFFSET); ByteBuffer elemBuffer = storage.readBuffer(suffixHead + ELEMENT_HEADER_SIZE, elemSize); Long newChainAddress = createAttachedChain(readKeyBuffer(chain), hash, elemBuffer); if (newChainAddress == null) { return false; } else { AttachedInternalChain newChain = new AttachedInternalChain(newChainAddress); try { long next = storage.readLong(suffixHead + ELEMENT_HEADER_NEXT_OFFSET); long tail = storage.readLong(chain + CHAIN_HEADER_TAIL_OFFSET); if (next != chain) { newChain.append(next, tail); } if (owner.updateEncoding(hash, chain, newChainAddress, ~0)) { storage.writeLong(prefixTail + ELEMENT_HEADER_NEXT_OFFSET, chain); free(); return true; } else { newChain.free(); throw new AssertionError("Encoding update failure - impossible!"); } } finally { newChain.close(); } } } }
Source:
<code><START> public synchronized void stop(final String reason) <END> { new Thread( "Shutdown Thread" ) { @Override public void run() { independentThreadStop( reason, true ); } }.start(); }</code><technical_language>remove synchronized now</technical_language>

Target:
public void stop(final String reason) { new Thread( "Shutdown Thread" ) { @Override public void run() { independentThreadStop( reason, true ); } }.start(); }
Source:
<code>public URI getOutputChannel() throws InfrastructureException { try { final URI apiURI = URI.create(apiEndpoint); <START> return UriBuilder.fromUri(apiURI) <END> .scheme("https".equals(apiURI.getScheme()) ? "wss" : "ws") .replacePath(apiURI.getPath().replace("/api", "")) .path(OUTPUT_WEBSOCKET_ENDPOINT_BASE) .build(); } catch (UriBuilderException | IllegalArgumentException ex) { throw new InternalInfrastructureException("Failed to get the output channel because: " + ex.getLocalizedMessage()); } }</code><technical_language>avoid URI transformation providing ws:// URI instead (in general case http:// )</technical_language>

Target:
public URI getOutputChannel() throws InfrastructureException { try { return UriBuilder.fromUri(websocketEndpointBase) .path(OUTPUT_WEBSOCKET_ENDPOINT_BASE) .build(); } catch (UriBuilderException | IllegalArgumentException ex) { throw new InternalInfrastructureException("Failed to get the output channel. " + ex.getMessage()); } }
Source:
<code>public void testEOL() throws Exception { RawText rt = new RawText(Constants.encodeASCII("foo\n")); assertEquals("\n", rt.getEOL()); assertFalse(rt.isMissingNewlineAtEnd()); rt = new RawText(Constants.encodeASCII("foo\r\n")); assertEquals("\r\n", rt.getEOL()); assertFalse(rt.isMissingNewlineAtEnd()); rt = new RawText(Constants.encodeASCII("foo\nbar")); assertEquals("\n", rt.getEOL()); assertTrue(rt.isMissingNewlineAtEnd()); rt = new RawText(Constants.encodeASCII("foo\r\nbar")); assertEquals("\r\n", rt.getEOL()); assertTrue(rt.isMissingNewlineAtEnd()); rt = new RawText(Constants.encodeASCII("foo\nbar\r\n")); assertEquals("\n", rt.getEOL()); assertFalse(rt.isMissingNewlineAtEnd()); rt = new RawText(Constants.encodeASCII("foo\r\nbar\n")); assertEquals("\r\n", rt.getEOL()); assertFalse(rt.isMissingNewlineAtEnd()); rt = new RawText(Constants.encodeASCII("foo")); assertNull(rt.getEOL()); <START> assertTrue(rt.isMissingNewlineAtEnd()); <END> }</code><technical_language>Add asserts for empty string, string of "\n", string of "\r\n"</technical_language>

Target:
public void testEOL() throws Exception { RawText rt = new RawText(Constants.encodeASCII("foo\n")); assertEquals("\n", rt.getEOL()); assertFalse(rt.isMissingNewlineAtEnd()); rt = new RawText(Constants.encodeASCII("foo\r\n")); assertEquals("\r\n", rt.getEOL()); assertFalse(rt.isMissingNewlineAtEnd()); rt = new RawText(Constants.encodeASCII("foo\nbar")); assertEquals("\n", rt.getEOL()); assertTrue(rt.isMissingNewlineAtEnd()); rt = new RawText(Constants.encodeASCII("foo\r\nbar")); assertEquals("\r\n", rt.getEOL()); assertTrue(rt.isMissingNewlineAtEnd()); rt = new RawText(Constants.encodeASCII("foo\nbar\r\n")); assertEquals("\n", rt.getEOL()); assertFalse(rt.isMissingNewlineAtEnd()); rt = new RawText(Constants.encodeASCII("foo\r\nbar\n")); assertEquals("\r\n", rt.getEOL()); assertFalse(rt.isMissingNewlineAtEnd()); rt = new RawText(Constants.encodeASCII("foo")); assertNull(rt.getEOL()); assertTrue(rt.isMissingNewlineAtEnd()); rt = new RawText(Constants.encodeASCII("")); assertNull(rt.getEOL()); assertTrue(rt.isMissingNewlineAtEnd()); rt = new RawText(Constants.encodeASCII("\n")); assertEquals("\n", rt.getEOL()); assertFalse(rt.isMissingNewlineAtEnd()); rt = new RawText(Constants.encodeASCII("\r\n")); assertEquals("\r\n", rt.getEOL()); assertFalse(rt.isMissingNewlineAtEnd()); }
Source:
<code><START> private List<GerritQueryResult> executeQueryRest(String query, String option) throws GerritException { <END> List<GerritQueryResult> results = null; results = client.executeQueryRest(new NullProgressMonitor(), query, option); return results; }</code><technical_language>here. define NullProgressMonitor a "monitor" field avoid cluttering code</technical_language>

Target:
private List<GerritQueryResult> executeQueryRest(String query, String option) throws GerritException { return client.executeQueryRest(new NullProgressMonitor(), query, option); }
Source:
<code>private static String executeCommand(List<String> command, OutputStream os, String message, Map<String, String> env) throws IOException, InterruptedException { ProcessBuilder pb = new ProcessBuilder(command); if (env != null) { for (String variable : env.keySet()) { pb.environment().put(variable, env.get(variable)); <START> } <END> } StringBuilder sb = new StringBuilder(); String result = ""; Process process = pb.start(); try { int errCode = process.waitFor(); sb.append("errCode: " + errCode + " \n"); result = output(process.getInputStream()); sb.append("inputStream: "); sb.append(result); sb.append("\n"); result = output(process.getErrorStream()); sb.append("errorStream: "); sb.append(result); sb.append("\n"); } catch (InterruptedException ie) { ie.printStackTrace(System.err); throw ie; } finally { process.destroy(); } return sb.toString(); }</code><technical_language>test failures - M2_HOME environment variable child process? Or, multiple (or no) Maven settings files server? @ctomc do presently configuring Maven settings server</technical_language>

Target:
private static String executeCommand(List<String> command, OutputStream os, String message, Map<String, String> env) throws IOException, InterruptedException { ProcessBuilder pb = new ProcessBuilder(command); pb.directory(new File ("/store")); if (env != null) { for (String variable : env.keySet()) { pb.environment().put(variable, env.get(variable)); } } StringBuilder sb = new StringBuilder(); sb.append(mydebug()); String result = ""; Process process = pb.start(); try { int errCode = process.waitFor(); sb.append("errCode: " + errCode + " \n"); result = output(process.getInputStream()); sb.append("inputStream: "); sb.append(result); sb.append("\n"); result = output(process.getErrorStream()); sb.append("errorStream: "); sb.append(result); sb.append("\n"); } catch (InterruptedException ie) { ie.printStackTrace(System.err); throw ie; } finally { process.destroy(); } return sb.toString(); }
Source:
<code>public void start() { <START> this.executorService = newSingleThreadExecutor(new AxonThreadFactory("TrackingEventProcessor - " + name)); <END> if (state == State.NOT_STARTED || state == State.SHUT_DOWN) { state = State.STARTED; registerInterceptor((unitOfWork, interceptorChain) -> { unitOfWork.onPrepareCommit(uow -> { EventMessage<?> event = uow.getMessage(); if (event instanceof TrackedEventMessage<?> && lastToken != null && lastToken.equals(((TrackedEventMessage) event).trackingToken())) { tokenStore.storeToken(lastToken, getName(), 0); } }); return interceptorChain.proceed(); }); executorService.submit(() -> { try { this.processingLoop(); } catch (Throwable e) { logger.error("Processing loop ended due to uncaught exception. Processor stopping.", e); } }); } }</code><technical_language>If executorService assigned field, stopped reused (if accepts tasks)</technical_language>

Target:
public void start() { if (state == State.NOT_STARTED || state == State.SHUT_DOWN) { if (this.executorService == null || this.executorService.isShutdown()) { this.executorService = newSingleThreadExecutor(new AxonThreadFactory("TrackingEventProcessor - " + name)); } state = State.STARTED; registerInterceptor((unitOfWork, interceptorChain) -> { unitOfWork.onPrepareCommit(uow -> { EventMessage<?> event = uow.getMessage(); if (event instanceof TrackedEventMessage<?> && lastToken != null && lastToken.equals(((TrackedEventMessage) event).trackingToken())) { tokenStore.storeToken(lastToken, getName(), 0); } }); return interceptorChain.proceed(); }); executorService.submit(() -> { try { this.processingLoop(); } catch (Throwable e) { logger.error("Processing loop ended due to uncaught exception. Processor stopping.", e); } }); } }