auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>static int countBitstreamLargerThanMaxSize(Context context, BundleName bundleName, Item item, String mimeList, String prop) { long size = ConfigurationManager.getLongProperty("rest", prop); int count = 0; try { for(Bundle bundle: item.getBundles()){ if (!bundle.getName().equals(bundleName.name())){ continue; } for(Bitstream bit: bundle.getBitstreams()) { <START> for(String mime: mimeList.split(",")) { <END> if (bit.getFormat(context).getMIMEType().equals(mime)) { if (bit.getSize() > size) { count++; } } } } } } catch (SQLException e) { } return count; }</code><technical_language>trim mime ? space occurs commas code work properly</technical_language>

Target:
static int countBitstreamLargerThanMaxSize(Context context, BundleName bundleName, Item item, String mimeList, String prop) { long size = ConfigurationManager.getLongProperty("rest", prop); int count = 0; try { for(Bundle bundle: item.getBundles()){ if (!bundle.getName().equals(bundleName.name())){ continue; } for(Bitstream bit: bundle.getBitstreams()) { for(String mime: mimeList.split(",")) { if (bit.getFormat(context).getMIMEType().equals(mime.trim())) { if (bit.getSize() > size) { count++; } } } } } } catch (SQLException e) { } return count; }
Source:
<code>private File doRemoteCompile(String namespace, String mainComposite, File zippedArchive) throws ClientProtocolException, IOException { String bundleName = namespace + "." + mainComposite + ".sab"; String archiveName = zippedArchive.getName(); HttpClient client = HttpClientBuilder.create().build(); <START> File archiveFile = new File(archiveName); <END> HttpPost postJobWithConfig = new HttpPost(getBuildFarmURL()); postJobWithConfig.addHeader("accept", ContentType.APPLICATION_JSON.getMimeType()); FileBody bundleBody = new FileBody(archiveFile, ContentType.APPLICATION_OCTET_STREAM, archiveName); StringBody configBody = new StringBody(createBuildConfig(namespace, mainComposite), ContentType.TEXT_PLAIN); HttpEntity reqEntity = MultipartEntityBuilder.create() .addPart("inputfile", bundleBody).addPart("buildconfig", configBody) .build(); postJobWithConfig.setEntity(reqEntity); File bundle = doPostAndRetreiveFile((CloseableHttpClient) client, postJobWithConfig, bundleName); return bundle; }</code><technical_language>archiveFile zippedArchive</technical_language>

Target:
private File doRemoteCompile(String namespace, String mainComposite, File zippedArchive) throws ClientProtocolException, IOException { String bundleName = namespace + "." + mainComposite + ".sab"; HttpClient client = HttpClientBuilder.create().build(); HttpPost postJobWithConfig = new HttpPost(getBuildFarmURL()); postJobWithConfig.addHeader("accept", ContentType.APPLICATION_JSON.getMimeType()); FileBody bundleBody = new FileBody(zippedArchive, ContentType.APPLICATION_OCTET_STREAM, zippedArchive.getName()); StringBody configBody = new StringBody(createBuildConfig(namespace, mainComposite), ContentType.TEXT_PLAIN); HttpEntity reqEntity = MultipartEntityBuilder.create() .addPart("inputfile", bundleBody).addPart("buildconfig", configBody) .build(); postJobWithConfig.setEntity(reqEntity); File bundle = doPostAndRetreiveFile((CloseableHttpClient) client, postJobWithConfig, bundleName); return bundle; }
Source:
<code><START> public void canLockAndUnlockMultipleLocks() { <END> LockTokenV2 token = lockSynchronously(REQUEST_1, LOCK_A); assertTrue(service.unlock(token)); assertNotLocked(LOCK_A); }</code><technical_language>locking unlocking a single lock, I assume name wanted multiple. Otherwise, this is a strict subset of test above</technical_language>

Target:
public void canLockAndUnlockMultipleLocks() { LockTokenV2 token = lockSynchronously(REQUEST_1, LOCK_A, LOCK_B, LOCK_C); assertTrue(service.unlock(token)); assertNotLocked(LOCK_A); assertNotLocked(LOCK_B); assertNotLocked(LOCK_C); }
Source:
<code>public void focusLost(FocusEvent e) { <START> if (this.handleFocusChanges && !e.widget.isDisposed()) { <END> if (!commit(MoveDirectionEnum.NONE, true)) { if (e.widget instanceof Control && !e.widget.isDisposed()) { ((Control) e.widget).forceFocus(); } } else { if (!AbstractCellEditor.this.parent.isDisposed()) AbstractCellEditor.this.parent.forceFocus(); } } }</code><technical_language>more sense move this check line down? commit() call produce error, guarded. else condition matched. Of needs check</technical_language>

Target:
public void focusLost(FocusEvent e) { if (this.handleFocusChanges) { if (!e.widget.isDisposed() && !commit(MoveDirectionEnum.NONE, true)) { if (e.widget instanceof Control && !e.widget.isDisposed()) { ((Control) e.widget).forceFocus(); } } else { if (!AbstractCellEditor.this.parent.isDisposed()) AbstractCellEditor.this.parent.forceFocus(); } } }
Source:
<code>public void generates_removal_after_marker_is_deleted() throws Exception { IMarker marker = this.testFile.createMarker(IMarker.PROBLEM); marker.setAttribute(IMarker.LINE_NUMBER, 1); IMarker marker2 = this.testFile.createMarker(IMarker.PROBLEM); marker2.setAttribute(IMarker.LINE_NUMBER, 2); <START> this.workspace.save(true, null); <END> Job.getJobManager().join(ResourcesPlugin.FAMILY_AUTO_BUILD, null); this.testFile.appendContents(generateFileStreamLines(10), true, true, null); marker.delete(); this.workspace.save(true, null); Job.getJobManager().join(ResourcesPlugin.FAMILY_AUTO_BUILD, null); ArgumentCaptor<StaticAnalysisWarningEvent> captor = ArgumentCaptor.forClass(StaticAnalysisWarningEvent.class); Mockito.verify(this.trackingEventManager, Mockito.times(3)).addEvent(captor.capture()); Assert.assertArrayEquals(captor.getAllValues().stream().map(StaticAnalysisWarningEvent::getType).toArray(), new TrackingEventType[] {TrackingEventType.SA_WARNING_CREATED, TrackingEventType.SA_WARNING_CREATED, TrackingEventType.SA_WARNING_REMOVED}); }</code><technical_language>is general rule for this. in rest of project? I constructors, right</technical_language>

