auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public String[] profilesToActivate() { if (this.regexPattern != null) { return new String[] { REGEX_PATTERN_FILTER }; } else if (this.pattern != null) { return new String[] { SIMPLE_PATTERN_FILTER }; } <START> else { <END> return new String[] { ACCEPT_ALL_FILES }; } }</code><technical_language>need else</technical_language>

Target:
public String[] profilesToActivate() { if (this.regexPattern != null) { return new String[] { REGEX_PATTERN_FILTER }; } else if (this.pattern != null) { return new String[] { SIMPLE_PATTERN_FILTER }; } return new String[] { ACCEPT_ALL_FILES }; }
Source:
<code>private void init() { if(eventService == null) { eventService = EventServiceFactory.getInstance().getEventService(); } if(dbConnection == null) { dbConnection = new DSpace().getSingletonService(DBConnection.class); if(dbConnection == null) { <START> log.fatal("Cannot obtain the bean the provides a database connection, " + <END> "check previous entries in the dspace.log to find why the db failed to initialize."); } } currentUser = null; currentLocale = I18nUtil.DEFAULTLOCALE; extraLogInfo = ""; ignoreAuth = false; specialGroups = new ArrayList<>(); authStateChangeHistory = new Stack<Boolean>(); authStateClassCallHistory = new Stack<String>(); }</code><technical_language>Picky language stuff: 1. replace "the" "which". 2. Comma splice: replace comma a period a new sentence below. changes, without, +1</technical_language>

Target:
private void init() { if(eventService == null) { eventService = EventServiceFactory.getInstance().getEventService(); } if(dbConnection == null) { dbConnection = new DSpace().getSingletonService(DBConnection.class); if(dbConnection == null) { log.fatal("Cannot obtain the bean which provides a database connection. " + "Check previous entries in the dspace.log to find why the db failed to initialize."); } } currentUser = null; currentLocale = I18nUtil.DEFAULTLOCALE; extraLogInfo = ""; ignoreAuth = false; specialGroups = new ArrayList<>(); authStateChangeHistory = new Stack<Boolean>(); authStateClassCallHistory = new Stack<String>(); }
Source:
<code>private void writeUnlockPage( long page, FullPageId fullId, Boolean walPlc, boolean markDirty, boolean restore ) { boolean wasDirty = isDirty(page); if (!restore && markDirty && !wasDirty && changeTracker != null) changeTracker.apply(page, fullId, this); boolean pageWalRec = markDirty && walPlc != FALSE && (walPlc == TRUE || !wasDirty); assert PageIO.getCrc(page + PAGE_OVERHEAD) == 0; if (markDirty) setDirty(fullId, page, markDirty, false); try { beforeReleaseWrite(fullId, page + PAGE_OVERHEAD, pageWalRec); } <START> catch (IgniteCheckedException e) { <END> throw new IgniteException(e); } finally { long pageId = PageIO.getPageId(page + PAGE_OVERHEAD); assert pageId != 0 : U.hexLong(PageHeader.readPageId(page)); assert PageIO.getVersion(page + PAGE_OVERHEAD) != 0 : U.hexLong(pageId); assert PageIO.getType(page + PAGE_OVERHEAD) != 0 : U.hexLong(pageId); try { rwLock.writeUnlock(page + PAGE_LOCK_OFFSET, PageIdUtils.tag(pageId)); if (throttlingPlc != ThrottlingPolicy.DISABLED && !restore && markDirty && !wasDirty) writeThrottle.onMarkDirty(isInCheckpoint(fullId)); } catch (AssertionError ex) { U.error(log, "Failed to unlock page [fullPageId=" + fullId + ", binPage=" + U.toHexString(page, systemPageSize()) + ']'); throw ex; } } }</code><technical_language>if IgniteCheckedException thrown is caught in method. it</technical_language>

Target:
private void writeUnlockPage( long page, FullPageId fullId, Boolean walPlc, boolean markDirty, boolean restore ) { boolean wasDirty = isDirty(page); try { if (!restore && markDirty && !wasDirty && changeTracker != null) changeTracker.apply(page, fullId, this); boolean pageWalRec = markDirty && walPlc != FALSE && (walPlc == TRUE || !wasDirty); assert PageIO.getCrc(page + PAGE_OVERHEAD) == 0; if (markDirty) setDirty(fullId, page, markDirty, false); beforeReleaseWrite(fullId, page + PAGE_OVERHEAD, pageWalRec); } catch (IgniteCheckedException e) { throw new IgniteException(e); } finally { long pageId = PageIO.getPageId(page + PAGE_OVERHEAD); assert pageId != 0 : U.hexLong(PageHeader.readPageId(page)); assert PageIO.getVersion(page + PAGE_OVERHEAD) != 0 : U.hexLong(pageId); assert PageIO.getType(page + PAGE_OVERHEAD) != 0 : U.hexLong(pageId); try { rwLock.writeUnlock(page + PAGE_LOCK_OFFSET, PageIdUtils.tag(pageId)); if (throttlingPlc != ThrottlingPolicy.DISABLED && !restore && markDirty && !wasDirty) writeThrottle.onMarkDirty(isInCheckpoint(fullId)); } catch (AssertionError ex) { U.error(log, "Failed to unlock page [fullPageId=" + fullId + ", binPage=" + U.toHexString(page, systemPageSize()) + ']'); throw ex; } } }
Source:
<code>public Adjustments getAccountAdjustments(final String accountCode, final Adjustments.AdjustmentType type,final Adjustments.AdjustmentState state) { <START> final String url = new StringBuilder().append(Account.ACCOUNT_RESOURCE).append("/").append(accountCode).append(Adjustments.ADJUSTMENTS_RESOURCE ) <END> .append((type != null ? "?type=" + type.getType() : "")).append((state != null ? "&state=" + state.getState() : "")).toString(); return doGET(url,Adjustments.class); }</code><technical_language>switch StringBuilder in d94ed92</technical_language>

Target:
public Adjustments getAccountAdjustments(final String accountCode, final Adjustments.AdjustmentType type,final Adjustments.AdjustmentState state) { StringBuilder sb = new StringBuilder().append(Account.ACCOUNT_RESOURCE).append("/").append(accountCode).append(Adjustments.ADJUSTMENTS_RESOURCE ); if(type != null){ sb.append("?type=").append(type.getType()); } if(state != null){ if(type != null){ sb.append("&"); }else{ sb.append("?"); } sb.append("state=").append(state.getState()); } return doGET(sb.toString(),Adjustments.class); }
Source:
<code>private Locale parseLocaleFrom(String filename, String basename) { Locale result = null; if (filename.startsWith(basename)) { String tempfilename = filename.substring(basename.length()); <START> filename = tempfilename; <END> } String localespec = filename.substring(0, filename.indexOf('.')); if ("".equals(localespec)) { result = Locale.ENGLISH; } else { localespec = localespec.substring(1); result = LocaleUtility.fromSpecification(localespec); } return result; }</code><technical_language>In issue "Background Information: **Method parameters**, caught exceptions foreach variables **should reassigned**". filename is a method parameter. do is assign method parameter a temporary variable reuse after</technical_language>

