auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>QueryIterable(DocumentClient client, <START> DocumentServiceRequest request, <END> ReadType readType, Class<T> classT) { this.client = client; this.retryPolicy = new ResourceThrottleRetryPolicy( client.getRetryPolicy().getMaxRetryAttemptsOnQuery()); this.request = request; this.readType = readType; this.classT = classT; if (this.request != null && this.request.getHeaders() != null) { String continuationToken = this.request.getHeaders().get(HttpConstants.HttpHeaders.CONTINUATION); if (!StringUtils.isBlank(continuationToken)) { this.continuation = continuationToken; } } }</code><technical_language>TABs in code. Please replace of 4 spaces</technical_language>

Target:
QueryIterable(DocumentClient client, DocumentServiceRequest request, ReadType readType, Class<T> classT) { this.client = client; this.retryPolicy = new ResourceThrottleRetryPolicy( client.getRetryPolicy().getMaxRetryAttemptsOnQuery()); this.request = request; this.readType = readType; this.classT = classT; this.reset(); }
Source:
<code>public boolean isAcceptResumed() { <START> return handle.isResumed(SelectionKey.OP_ACCEPT) || suspendedDueToWatermark; <END> }</code><technical_language>This method reflect status of user suspention, connection limit suspension</technical_language>

Target:
public boolean isAcceptResumed() { return !suspended; }
Source:
<code>private void loadCommit(final RevisionInfo rev, CallbackGroup group) { if (rev.is_edit()) { return; } <START> RestApi call = ChangeApi.revision(changeId.get(), rev.name()).view("commit"); ChangeList.addWebLinksOption(call); call.get(group.add(new <END> AsyncCallback<CommitInfo>() { @Override public void onSuccess(CommitInfo info) { rev.set_commit(info); } @Override public void onFailure(Throwable caught) { } })); }</code><technical_language>This is verbose. add helper method in ChangeApi.commitWithInkls() some such. ChangeList.addWebLinksOption() a wrong place for adding private option: ChangeApi.commitWithLinks(changeId.get(), rev.name(), new GerritCallback<CommitInfo>() { @Override public void onSuccess(CommitInfo info) { rev.set_commit(info); } }));</technical_language>

Target:
private void loadCommit(final RevisionInfo rev, CallbackGroup group) { if (rev.is_edit()) { return; } ChangeApi.commitWithLinks(changeId.get(), rev.name(), group.add(new AsyncCallback<CommitInfo>() { @Override public void onSuccess(CommitInfo info) { rev.set_commit(info); } @Override public void onFailure(Throwable caught) { } })); }
Source:
<code>protected Object decode( Channel channel, SocketAddress remoteAddress, Object msg) throws Exception { Parser parser = new Parser(PATTERN, (String) msg); if (!parser.matches()) { return null; } DeviceSession deviceSession = getDeviceSession(channel, remoteAddress, parser.next()); if (deviceSession == null) { return null; } Position position = new Position(getProtocolName()); position.setDeviceId(deviceSession.getDeviceId()); position.setTime(parser.nextDateTime(Parser.DateTimeFormat.YMD_HMS, TimeZone.getDefault().getID())); position.setValid(true); position.setLatitude(Double.parseDouble(parser.next().replace(',', '.'))); position.setLongitude(Double.parseDouble(parser.next().replace(',', '.'))); position.set("azimuth", parser.nextInt()); position.set("angle", parser.nextInt()); position.set("range", parser.nextInt()); <START> position.set("out_of_range", parser.nextInt()); <END> position.set("currier", parser.next()); return position; }</code><technical_language>This comply naming convention. Also, mean</technical_language>

Target:
protected Object decode( Channel channel, SocketAddress remoteAddress, Object msg) throws Exception { Parser parser = new Parser(PATTERN, (String) msg); if (!parser.matches()) { return null; } DeviceSession deviceSession = getDeviceSession(channel, remoteAddress, parser.next()); if (deviceSession == null) { return null; } Position position = new Position(getProtocolName()); position.setDeviceId(deviceSession.getDeviceId()); position.setTime(parser.nextDateTime(Parser.DateTimeFormat.YMD_HMS, TimeZone.getDefault().getID())); position.setValid(true); position.setLatitude(Double.parseDouble(parser.next().replace(',', '.'))); position.setLongitude(Double.parseDouble(parser.next().replace(',', '.'))); position.setCourse(parser.nextInt()); position.set("angle", parser.nextInt()); position.set("range", parser.nextInt()); position.set("outOfRange", parser.nextInt()); position.set("carrier", parser.next()); return position; }
Source:
<code>private RevObject pushTree(RevObject obj) throws LargeObjectException, MissingObjectException, IncorrectObjectTypeException, IOException { TreeVisit tv = freeVisit; if (tv != null) { freeVisit = tv.parent; tv.ptr = 0; tv.namePtr = 0; tv.nameEnd = 0; tv.pathLen = 0; } else { tv = new TreeVisit(); } tv.obj = obj; tv.buf = reader.open(obj, OBJ_TREE).getCachedBytes(); tv.parent = currVisit; currVisit = tv; <START> if (tv.parent == null) <END> tv.depth = 1; else tv.depth = tv.parent.depth + 1; return obj; }</code><technical_language>style nit: missing braces</technical_language>

Target:
private RevObject pushTree(RevObject obj) throws LargeObjectException, MissingObjectException, IncorrectObjectTypeException, IOException { TreeVisit tv = freeVisit; if (tv != null) { freeVisit = tv.parent; tv.ptr = 0; tv.namePtr = 0; tv.nameEnd = 0; tv.pathLen = 0; } else { tv = new TreeVisit(); } tv.obj = obj; tv.buf = reader.open(obj, OBJ_TREE).getCachedBytes(); tv.parent = currVisit; currVisit = tv; if (tv.parent == null) { tv.depth = 1; } else { tv.depth = tv.parent.depth + 1; } return obj; }
Source:
<code>public void getPhotonImageUrlIsEmptyWhenUrlIsNull() { String photonUrl = PhotonUtils.getPhotonImageUrl(null, 0, 1); <START> assertEquals("", photonUrl); <END> }</code><technical_language>assertThat(photonUrl).isEmpty() generally assertThat other asserts. I more readable I consistency</technical_language>