Target:
public void generates_removal_after_marker_is_deleted() throws Exception { IMarker marker = this.testFile.createMarker(IMarker.PROBLEM); marker.setAttribute(IMarker.LINE_NUMBER, 1); IMarker marker2 = this.testFile.createMarker(IMarker.PROBLEM); marker2.setAttribute(IMarker.LINE_NUMBER, 2); this.saveWorkspaceAndWaitForBuild(); this.testFile.appendContents(generateFileStreamLines(10), true, true, null); marker.delete(); this.saveWorkspaceAndWaitForBuild(); Assert.assertArrayEquals(generatedEvents.stream().toArray(), new TrackingEventType[] {TrackingEventType.SA_WARNING_CREATED, TrackingEventType.SA_WARNING_CREATED, TrackingEventType.SA_WARNING_REMOVED}); }
Source:
<code>public static Object[] parseArguments(String args) throws CoreException { List<Object> result= new <START> ArrayList<Object>(); <END> int start= 0; int comma; while ((comma= findNextComma(args, start)) != -1) { result.add(convertArgument(args.substring(start, comma).trim())); start= comma + 1; } result.add(convertArgument(args.substring(start).trim())); return result.toArray(); }</code><technical_language>A diamond operator suffice</technical_language>

Target:
public static Object[] parseArguments(String args) throws CoreException { List<Object> result= new ArrayList<>(); int start= 0; int comma; while ((comma= findNextComma(args, start)) != -1) { result.add(convertArgument(args.substring(start, comma).trim())); start= comma + 1; } result.add(convertArgument(args.substring(start).trim())); return result.toArray(); }
Source:
<code>public void TopWamWikisWhereIsMyExtension_GeoEdgeFree() { WikiBasePageObject wikiPage = new WikiBasePageObject(driver); wikiPage.logInCookie(credentials.userNameStaff, credentials.passwordStaff, wikiURL); <START> driver.get(wikiURL + URLsContent.specialWhereIsExtension); <END> wikiPage.appendToUrl(extensionURL); wikiPage.verifyNumberOfTop1kWikis(numberOfTop1kWikis); }</code><technical_language>Consider create a new PageObject for Special:WhereIsExtension. e.g. (other examples in WikiBasePageObject) public SpecialEditHubPageObject openSpecialEditHub(String wikiURL) { getUrl(wikiURL + URLsContent.specialEditHub); return new SpecialEditHubPageObject(driver); }</technical_language>

Target:
public void TopWamWikisWhereIsMyExtension_GeoEdgeFree() { WikiBasePageObject wikiPage = new WikiBasePageObject(driver); wikiPage.logInCookie(credentials.userNameStaff, credentials.passwordStaff, wikiURL); wikiPage.getUrl(wikiURL + URLsContent.specialWhereIsExtension); wikiPage.appendToUrl(extensionURL); wikiPage.verifyNumberOfTop1kWikis(numberOfTop1kWikis); }
Source:
<code>public void write(ChannelHandlerContext ctx, Object msg, ChannelPromise prm) throws Exception { if (!(msg instanceof HttpResponse)) return; HttpResponse response = (HttpResponse) msg; Span span = ctx.channel().attr(NettyHttpTracing.SPAN_ATTRIBUTE).get(); Throwable error = null; try (SpanInScope ws = tracer.withSpanInScope(span)) { <START> super.write(ctx, msg, prm); <END> } catch (Exception | Error e) { error = e; throw e; } finally { handler.handleSend(response, error, span); } }</code><technical_language>This throw</technical_language>

Target:
@Override public void write(ChannelHandlerContext ctx, Object msg, ChannelPromise prm) { Span span = ctx.channel().attr(NettyHttpTracing.SPAN_ATTRIBUTE).get(); if (span == null || !(msg instanceof HttpResponse)) { ctx.write(msg, prm); return; } HttpResponse response = (HttpResponse) msg; try (SpanInScope ws = tracer.withSpanInScope(span)) { ctx.write(msg, prm); parser.response(adapter, response, null, span); span.finish(); } }
Source:
<code>public int getDeviceCompletion(String deviceId) { addDevice(deviceId); <START> int folderCount = 0; <END> double sumCompletion = 0; for (String folderId : deviceFolderMap.get(deviceId).keySet()) { sumCompletion += getCompletionInfo(deviceId, folderId).completion; folderCount++; } return (int) Math.floor(sumCompletion / folderCount); }</code><technical_language>Instead of calling add not, do getOrDefault potentoally return zeroes early</technical_language>

Target:
public int getDeviceCompletion(String deviceId) { int folderCount = 0; double sumCompletion = 0; HashMap<String, CompletionInfo> folderMap = deviceFolderMap.get(deviceId); if (folderMap != null) { for (Map.Entry<String, CompletionInfo> folder : folderMap.entrySet()) { sumCompletion += folder.getValue().completion; folderCount++; } } if (folderCount == 0) { return 100; } else { return (int) Math.floor(sumCompletion / folderCount); } }
Source:
<code>private XmlListenersConfig(final ListenersType type, final ListenersType... others) { <START> this.parallelismLevel = type.getDispatcherConcurrency().intValue(); <END> String threadPool = type.getDispatcherThreadPool(); Set<Listener> listenerSet = new HashSet<Listener>(); final List<ListenersType.Listener> xmlListeners = type.getListener(); extractListeners(listenerSet, xmlListeners); for (ListenersType other : others) { if (threadPool == null && other.getDispatcherThreadPool() != null) { threadPool = other.getDispatcherThreadPool(); } extractListeners(listenerSet, other.getListener()); } this.threadPool = threadPool; this.listeners = !listenerSet.isEmpty() ? listenerSet : null; }</code><technical_language>Please change variable name parallelismLevel dispatcherConcurrency</technical_language>

Target:
private XmlListenersConfig(final ListenersType type, final ListenersType... others) { this.dispatcherConcurrency = type.getDispatcherConcurrency().intValue(); String threadPool = type.getDispatcherThreadPool(); Set<Listener> listenerSet = new HashSet<Listener>(); final List<ListenersType.Listener> xmlListeners = type.getListener(); extractListeners(listenerSet, xmlListeners); for (ListenersType other : others) { if (threadPool == null && other.getDispatcherThreadPool() != null) { threadPool = other.getDispatcherThreadPool(); } extractListeners(listenerSet, other.getListener()); } this.threadPool = threadPool; this.listeners = !listenerSet.isEmpty() ? listenerSet : null; }
Source:
<code>public void pull(PullFilters pullFilters, IPullController.Callback callback, Context context) { Log.d(TAG, "Starting PULL process..."); try { callback.onStep(PullStep.METADATA); mPullController.populateMetadataFromCsvs(pullFilters.isAutoConfig()); OrganisationUnit organisationUnit = null; if (pullFilters.isAutoConfig()) { try { organisationUnit = getOrgUnitByPhone(context, callback); } catch (ApiCallException e) { throw new AutoconfigureException(); } } if (pullFilters.isDemo()) { callback.onComplete(); } else { <START> mPullController.pullMetada(pullFilters, callback); <END> } } catch (Exception ex) { Log.e(TAG, "pull: " + ex.getLocalizedMessage()); ex.printStackTrace(); callback.onError(ex); } }</code><technical_language>pull is executed in autoconfigure mode, this method is executed parameters in pullFilters download metadata</technical_language>

