auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public JAXBElement<?> get() { JAXBElement<?> reduced = super.get(); notNull(distance); if (!DistanceBufferType.class.equals(reduced.getDeclaredType()) || !(reduced.getValue() instanceof DistanceBufferType)) { throw new FilterProcessingException( "Incorrect use of DistanceBufferSupplier for given type " + reduced.toString()); } DistanceBufferType value = (DistanceBufferType) reduced.getValue(); value.setDistance(new MeasureType().withUom("m").withValue(distance)); return reduced; }

Target:
public JAXBElement<?> get() { JAXBElement<?> reduced = super.get(); notNull(distance, "The Distance element cannot be created without a distance value"); if (!DistanceBufferType.class.equals(reduced.getDeclaredType()) || !(reduced.getValue() instanceof DistanceBufferType)) { throw new FilterProcessingException( "Incorrect use of DistanceBufferSupplier for given type " + reduced.toString()); } DistanceBufferType value = (DistanceBufferType) reduced.getValue(); value.setDistance(new MeasureType().withUom(UOM_METERS).withValue(distance)); return reduced; }
Source:
public void load() throws TableNotFoundException, IOException, AccumuloException, AccumuloSecurityException { Table.ID tableId = Tables.getTableId(context.getInstance(), tableName); Map<String,String> props = context.getConnector().instanceOperations().getSystemConfiguration(); AccumuloConfiguration conf = new ConfigurationCopy(props); FileSystem fs = VolumeConfiguration.getVolume(dir, CachedConfiguration.getInstance(), conf) .getFileSystem(); Path srcPath = checkPath(fs, dir); Executor executor; ExecutorService service = null; if (this.executor != null) { executor = this.executor; } else if (numThreads > 0) { executor = service = Executors.newFixedThreadPool(numThreads); } else { String threads = context.getConfiguration().get(ClientProperty.BULK_LOAD_THREADS.getKey()); if (threads == null) { threads = ClientProperty.BULK_LOAD_THREADS.getDefaultValue(); } int nThreads; if (threads.toUpperCase().endsWith("C")) { nThreads = Runtime.getRuntime().availableProcessors() * Integer.parseInt(threads.substring(0, threads.length() - 1)); } else { nThreads = Integer.parseInt(threads); } executor = service = Executors.newFixedThreadPool(nThreads); } try { SortedMap<KeyExtent,Bulk.Files> mappings = computeFileToTabletMappings(fs, tableId, srcPath, executor, context); BulkSerialize.writeLoadMapping(mappings, srcPath.toString(), p -> fs.create(p)); List<ByteBuffer> args = Arrays.asList(ByteBuffer.wrap(tableName.getBytes(UTF_8)), ByteBuffer.wrap(srcPath.toString().getBytes(UTF_8)), ByteBuffer.wrap((setTime + "").getBytes(UTF_8))); doFateOperation(FateOperation.TABLE_BULK_IMPORT2, args, Collections.emptyMap(), tableName); } finally { if (service != null) { service.shutdown(); } } }

Target:
public void load() throws TableNotFoundException, IOException, AccumuloException, AccumuloSecurityException { Table.ID tableId = Tables.getTableId(context.getInstance(), tableName); Map<String,String> props = context.getConnector().instanceOperations().getSystemConfiguration(); AccumuloConfiguration conf = new ConfigurationCopy(props); FileSystem fs = VolumeConfiguration.getVolume(dir, CachedConfiguration.getInstance(), conf) .getFileSystem(); Path srcPath = checkPath(fs, dir); Executor executor; ExecutorService service = null; if (this.executor != null) { executor = this.executor; } else if (numThreads > 0) { executor = service = Executors.newFixedThreadPool(numThreads); } else { String threads = context.getConfiguration().get(ClientProperty.BULK_LOAD_THREADS.getKey()); executor = service = Executors .newFixedThreadPool(ConfigurationTypeHelper.getNumThreads(threads)); } try { SortedMap<KeyExtent,Bulk.Files> mappings = computeFileToTabletMappings(fs, tableId, srcPath, executor, context); BulkSerialize.writeLoadMapping(mappings, srcPath.toString(), p -> fs.create(p)); List<ByteBuffer> args = Arrays.asList(ByteBuffer.wrap(tableId.getUtf8()), ByteBuffer.wrap(srcPath.toString().getBytes(UTF_8)), ByteBuffer.wrap((setTime + "").getBytes(UTF_8))); doFateOperation(FateOperation.TABLE_BULK_IMPORT2, args, Collections.emptyMap(), tableName); } finally { if (service != null) { service.shutdown(); } } }
Source:
protected void clearContent() { setStartTime(0); setEndTime(0); getSwtChart().getAxisSet().getXAxis(0).getTick().setFormat(null); super.clearContent(); }