Target:
private Locale parseLocaleFrom(String filename, String basename) { Locale result = null; if (filename.startsWith(basename)) { String tempfilename = filename; tempfilename = tempfilename.substring(basename.length()); filename = tempfilename; } String localespec = filename.substring(0, filename.indexOf('.')); if ("".equals(localespec)) { result = Locale.ENGLISH; } else { localespec = localespec.substring(1); result = LocaleUtility.fromSpecification(localespec); } return result; }
Source:
<code>public RowHmacCheck getRowHmacCheck() { <START> if (rowHmacCheck.equals("enabled")) { <END> return RowHmacCheck.ENABLED; } else if (rowHmacCheck.equals("logging")) { return RowHmacCheck.LOGGING; } return RowHmacCheck.DISABLED; }</code><technical_language>a switch statement exception for default case is cleaner</technical_language>

Target:
public RowHmacCheck getRowHmacCheck() { switch (rowHmacCheck) { case "enforced": return RowHmacCheck.ENFORCED; case "logging": return RowHmacCheck.DISABLED_BUT_LOG; case "disabled": return RowHmacCheck.DISABLED; default: throw new IllegalArgumentException( String.format("%s is an invalid rowHmacCheck parameter", rowHmacCheck) ); } }
Source:
<code>public void pack(String storageId, String repositoryId) throws IOException { String contextId = storageId + ":" + repositoryId + ":local"; logger.info("Packing index for " + contextId + " ..."); final RepositoryIndexer indexer = repositoryIndexManager.getRepositoryIndexer(contextId); if (indexer == null) { <START> throw new NullPointerException("Unable to find RepositoryIndexer by key " + contextId + <END> ". \nAvailable keys are " + repositoryIndexManager.getIndexes() .keySet()); } IndexingContext context = indexer.getIndexingContext(); final IndexSearcher indexSearcher = context.acquireIndexSearcher(); try { IndexPackingRequest request = new IndexPackingRequest(context, indexSearcher.getIndexReader(), new File(indexer.getRepositoryBasedir() + "/.index/local")); request.setUseTargetProperties(true); indexPacker.packIndex(request); logger.info("Index for " + storageId + ":" + repositoryId + ":local was packed successfully."); } finally { context.releaseIndexSearcher(indexSearcher); } }</code><technical_language>![MAJOR](<LINK_1> 'Severity: MAJOR') Avoid throwing null pointer exceptions. [![rule](<LINK_2>](<LINK_0></technical_language>

Target:
public void pack(String storageId, String repositoryId) throws IOException { String contextId = storageId + ":" + repositoryId + ":" + IndexTypeEnum.LOCAL.getType(); logger.info("Packing index for " + contextId + " ..."); final RepositoryIndexer indexer = repositoryIndexManager.getRepositoryIndexer(contextId); if (indexer == null) { throw new NullPointerException("Unable to find RepositoryIndexer by key " + contextId + ". \nAvailable keys are " + repositoryIndexManager.getIndexes() .keySet()); } IndexingContext context = indexer.getIndexingContext(); final IndexSearcher indexSearcher = context.acquireIndexSearcher(); try { IndexPackingRequest request = new IndexPackingRequest(context, indexSearcher.getIndexReader(), new File(indexer.getRepositoryBasedir() + "/.index/local")); request.setUseTargetProperties(true); indexPacker.packIndex(request); logger.info("Index for " + storageId + ":" + repositoryId + ":" + IndexTypeEnum.LOCAL.getType() + " was packed successfully."); } finally { context.releaseIndexSearcher(indexSearcher); } }
Source:
<code>public void addFinishedMission(DownloadMission downloadMission) { SQLiteDatabase database = getWritableDatabase(); <START> ContentValues values = getValuesOfMission(Objects.requireNonNull(downloadMission, "downloadMission is null")); <END> database.insert(FINISHED_TABLE_NAME, null, values); }</code><technical_language>move this</technical_language>

Target:
public void addFinishedMission(DownloadMission downloadMission) { ContentValues values = getValuesOfMission(Objects.requireNonNull(downloadMission)); SQLiteDatabase database = getWritableDatabase(); database.insert(FINISHED_TABLE_NAME, null, values); }
Source:
<code>public String lineProtocol(final TimeUnit precision) { final StringBuilder sb = new StringBuilder(); <START> sb.append(KEY_ESCAPER.escape(this.measurement)); <END> sb.append(concatenatedTags()); sb.append(concatenateFields()); sb.append(formatedTime(precision)); return sb.toString(); }</code><technical_language>need synchronize this #322 @simon04 track of this change in PR, depending merge first</technical_language>

Target:
public String lineProtocol(final TimeUnit precision) { final StringBuilder sb = CACHED_STRINGBUILDERS .get() .computeIfAbsent(this.measurement, MeasurementStringBuilder::new) .resetForUse(); concatenatedTags(sb); concatenatedFields(sb); formatedTime(sb, precision); return sb.toString(); }
Source:
<code>public void testPollableReactiveFlow() throws Exception { this.inputChannel.send(new GenericMessage<>("1,2,3,4,5")); CountDownLatch latch = new CountDownLatch(6); Flux.from(this.pollablePublisher) .take(6) .filter(m -> m.getHeaders().containsKey(IntegrationMessageHeaderAccessor.SEQUENCE_NUMBER)) .log("org.springframework.integration.flux2", Level.WARNING) .doOnNext(p -> latch.countDown()) .subscribe(); Future<List<Integer>> future = Executors.newSingleThreadExecutor().submit(() -> Flux.just("11,12,13") .map(v -> v.split(",")) .flatMapIterable(Arrays::asList) .map(Integer::parseInt) .<Message<Integer>>map(GenericMessage::new) <START> .concatWith(this.pollablePublisher) <END> .take(7) .map(Message::getPayload) .log("org.springframework.integration.flux", Level.WARNING) .collectList() .block(Duration.ofSeconds(10)) ); this.inputChannel.send(new GenericMessage<>("6,7,8,9,10")); assertTrue(latch.await(20, TimeUnit.SECONDS)); List<Integer> integers = future.get(20, TimeUnit.SECONDS); assertNotNull(integers); assertEquals(7, integers.size()); }</code><technical_language>remove generic type (and below). Works for restored (and removes warning IDE)</technical_language>

Target:
public void testPollableReactiveFlow() throws Exception { this.inputChannel.send(new GenericMessage<>("1,2,3,4,5")); CountDownLatch latch = new CountDownLatch(6); Flux.from(this.pollablePublisher) .take(6) .filter(m -> m.getHeaders().containsKey(IntegrationMessageHeaderAccessor.SEQUENCE_NUMBER)) .log("org.springframework.integration.flux2", Level.WARNING) .doOnNext(p -> latch.countDown()) .subscribe(); Future<List<Integer>> future = Executors.newSingleThreadExecutor().submit(() -> Flux.just("11,12,13") .map(v -> v.split(",")) .flatMapIterable(Arrays::asList) .map(Integer::parseInt) .<Message<Integer>>map(GenericMessage<Integer>::new) .concatWith(this.pollablePublisher) .take(7) .map(Message::getPayload) .log("org.springframework.integration.flux", Level.WARNING) .collectList() .block(Duration.ofSeconds(10)) ); this.inputChannel.send(new GenericMessage<>("6,7,8,9,10")); assertTrue(latch.await(20, TimeUnit.SECONDS)); List<Integer> integers = future.get(20, TimeUnit.SECONDS); assertNotNull(integers); assertEquals(7, integers.size()); }
Source:
<code>public CoordinatorConfig(Properties config) { _config = config; _properties = new VerifiableProperties(config); _cluster = _properties.getString(CONFIG_CLUSTER); _zkAddress = _properties.getString(CONFIG_ZK_ADDRESS); _zkSessionTimeout = _properties.getInt(CONFIG_ZK_SESSION_TIMEOUT, ZkClient.DEFAULT_SESSION_TIMEOUT); _zkConnectionTimeout = _properties.getInt(CONFIG_ZK_CONNECTION_TIMEOUT, ZkClient.DEFAULT_CONNECTION_TIMEOUT); _retryIntervalMs = _properties.getInt(CONFIG_RETRY_INTERVAL, 1000 ); _heartbeatPeriodMs = _properties.getLong(CONFIG_HEARTBEAT_PERIOD_MS, Duration.ofMinutes(1).toMillis()); _debounceTimerMs = _properties.getLong(CONFIG_DEBOUNCE_TIMER_MS, Duration.ofSeconds(30).toMillis()); _defaultTransportProviderName = _properties.getString(CONFIG_DEFAULT_TRANSPORT_PROVIDER, ""); _zkCleanUpOrphanConnectorTask = _properties.getBoolean(CONFIG_ZK_CLEANUP_ORPHAN_CONNECTOR_TASK, false); _zkCleanUpOrphanConnectorTaskLock = _properties.getBoolean(CONFIG_ZK_CLEANUP_ORPHAN_CONNECTOR_TASK_LOCK, false); <START> _performPreAssignmentCleanup = _properties.getBoolean(CONFIG_PERFORM_PRE_ASSIGNMENT_CLEANUP, true); <END> }</code><technical_language>Do turn this feature default testing in production</technical_language>

Target:
public CoordinatorConfig(Properties config) { _config = config; _properties = new VerifiableProperties(config); _cluster = _properties.getString(CONFIG_CLUSTER); _zkAddress = _properties.getString(CONFIG_ZK_ADDRESS); _zkSessionTimeout = _properties.getInt(CONFIG_ZK_SESSION_TIMEOUT, ZkClient.DEFAULT_SESSION_TIMEOUT); _zkConnectionTimeout = _properties.getInt(CONFIG_ZK_CONNECTION_TIMEOUT, ZkClient.DEFAULT_CONNECTION_TIMEOUT); _retryIntervalMs = _properties.getInt(CONFIG_RETRY_INTERVAL, 1000 ); _heartbeatPeriodMs = _properties.getLong(CONFIG_HEARTBEAT_PERIOD_MS, Duration.ofMinutes(1).toMillis()); _debounceTimerMs = _properties.getLong(CONFIG_DEBOUNCE_TIMER_MS, Duration.ofSeconds(30).toMillis()); _defaultTransportProviderName = _properties.getString(CONFIG_DEFAULT_TRANSPORT_PROVIDER, ""); _zkCleanUpOrphanConnectorTask = _properties.getBoolean(CONFIG_ZK_CLEANUP_ORPHAN_CONNECTOR_TASK, false); _zkCleanUpOrphanConnectorTaskLock = _properties.getBoolean(CONFIG_ZK_CLEANUP_ORPHAN_CONNECTOR_TASK_LOCK, false); _maxDatastreamTasksPerInstance = _properties.getInt(CONFIG_MAX_DATASTREAM_TASKS_PER_INSTANCE, 0); _performPreAssignmentCleanup = _properties.getBoolean(CONFIG_PERFORM_PRE_ASSIGNMENT_CLEANUP, false); }
Source:
<code>protected void ExecuteVDSCommand() { SetVmStatusVDSCommandParameters parameters = getParameters(); VmDynamic vmDynamic = DbFacade.getInstance().getVmDynamicDao().get(parameters.getVmId()); vmDynamic.setstatus(parameters.getStatus()); <START> if (parameters.getStatus().isNotRunning()) { <END> ResourceManager.getInstance().RemoveAsyncRunningVm(parameters.getVmId()); VmStatistics vmStatistics = DbFacade.getInstance().getVmStatisticsDao().get(parameters.getVmId()); VM vm = new VM(null, vmDynamic, vmStatistics); ResourceManager.getInstance().InternalSetVmStatus(vm, parameters.getStatus()); DbFacade.getInstance().getVmStatisticsDao().update(vm.getStatisticsData()); List<VmNetworkInterface> interfaces = vm.getInterfaces(); if (interfaces != null && interfaces.size() > 0) { for (VmNetworkInterface ifc : interfaces) { VmNetworkStatistics stats = ifc.getStatistics(); DbFacade.getInstance().getVmNetworkStatisticsDao().update(stats); } } } else if (parameters.getStatus() == VMStatus.Unknown) { ResourceManager.getInstance().RemoveAsyncRunningVm(parameters.getVmId()); } DbFacade.getInstance().getVmDynamicDao().update(vmDynamic); }</code><technical_language>need if null here, add a check safe</technical_language>

Target:
protected void ExecuteVDSCommand() { SetVmStatusVDSCommandParameters parameters = getParameters(); final VMStatus status = parameters.getStatus(); if (status == null) { log.warnFormat("got request to change the status of VM whose id is {0} to null, ignoring", parameters.getVmId()); return; } VmDynamic vmDynamic = DbFacade.getInstance().getVmDynamicDao().get(parameters.getVmId()); vmDynamic.setstatus(status); if (status.isNotRunning()) { ResourceManager.getInstance().RemoveAsyncRunningVm(parameters.getVmId()); VmStatistics vmStatistics = DbFacade.getInstance().getVmStatisticsDao().get(parameters.getVmId()); VM vm = new VM(null, vmDynamic, vmStatistics); ResourceManager.getInstance().InternalSetVmStatus(vm, status); DbFacade.getInstance().getVmStatisticsDao().update(vm.getStatisticsData()); List<VmNetworkInterface> interfaces = vm.getInterfaces(); if (interfaces != null && interfaces.size() > 0) { for (VmNetworkInterface ifc : interfaces) { VmNetworkStatistics stats = ifc.getStatistics(); DbFacade.getInstance().getVmNetworkStatisticsDao().update(stats); } } } else if (status == VMStatus.Unknown) { ResourceManager.getInstance().RemoveAsyncRunningVm(parameters.getVmId()); } DbFacade.getInstance().getVmDynamicDao().update(vmDynamic); }
Source:
<code>public boolean equals(Object other) { <START> if (other == null || !(other instanceof Type)) { <END> return false; } return equals((Type)other); }</code><technical_language>is this required? test wrote fails I apply change PrimitiveType, fail if I apply this</technical_language>

Target:
public boolean equals(Object other) { if (!(other instanceof Type) || other == null) { return false; } return equals((Type)other); }
Source:
<code>private boolean validateNames() { boolean valid = true; <START> for (E entity : entities.getItems()) { <END> EntityModel<String> nameEntity = validateName(entity); if (!nameEntity.getIsValid()) { valid = false; entity.setError(ConstantsManager.getInstance().getConstants().invalidName()); entity.setInvalidityReasons(nameEntity.getInvalidityReasons()); entity.setIsValid(nameEntity.getIsValid()); } } entities.getItems().stream().findFirst() .filter(e -> !e.getIsValid()) .ifPresent(e -> { entities.setSelectedItem(e); onPropertyChanged(new PropertyChangedEventArgs("InvalidVm")); }); return valid; }</code><technical_language>switched entities.getItems().stream().forEach()</technical_language>

Target:
private boolean validateNames() { for (E entity : entities.getItems()) { EntityModel<String> nameEntity = validateName(entity); if (!nameEntity.getIsValid()) { entity.setError(ConstantsManager.getInstance().getConstants().invalidName()); entity.setInvalidityReasons(nameEntity.getInvalidityReasons()); entity.setIsValid(nameEntity.getIsValid()); entities.setSelectedItem(entity); onPropertyChanged(new PropertyChangedEventArgs("InvalidVm")); return false; } } return true; }
Source:
<code>protected Cache<Object, Object> createCache(String regionName) { switch ( missingCacheStrategy ) { case CREATE_WARN: LOG.missingCacheCreated( regionName ); <START> cacheManager.createCache( regionName, new MutableConfiguration<>() ); <END> return cacheManager.getCache( regionName ); case CREATE: cacheManager.createCache( regionName, new MutableConfiguration<>() ); return cacheManager.getCache( regionName ); case FAIL: throw new CacheException( "On-the-fly creation of JCache Cache objects is not supported [" + regionName + "]" ); default: throw new IllegalStateException( "Unsupported missing cache strategy: " + missingCacheStrategy ); } }</code><technical_language>I createCache() returns cache get back</technical_language>

Target:
protected Cache<Object, Object> createCache(String regionName) { switch ( missingCacheStrategy ) { case CREATE_WARN: SecondLevelCacheLogger.INSTANCE.missingCacheCreated( regionName, ConfigSettings.MISSING_CACHE_STRATEGY, MissingCacheStrategy.CREATE.getExternalRepresentation() ); return cacheManager.createCache( regionName, new MutableConfiguration<>() ); case CREATE: return cacheManager.createCache( regionName, new MutableConfiguration<>() ); case FAIL: throw new CacheException( "On-the-fly creation of JCache Cache objects is not supported [" + regionName + "]" ); default: throw new IllegalStateException( "Unsupported missing cache strategy: " + missingCacheStrategy ); } }
Source:
<code>protected void init(ExpressionExecutor[] attributeExpressionExecutors, ExecutionPlanContext executionPlanContext) { if (attributeExpressionExecutors.length != 2) { throw new OperationNotSupportedException("Percentile function has to have exactly 2 parameter, currently " + attributeExpressionExecutors.length + " parameters provided"); } try { if (attributeExpressionExecutors[1] instanceof ConstantExpressionExecutor) { percentileValue = ((Double) attributeExpressionExecutors[1].execute(null)); } else { throw new OperationNotSupportedException("Percentile value has to be a constant"); } } catch (ClassCastException c) { throw new ExecutionPlanCreationException("Percentile value should be of type double. But found " + attributeExpressionExecutors[1].getReturnType()); } if (percentileValue <= 0 || percentileValue > 100) { <START> throw new OperationNotSupportedException("Percentile value should be in 0 < p ≤ 100 range"); <END> } Attribute.Type type = attributeExpressionExecutors[0].getReturnType(); switch (type) { case FLOAT: percentileOutputFunctionExtension = new PercentileFunctionExtensionFloat(); break; case INT: percentileOutputFunctionExtension = new PercentileFunctionExtensionInt(); break; case LONG: percentileOutputFunctionExtension = new PercentileFunctionExtensionLong(); break; case DOUBLE: percentileOutputFunctionExtension = new PercentileFunctionExtensionDouble(); break; default: throw new OperationNotSupportedException("Percentile not supported for " + type); } }</code><technical_language>Add is current</technical_language>

Target:
protected void init(ExpressionExecutor[] attributeExpressionExecutors, ExecutionPlanContext executionPlanContext) { if (attributeExpressionExecutors.length != 2) { throw new OperationNotSupportedException("Percentile function has to have exactly 2 parameter, currently " + attributeExpressionExecutors.length + " parameters provided"); } try { if (attributeExpressionExecutors[1] instanceof ConstantExpressionExecutor) { percentileValue = ((Double) attributeExpressionExecutors[1].execute(null)); } else { throw new OperationNotSupportedException("Percentile value has to be a constant"); } } catch (ClassCastException c) { throw new ExecutionPlanCreationException("Percentile value should be of type double. But found " + attributeExpressionExecutors[1].getReturnType()); } if (percentileValue <= 0 || percentileValue > 100) { throw new OperationNotSupportedException( "Percentile value should be in 0 < p ≤ 100 range. But found " + percentileValue); } Attribute.Type type = attributeExpressionExecutors[0].getReturnType(); switch (type) { case FLOAT: percentileOutputFunctionExtension = new PercentileFunctionExtensionFloat(); break; case INT: percentileOutputFunctionExtension = new PercentileFunctionExtensionInt(); break; case LONG: percentileOutputFunctionExtension = new PercentileFunctionExtensionLong(); break; case DOUBLE: percentileOutputFunctionExtension = new PercentileFunctionExtensionDouble(); break; default: throw new OperationNotSupportedException("Percentile not supported for " + type); } }
Source:
<code>public void removeActivity(String workspaceId) throws ServerException { EntityManager em = managerProvider.get(); <START> WorkspaceActivity activity = em.find(WorkspaceActivity.class, workspaceId); <END> try { if (activity != null) { em.remove(activity); em.flush(); } } catch (RuntimeException x) { throw new ServerException(x.getLocalizedMessage(), x); } }</code><technical_language>em.find(...) throw RuntimeException? If - please consider moving Try statement</technical_language>

Target:
public void removeActivity(String workspaceId) throws ServerException { try { EntityManager em = managerProvider.get(); WorkspaceActivity activity = em.find(WorkspaceActivity.class, workspaceId); if (activity != null) { em.remove(activity); em.flush(); } } catch (RuntimeException x) { throw new ServerException(x.getLocalizedMessage(), x); } }
Source:
<code>public static void main(String[] args) { SingleCommand<TestMain> cmd = SingleCommand.singleCommand(TestMain.class); cmd.parse(args); ServerThread st = new ServerThread(port, serverfile); st.start(); try { <START> Thread.sleep(2000); END> if (tests != null) new JavaTCPClient().run(clientfile, "localhost", port, debug, Arrays.asList(tests.split(","))); else new JavaTCPClient().run(clientfile, "localhost", port, debug, new ArrayList<>()); } catch (Exception e) { e.printStackTrace(); } }</code><technical_language>If this is ServerThread is running in another thread needs get some point continue, prefer add a hook ServerThread e.g. st.waitUntilReady() magic values noisy e.g. fail in CI 2% of time, slow local builds longer</technical_language>

Target:
public static void main(String[] args) { SingleCommand<TestMain> cmd = SingleCommand.singleCommand(TestMain.class); cmd.parse(args); ServerThread st = new ServerThread(port, serverfile); st.start(); st.awaitStart(); try { if (tests != null) new JavaTCPClient().run(clientfile, "localhost", port, debug, Arrays.asList(tests.split(","))); else new JavaTCPClient().run(clientfile, "localhost", port, debug, new ArrayList<>()); } catch (Exception e) { e.printStackTrace(); } if (ConsoleUtils.allPassed()) ConsoleUtils.success("ALL TESTS PASSED"); else { ConsoleUtils.failure("SOME TESTS FAILED"); System.exit(1); } }
Source:
<code>private void startGetBlobAuthorizationFailTest(final OperationChain opChain) { Callback<GetBlobResult> callback = new TestCallback<>(opChain, false); BlobId originalId, fraudId = null; try { originalId = new BlobId(opChain.blobId, clusterMap); <START> fraudId = BlobId.craft(originalId, originalId.getVersion(), (short) (1), (short) 1); <END> } catch (IOException e) { Assert.fail("BlobId creation failed."); } Future<GetBlobResult> future = router.getBlob(fraudId.getID(), new GetBlobOptionsBuilder().operationType(GetBlobOptions.OperationType.All) .getOption(GetOption.Include_All) .build(), callback); TestFuture<GetBlobResult> testFuture = new TestFuture<GetBlobResult>(future, genLabel("getBlob", true), opChain) { @Override void check() throws Exception { checkExpectedRouterErrorCode(RouterErrorCode.BlobAuthorizationFailure); } }; opChain.testFutures.add(testFuture); }</code><technical_language>if account id, container id is 1? I do "current id + 1" is</technical_language>

Target:
private void startGetBlobAuthorizationFailTest(final OperationChain opChain) { Callback<GetBlobResult> callback = new TestCallback<>(opChain, false); BlobId originalId, fraudId; try { originalId = new BlobId(opChain.blobId, clusterMap); fraudId = BlobId.craft(originalId, originalId.getVersion(), (short) (originalId.getAccountId() + 1), (short) (originalId.getContainerId() + 1)); } catch (IOException e) { FutureResult<Void> future = new FutureResult<>(); future.done(null, e); callback.onCompletion(null, e); TestFuture<Void> testFuture = new TestFuture<Void>(future, genLabel("getBlob", true), opChain) { @Override void check() throws Exception { throw e; } }; opChain.testFutures.add(testFuture); return; } Future<GetBlobResult> future = router.getBlob(fraudId.getID(), new GetBlobOptionsBuilder().operationType(GetBlobOptions.OperationType.All) .getOption(GetOption.Include_All) .build(), callback); TestFuture<GetBlobResult> testFuture = new TestFuture<GetBlobResult>(future, genLabel("getBlob", true), opChain) { @Override void check() throws Exception { checkExpectedRouterErrorCode(RouterErrorCode.BlobAuthorizationFailure); } }; opChain.testFutures.add(testFuture); }
Source:
<code>@Override public void stop() { if (initGuard.get()) { try { U.await(initLatch); } catch (IgniteInterruptedCheckedException e) { if (log.isDebugEnabled()) log.error("Failed waiting while initialization is completed.", e); } } else { if (initGuard.compareAndSet(false, true)) { initLatch.countDown(); if (log.isDebugEnabled()) log.debug("Semaphore wasn't initialized. Prevented further initialization."); return; } else { try { U.await(initLatch); } catch (IgniteInterruptedCheckedException e) { if (log.isDebugEnabled()) log.error("Failed waiting while initialization is completed.", e); } } } assert sync != null; sync.setBroken(true); sync.releaseShared(0); UUID nodeID = ctx.localNodeId(); <START> onNodeRemoved(nodeID); <END> }</code><technical_language>This requires cache operations hang; done separate thread (see invocation of onNode Removed in DataStructuresProcessor, reconsider moving this call onKernalStop there, applicable IgniteLock well, do think?)</technical_language>

Target:
@Override public void stop() { if (initGuard.get()) { try { U.await(initLatch); } catch (IgniteInterruptedCheckedException e) { if (log.isDebugEnabled()) log.error("Failed waiting while initialization is completed.", e); } } else { if (initGuard.compareAndSet(false, true)) { initLatch.countDown(); if (log.isDebugEnabled()) log.debug("Semaphore wasn't initialized. Prevented further initialization."); return; } else { try { U.await(initLatch); } catch (IgniteInterruptedCheckedException e) { if (log.isDebugEnabled()) log.error("Failed waiting while initialization is completed.", e); } } } assert sync != null; sync.setBroken(true); sync.releaseShared(0); }
Source:
<code>private Map<String, Object>[] hashMapOfFoundSolutionsWithThresholds(Solution[] bestSols, Map<String, Object> applicMap, Topology topology, SuitableOptions cloudOffers, int numPlansToGenerate, QualityInformation requirements) { <START> if (IS_DEBUG) { <END> engine.checkQualityAttachedToSolutions(bestSols); } @SuppressWarnings("unchecked") Map<String, Object>[] solutions = new HashMap[numPlansToGenerate]; for (int i = 0; i < bestSols.length; i++) { Map<String, Object> baseAppMap = YAMLoptimizerParser.cloneYAML(applicMap); addSolutionToAppMap(bestSols[i], baseAppMap); if (IS_DEBUG) { log.info("Before creating reconfiguration thesholds"); } HashMap<String, ArrayList<Double>> thresholds = createReconfigurationThresholds(bestSols[i], baseAppMap, topology, cloudOffers, requirements); if (IS_DEBUG) { log.info("Before adding the reconfiguration thesholds to the map"); } YAMLoptimizerParser.AddReconfigurationThresholds(thresholds, baseAppMap); solutions[i] = baseAppMap; } return solutions; }</code><technical_language>log.isDebugEnabled()</technical_language>

Target:
private Map<String, Object>[] hashMapOfFoundSolutionsWithThresholds(Solution[] bestSols, Map<String, Object> applicMap, Topology topology, SuitableOptions cloudOffers, int numPlansToGenerate, QualityInformation requirements) { if (IS_DEBUG) { engine.checkQualityAttachedToSolutions(bestSols); } @SuppressWarnings("unchecked") Map<String, Object>[] solutions = new HashMap[numPlansToGenerate]; for (int i = 0; i < bestSols.length; i++) { Map<String, Object> baseAppMap = YAMLoptimizerParser.cloneYAML(applicMap); addSolutionToAppMap(bestSols[i], baseAppMap); if (IS_DEBUG) { log.debug("Before creating reconfiguration thesholds"); } HashMap<String, ArrayList<Double>> thresholds = createReconfigurationThresholds(bestSols[i], baseAppMap, topology, cloudOffers, requirements); if (IS_DEBUG) { log.debug("Before adding the reconfiguration thesholds to the map"); } YAMLoptimizerParser.addReconfigurationThresholds(thresholds, baseAppMap); solutions[i] = baseAppMap; } return solutions; }
Source:
<code><START> public static Map<List<String>, RichColumnDescriptor> getDescriptors(MessageType fileSchema, MessageType requestedSchema, Map<parquet.schema.Type, HiveColumnHandle> typeColumns) <END> { Map<List<String>, RichColumnDescriptor> descriptorsByPath = new HashMap<>(); List<PrimitiveColumnIO> columns = getColumns(fileSchema, requestedSchema); for (String[] paths : fileSchema.getPaths()) { List<String> columnPath = Arrays.asList(paths); HiveColumnHandle hiveColumnHandle = typeColumns.get(fileSchema.getType(paths)); getDescriptor(columns, columnPath, hiveColumnHandle) .ifPresent(richColumnDescriptor -> { descriptorsByPath.put(columnPath, richColumnDescriptor); }); } return descriptorsByPath; }</code><technical_language>put parameter line this line is long: public static Map<List<String>, RichColumnDescriptor> getDescriptors( MessageType fileSchema, MessageType requestedSchema, Map<parquet.schema.Type, HiveColumnHandle> typeColumns) {</technical_language>

Target:
public static Map<List<String>, RichColumnDescriptor> getDescriptors( MessageType fileSchema, MessageType requestedSchema, Map<parquet.schema.Type, HiveColumnHandle> typeColumns) { Map<List<String>, RichColumnDescriptor> descriptorsByPath = new HashMap<>(); List<PrimitiveColumnIO> columns = getColumns(fileSchema, requestedSchema); for (String[] paths : fileSchema.getPaths()) { List<String> columnPath = Arrays.asList(paths); HiveColumnHandle hiveColumnHandle = typeColumns.get(fileSchema.getType(paths)); Optional<RichColumnDescriptor> richColumnDescriptor = getDescriptor(columns, columnPath, hiveColumnHandle); richColumnDescriptor.ifPresent(descriptor -> descriptorsByPath.put(columnPath, descriptor)); } return descriptorsByPath; }
Source:
<code>public static Request handleRequest(final Request req, final MultiConnectionManager internalConnections) { final String sessionInfo = req.getSessionInfo(); try { final ByteString result = handleSubmission(req); final Request.Builder build = Request.newBuilder(req); build.setResponseText("Submission Succesful!"); build.clearOtherData(); LOG.info("Session Info: {}", sessionInfo); if (result != null) { final Data.DataSend send = Data.DataSend.newBuilder().addItems(Data.ItemSend.newBuilder().setData(result). setQuery(Data.ItemQuery.EXPERIMENT)).build(); final Request.Builder databaseRequest = Request.newBuilder(req); databaseRequest.setRequestType(Request.MessageType.DATA_INSERT); databaseRequest.setOtherData(send.toByteString()); LOG.info("Sending experiment data to database server"); internalConnections.send(databaseRequest.build(), "", DataClientWebSocket.class); } return build.build(); } catch (SubmissionException e) { final Message.ProtoException protoEx = ExceptionUtilities.createProtoException(e); <START> final Request.Builder build = Request.newBuilder(); <END> build.setRequestType(Request.MessageType.ERROR); if (e.getMessage() != null) { build.setResponseText(e.getMessage()); } build.setSessionInfo(sessionInfo); build.setOtherData(protoEx.toByteString()); LOG.error(LoggingConstants.EXCEPTION_MESSAGE, e); return build.build(); } catch (ConnectionException e) { LOG.error(LoggingConstants.EXCEPTION_MESSAGE, e); } return null; }</code><technical_language>this replaced function</technical_language>

Target:
public static Request handleRequest(final Request req, final MultiConnectionManager internalConnections) { final String sessionInfo = req.getSessionInfo(); try { final ByteString result = handleSubmission(req); final Request.Builder build = Request.newBuilder(req); build.setResponseText("Submission Succesful!"); build.clearOtherData(); LOG.info("Session Info: {}", sessionInfo); if (result != null) { final Data.DataSend send = Data.DataSend.newBuilder().addItems(Data.ItemSend.newBuilder().setData(result). setQuery(Data.ItemQuery.EXPERIMENT)).build(); final Request.Builder databaseRequest = Request.newBuilder(req); databaseRequest.setRequestType(Request.MessageType.DATA_INSERT); databaseRequest.setOtherData(send.toByteString()); LOG.info("Sending experiment data to database server"); internalConnections.send(databaseRequest.build(), "", DataClientWebSocket.class); } return build.build(); } catch (SubmissionException e) { final Message.ProtoException protoEx = ExceptionUtilities.createProtoException(e); final Request build = ExceptionUtilities.createExceptionRequest(protoEx, req); LOG.error(LoggingConstants.EXCEPTION_MESSAGE, e); return build; } catch (ConnectionException e) { LOG.error(LoggingConstants.EXCEPTION_MESSAGE, e); } return null; }
Source:
<code>public String toString() { return "DocumentReplication {" + "replicator=" + replicator + ", is pushing =" + pushing + ", document id =" + docId + ", revision id =" + revId + ", error code =" + error.getCode()+ ", error domain=" + error.getDomain() + ", is transient=" + trans + ", flags =" + flags + ", doc is deleted =" + isDeleted + '}'; <START> } <END></code><technical_language>Please remove info is in public API</technical_language>

Target:
public String toString() { return "DocumentReplication {" + "replicator=" + replicator + ", is pushing =" + pushing + ", document id =" + docId + ", error code =" + error.getCode()+ ", error domain=" + error.getDomain() + ", doc is deleted =" + isDeleted + '}'; }
Source:
<code>private void addDisk(DiskImage disk) { if (disk != null) { saveImage(disk); saveBaseDisk(disk); saveDiskImageDynamic(disk); } else { <START> log.error("Memory/Metadata disk <END> could not be added"); } }</code><technical_language>Memory metadata/dump disk not..</technical_language>

Target:
private void addDisk(DiskImage disk) { if (disk != null) { saveImage(disk); saveBaseDisk(disk); saveDiskImageDynamic(disk); } else { log.error("Memory metadata/dump disk could not be added"); } }
Source:
<code>String dumpState() { return new StringBuilder(256).append("TLSEncryptionAdapter[") .append("isEmpty()=").append(isEmpty()) .append(", exceptions.isEmpty()=").append(m_exceptions.isEmpty()) .append(", gateway=").append(m_ecryptgw.dumpState()) <START> .append(", inFligth=").append(m_inFlight.availablePermits()) <END> .append("]").toString(); }</code><technical_language>A typo in code "inFligth" "inFlight"</technical_language>

Target:
String dumpState() { return new StringBuilder(256).append("TLSEncryptionAdapter[") .append("isEmpty()=").append(isEmpty()) .append(", exceptions.isEmpty()=").append(m_exceptions.isEmpty()) .append(", gateway=").append(m_ecryptgw.dumpState()) .append(", inFlight=").append(m_inFlight.availablePermits()) .append("]").toString(); }
Source:
<code>public List<String> getImageUrls() { final List<String> imageUrls = new ArrayList<>(3); final String mainImageUrl = getMainImageUrl(); if (mainImageUrl != null) { imageUrls.add(mainImageUrl); Log.d(LOG_TAG, "Flurry Native Ad main image found."); } final String iconUrl = getIconImageUrl(); if (iconUrl != null) { imageUrls.add(iconUrl); Log.d(LOG_TAG, "Flurry Native Ad icon image found."); } final String privacyUrl = getPrivacyInformationIconImageUrl(); <START> if (iconUrl != null) { <END> imageUrls.add(privacyUrl); Log.d(LOG_TAG, "Flurry Native Ad privacy information icon image found."); } return imageUrls; }</code><technical_language>Typo, be: if (privacyUrl != null) {</technical_language>

Target:
public List<String> getImageUrls() { final List<String> imageUrls = new ArrayList<>(3); final String mainImageUrl = getMainImageUrl(); if (mainImageUrl != null) { imageUrls.add(mainImageUrl); Log.d(LOG_TAG, "Flurry Native Ad main image found."); } final String iconUrl = getIconImageUrl(); if (iconUrl != null) { imageUrls.add(iconUrl); Log.d(LOG_TAG, "Flurry Native Ad icon image found."); } final String privacyUrl = getPrivacyInformationIconImageUrl(); if (privacyUrl != null) { imageUrls.add(privacyUrl); Log.d(LOG_TAG, "Flurry Native Ad privacy information icon image found."); } return imageUrls; }
Source:
<code>public static OfferResult accept() { <START> return new OfferResult(Arrays.asList()); <END> }</code><technical_language>java.util.Collections.emptyList() is cheaper</technical_language>

Target:
public static OfferResult accept() { return new OfferResult(Collections.emptyList()); }
Source:
<code>public List<UserModel> searchForUserByUserAttribute(String attrName, String attrValue, RealmModel realm) { try (LDAPQuery ldapQuery = LDAPUtils.createQueryForUserSearch(this, realm)) { LDAPQueryConditionsBuilder conditionsBuilder = new LDAPQueryConditionsBuilder(); Condition attrCondition = conditionsBuilder.equal(attrName, attrValue, EscapeStrategy.DEFAULT); ldapQuery.addWhereCondition(attrCondition); List<LDAPObject> ldapObjects = ldapQuery.getResultList(); if (ldapObjects == null || ldapObjects.isEmpty()) { return Collections.emptyList(); } List<UserModel> searchResults = new LinkedList<UserModel>(); for (LDAPObject ldapUser : ldapObjects) { String ldapUsername = LDAPUtils.getUsername(ldapUser, this.ldapIdentityStore.getConfig()); UserModel localUser = session.userLocalStorage().getUserByUsername(ldapUsername, realm); if (localUser == null) { UserModel imported = importUserFromLDAP(session, realm, ldapUser); searchResults.add(imported); } else if (shouldUserAttributeBeAlwaysReadFromLdap(realm, attrName)) { searchResults.add(proxy(realm, localUser, ldapUser)); } } <START> <END> return searchResults; } }</code><technical_language>I good remove method "shouldUserAttributeBeAlwaysReadFromLdap" (and new related added in this PR) add proxy results. this, good update a bit method UserStorageManager.query duplicates returned. currently UserStorageMAnager.query returns stuff multiple providers, return duplicated stuff in some cases (EG. in case LDAP user imported attribute "foo" "bar" is in DB LDAP)</technical_language>

Target:
public List<UserModel> searchForUserByUserAttribute(String attrName, String attrValue, RealmModel realm) { try (LDAPQuery ldapQuery = LDAPUtils.createQueryForUserSearch(this, realm)) { LDAPQueryConditionsBuilder conditionsBuilder = new LDAPQueryConditionsBuilder(); Condition attrCondition = conditionsBuilder.equal(attrName, attrValue, EscapeStrategy.DEFAULT); ldapQuery.addWhereCondition(attrCondition); List<LDAPObject> ldapObjects = ldapQuery.getResultList(); if (ldapObjects == null || ldapObjects.isEmpty()) { return Collections.emptyList(); } List<UserModel> searchResults = new LinkedList<UserModel>(); for (LDAPObject ldapUser : ldapObjects) { String ldapUsername = LDAPUtils.getUsername(ldapUser, this.ldapIdentityStore.getConfig()); UserModel localUser = session.userLocalStorage().getUserByUsername(ldapUsername, realm); if (localUser == null) { UserModel imported = importUserFromLDAP(session, realm, ldapUser); searchResults.add(imported); } else { searchResults.add(proxy(realm, localUser, ldapUser)); } } return searchResults; } }
Source:
<code>public List<String> validateQuestionDetails() { List<String> errors = new ArrayList<String>(); if (!distributeToRecipients && numOfConstSumOptions < Const.FeedbackQuestion.CONST_SUM_MIN_NUM_OF_OPTIONS) { errors.add(Const.FeedbackQuestion.CONST_SUM_ERROR_NOT_ENOUGH_OPTIONS + Const.FeedbackQuestion.CONST_SUM_MIN_NUM_OF_OPTIONS + "."); } if (points < Const.FeedbackQuestion.CONST_SUM_MIN_NUM_OF_POINTS) { errors.add(Const.FeedbackQuestion.CONST_SUM_ERROR_NOT_ENOUGH_POINTS + Const.FeedbackQuestion.CONST_SUM_MIN_NUM_OF_POINTS + "."); } Set<String> constSumOptionsSet = new HashSet<>(constSumOptions); if (constSumOptionsSet.size() < numOfConstSumOptions) { errors.add(Const.FeedbackQuestion.CONST_SUM_ERROR_DUPLICATE_OPTIONS); } <START> <END> return errors; }</code><technical_language>extract areElementsUnique() utility method</technical_language>

Target:
public List<String> validateQuestionDetails() { List<String> errors = new ArrayList<String>(); if (!distributeToRecipients && numOfConstSumOptions < Const.FeedbackQuestion.CONST_SUM_MIN_NUM_OF_OPTIONS) { errors.add(Const.FeedbackQuestion.CONST_SUM_ERROR_NOT_ENOUGH_OPTIONS + Const.FeedbackQuestion.CONST_SUM_MIN_NUM_OF_OPTIONS + "."); } if (points < Const.FeedbackQuestion.CONST_SUM_MIN_NUM_OF_POINTS) { errors.add(Const.FeedbackQuestion.CONST_SUM_ERROR_NOT_ENOUGH_POINTS + Const.FeedbackQuestion.CONST_SUM_MIN_NUM_OF_POINTS + "."); } if (!FieldValidator.areElementsUnique(constSumOptions)) { errors.add(Const.FeedbackQuestion.CONST_SUM_ERROR_DUPLICATE_OPTIONS); } return errors; }
Source:
<code><START> public SwiftAccessIO getSwiftObject() { <END> try { DataFileIO dataFileIO = getInitialDataFile().getDataFileIO(); try { SwiftAccessIO swiftIO = (SwiftAccessIO)dataFileIO; return swiftIO; } catch (Exception e) { e.printStackTrace(); } } catch (Exception e){ e.printStackTrace(); } return null; }</code><technical_language>figure out if this merged 3919, way, need change this SwiftAccessIO parametrized correct type</technical_language>

Target:
public SwiftAccessIO getSwiftObject() { try { StorageIO<DataFile> storageIO = getInitialDataFile() == null ? null : getInitialDataFile().getStorageIO(); if (storageIO != null && storageIO instanceof SwiftAccessIO) { return (SwiftAccessIO)storageIO; } else { logger.fine("DatasetPage: Failed to cast storageIO as SwiftAccessIO (most likely because storageIO is a FileAccessIO)"); } } catch (IOException e) { logger.fine("DatasetPage: Failed to get storageIO"); } return null; }
Source:
<code>protected void preparePrerequisites(String repo, ArtifactoryBaseClient client) throws VersionException, IOException { validateArtifactoryVersion(client); <START> validateRepoExists(repo, client,"Target repo must be specified"); <END> }</code><technical_language>"Source repo specified" running go-build</technical_language>

Target:
protected void preparePrerequisites(String repo, ArtifactoryBaseClient client) throws VersionException, IOException { validateArtifactoryVersion(client); validateRepoExists(repo, client, "The provided repo must be specified"); }
Source:
<code>protected void translateAndSendBatch(ConsumerRecords<?, ?> records, Instant readTime) { for (TopicPartition topicPartition : records.partitions()) { for (ConsumerRecord<?, ?> record : records.records(topicPartition)) { try { if (_autoPausedSourcePartitions.containsKey(topicPartition)) { _logger.warn("Abort sending as is auto-paused", topicPartition); } else { DatastreamProducerRecord datastreamProducerRecord = translate(record, readTime); sendDatastreamProducerRecord(datastreamProducerRecord, topicPartition); int numBytes = record.serializedKeySize() + record.serializedValueSize(); <START> _consumerMetrics.updateBytesProcessedRate(numBytes); <END> } } catch (Exception e) { _logger.warn("Got exception while sending record {}", record); pauseTopicPartitionWhenException(topicPartition, e); break; } } } _kafkaPositionTracker.ifPresent(tracker -> tracker.updatePositions(readTime, records, _consumer.metrics(), records.partitions().stream().collect(Collectors.toMap(Function.identity(), tp -> _consumer.position(tp))))); }</code><technical_language>this happen in callback in sendDatastreamProducerRecord (if send succeeds)</technical_language>

Target:
protected void translateAndSendBatch(ConsumerRecords<?, ?> records, Instant readTime) { for (TopicPartition topicPartition : records.partitions()) { for (ConsumerRecord<?, ?> record : records.records(topicPartition)) { try { if (_autoPausedSourcePartitions.containsKey(topicPartition)) { _logger.warn("Abort sending as is auto-paused", topicPartition); } else { DatastreamProducerRecord datastreamProducerRecord = translate(record, readTime); int numBytes = record.serializedKeySize() + record.serializedValueSize(); sendDatastreamProducerRecord(datastreamProducerRecord, topicPartition, numBytes); } } catch (Exception e) { _logger.warn("Got exception while sending record {}", record); rewindAndPausePartitionOnException(topicPartition, e); break; } } } }