Target:
public void pull(PullFilters pullFilters, IPullController.Callback callback, Context context) { Log.d(TAG, "Starting PULL process..."); try { callback.onStep(PullStep.METADATA); mPullController.populateMetadataFromCsvs(pullFilters.isAutoConfig()); if (pullFilters.isAutoConfig()) { try { autoConfigureByPhone(context, callback, pullFilters); } catch (ApiCallException e) { throw new AutoconfigureException(); } } else { downloadMetadata(pullFilters, callback); } } catch (Exception ex) { Log.e(TAG, "pull: " + ex.getLocalizedMessage()); ex.printStackTrace(); callback.onError(ex); } }
Source:
<code><START> protected void acquireRecoveryMemory(KeyExtent extent) { <END> if (!extent.isMeta()) { recoveryLock.lock(); } }</code><technical_language>suggestion void acquireRecoveryMemory(KeyExtent extent) {</technical_language>

Target:
void acquireRecoveryMemory(KeyExtent extent) { if (!extent.isMeta()) { recoveryLock.lock(); } }
Source:
<code>public void noBodyForHeadTest() { EmbeddedChannel channel = createEmbeddedChannel(); for (Map.Entry<RestServiceErrorCode, HttpResponseStatus> entry : REST_SERVICE_ERROR_CODE_TO_HTTP_RESPONSE_STATUS_MAP .entrySet()) { HttpHeaders httpHeaders = new DefaultHttpHeaders(); httpHeaders.set(MockNettyMessageProcessor.REST_SERVICE_ERROR_CODE_HEADER_NAME, entry.getKey()); channel.writeInbound(RestTestUtils .createRequest(HttpMethod.HEAD, TestingUri.OnResponseCompleteWithRestException.toString(), httpHeaders)); HttpResponse response = (HttpResponse) channel.readOutbound(); assertEquals("Unexpected response status", entry.getValue(), response.getStatus()); if (response instanceof FullHttpResponse) { assertEquals("The response should not contain content", 0, ((FullHttpResponse) response).content().readableBytes()); } else { HttpContent content = (HttpContent) channel.readOutbound(); assertTrue("End marker should be received", content instanceof LastHttpContent); } assertNull("There should be no more data in the channel", channel.readOutbound()); boolean shouldBeAlive = !NettyResponseChannel.CLOSE_CONNECTION_ERROR_STATUSES.contains(entry.getValue()); assertEquals("Channel state (open/close) not as expected", shouldBeAlive, channel.isActive()); assertEquals("Connection header should be consistent with channel state", shouldBeAlive, HttpHeaders.isKeepAlive(response)); if (!shouldBeAlive) { <START> channel = createEmbeddedChannel(); <END> } } channel.close(); }</code><technical_language>is this required? channel close idempotent</technical_language>

Target:
public void noBodyForHeadTest() { EmbeddedChannel channel = createEmbeddedChannel(); for (Map.Entry<RestServiceErrorCode, HttpResponseStatus> entry : REST_ERROR_CODE_TO_HTTP_STATUS.entrySet()) { HttpHeaders httpHeaders = new DefaultHttpHeaders(); httpHeaders.set(MockNettyMessageProcessor.REST_SERVICE_ERROR_CODE_HEADER_NAME, entry.getKey()); channel.writeInbound(RestTestUtils .createRequest(HttpMethod.HEAD, TestingUri.OnResponseCompleteWithRestException.toString(), httpHeaders)); HttpResponse response = (HttpResponse) channel.readOutbound(); assertEquals("Unexpected response status", entry.getValue(), response.getStatus()); if (response instanceof FullHttpResponse) { assertEquals("The response should not contain content", 0, ((FullHttpResponse) response).content().readableBytes()); } else { HttpContent content = (HttpContent) channel.readOutbound(); assertTrue("End marker should be received", content instanceof LastHttpContent); } assertNull("There should be no more data in the channel", channel.readOutbound()); boolean shouldBeAlive = !NettyResponseChannel.CLOSE_CONNECTION_ERROR_STATUSES.contains(entry.getValue()); assertEquals("Channel state (open/close) not as expected", shouldBeAlive, channel.isActive()); assertEquals("Connection header should be consistent with channel state", shouldBeAlive, HttpHeaders.isKeepAlive(response)); if (!shouldBeAlive) { channel = createEmbeddedChannel(); } } channel.close(); }
Source:
<code>private void assignPartitionsStates(boolean resetOwners) { Map<String, List<SupplyPartitionInfo>> supplyInfoMap = log.isInfoEnabled() ? new ConcurrentHashMap<>() : null; try { U.doInParallel( cctx.kernalContext().getSystemExecutorService(), nonLocalCacheGroupDescriptors(), grpDesc -> { CacheGroupContext grpCtx = cctx.cache().cacheGroup(grpDesc.groupId()); GridDhtPartitionTopology top = grpCtx != null ? grpCtx.topology() : cctx.exchange().clientTopology(grpDesc.groupId(), events().discoveryCache()); if (CU.isPersistentCache(grpDesc.config(), cctx.gridConfig().getDataStorageConfiguration())) { List<SupplyPartitionInfo> list = assignPartitionStates(top, resetOwners); if (supplyInfoMap != null && !F.isEmpty(list)) supplyInfoMap.put(grpDesc.cacheOrGroupName(), list); } else if (resetOwners) assignPartitionSizes(top); return null; } ); } catch (IgniteCheckedException e) { throw new IgniteException("Failed to assign partition states", e); } <START> if (log.isInfoEnabled() && !F.isEmpty(supplyInfoMap)) <END> printPartitionRebalancingFully(supplyInfoMap); timeBag.finishGlobalStage("Assign partitions states"); }</code><technical_language>Enough check supplyInfoMap != null</technical_language>

Target:
private void assignPartitionsStates(boolean resetOwners) { Map<String, List<SupplyPartitionInfo>> supplyInfoMap = log.isInfoEnabled() ? new ConcurrentHashMap<>() : null; try { U.doInParallel( cctx.kernalContext().getSystemExecutorService(), nonLocalCacheGroupDescriptors(), grpDesc -> { CacheGroupContext grpCtx = cctx.cache().cacheGroup(grpDesc.groupId()); GridDhtPartitionTopology top = grpCtx != null ? grpCtx.topology() : cctx.exchange().clientTopology(grpDesc.groupId(), events().discoveryCache()); if (CU.isPersistentCache(grpDesc.config(), cctx.gridConfig().getDataStorageConfiguration())) { List<SupplyPartitionInfo> list = assignPartitionStates(top, resetOwners); if (supplyInfoMap != null && !F.isEmpty(list)) supplyInfoMap.put(grpDesc.cacheOrGroupName(), list); } else if (resetOwners) assignPartitionSizes(top); return null; } ); } catch (IgniteCheckedException e) { throw new IgniteException("Failed to assign partition states", e); } if (!F.isEmpty(supplyInfoMap)) printPartitionRebalancingFully(supplyInfoMap); timeBag.finishGlobalStage("Assign partitions states"); }
Source:
<code><START> public static String truncate(String index, int shortestLength) { <END> return index.substring(0, shortestLength); }</code><technical_language>3 methods private, if useful of this controller, in a utilities class</technical_language>

Target:
private static String truncate(String index, int shortestLength) { return index.substring(0, shortestLength); }
Source:
<code>private void renderCombinedEventScripts() { StringBuilder combinedScript = new StringBuilder(); for (HeaderItem curItem : domReadyItemsToBeRendered) { if (markItemRendered(curItem)) { combinedScript.append('\n'); if (curItem instanceof OnDomReadyHeaderItem) { combinedScript.append(((OnDomReadyHeaderItem)curItem).getJavaScript()); } else if (curItem instanceof OnEventHeaderItem) { combinedScript.append(((OnEventHeaderItem)curItem).getCompleteJavaScript()); } combinedScript.append(';'); } } if (combinedScript.length() > 0) { combinedScript.append("\nWicket.Event.publish(Wicket.Event.Topic.AJAX_HANDLERS_BOUND);"); getRealResponse().render(OnDomReadyHeaderItem.forScript(combinedScript.append('\n'))); } combinedScript.setLength(0); <START> String lastId = null; <END> for (OnLoadHeaderItem curItem : loadItemsToBeRendered) { if (markItemRendered(curItem)) { if (!Strings.isEmpty(curItem.getId())) { lastId = curItem.getId(); } combinedScript.append('\n'); combinedScript.append(curItem.getJavaScript()); combinedScript.append(';'); } } if (combinedScript.length() > 0) { getRealResponse().render(OnLoadHeaderItem.forScript(combinedScript.append('\n'), lastId)); } }</code><technical_language>appreciate review this commit, especially this part ...</technical_language>

Target:
private void renderCombinedEventScripts() { StringBuilder combinedScript = new StringBuilder(); for (HeaderItem curItem : domReadyItemsToBeRendered) { if (markItemRendered(curItem)) { combinedScript.append('\n'); if (curItem instanceof OnDomReadyHeaderItem) { combinedScript.append(((OnDomReadyHeaderItem)curItem).getJavaScript()); } else if (curItem instanceof OnEventHeaderItem) { combinedScript.append(((OnEventHeaderItem)curItem).getCompleteJavaScript()); } combinedScript.append(';'); } } if (combinedScript.length() > 0) { combinedScript.append("\nWicket.Event.publish(Wicket.Event.Topic.AJAX_HANDLERS_BOUND);"); getRealResponse().render(OnDomReadyHeaderItem.forScript(combinedScript.append('\n'))); } combinedScript.setLength(0); for (OnLoadHeaderItem curItem : loadItemsToBeRendered) { if (markItemRendered(curItem)) { combinedScript.append('\n'); combinedScript.append(curItem.getJavaScript()); combinedScript.append(';'); } } if (combinedScript.length() > 0) { getRealResponse().render(OnLoadHeaderItem.forScript(combinedScript.append('\n'))); } }
Source:
<code>public static Event<WebSocketFrameError> webSocketFrameError(){ <START> return new Event<>(domainName+".webSocketFrameError",map("requestId", WebSocketFrameError.class)); <END> }</code><technical_language>Nit: spaces commas</technical_language>

Target:
public static Event<WebSocketFrameError> webSocketFrameError() { return new Event<>(DOMAIN_NAME + ".webSocketFrameError", map("requestId", WebSocketFrameError.class)); }
Source:
<code>public void process(KeyFilter keyFilter, CacheLoaderTask cacheLoaderTask, Executor executor, boolean loadValues, boolean loadMetadata) { int batchSize = 100; ExecutorAllCompletionService eacs = new ExecutorAllCompletionService(executor); final TaskContext taskContext = new TaskContextImpl(); Set<Object> allKeys = new HashSet<Object>(batchSize); Set<Object> batch = new HashSet<Object>(); loadAllKeys(state.get(), allKeys, keyFilter, executor); for (Iterator it = allKeys.iterator(); it.hasNext(); ) { batch.add(it.next()); if (batch.size() == batchSize) { final Set<Object> toHandle = batch; batch = new HashSet<Object>(batchSize); submitProcessTask(cacheLoaderTask, eacs, taskContext, toHandle); } } if (!batch.isEmpty()) { submitProcessTask(cacheLoaderTask, eacs, taskContext, batch); } eacs.waitUntilAllCompleted(); if (eacs.isExceptionThrown()) { <START> throw new CacheLoaderException("Execution exception!"); <END> } }</code><technical_language>above: "couldn't save occurred exception put a exception?"</technical_language>

Target:
public void process(KeyFilter keyFilter, CacheLoaderTask cacheLoaderTask, Executor executor, boolean loadValues, boolean loadMetadata) { int batchSize = 100; ExecutorAllCompletionService eacs = new ExecutorAllCompletionService(executor); final TaskContext taskContext = new TaskContextImpl(); Set<Object> allKeys = new HashSet<Object>(batchSize); Set<Object> batch = new HashSet<Object>(); loadAllKeys(state.get(), allKeys, keyFilter, executor); for (Iterator it = allKeys.iterator(); it.hasNext(); ) { batch.add(it.next()); if (batch.size() == batchSize) { final Set<Object> toHandle = batch; batch = new HashSet<Object>(batchSize); submitProcessTask(cacheLoaderTask, eacs, taskContext, toHandle); } } if (!batch.isEmpty()) { submitProcessTask(cacheLoaderTask, eacs, taskContext, batch); } eacs.waitUntilAllCompleted(); if (eacs.isExceptionThrown()) { throw new CacheLoaderException("Execution exception!", eacs.getFirstException()); } }
Source:
<code><START> public void convert_using_main_title() throws IOException { <END> Result sourceDataset = minimalEntityBuilder(ID, InfoSpaceConstants.SEMANTIC_CLASS_INSTANCE_TYPE_DATASET); addTitle(sourceDataset, OTHER_TITLE, null); addTitle(sourceDataset, TITLE, InfoSpaceConstants.SEMANTIC_CLASS_MAIN_TITLE); DataSetReference metadata = converter.convert(sourceDataset); assertNotNull(metadata); assertEquals(2, metadata.getTitles().size()); assertEquals(OTHER_TITLE, metadata.getTitles().get(0)); assertEquals(TITLE, metadata.getTitles().get(1)); }</code><technical_language>Exception is thrown</technical_language>

Target:
public void convert_using_main_title() { Result sourceDataset = minimalEntityBuilder(ID, InfoSpaceConstants.SEMANTIC_CLASS_INSTANCE_TYPE_DATASET); addTitle(sourceDataset, OTHER_TITLE, null); addTitle(sourceDataset, TITLE, InfoSpaceConstants.SEMANTIC_CLASS_MAIN_TITLE); DataSetReference metadata = converter.convert(sourceDataset); assertNotNull(metadata); assertEquals(2, metadata.getTitles().size()); assertEquals(OTHER_TITLE, metadata.getTitles().get(0)); assertEquals(TITLE, metadata.getTitles().get(1)); }
Source:
<code>public CompletableFuture<Void> closeAsync() { <START> jobManagerRunnerFuture.handle((runner, throwable) -> { <END> if (throwable == null) { CompletableFuture<Void> jobManagerRunnerClose = jobManagerRunnerFuture.thenCompose( AutoCloseableAsync::closeAsync); FutureUtils.forward(jobManagerRunnerClose, terminationFuture); } else { terminationFuture.complete(null); } return null; }); return terminationFuture; }</code><technical_language>FutureUtils.assertNoException missing</technical_language>

Target:
public CompletableFuture<Void> closeAsync() { FutureUtils.assertNoException(jobManagerRunnerFuture.handle((runner, throwable) -> { if (throwable == null) { CompletableFuture<Void> jobManagerRunnerClose = jobManagerRunnerFuture.thenCompose( AutoCloseableAsync::closeAsync); FutureUtils.forward(jobManagerRunnerClose, terminationFuture); } else { terminationFuture.complete(null); } return null; })); return terminationFuture; }
Source:
<code><START> public List<Integer> getRunningFlows(int projectId, String flowId) { <END> ArrayList<Integer> executionIds = new ArrayList<Integer>(); getRunningFlowsHelper(projectId, flowId, executionIds, queuedFlowMap.values()); getRunningFlowsHelper(projectId, flowId, executionIds, runningFlows.values()); return executionIds; }</code><technical_language>This method is returning a list of execution ids, method name is "getRunningFlows". I a bit confused</technical_language>

Target:
public List<Integer> getRunningFlows(int projectId, String flowId) { List<Integer> executionIds = new ArrayList<Integer>(); executionIds.addAll(getRunningFlowsHelper(projectId, flowId, queuedFlows.getAllEntries())); executionIds.addAll(getRunningFlowsHelper(projectId, flowId, runningFlows.values())); return executionIds; }
Source:
<code>public Subject extractSubject(String token) { <START> try { <END> final Claims claims = jwtParser.parseClaimsJws(token).getBody(); final String userId = claims.get(USER_ID_CLAIM, String.class); final String userName = userManager.getById(userId).getName(); final String workspaceId = claims.get(WORKSPACE_ID_CLAIM, String.class); return new MachineTokenAuthorizedSubject( new SubjectImpl(userName, userId, token, false), permissionChecker, workspaceId); } catch (NotFoundException e) { throw new JwtException("User for this token no longer exist."); } catch (ServerException | JwtException e) { throw new JwtException(e.getMessage(), e); } }</code><technical_language>this block NPE fragile. Do sense catch NPE rethrow some meaningful message? check potential NPE places for null</technical_language>

Target:
public Subject extractSubject(String token) { try { final Claims claims = jwtParser.parseClaimsJws(token).getBody(); final String userId = claims.get(USER_ID_CLAIM, String.class); final String userName = userManager.getById(userId).getName(); final String workspaceId = claims.get(WORKSPACE_ID_CLAIM, String.class); return new MachineTokenAuthorizedSubject( new SubjectImpl(userName, userId, token, false), permissionChecker, workspaceId); } catch (NotFoundException e) { throw new JwtException("Corresponding user doesn't exist."); } catch (ServerException | JwtException e) { throw new JwtException(e.getMessage(), e); } }
Source:
<code>public void setData(@Nullable LatencyAnalysis analysis) <START> { <END> if (analysis == null) { updateModel(null); return; } ISegmentStore<ISegment> results = analysis.getResults(); if (results != null) { updateModel(new LatencyDataStore(results)); return; } updateModel(null); LatencyViewerUtils.runAnalysis(fListener); }</code><technical_language>{ line</technical_language>

Target:
public void setData(@Nullable LatencyAnalysis analysis) { if (analysis == null) { updateModel(null); return; } ISegmentStore<ISegment> results = analysis.getResults(); if (results != null) { updateModel(new LatencyDataStore(results)); return; } updateModel(null); analysis.addListener(fListener); analysis.schedule(); }
Source:
<code>public static int numWorkers(CuratorFramework curator) { int numWorkers = 0; try { if (curator.checkExists().forPath(ZookeeperPath.FINDERS) != null) { for (String path : curator.getChildren().forPath(ZookeeperPath.FINDERS)) { <START> if (path.startsWith("f-")) { <END> numWorkers++; } } } } catch (Exception e) { throw new RuntimeException(e); } return numWorkers; }</code><technical_language>this a constant shared other code. This implication more obvious if changes it</technical_language>

Target:
public static int numWorkers(CuratorFramework curator) { int numWorkers = 0; try { if (curator.checkExists().forPath(ZookeeperPath.FINDERS) != null) { for (String path : curator.getChildren().forPath(ZookeeperPath.FINDERS)) { if (path.startsWith(PartitionManager.ZK_FINDER_PREFIX)) { numWorkers++; } } } } catch (Exception e) { throw new RuntimeException(e); } return numWorkers; }
Source:
<code>public synchronized String nextNumber(Project project, User user) { Query query = currentSession().createQuery("from SampleNumberPerProjectImpl sn where sn.project = :project"); query.setParameter("project", project); SampleNumberPerProject sampleNumberPerProject = (SampleNumberPerProject) query.uniqueResult(); if (sampleNumberPerProject == null) { sampleNumberPerProject = createSampleNumberPerProject(project, user); } Integer highestSampleNumber = sampleNumberPerProject.getHighestSampleNumber(); highestSampleNumber++; sampleNumberPerProject.setHighestSampleNumber(highestSampleNumber); sampleNumberPerProject.setUpdatedBy(user); sampleNumberPerProject.setLastUpdated(new Date()); <START> addSampleNumberPerProject(sampleNumberPerProject); <END> return padInteger(sampleNumberPerProject.getPadding(), highestSampleNumber); }</code><technical_language>This update method instead of add method</technical_language>

Target:
public synchronized String nextNumber(Project project, User user) { Query query = currentSession().createQuery("from SampleNumberPerProjectImpl sn where sn.project = :project"); query.setParameter("project", project); SampleNumberPerProject sampleNumberPerProject = (SampleNumberPerProject) query.uniqueResult(); if (sampleNumberPerProject == null) { sampleNumberPerProject = createSampleNumberPerProject(project, user); } Integer highestSampleNumber = sampleNumberPerProject.getHighestSampleNumber(); highestSampleNumber++; sampleNumberPerProject.setHighestSampleNumber(highestSampleNumber); sampleNumberPerProject.setUpdatedBy(user); update(sampleNumberPerProject); return padInteger(sampleNumberPerProject.getPadding(), highestSampleNumber); }
Source:
<code>public float getVolume(String sinkId) { AudioSink sink = null; if (sinkId == null) { sink = getSink(); } else { sink = audioSinks.get(sinkId); } if (sink != null) { try { return sink.getVolume(); } catch (IOException e) { logger.error("An exception occured while getting the volume of sink : '{}'", sink.getId(), e.getMessage()); } } return 0; <START> <END> }</code><technical_language>need touch this file, I this empty line removed</technical_language>

Target:
public float getVolume(String sinkId) { AudioSink sink = getSink(sinkId); if (sink != null) { try { return sink.getVolume(); } catch (IOException e) { logger.error("An exception occured while getting the volume of sink : '{}'", sink.getId(), e.getMessage()); } } return 0; }
Source:
<code>void deadLetterMessage(MessagingEntityType entityType, boolean isSessionEnabled) { setSenderAndReceiver(entityType, isSessionEnabled); final String messageId = UUID.randomUUID().toString(); final ServiceBusMessage message = getMessage(messageId, isSessionEnabled); sendMessage(message); final IterableStream<ServiceBusReceivedMessage> messageIte = receiver.receive(1, TIMEOUT); Assertions.assertNotNull(messageIte); final List<ServiceBusReceivedMessage> asList = messageIte.stream().collect(Collectors.toList()); ServiceBusReceivedMessage receivedMessage = asList.get(0); <START> assertNotNull(receivedMessage); <END> receiver.deadLetter(receivedMessage); messagesPending.decrementAndGet(); }</code><technical_language>other instances of it</technical_language>

Target:
void deadLetterMessage(MessagingEntityType entityType, boolean isSessionEnabled) { setSenderAndReceiver(entityType, isSessionEnabled); final String messageId = UUID.randomUUID().toString(); final ServiceBusMessage message = getMessage(messageId, isSessionEnabled); final int maxMessages = 1; sendMessage(message); final IterableStream<ServiceBusReceivedMessage> messages = receiver.receive(maxMessages, TIMEOUT); Assertions.assertNotNull(messages); final List<ServiceBusReceivedMessage> asList = messages.stream().collect(Collectors.toList()); assertEquals(maxMessages, asList.size()); final ServiceBusReceivedMessage receivedMessage = asList.get(0); assertNotNull(receivedMessage); receiver.deadLetter(receivedMessage); messagesPending.decrementAndGet(); }
Source:
<code>public static String getQualifiedNameLabelWithSufficientDepth(final NamedElement namedElement, final Namespace model) { Assert.isNotNull(namedElement); StringBuffer label = new StringBuffer(); List<Package> importedPackages = null; if (null != model) { importedPackages = new ArrayList<Package>(model.getImportedPackages()); } List<Namespace> visitedNamespaces = new ArrayList<Namespace>(); Namespace currentNamespace = namedElement.getNamespace(); boolean rootFound = false; boolean modelIsTheRoot = false; while (currentNamespace != null && !rootFound) { visitedNamespaces.add(currentNamespace); if (null != importedPackages || null != model) { if (importedPackages.contains(currentNamespace) || currentNamespace == model) { rootFound = true; if (currentNamespace == model) { modelIsTheRoot = true; } } } Element owner = currentNamespace.getOwner(); while <START> (owner != null && <END> !(owner instanceof Namespace)) { owner = owner.getOwner(); } currentNamespace = owner != null ? (Namespace) owner : null; } for (int i = visitedNamespaces.size() - 1 - (modelIsTheRoot ? 1 : 0); i >= 0; i--) { label.append(visitedNamespaces.get(i).getName()); label.append("::"); } label.append(namedElement.getName()); return label.toString(); }</code><technical_language>constant variable</technical_language>

Target:
public static String getQualifiedNameLabelWithSufficientDepth(final NamedElement namedElement, final Namespace model) { Assert.isNotNull(namedElement); StringBuffer label = new StringBuffer(); List<Package> importedPackages = null; if (null != model) { importedPackages = new ArrayList<Package>(model.getImportedPackages()); } List<Namespace> visitedNamespaces = new ArrayList<Namespace>(); Namespace currentNamespace = namedElement.getNamespace(); boolean rootFound = false; boolean modelIsTheRoot = false; while (currentNamespace != null && !rootFound) { visitedNamespaces.add(currentNamespace); if (null != importedPackages || null != model) { if (importedPackages.contains(currentNamespace) || currentNamespace == model) { rootFound = true; if (currentNamespace == model) { modelIsTheRoot = true; } } } Element owner = currentNamespace.getOwner(); while (null != owner && !(owner instanceof Namespace)) { owner = owner.getOwner(); } currentNamespace = owner != null ? (Namespace) owner : null; } int qualifiedNameDepht = visitedNamespaces.size() - 1 - (modelIsTheRoot ? 1 : 0); for (int i = qualifiedNameDepht; i >= 0; i--) { label.append(visitedNamespaces.get(i).getName()); label.append("::"); } label.append(namedElement.getName()); return label.toString(); }
Source:
<code>public static String createAllResponseResultClassVars(final ImmutableList<Ds3ResponseCode> responseCodes) { if (isEmpty(responseCodes)) { return ""; } final ImmutableMap<String, Ds3ResponseType> map = createUniqueDs3ResponseTypesMap(responseCodes); final ImmutableList.Builder<String> builder = ImmutableList.builder(); <START> for (Map.Entry<String, Ds3ResponseType> entry : map.entrySet()) { <END> builder.add("private " + convertType(entry.getValue().getType(), entry.getValue().getComponentType()) + " " + entry.getKey() + ";"); } return builder.build() .stream() .map(i -> indent(1) + i) .collect(Collectors.joining("\n")); }</code><technical_language>Missing final</technical_language>

Target:
public static String createAllResponseResultClassVars(final ImmutableList<Ds3ResponseCode> responseCodes) { if (isEmpty(responseCodes)) { return ""; } final ImmutableMap<String, Ds3ResponseType> map = createUniqueDs3ResponseTypesMap(responseCodes); final ImmutableList.Builder<String> builder = ImmutableList.builder(); for (final Map.Entry<String, Ds3ResponseType> entry : map.entrySet()) { builder.add("private " + convertType(entry.getValue().getType(), entry.getValue().getComponentType()) + " " + entry.getKey() + ";"); } return builder.build() .stream() .map(i -> indent(1) + i) .collect(Collectors.joining("\n")); }
Source:
<code>public void handleReconnect(ClientDescriptor clientDescriptor, byte[] extendedReconnectData) { ClientState clientState = this.clientStateMap.get(clientDescriptor); if (clientState == null) { LOGGER.error("Client trying to reconnect is not connected to entity.", clientDescriptor); <START> return; <END> } clientState.attach(); Set<String> cacheIds = reconnectDataCodec.decode(extendedReconnectData); for (final String cacheId : cacheIds) { ServerStoreImpl serverStore = ehcacheStateService.getStore(cacheId); if (serverStore == null) { LOGGER.error("ServerStore '{}' does not exist as expected by Client '{}'.", cacheId, clientDescriptor); continue; } serverStore.setEvictionListener(new ServerStoreEvictionListener() { @Override public void onEviction(long key) { invalidateHashAfterEviction(cacheId, key); } }); attachStore(clientDescriptor, cacheId); } LOGGER.info("Client '{}' successfully reconnected to newly promoted ACTIVE after failover.", clientDescriptor); }</code><technical_language>I throw AssertionError - this impossible platform's perspective</technical_language>

Target:
public void handleReconnect(ClientDescriptor clientDescriptor, byte[] extendedReconnectData) { ClientState clientState = this.clientStateMap.get(clientDescriptor); if (clientState == null) { throw new AssertionError("Client "+ clientDescriptor +" trying to reconnect is not connected to entity"); } clientState.attach(); Set<String> cacheIds = reconnectDataCodec.decode(extendedReconnectData); for (final String cacheId : cacheIds) { ServerStoreImpl serverStore = ehcacheStateService.getStore(cacheId); if (serverStore == null) { LOGGER.warn("ServerStore '{}' does not exist as expected by Client '{}'.", cacheId, clientDescriptor); continue; } serverStore.setEvictionListener(new ServerStoreEvictionListener() { @Override public void onEviction(long key) { invalidateHashAfterEviction(cacheId, key); } }); attachStore(clientDescriptor, cacheId); } LOGGER.info("Client '{}' successfully reconnected to newly promoted ACTIVE after failover.", clientDescriptor); }
Source:
<code>public Jackson2Config createCopy() { <START> return new Jackson2Config().setMapper(mapper); <END> }</code><technical_language>a copy constructor consistent other Config classes? a shame divert pattern refactor anyway</technical_language>

Target:
public Jackson2Config createCopy() { return new Jackson2Config(this); }
Source:
<code>protected void checkFile(@NotNull GoFile file, @NotNull ProblemsHolder problemsHolder) { super.checkFile(file, problemsHolder); <START> ProgressManager.checkCanceled(); <END> if (!GoTestFinder.isTestFile(file)) return; for (GoImportSpec importSpec : file.getImports()) { if (importSpec.isCImport()) { problemsHolder.registerProblem(importSpec, "Usage of cgo in tests is not supported.", new GoDeleteImportQuickFix()); } } }</code><technical_language>checkCancelled is called for element com.intellij.psi.PsiElementVisitor#visitElement, sense invoke super.visit*</technical_language>

Target:
protected void checkFile(@NotNull GoFile file, @NotNull ProblemsHolder problemsHolder) { if (!GoTestFinder.isTestFile(file)) return; for (GoImportSpec importSpec : file.getImports()) { if (importSpec.isCImport()) { problemsHolder.registerProblem(importSpec, "Usage of cgo in tests is not supported.", new GoDeleteImportQuickFix()); } } }
Source:
<code>private Resource addLinks(Object original, Resource converted) { boolean add = false; if (original instanceof Host) { if (StringUtils.isNotEmpty((String) DataAccessor.getFields(original).get(EXTRACTED_CONFIG_FIELD))) { add = canAccessConfig(); } if (!add && StringUtils.isNotEmpty((String) converted.getFields().get(FIELD_DRIVER))) { add = canAccessConfig(); } Object imported = DataAccessor.fromDataFieldOf(original).withKey(HostConstants.FIELD_IMPORTED).get(); <START> if (imported != null && (Boolean)imported) { <END> Map<String, URL> links = converted.getLinks(); if (links != null) { links.remove("remove"); } } } if (add) { converted.getLinks().put(CONFIG_LINK, ApiContext.getUrlBuilder().resourceLink(converted, CONFIG_LINK)); } converted.getLinks().put(STORAGE_POOLS_LINK, ApiContext.getUrlBuilder().resourceLink(converted, STORAGE_POOLS_LINK)); return converted; }</code><technical_language>protip: if (imported instanceof Boolean && (Boolean)imported) ensure get a classcastexception "null" is instanceof anything, checks for null too</technical_language>

Target:
private Resource addLinks(Object original, Resource converted) { boolean add = false; if (original instanceof Host) { if (StringUtils.isNotEmpty((String) DataAccessor.getFields(original).get(EXTRACTED_CONFIG_FIELD))) { add = canAccessConfig(); } if (!add && StringUtils.isNotEmpty((String) converted.getFields().get(FIELD_DRIVER))) { add = canAccessConfig(); } boolean imported = DataAccessor.fieldBool(original, HostConstants.FIELD_IMPORTED); if (imported) { Map<String, URL> links = converted.getLinks(); if (links != null) { links.remove("remove"); } } } if (add) { converted.getLinks().put(CONFIG_LINK, ApiContext.getUrlBuilder().resourceLink(converted, CONFIG_LINK)); } converted.getLinks().put(STORAGE_POOLS_LINK, ApiContext.getUrlBuilder().resourceLink(converted, STORAGE_POOLS_LINK)); return converted; }
Source:
<code>public void rateLimitLog(String newMsg, String value) { long now = Time.currentElapsedTime(); if (newMsg.equals(msg)) { ++count; this.value = value; if (now - timestamp >= LOG_INTERVAL) { flush(); <START> msg = newMsg; <END> timestamp = now; this.value = value; } } else { flush(); msg = newMsg; this.value = value; timestamp = now; if (null == value) { LOG.warn("Message: {}", msg); } else { LOG.warn("Message: {}, Value: {}", msg, value); } } }</code><technical_language>do need this change? Time interval elapsed, reset count</technical_language>

Target:
public void rateLimitLog(String newMsg, String value) { long now = getCurrentElapsedTime(); if (newMsg.equals(msg)) { if (now - timestamp >= LOG_INTERVAL) { flush(); msg = newMsg; timestamp = now; this.value = value; count = 1; } else { ++count; this.value = value; } } else { flush(); msg = newMsg; this.value = value; timestamp = now; if (null == value) { LOG.warn("Message: {}", msg); } else { LOG.warn("Message: Value: {}", msg, value); } } }
Source:
<code>public BoxRequestsMetadata.DeleteItemMetadata getDeleteFolderMetadataTemplateRequest(String id, String template) { <START> BoxRequestsMetadata.DeleteItemMetadata request = new BoxRequestsMetadata.DeleteItemMetadata(getFileMetadataUrl(id, template), mSession); <END> return request; }</code><technical_language>Please correct "getFolderMetadataUrl"</technical_language>

Target:
public BoxRequestsMetadata.DeleteItemMetadata getDeleteFolderMetadataTemplateRequest(String id, String template) { BoxRequestsMetadata.DeleteItemMetadata request = new BoxRequestsMetadata.DeleteItemMetadata(getFolderMetadataUrl(id, template), mSession); return request; }
Source:
<code>void initializeAndPublishProxies() { for (Map.Entry<String, DistributedObjectFuture> entry : proxies.entrySet()) { DistributedObjectFuture future = entry.getValue(); if (!future.isSetAndInitialized()) { extractDistributedObject(future); <START> publish(new DistributedObjectEventPacket(CREATED, serviceName, entry.getKey())); <END> } } }</code><technical_language>mind - I ProxyRegistry#extractDistributedObject method return null in case able retrieve proxy. skip publication in this case</technical_language>

Target:
void initializeAndPublishProxies() { for (Map.Entry<String, DistributedObjectFuture> entry : proxies.entrySet()) { String name = entry.getKey(); DistributedObjectFuture future = entry.getValue(); if (!future.isSetAndInitialized()) { try { future.get(); } catch (Throwable e) { proxyService.logger.warning("Error while initializing proxy: " + name, e); future.setError(e); proxies.remove(entry.getKey()); throw rethrow(e); } publish(new DistributedObjectEventPacket(CREATED, serviceName, name)); } } }
Source:
<code>public void courseDetailShared(String courseId, String aboutUrl, ShareUtils.ShareType method) { Event aEvent = new Event(); aEvent.properties.putValue(Keys.NAME, Values.SOCIAL_COURSE_DETAIL_SHARED); aEvent.data.putValue(Keys.NAME, courseId); aEvent.data.putValue(Keys.CATEGORY, Values.SOCIAL_SHARING); aEvent.data.putValue(Keys.URL, aboutUrl); <START> aEvent.data.putValue(Keys.TYPE, Analytics.Util.getShareTypeValue(method)); <END> aEvent.setAppNameContext(); tracker.track(Events.SOCIAL_COURSE_DETAIL_SHARED, aEvent.properties); }</code><technical_language>implementer of Analytics interface, this class able resolve classes defined in interface (i.e. Analytics. is needed here). Alternatively, statically import methods in utility class, enable methods resolved needing namespacing (just if static method defined in interface)</technical_language>

Target:
public void courseDetailShared(String courseId, String aboutUrl, ShareUtils.ShareType method) { Event aEvent = new Event(); aEvent.properties.putValue(Keys.NAME, Values.SOCIAL_COURSE_DETAIL_SHARED); aEvent.data.putValue(Keys.NAME, courseId); aEvent.data.putValue(Keys.CATEGORY, Values.SOCIAL_SHARING); aEvent.data.putValue(Keys.URL, aboutUrl); aEvent.data.putValue(Keys.TYPE, getShareTypeValue(method)); aEvent.setAppNameContext(); tracker.track(Events.SOCIAL_COURSE_DETAIL_SHARED, aEvent.properties); }
Source:
<code>public CodeSystemVersionEntry build(final Document doc) { return new CodeSystemVersionEntry( Mappings.longDocValuesField(VERSION_IMPORT_DATE).getValue(doc), Mappings.longDocValuesField(VERSION_EFFECTIVE_DATE).getValue(doc), <START> Mappings.longDocValuesField(VERSION_EFFECTIVE_DATE).getValue(doc), <END> Mappings.stringDocValuesField(VERSION_DESCRIPTION).getValue(doc), doc.get(VERSION_VERSION_ID), doc.get(TerminologyRegistryIndexConstants.VERSION_PARENT_BRANCH_PATH) != null ? doc.get(TerminologyRegistryIndexConstants.VERSION_PARENT_BRANCH_PATH): "MAIN", Mappings.longDocValuesField(VERSION_STORAGE_KEY).getValue(doc), doc.get(VERSION_REPOSITORY_UUID), doc.get(VERSION_SYSTEM_SHORT_NAME)); }</code><technical_language>This constant is twice, is earlier; do store updated timestamp in index</technical_language>

Target:
public CodeSystemVersionEntry build(final Document doc) { return new CodeSystemVersionEntry( Mappings.longField(VERSION_IMPORT_DATE).getValue(doc), Mappings.longField(VERSION_EFFECTIVE_DATE).getValue(doc), Mappings.longField(VERSION_LATEST_UPDATE_DATE).getValue(doc), doc.get(VERSION_DESCRIPTION), doc.get(VERSION_VERSION_ID), doc.get(TerminologyRegistryIndexConstants.VERSION_PARENT_BRANCH_PATH) != null ? doc.get(TerminologyRegistryIndexConstants.VERSION_PARENT_BRANCH_PATH): "MAIN", Mappings.longDocValuesField(VERSION_STORAGE_KEY).getValue(doc), doc.get(VERSION_REPOSITORY_UUID), doc.get(VERSION_SYSTEM_SHORT_NAME)); }