Target:
protected void clearContent() { getSwtChart().getAxisSet().getXAxis(0).getTick().setFormat(null); super.clearContent(); }
Source:
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; if (this.request != null && this.request.getHeaders() != null) { String continuationToken = this.request.getHeaders().get(HttpConstants.HttpHeaders.CONTINUATION); if (!StringUtils.isBlank(continuationToken)) { this.continuation = continuationToken; } } }

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:
public boolean isAcceptResumed() { return handle.isResumed(SelectionKey.OP_ACCEPT) || suspendedDueToWatermark; }

Target:
public boolean isAcceptResumed() { return !suspended; }
Source:
private void loadCommit(final RevisionInfo rev, CallbackGroup group) { if (rev.is_edit()) { return; } RestApi call = ChangeApi.revision(changeId.get(), rev.name()).view("commit"); ChangeList.addWebLinksOption(call); call.get(group.add(new AsyncCallback<CommitInfo>() { @Override public void onSuccess(CommitInfo info) { rev.set_commit(info); } @Override public void onFailure(Throwable caught) { } })); }

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:
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()); position.set("out_of_range", parser.nextInt()); position.set("currier", parser.next()); return position; }

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:
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; }

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:
public void getPhotonImageUrlIsEmptyWhenUrlIsNull() { String photonUrl = PhotonUtils.getPhotonImageUrl(null, 0, 1); assertEquals("", photonUrl); }

Target:
public void getPhotonImageUrlIsEmptyWhenUrlIsNull() { String photonUrl = PhotonUtils.getPhotonImageUrl(null, 0, 1); assertThat(photonUrl, equalTo("")); }
Source:
private void setClanTag(String clanTag) { if (!chatUser.getPlayer().isPresent() || clanTag == null || clanTag.isEmpty()) { clanMenu.setVisible(false); return; } clanMenu.setText(String.format("[%s]", clanTag)); clanMenu.setVisible(true); updateClanMenu(); }

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:
public StripedExchangeJob(Exchange exchange) { this.exchange = exchange; this.caller = new Throwable(exchange + " stripe caller"); }

Target:
public StripedExchangeJob(Exchange exchange) { this.exchange = exchange; if (Exchange.DEBUG) { this.caller = new Throwable(exchange + " stripe caller"); } else { this.caller = null; } }
Source:
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) LOG.info("Ignored request to resize replica set to because larger than max size of {}", getReplicaSetName(), MAX_MEMBERS); return getCurrentSize(); }

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:
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.")); } 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; }

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:
private String generatePassword() { String allowedChars = "abcdefghijklmnopqrstuvwxyz0123456789"; int charRange = allowedChars.length(); Random random = new Random(); StringBuilder password = new StringBuilder(); int passwordLength = 10; for ( int i = 0; i < passwordLength; i++ ) { password.append( allowedChars.charAt( random.nextInt( charRange ) ) ); } return password.toString(); }

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:
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++){ if (language.equals(Constants.languagelistNotDefault[i])){ temp.setParent(Constants.languageCategoryNotDefault[i]); temp.setStatus(Constants.languagelistNotDefault[i]); } } executeAddTask(temp); } else { Toast.makeText(this, "Empty Input", Toast.LENGTH_LONG).show(); } }

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:
public static SCMHead readResolveSCMHead(@NonNull SCMSource source, @NonNull SCMHead head) { for (SCMHeadMigration m : ExtensionList.lookup(SCMHeadMigration.class)) { if (m.sourceClass.equals(source.getClass()) && m.headClass.equals(head.getClass())) { SCMHead migrated = m.migrate(source, head); if (migrated != null) { return migrated; } } } return head; }

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:
public void startBackgroundTasks() { scheduler.schedule(ingestTask(soccerFetcher()).withName("Opta Football Events Updater"), RepetitionRules.NEVER); scheduler.schedule(ingestTask(sportsFetcher()).withName("Opta (Non Football) Sports Events Updater"), RepetitionRules.NEVER); }

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:
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()); } for (Map.Entry<String, String> entry : m_parameters.entrySet()) { result.put(entry.getKey(), entry.getValue()); } return result; }

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:
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)); }

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:
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), 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); }

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:
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; exactColumnSizes = new ArrayList<>(Collections.nCopies(valueSizeHints.size(), 0)); } } 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; }

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:
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); return linkedContact; }