Target:
public void getPhotonImageUrlIsEmptyWhenUrlIsNull() { String photonUrl = PhotonUtils.getPhotonImageUrl(null, 0, 1); assertThat(photonUrl, equalTo("")); }
Source:
<code>private void setClanTag(String clanTag) { <START> if (!chatUser.getPlayer().isPresent() || clanTag == null || clanTag.isEmpty()) { <END> clanMenu.setVisible(false); return; } clanMenu.setText(String.format("[%s]", clanTag)); clanMenu.setVisible(true); updateClanMenu(); }</code><technical_language>com.google.common.base.Strings#isNullOrEmpty</technical_language>

Target:
private void setClanTag(String clanTag) { if (!chatUser.getPlayer().isPresent() || Strings.isNullOrEmpty(clanTag)) { clanMenu.setVisible(false); return; } clanMenu.setText(String.format("[%s]", clanTag)); clanMenu.setVisible(true); updateClanMenu(); }
Source:
<code>public StripedExchangeJob(Exchange exchange) { this.exchange = exchange; <START> this.caller = new Throwable(exchange + " stripe caller"); <END> }</code><technical_language>Creating exception in Java is slow. (<LINK_0> Do need this</technical_language>

Target:
public StripedExchangeJob(Exchange exchange) { this.exchange = exchange; if (Exchange.DEBUG) { this.caller = new Throwable(exchange + " stripe caller"); } else { this.caller = null; } }
Source:
<code>public Integer resize(Integer desired) { if ((desired >= MIN_MEMBERS && desired <= MAX_MEMBERS && desired % 2 == 1) || desired == 0) return super.resize(desired); if (desired % 2 == 0) LOG.info("Ignored request to resize replica set to even number of members", getReplicaSetName()); if (desired < MIN_MEMBERS) LOG.info("Ignored request to resize replica set to because smaller than min size of {}", getReplicaSetName(), MIN_MEMBERS); if (desired > MAX_MEMBERS) <START> LOG.info("Ignored request to resize replica set to because larger than max size of {}", getReplicaSetName(), MAX_MEMBERS); <END> return getCurrentSize(); }</code><technical_language>warn these? debug if expected a lot? info wrong. also, show ID of entity</technical_language>

Target:
public Integer resize(Integer desired) { if ((desired >= MIN_MEMBERS && desired <= MAX_MEMBERS && desired % 2 == 1) || desired == 0) return super.resize(desired); if (desired % 2 == 0) LOG.warn("Ignored request to resize replica set to even number of members {}", new Object[] {this, getReplicaSetName(), desired}); if (desired < MIN_MEMBERS) LOG.warn("Ignored request to resize replica set to because smaller than min size of {}", new Object[] {this, getReplicaSetName(), desired, MIN_MEMBERS}); if (desired > MAX_MEMBERS) LOG.warn("Ignored request to resize replica set to because larger than max size of {}", new Object[] {this, getReplicaSetName(), desired, MAX_MEMBERS}); return getCurrentSize(); }
Source:
<code>public PatchSetContent pull(IReviewItemSet parentObject, PatchSetContent content, IProgressMonitor monitor) throws CoreException { try { gerritFactoryProvider.getClient().loadPatchSetContent(content, monitor); <START> } catch (GerritException e) { <END> throw new CoreException(new Status(IStatus.ERROR, GerritCorePlugin.PLUGIN_ID, "Couldn't obtain patch set content for " + content.getId() + ". Check remote connection.")); } for (Patch patch : content.getTargetDetail().getPatches()) { PatchScript patchScript = content.getPatchScript(patch.getKey()); if (patchScript == null) { throw new CoreException(new Status(IStatus.ERROR, GerritCorePlugin.PLUGIN_ID, "Couldn't obtain patch information for patch set " + patch.getKey() + ". Check remote connection.")); } CommentDetail commentDetail = patchScript.getCommentDetail(); List<PatchLineComment> comments = new ArrayList<PatchLineComment>(); comments.addAll(commentDetail.getCommentsA()); comments.addAll(commentDetail.getCommentsB()); for (PatchLineComment comment : comments) { gerritFactoryProvider.pullUser(gerritFactoryProvider.getRoot(), patchScript.getCommentDetail() .getAccounts(), comment.getAuthor(), monitor); } } return content; }</code><technical_language>pass GerritException status</technical_language>

Target:
public PatchSetContent pull(IReviewItemSet parentObject, PatchSetContent content, IProgressMonitor monitor) throws CoreException { try { gerritFactoryProvider.getClient().loadPatchSetContent(content, monitor); } catch (GerritException e) { throw new CoreException(new Status(IStatus.ERROR, GerritCorePlugin.PLUGIN_ID, "Couldn't obtain patch set content for " + content.getId() + ". Check remote connection.", e)); } for (Patch patch : content.getTargetDetail().getPatches()) { PatchScript patchScript = content.getPatchScript(patch.getKey()); if (patchScript == null) { throw new CoreException(new Status(IStatus.ERROR, GerritCorePlugin.PLUGIN_ID, "Couldn't obtain patch information for patch set " + patch.getKey() + ". Check remote connection.")); } CommentDetail commentDetail = patchScript.getCommentDetail(); List<PatchLineComment> comments = new ArrayList<PatchLineComment>(); comments.addAll(commentDetail.getCommentsA()); comments.addAll(commentDetail.getCommentsB()); for (PatchLineComment comment : comments) { gerritFactoryProvider.pullUser(gerritFactoryProvider.getRoot(), patchScript.getCommentDetail() .getAccounts(), comment.getAuthor(), monitor); } } return content; }
Source:
<code>private String generatePassword() { String allowedChars = "abcdefghijklmnopqrstuvwxyz0123456789"; int charRange = allowedChars.length(); <START> Random random = new Random(); <END> StringBuilder password = new StringBuilder(); int passwordLength = 10; for ( int i = 0; i < passwordLength; i++ ) { password.append( allowedChars.charAt( random.nextInt( charRange ) ) ); } return password.toString(); }</code><technical_language>SecureRandom for security related</technical_language>

Target:
private String generatePassword() throws NoSuchAlgorithmException { String allowedChars = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789!@#$%&?"; int charRange = allowedChars.length(); SecureRandom random = SecureRandom.getInstanceStrong(); int passwordLength = 20; char[] password = new char[passwordLength]; for ( int i = 0; i < passwordLength; i++ ) { password[i] = allowedChars.charAt( random.nextInt( charRange ) ); } return new String( password ); }
Source:
<code>private void handleOK(EditText input, EditText inputTitle) { String novel = input.getText().toString(); String title = inputTitle.getText().toString(); if(novel != null && novel.length() > 0 && inputTitle != null && inputTitle.length() > 0) { PageModel temp = new PageModel(); temp.setPage(novel); temp.setTitle(title); temp.setType(PageModel.TYPE_NOVEL); for (int i = 0; i < Constants.languagelistNotDefault.length; i++){ <START> if (language.equals(Constants.languagelistNotDefault[i])){ <END> temp.setParent(Constants.languageCategoryNotDefault[i]); temp.setStatus(Constants.languagelistNotDefault[i]); } } executeAddTask(temp); } else { Toast.makeText(this, "Empty Input", Toast.LENGTH_LONG).show(); } }</code><technical_language>is 1 languange, put break languange is found, if Dictionary, lines replaced java temp.setParent(AltLangDict[languange].getCategory()); temp.setStatus(AltLangDict[languange].getLanguage());</technical_language>

Target:
private void handleOK(EditText input, EditText inputTitle) { String novel = input.getText().toString(); String title = inputTitle.getText().toString(); if(novel != null && novel.length() > 0 && inputTitle != null && inputTitle.length() > 0) { PageModel temp = new PageModel(); temp.setPage(novel); temp.setTitle(title); temp.setType(PageModel.TYPE_NOVEL); if (language != null){ temp.setParent(AlternativeLanguageInfo.getAlternativeLanguageInfo().get(language).getCategoryInfo()); temp.setStatus(language); executeAddTask(temp); } } else { Toast.makeText(this, "Empty Input", Toast.LENGTH_LONG).show(); } }
Source:
<code>public static SCMHead readResolveSCMHead(@NonNull SCMSource source, @NonNull SCMHead head) { for (SCMHeadMigration m : ExtensionList.lookup(SCMHeadMigration.class)) { <START> if (m.sourceClass.equals(source.getClass()) <END> && m.headClass.equals(head.getClass())) { SCMHead migrated = m.migrate(source, head); if (migrated != null) { return migrated; } } } return head; }</code><technical_language>== for Classes</technical_language>

Target:
public static SCMHead readResolveSCMHead(@NonNull SCMSource source, @NonNull SCMHead head) { for (SCMHeadMigration m : ExtensionList.lookup(SCMHeadMigration.class)) { if (m.sourceClass == source.getClass() && m.headClass == head.getClass()) { SCMHead migrated = m.migrate(source, head); if (migrated != null) { return migrated; } } } return head; }
Source:
<code>public void startBackgroundTasks() { <START> scheduler.schedule(ingestTask(soccerFetcher()).withName("Opta Football Events Updater"), RepetitionRules.NEVER); <END> scheduler.schedule(ingestTask(sportsFetcher()).withName("Opta (Non Football) Sports Events Updater"), RepetitionRules.NEVER); }</code><technical_language>suggest Opta Events (Football) Opta Events (Non-football) class easier find (maybe)</technical_language>

Target:
public void startBackgroundTasks() { scheduler.schedule(ingestTask(soccerFetcher()).withName("Opta Events (Football) Updater"), RepetitionRules.NEVER); scheduler.schedule(ingestTask(sportsFetcher()).withName("Opta Events (Non Football) Updater"), RepetitionRules.NEVER); }
Source:
<code>public Map<String, String> getAllParameters() { Map<String, String> result = Maps.newHashMap(); Map<String, String> parameters = m_xmlTest.getLocalParameters(); for (Map.Entry<String, String> parameter : parameters.entrySet()) { result.put(parameter.getKey(), parameter.getValue()); } <START> for (Map.Entry<String, String> entry : m_parameters.entrySet()) { <END> result.put(entry.getKey(), entry.getValue()); } return result; }</code><technical_language>below: putAll instead of loop</technical_language>

Target:
public Map<String, String> getAllParameters() { Map<String, String> result = Maps.newHashMap(); Map<String, String> parameters = m_xmlTest.getLocalParameters(); result.putAll(parameters); result.putAll(m_parameters); return result; }
Source:
<code>public void handle(Callback[] callbacks) throws IOException, UnsupportedCallbackException { AuthorizeCallback acb = (AuthorizeCallback) callbacks[0]; String authenticationId = acb.getAuthenticationID(); String authorizationId = acb.getAuthorizationID(); acb.setAuthorized(authenticationId.equals(authorizationId)); int realmSep = authorizationId.indexOf('@'); <START> realmUser = realmSep < 0 ? new RealmUser(authorizationId) : new RealmUser(authorizationId.substring(realmSep+1), authorizationId.substring(0, realmSep)); <END> }</code><technical_language>need handle case realmSep == 0</technical_language>

Target:
public void handle(Callback[] callbacks) throws IOException, UnsupportedCallbackException { AuthorizeCallback acb = (AuthorizeCallback) callbacks[0]; String authenticationId = acb.getAuthenticationID(); String authorizationId = acb.getAuthorizationID(); acb.setAuthorized(authenticationId.equals(authorizationId)); int realmSep = authorizationId.indexOf('@'); realmUser = realmSep <= 0 ? new RealmUser(authorizationId) : new RealmUser(authorizationId.substring(realmSep+1), authorizationId.substring(0, realmSep)); }
Source:
<code>public TimestampParser(ScriptingContainer jruby, String format, DateTimeZone defaultTimeZone, String defaultDate) { <START> Ruby runtime = jruby.getProvider().getRuntime(); <END> this.format = format; this.parser = new RubyDateParser(runtime.getCurrentContext()); this.compiledPattern = this.parser.compilePattern(runtime.newString(format), true); this.defaultTimeZone = defaultTimeZone; SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd", Locale.ENGLISH); df.setTimeZone(TimeZone.getTimeZone("UTC")); Date utc; try { utc = df.parse(defaultDate); } catch (ParseException ex) { throw new ConfigException("Invalid date format. Expected yyyy-MM-dd: " + defaultDate); } this.cal = Calendar.getInstance(TimeZone.getTimeZone("UTC"), Locale.ENGLISH); this.cal.setTime(utc); }</code><technical_language>Do plans eliminate this JRuby instance eventually (may in this PR)</technical_language>

Target:
public TimestampParser(ScriptingContainer jruby, String format, DateTimeZone defaultTimeZone, String defaultDate) { Ruby runtime = jruby.getProvider().getRuntime(); this.format = format; this.parser = new RubyDateParser(runtime.getCurrentContext()); this.compiledPattern = this.parser.compilePattern(runtime.newString(format)); this.defaultTimeZone = defaultTimeZone; SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd", Locale.ENGLISH); df.setTimeZone(TimeZone.getTimeZone("UTC")); Date utc; try { utc = df.parse(defaultDate); } catch (ParseException ex) { throw new ConfigException("Invalid date format. Expected yyyy-MM-dd: " + defaultDate); } this.calendar = Calendar.getInstance(TimeZone.getTimeZone("UTC"), Locale.ENGLISH); this.calendar.setTime(utc); }
Source:
<code>public boolean readColumns(final List<String> columns, final BooleanList quotedColumns) throws IOException { if (columns == null) { throw new NullPointerException("columns should not be null"); } columns.clear(); if (quotedColumns != null) quotedColumns.clear(); colIdx = 0; currentColumn.setLength(0); currentRow.clear(); state = TokenizerState.NORMAL; quoteScopeStartingLine = -1; potentialSpaces = 0; charIndex = 0; wasQuoted = false; if (!readFirstLine()) return false; checkExactSizeFirst = false; if (valueSizeHints != null) { if (valueSizeHints.stream().max(Integer::compare).get() > scanThresold) { checkExactSizeFirst = true; <START> exactColumnSizes = new ArrayList<>(Collections.nCopies(valueSizeHints.size(), 0)); <END> } } if (checkExactSizeFirst) { runStateMachine(new ArrayList<>(), null); checkExactSizeFirst = false; colIdx = 0; currentColumn.setLength(0); state = TokenizerState.NORMAL; quoteScopeStartingLine = -1; potentialSpaces = 0; charIndex = 0; rowIdx = 0; wasQuoted = false; resetColumn(); } runStateMachine(columns, quotedColumns); return true; }</code><technical_language>Collections.nCopies() here</technical_language>

Target:
public boolean readColumns(final List<String> columns, final BooleanList quotedColumns) throws IOException { if (columns == null) { throw new NullPointerException("columns should not be null"); } columns.clear(); if (quotedColumns != null) quotedColumns.clear(); reset(); currentRow.clear(); if (!readFirstLine()) return false; checkExactSizeFirst = false; if (valueSizeHints != null) { if (valueSizeHints.stream().max(Integer::compare).get() > scanThresold) { checkExactSizeFirst = true; exactColumnSizes = new ArrayList<>(Collections.nCopies(valueSizeHints.size(), 0)); } } if (checkExactSizeFirst) { runStateMachine(new ArrayList<>(), null); reset(); allocateColumnMemory(); checkExactSizeFirst = false; rowIdx = 0; } runStateMachine(columns, quotedColumns); return true; }
Source:
<code>public static LinkedContact linkContact(String companyId, String contactId) throws OnePageException { String endpoint = LINKED_CONTACTS_ENDPOINT.replace("{id}", companyId); Request request = new PostRequest( endpoint, null, CompanySerializer.toJsonObject(contactId, null) ); Response response = request.send(); String responseBody = response.getResponseBody(); LinkedContact linkedContact = LinkedContactSerializer.fromString(responseBody); LoginSerializer.updateDynamicResources(responseBody); <START> return linkedContact; <END> }</code><technical_language>@lorobode Instead of duplicating code methods, call linkContact method passing null for linkedWithId param</technical_language>

Target:
public static LinkedContact linkContact(String companyId, String contactId) throws OnePageException { return linkContact(companyId, contactId, null); }
Source:
<code>private void check(AssertionError error) throws Exception { verify(constructorInvoker) .newInstance(ComparisonFailure.class.getName(), new Class<?>[] { String.class, String.class, String.class }, array("[Jedi]", "\"Yoda\"", "\"Luke\"")); verify(constructorInvoker) .newInstance(AssertionFailedError.class.getName(), new Class<?>[] { String.class, Object.class, Object.class }, array(String.format("[Jedi] %nExpecting:%n <\"Luke\">%nto be equal to:%n <\"Yoda\">%nbut was not."), "Yoda", "Luke")); assertThat(error).isNotInstanceOf(ComparisonFailure.class); <START> assertThat(error).isInstanceOf(AssertionFailedError.class); <END> AssertionFailedError assertionFailedError = (AssertionFailedError) error; assertThat(assertionFailedError.getActual().getValue()).isEqualTo("Luke"); assertThat(assertionFailedError.getExpected().getValue()).isEqualTo("Yoda"); assertThat(error.getMessage()) .isEqualTo(String.format("[Jedi] %nExpecting:%n <\"Luke\">%nto be equal to:%n <\"Yoda\">%nbut was not.")); }</code><technical_language>chain assertion</technical_language>

Target:
private void check(AssertionError error) throws Exception { verify(constructorInvoker) .newInstance(ComparisonFailure.class.getName(), new Class<?>[] { String.class, String.class, String.class }, "[Jedi]", "\"Yoda\"", "\"Luke\""); verify(constructorInvoker) .newInstance(AssertionFailedError.class.getName(), new Class<?>[] { String.class, Object.class, Object.class }, String.format("[Jedi] %nExpecting:%n <\"Luke\">%nto be equal to:%n <\"Yoda\">%nbut was not."), "Yoda", "Luke"); assertThat(error).isNotInstanceOf(ComparisonFailure.class) .isInstanceOf(AssertionFailedError.class); AssertionFailedError assertionFailedError = (AssertionFailedError) error; assertThat(assertionFailedError.getActual().getValue()).isEqualTo("Luke"); assertThat(assertionFailedError.getExpected().getValue()).isEqualTo("Yoda"); assertThat(error.getMessage()) .isEqualTo(String.format("[Jedi] %nExpecting:%n <\"Luke\">%nto be equal to:%n <\"Yoda\">%nbut was not.")); }
Source:
<code>protected void eventHandle(@NonNull ITmfEvent event) { String name = event.getName(); long inc; if (name.equals(fLayout.eventKmemPageAlloc())) { inc = PAGE_SIZE; } else if (name.equals(fLayout.eventKmemPageFree())) { inc = -PAGE_SIZE; } else { return; } String fieldOrder = fLayout.fieldOrder(); if (fieldOrder != null) { Long value = event.getContent().getFieldValue(Long.class, fieldOrder); if (value != null) { if (value > MAX_ORDER || value < 0) { Activator.getDefault().logWarning("Order of alloc is outside of acceptable range : " + value); return; } inc <<= value; } } ITmfStateSystemBuilder ss = checkNotNull(getStateSystemBuilder()); long ts = event.getTimestamp().toNanos(); Integer tidField = KernelTidAspect.INSTANCE.resolve(event); String tid; if (tidField == null) { tid = OTHER_TID; } else { tid = tidField.toString(); } int tidQuark = ss.getQuarkAbsoluteAndAdd(tid); StateSystemBuilderUtils.incrementAttributeLong(ss, ts, tidQuark, inc); long currentMemoryValue = ss.queryOngoingState(tidQuark).unboxLong(); int lowestMemoryQuark = ss.getQuarkRelativeAndAdd(tidQuark, KernelMemoryAnalysisModule.THREAD_LOWEST_MEMORY_VALUE); <START> ITmfStateValue lowestMemoryValue = ss.queryOngoingState(lowestMemoryQuark); long previousLowest = lowestMemoryValue.isNull() ? 0 : lowestMemoryValue.unboxLong(); if (previousLowest > currentMemoryValue) { ss.modifyAttribute(ts, TmfStateValue.newValueLong(currentMemoryValue), lowestMemoryQuark); <END> } }</code><technical_language>Objects instead of statevalues? Ping show if this is unclear</technical_language>

Target:
protected void eventHandle(@NonNull ITmfEvent event) { String name = event.getName(); long inc; if (name.equals(fLayout.eventKmemPageAlloc())) { inc = PAGE_SIZE; } else if (name.equals(fLayout.eventKmemPageFree())) { inc = -PAGE_SIZE; } else { return; } String fieldOrder = fLayout.fieldOrder(); if (fieldOrder != null) { Long value = event.getContent().getFieldValue(Long.class, fieldOrder); if (value != null) { if (value > MAX_ORDER || value < 0) { Activator.getDefault().logWarning("Order of alloc is outside of acceptable range : " + value); return; } inc <<= value; } } ITmfStateSystemBuilder ss = checkNotNull(getStateSystemBuilder()); long ts = event.getTimestamp().toNanos(); Integer tidField = KernelTidAspect.INSTANCE.resolve(event); String tid; if (tidField == null) { tid = OTHER_TID; } else { tid = tidField.toString(); } int tidQuark = ss.getQuarkAbsoluteAndAdd(tid); StateSystemBuilderUtils.incrementAttributeLong(ss, ts, tidQuark, inc); long currentMemoryValue = ss.queryOngoingState(tidQuark).unboxLong(); int lowestMemoryQuark = ss.getQuarkRelativeAndAdd(tidQuark, KernelMemoryAnalysisModule.THREAD_LOWEST_MEMORY_VALUE); Object lowestMemoryValue = ss.queryOngoing(lowestMemoryQuark); long previousLowest = lowestMemoryValue == null ? 0 : (Long) lowestMemoryValue; if (previousLowest > currentMemoryValue) { ss.modifyAttribute(ts, currentMemoryValue, lowestMemoryQuark); } }
Source:
<code>public void transferMemoryToTaskContext(long taskBytes) { long bytes = operatorMemoryContext.getUserMemory(); LocalMemoryContext taskLocalMemoryContext = driverContext.getPipelineContext().getTaskContext().localUserMemoryContext(); try { <START> operatorMemoryContext.localUserMemoryContext().transferOwnership(taskLocalMemoryContext); <END> taskLocalMemoryContext.addBytes(taskBytes - bytes); } catch (ExceededMemoryLimitException e) { taskLocalMemoryContext.addBytes(-bytes); throw e; } }</code><technical_language>This explains call get parent transferOwnership. exposed localUserMemoryContext, aggregatedUserMemoryContext. a result, access parent. This solution is ok. revisit. DELETE</technical_language>

Target:
public void transferMemoryToTaskContext(long taskBytes) { long bytes = operatorMemoryContext.getUserMemory(); LocalMemoryContext transferredBytesMemoryContext = driverContext.getPipelineContext().getTaskContext().getTransferredBytesMemoryContext(); operatorMemoryContext.localUserMemoryContext().transferOwnership(transferredBytesMemoryContext); try { transferredBytesMemoryContext.setBytes(transferredBytesMemoryContext.getBytes() + taskBytes - bytes); } catch (ExceededMemoryLimitException e) { transferredBytesMemoryContext.setBytes(0); throw e; } }
Source:
<code>public GroupRest getSubmittersGroup(@Nullable HttpServletRequest request, UUID collectionId, @Nullable Pageable optionalPageable, Projection projection) { try { Context context = obtainContext(); Collection collection = collectionService.find(context, collectionId); if (collection == null) { throw new ResourceNotFoundException("No such collection: " + collectionId); } Group submitters = collection.getSubmitters(); <START> if (!authorizeService.isAdmin(context) && !authorizeService.authorizeActionBoolean(context, collection, <END> Constants.ADMIN, true)) { throw new AccessDeniedException("The current user was not allowed to retrieve the submitterGroup for" + " collection: " + collectionId); } if (submitters == null) { return null; } return converter.toRest(submitters, projection); } catch (SQLException e) { throw new RuntimeException(e); } }</code><technical_language>Again, move authorization check line loads group</technical_language>

Target:
public GroupRest getSubmittersGroup(@Nullable HttpServletRequest request, UUID collectionId, @Nullable Pageable optionalPageable, Projection projection) { try { Context context = obtainContext(); Collection collection = collectionService.find(context, collectionId); if (collection == null) { throw new ResourceNotFoundException("No such collection: " + collectionId); } try { AuthorizeUtil.authorizeManageSubmittersGroup(context, collection); } catch (AuthorizeException e) { throw new AccessDeniedException("The current user was not allowed to retrieve the submitterGroup for" + " collection: " + collectionId); } Group submitters = collection.getSubmitters(); if (submitters == null) { return null; } return converter.toRest(submitters, projection); } catch (SQLException e) { throw new RuntimeException(e); } }
Source:
<code>public void onError(Throwable throwable) { errors.inc(); aggReadErrors.inc(); <START> LOG.error(String.format("Received error from event hub connection (ssp=%s): ", ssp), throwable); <END> }</code><technical_language>swallow propagate user</technical_language>

Target:
public void onError(Throwable throwable) { errorRate.inc(); aggReadErrors.inc(); if (throwable instanceof ServiceBusException) { ServiceBusException busException = (ServiceBusException) throwable; if (busException.getIsTransient()) { eventHubHandlerError.compareAndSet(null, throwable); renewPartitionReceiver(ssp); return; } } eventHubHandlerError.set(throwable); }
Source:
<code>public void onDoubleTap(@NotNull final MotionEvent event, @NotNull final DisplayPortion portion) { if (DEBUG) { Log.d(TAG, "onDoubleTap called with playerType = [" + playerImpl.getPlayerType() + "], portion = [" + portion + "]"); } if (playerImpl.isSomePopupMenuVisible()) { playerImpl.hideControls(0, 0); } if (portion == DisplayPortion.LEFT) { playerImpl.onFastRewind(); } else if (portion == DisplayPortion.RIGHT) { playerImpl.onFastForward(); <START> } <END> }</code><technical_language>add else if (portion == DisplayPortion.MIDDLE) { playerImpl.onPlayPause(); }, a double tap in middle changes playing state, #2907? do this in a future PR</technical_language>

Target:
public void onDoubleTap(@NotNull final MotionEvent event, @NotNull final DisplayPortion portion) { if (DEBUG) { Log.d(TAG, "onDoubleTap called with playerType = [" + playerImpl.getPlayerType() + "], portion = [" + portion + "]"); } if (playerImpl.isSomePopupMenuVisible()) { playerImpl.hideControls(0, 0); } if (portion == DisplayPortion.LEFT) { playerImpl.onFastRewind(); } else if (portion == DisplayPortion.MIDDLE) { playerImpl.onPlayPause(); } else if (portion == DisplayPortion.RIGHT) { playerImpl.onFastForward(); } }
Source:
<code>public final ClientBuilder ssl(Optional<SslConfiguration> config) { if (config.isPresent()) { verifySslConfigurationUnset(); thisSslSocketFactory = Optional.of(SslSocketFactories.createSslSocketFactory(config.get())); thisTrustManager = Optional.of( <START> (X509TrustManager) SslSocketFactories.createTrustManagers(config.get())[0]); <END> } return this; }</code><technical_language>swap 3 lines for ssl(SslSocketFactories.createSslSocketFactory(config.get()), SslSocketFactories.createTrustManagers(config.get())[0]); reduce duplicated code</technical_language>

Target:
public final ClientBuilder ssl(Optional<SslConfiguration> config) { if (config.isPresent()) { ssl(SslSocketFactories.createSslSocketFactory(config.get()), (X509TrustManager) SslSocketFactories.createTrustManagers(config.get())[0]); } return this; }
Source:
<code>void testGetConfig() throws Exception { <START> ((BrooklynProperties)getManagementContext().getConfig()).addFrom(ImmutableMap.of("foo.bar.baz", "quux")); <END> try { assertEquals(client().resource("/v1/server/getConfig/foo.bar.baz").get(String.class), "quux"); } finally { ((BrooklynProperties)getManagementContext().getConfig()).remove("foo.bar.baz"); } }</code><technical_language>do ((ManagementContextInternal)getManagementContext()).getBrooklynProperties(). effectively thing, cast "internal" version (whereas casting return of a getter guaranteed moving forwards). Also, .put("foo.bar.baz", "quux") needing map</technical_language>

Target:
void testGetConfig() throws Exception { ((ManagementContextInternal)getManagementContext()).getBrooklynProperties().put("foo.bar.baz", "quux"); try { assertEquals(client().resource("/v1/server/config/foo.bar.baz").get(String.class), "quux"); } finally { ((ManagementContextInternal)getManagementContext()).getBrooklynProperties().remove("foo.bar.baz"); } }
Source:
<code>private void AttachDisk_EntityChanged(EventArgs e) { if ((Boolean) getAttachDisk().getEntity()) { AsyncDataProvider.GetAllAttachableDisks(new AsyncQuery(this, new INewAsyncCallback() { @Override public void OnSuccess(Object target, Object returnValue) { DiskModel model = (DiskModel) target; ArrayList<Disk> disks = (ArrayList<Disk>) returnValue; <START> ArrayList<DiskModel> diskModels = Linq.DisksToDiskModelList(disks); <END> model.getInternalAttachableDisks().setItems(Linq.ToEntityModelList( Linq.FilterDisksByType(diskModels, DiskStorageType.IMAGE))); } }), getDatacenterId(), vmId); AsyncDataProvider.GetAllAttachableDisks(new AsyncQuery(this, new INewAsyncCallback() { @Override public void OnSuccess(Object target, Object returnValue) { DiskModel model = (DiskModel) target; ArrayList<Disk> disks = (ArrayList<Disk>) returnValue; Linq.Sort(disks, new Linq.DiskByAliasComparer()); ArrayList<DiskModel> diskModels = Linq.DisksToDiskModelList(disks); model.getExternalAttachableDisks().setItems(Linq.ToEntityModelList( Linq.FilterDisksByType(diskModels, DiskStorageType.LUN))); } }), null, vmId); } }</code><technical_language>For symmetrical purposes, sort internal disks list well</technical_language>

Target:
private void AttachDisk_EntityChanged(EventArgs e) { if ((Boolean) getAttachDisk().getEntity()) { AsyncDataProvider.GetAllAttachableDisks(new AsyncQuery(this, new INewAsyncCallback() { @Override public void OnSuccess(Object target, Object returnValue) { DiskModel model = (DiskModel) target; ArrayList<Disk> disks = (ArrayList<Disk>) returnValue; Linq.Sort(disks, new Linq.DiskByAliasComparer()); ArrayList<DiskModel> diskModels = Linq.DisksToDiskModelList(disks); model.getInternalAttachableDisks().setItems(Linq.ToEntityModelList( Linq.FilterDisksByType(diskModels, DiskStorageType.IMAGE))); } }), getDatacenterId(), vmId); AsyncDataProvider.GetAllAttachableDisks(new AsyncQuery(this, new INewAsyncCallback() { @Override public void OnSuccess(Object target, Object returnValue) { DiskModel model = (DiskModel) target; ArrayList<Disk> disks = (ArrayList<Disk>) returnValue; Linq.Sort(disks, new Linq.DiskByAliasComparer()); ArrayList<DiskModel> diskModels = Linq.DisksToDiskModelList(disks); model.getExternalAttachableDisks().setItems(Linq.ToEntityModelList( Linq.FilterDisksByType(diskModels, DiskStorageType.LUN))); } }), null, vmId); } }
Source:
<code>public Optional<AggregateStateRecord> read(I aggregateId) { checkNotClosed(); checkNotNull(aggregateId); final Deque<Event> history = newLinkedList(); Snapshot snapshot = null; final Iterator<AggregateEventRecord> historyBackward = historyBackward(aggregateId); while (historyBackward.hasNext() && snapshot == null) { final AggregateEventRecord record = historyBackward.next(); switch (record.getKindCase()) { case EVENT: history.addFirst(record.getEvent()); break; case SNAPSHOT: snapshot = record.getSnapshot(); break; case KIND_NOT_SET: default: throw newIllegalStateException("Event or snapshot missing in record: \"%s\"", shortDebugString(record)); } } <START> if (snapshot == null && history.isEmpty()) { <END> return Optional.absent(); } final AggregateStateRecord.Builder builder = AggregateStateRecord.newBuilder(); if (snapshot != null) { builder.setSnapshot(snapshot); } builder.addAllEvent(history); return Optional.of(builder.build()); }</code><technical_language>This iterating historyBackward</technical_language>

Target:
public Optional<AggregateStateRecord> read(I aggregateId) { checkNotClosed(); checkNotNull(aggregateId); final Deque<Event> history = newLinkedList(); Snapshot snapshot = null; final Iterator<AggregateEventRecord> historyBackward = historyBackward(aggregateId); if (!historyBackward.hasNext()) { return Optional.absent(); } while (historyBackward.hasNext() && snapshot == null) { final AggregateEventRecord record = historyBackward.next(); switch (record.getKindCase()) { case EVENT: history.addFirst(record.getEvent()); break; case SNAPSHOT: snapshot = record.getSnapshot(); break; case KIND_NOT_SET: default: throw newIllegalStateException("Event or snapshot missing in record: \"%s\"", shortDebugString(record)); } } final AggregateStateRecord.Builder builder = AggregateStateRecord.newBuilder(); if (snapshot != null) { builder.setSnapshot(snapshot); } builder.addAllEvent(history); return Optional.of(builder.build()); }
Source:
<code>public void checkRetransmissionForForking(SIPResponse response) { final int statusCode = response.getStatusCode(); final String responseMethod = response.getCSeqHeader().getMethod(); final long responseCSeqNumber = response.getCSeq().getSeqNumber(); RSeq rseq = (RSeq) response.getHeader(RSeqHeader.NAME); String responseRSeqNumber = ""; if(rseq != null) { responseRSeqNumber = "/" + rseq.getSeqNumber(); } <START> boolean isRetransmission = !responsesReceivedInForkingCase.add(statusCode + "/" + responseCSeqNumber + "/" + responseMethod + responseRSeqNumber); <END> response.setRetransmission(isRetransmission); if (logger.isLoggingEnabled(LogWriter.TRACE_DEBUG)) { logger.logDebug( "marking response as retransmission " + isRetransmission + " for dialog " + this); } }</code><technical_language>I assume if RSeq header is present, logic remains previously,right? tested this somehow? possibility provide automated junit test? Ideally logic targeted for prov resps (1XX) enabled form stack conf flag..</technical_language>

Target:
public void checkRetransmissionForForking(SIPResponse response) { final int statusCode = response.getStatusCode(); final String responseMethod = response.getCSeqHeader().getMethod(); final long responseCSeqNumber = response.getCSeq().getSeqNumber(); RSeq rseq = (RSeq) response.getHeader(RSeqHeader.NAME); String retransCondition =(statusCode + "/" + responseCSeqNumber + "/" + responseMethod); if(rseq != null) { retransCondition = retransCondition + "/" + rseq.getSeqNumber(); } boolean isRetransmission = !responsesReceivedInForkingCase.add(retransCondition); response.setRetransmission(isRetransmission); if (logger.isLoggingEnabled(LogWriter.TRACE_DEBUG)) { logger.logDebug( "marking response as retransmission " + isRetransmission + " for dialog " + this); } }
Source:
<code>public List<MeasurementData> getNonTrialDataList(List<String> trialHeaders) { List<MeasurementData> list = new ArrayList<MeasurementData>(); if (this.dataList != null && !this.dataList.isEmpty()) { for (MeasurementData data : this.dataList) { <START> boolean nonexistentTermId = data.getMeasurementVariable().getTermId() == TermId.SAMPLES.getId(); <END> if ( (trialHeaders == null || !trialHeaders.contains(data.getLabel()) ) && !nonexistentTermId) { list.add(data); } } return list; } return list; }</code><technical_language>rename variable, camelCase</technical_language>

Target:
public List<MeasurementData> getNonTrialDataList(List<String> trialHeaders) { final List<MeasurementData> list = new ArrayList<>(); if (this.dataList != null && !this.dataList.isEmpty()) { for (MeasurementData data : this.dataList) { boolean isSampleVaraible = data.getMeasurementVariable().getTermId() == TermId.SAMPLES.getId(); if ( (trialHeaders == null || !trialHeaders.contains(data.getLabel()) ) && !isSampleVaraible) { list.add(data); } } return list; } return list; }
Source:
<code><START> private Now(A a) { <END> this.a = a; }</code><technical_language>constructor package private instead of private avoid a generated synthetic constructor</technical_language>

Target:
Now(A a) { this.a = a; }
Source:
<code>public void testColonInComment() { <START> String sql = " select 1"; <END> assertThat(render(sql)).isEqualTo(sql); }</code><technical_language>add a valid :abc parameter in too, invalid bait</technical_language>

Target:
public void testColonInComment() { String sql = " select :abc"; assertThat(render(sql)).isEqualTo(sql); }
Source:
<code>RawBsonDocument mark(final String databaseName, final RawBsonDocument command) { spawnIfNecesary(); try { try { <START> System.out.println(command); <END> return executeCommand(databaseName, command); } catch (MongoTimeoutException e) { spawnIfNecesary(); return executeCommand(databaseName, command); } } catch (MongoException e) { throw wrapInClientException(e); } }</code><technical_language>Ditch debugging :)</technical_language>

Target:
RawBsonDocument mark(final String databaseName, final RawBsonDocument command) { spawnIfNecesary(); try { try { return executeCommand(databaseName, command); } catch (MongoTimeoutException e) { spawnIfNecesary(); return executeCommand(databaseName, command); } } catch (MongoException e) { throw wrapInClientException(e); } }
Source:
<code>public static void compareFiles(final File actualFile, final File testFile) { Scanner actual = null; Scanner expected = null; try { expected = new Scanner(testFile); actual = new Scanner(actualFile); final SortedSet<String> expectedSet = asSet(expected); final SortedSet<String> actualSet = asSet(actual); assertSetSize(expectedSet, actualSet); assertSetElements(expectedSet, actualSet); Assert.assertEquals(expectedSet, actualSet); } catch (IOException e) { LOG.error(e.getMessage(), e); } finally { if (actual != null) { actual.close(); } if (expected != null) { expected.close(); <START> } <END> } actualFile.deleteOnExit(); }</code><technical_language>try-with-resource instead of closing manually</technical_language>

Target:
public static void compareFiles(final File actualFile, final File testFile) { Scanner actual = null; Scanner expected = null; try { expected = new Scanner(testFile); actual = new Scanner(actualFile); final SortedSet<String> expectedSet = asSet(expected); final SortedSet<String> actualSet = asSet(actual); assertSetSize(expectedSet, actualSet); assertSetElements(expectedSet, actualSet); } catch (IOException e) { LOG.error(e.getMessage(), e); } finally { if (actual != null) { actual.close(); } if (expected != null) { expected.close(); } } actualFile.deleteOnExit(); }
Source:
<code>public PlanNode visitAggregation(AggregationNode node, RewriteContext<Set<Symbol>> context) { ImmutableSet.Builder<Symbol> expectedInputs = ImmutableSet.<Symbol>builder() .addAll(node.getGroupingKeys()); if (node.getHashSymbol().isPresent()) { expectedInputs.add(node.getHashSymbol().get()); } ImmutableMap.Builder<Symbol, Aggregation> aggregations = ImmutableMap.builder(); for (Map.Entry<Symbol, Aggregation> entry : node.getAggregations().entrySet()) { Symbol symbol = entry.getKey(); if (context.get().contains(symbol)) { Aggregation aggregation = entry.getValue(); FunctionCall call = aggregation.getCall(); expectedInputs.addAll(SymbolsExtractor.extractUnique(call)); <START> aggregation.getMask().ifPresent(expectedInputs::add); <END> aggregations.put(symbol, aggregation); } } PlanNode source = context.rewrite(node.getSource(), expectedInputs.build()); return new AggregationNode(node.getId(), source, aggregations.build(), node.getGroupingSets(), node.getStep(), node.getHashSymbol(), node.getGroupIdSymbol()); }</code><technical_language>inline call variable</technical_language>

Target:
public PlanNode visitAggregation(AggregationNode node, RewriteContext<Set<Symbol>> context) { ImmutableSet.Builder<Symbol> expectedInputs = ImmutableSet.<Symbol>builder() .addAll(node.getGroupingKeys()); if (node.getHashSymbol().isPresent()) { expectedInputs.add(node.getHashSymbol().get()); } ImmutableMap.Builder<Symbol, Aggregation> aggregations = ImmutableMap.builder(); for (Map.Entry<Symbol, Aggregation> entry : node.getAggregations().entrySet()) { Symbol symbol = entry.getKey(); if (context.get().contains(symbol)) { Aggregation aggregation = entry.getValue(); expectedInputs.addAll(SymbolsExtractor.extractUnique(aggregation.getCall())); aggregation.getMask().ifPresent(expectedInputs::add); aggregations.put(symbol, aggregation); } } PlanNode source = context.rewrite(node.getSource(), expectedInputs.build()); return new AggregationNode(node.getId(), source, aggregations.build(), node.getGroupingSets(), node.getStep(), node.getHashSymbol(), node.getGroupIdSymbol()); }
Source:
<code>public void showAllSurvey(final List<Survey> surveys) { if (surveys.size() == 0) { <START> TextView surveySelectText = (TextView) rootView.findViewById(R.id.tv_survey_name); <END> surveySelectText.setText("No Survey Available for this client"); } SurveyListAdapter surveyListAdapter = new SurveyListAdapter(getActivity(), surveys); lv_surveys_list.setAdapter(surveyListAdapter); lv_surveys_list.setOnItemClickListener(new AdapterView.OnItemClickListener() { @Override public void onItemClick(AdapterView<?> adapterView, View view, int position, long l) { mListener.loadSurveyQuestion(surveys.get(position), clientId); } }); }</code><technical_language>@mayank-kgp, butter knife for View injection</technical_language>

Target:
public void showAllSurvey(final List<Survey> surveys) { SurveyListAdapter surveyListAdapter = new SurveyListAdapter(getActivity(), surveys); lv_surveys_list.setAdapter(surveyListAdapter); lv_surveys_list.setOnItemClickListener(new AdapterView.OnItemClickListener() { @Override public void onItemClick(AdapterView<?> adapterView, View view, int position, long l) { mListener.loadSurveyQuestion(surveys.get(position), clientId); } }); }
Source:
<code>public TrackingToken createTokenAt(Instant dateTime) { <START> String sql = "SELECT max(" + schema.globalIndexColumn() + ") FROM " + schema.domainEventTable() + " WHERE " <END> + schema.timestampColumn() + " < ?"; Long index = transactionManager.fetchInTransaction( () -> executeQuery(getConnection(), connection -> { PreparedStatement stmt = connection.prepareStatement(sql); stmt.setString(1, formatInstant(dateTime)); return stmt; }, resultSet -> resultSet.next() ? resultSet.getObject(1, Long.class) : null, e -> new EventStoreException(format("Failed to get token at [%s]", dateTime)))); if (index == null) { return null; } return GapAwareTrackingToken.newInstance(index, Collections.emptySet()); }</code><technical_language>This query match requirement. This method return a token give events a timestamp dateTime. This _may_ events in a timestamp, creation publication order identical. query SELECT min(...) - 1 ... timestamp >= dateTime</technical_language>

Target:
public TrackingToken createTokenAt(Instant dateTime) { String sql = "SELECT min(" + schema.globalIndexColumn() + ") - 1 FROM " + schema.domainEventTable() + " WHERE " + schema.timestampColumn() + " >= ?"; Long index = transactionManager.fetchInTransaction( () -> executeQuery(getConnection(), connection -> { PreparedStatement stmt = connection.prepareStatement(sql); stmt.setString(1, formatInstant(dateTime)); return stmt; }, resultSet -> nextAndExtract(resultSet, 1, Long.class), e -> new EventStoreException(format("Failed to get token at [%s]", dateTime)))); if (index == null) { return null; } return GapAwareTrackingToken.newInstance(index, Collections.emptySet()); }