Target:
public static LinkedContact linkContact(String companyId, String contactId) throws OnePageException { return linkContact(companyId, contactId, null); }
Source:
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); assertThat(error).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.")); }

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:
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); ITmfStateValue lowestMemoryValue = ss.queryOngoingState(lowestMemoryQuark); long previousLowest = lowestMemoryValue.isNull() ? 0 : lowestMemoryValue.unboxLong(); if (previousLowest > currentMemoryValue) { ss.modifyAttribute(ts, TmfStateValue.newValueLong(currentMemoryValue), lowestMemoryQuark); } }

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:
public void transferMemoryToTaskContext(long taskBytes) { long bytes = operatorMemoryContext.getUserMemory(); LocalMemoryContext taskLocalMemoryContext = driverContext.getPipelineContext().getTaskContext().localUserMemoryContext(); try { operatorMemoryContext.localUserMemoryContext().transferOwnership(taskLocalMemoryContext); taskLocalMemoryContext.addBytes(taskBytes - bytes); } catch (ExceededMemoryLimitException e) { taskLocalMemoryContext.addBytes(-bytes); throw e; } }

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:
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(); if (!authorizeService.isAdmin(context) && !authorizeService.authorizeActionBoolean(context, collection, 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); } }

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:
public void onError(Throwable throwable) { errors.inc(); aggReadErrors.inc(); LOG.error(String.format("Received error from event hub connection (ssp=%s): ", ssp), throwable); }

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:
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(); } }

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:
public final ClientBuilder ssl(Optional<SslConfiguration> config) { if (config.isPresent()) { verifySslConfigurationUnset(); thisSslSocketFactory = Optional.of(SslSocketFactories.createSslSocketFactory(config.get())); thisTrustManager = Optional.of( (X509TrustManager) SslSocketFactories.createTrustManagers(config.get())[0]); } return this; }

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:
void testGetConfig() throws Exception { ((BrooklynProperties)getManagementContext().getConfig()).addFrom(ImmutableMap.of("foo.bar.baz", "quux")); try { assertEquals(client().resource("/v1/server/getConfig/foo.bar.baz").get(String.class), "quux"); } finally { ((BrooklynProperties)getManagementContext().getConfig()).remove("foo.bar.baz"); } }

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:
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; 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); } }

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:
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)); } } if (snapshot == null && history.isEmpty()) { return Optional.absent(); } final AggregateStateRecord.Builder builder = AggregateStateRecord.newBuilder(); if (snapshot != null) { builder.setSnapshot(snapshot); } builder.addAllEvent(history); return Optional.of(builder.build()); }

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:
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(); } boolean isRetransmission = !responsesReceivedInForkingCase.add(statusCode + "/" + responseCSeqNumber + "/" + responseMethod + responseRSeqNumber); response.setRetransmission(isRetransmission); if (logger.isLoggingEnabled(LogWriter.TRACE_DEBUG)) { logger.logDebug( "marking response as retransmission " + isRetransmission + " for dialog " + this); } }

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:
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) { boolean nonexistentTermId = data.getMeasurementVariable().getTermId() == TermId.SAMPLES.getId(); if ( (trialHeaders == null || !trialHeaders.contains(data.getLabel()) ) && !nonexistentTermId) { list.add(data); } } return list; } return list; }

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:
private Now(A a) { this.a = a; }

Target:
Now(A a) { this.a = a; }
Source:
public void testColonInComment() { String sql = " select 1"; assertThat(render(sql)).isEqualTo(sql); }

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

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:
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(); } } actualFile.deleteOnExit(); }

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:
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)); 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()); }

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:
public void showAllSurvey(final List<Survey> surveys) { if (surveys.size() == 0) { TextView surveySelectText = (TextView) rootView.findViewById(R.id.tv_survey_name); 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); } }); }

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:
public TrackingToken createTokenAt(Instant dateTime) { String sql = "SELECT max(" + schema.globalIndexColumn() + ") 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 -> 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()); }

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()); }
Source:
private boolean possiblyStopAndRemoveSupervisorInternal(String id, boolean writeTombstone) { Pair<Supervisor, SupervisorSpec> pair = supervisors.get(id); if (pair != null) { if (writeTombstone) { metadataSupervisorManager.insert(id, new NoopSupervisorSpec()); } pair.lhs.stop(true); supervisors.remove(id); return true; } return false; }

Target:
private boolean possiblyStopAndRemoveSupervisorInternal(String id, boolean writeTombstone) { Pair<Supervisor, SupervisorSpec> pair = supervisors.get(id); if (pair == null) { return false; } if (writeTombstone) { metadataSupervisorManager.insert(id, new NoopSupervisorSpec()); } pair.lhs.stop(true); supervisors.remove(id); return true; }