auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public void run() { if (!immediateShutdown) { try { LOG.info("Sleeping for 5 seconds before shutting down"); Thread.sleep(5000); } catch (InterruptedException e) { e.printStackTrace(); } } try { LOG.info("Calling stop for all the services"); stop(); <START> synchronized (shutdownHandlerLock) { <END> shutdownHandlerRunning.set(false); shutdownHandlerLock.notify(); } LOG.info("Exiting DAGAppMaster..GoodBye!"); sysexit(); } catch (Throwable t) { LOG.warn("Graceful stop failed ", t); } }</code><technical_language>object</technical_language>

Target:
public void run() { if (!immediateShutdown) { try { LOG.info("Sleeping for 5 seconds before shutting down"); Thread.sleep(5000); } catch (InterruptedException e) { e.printStackTrace(); } } try { LOG.info("Calling stop for all the services"); stop(); synchronized (shutdownHandlerRunning) { shutdownHandlerRunning.set(false); shutdownHandlerRunning.notify(); } LOG.info("Exiting DAGAppMaster..GoodBye!"); sysexit(); } catch (Throwable t) { LOG.warn("Graceful stop failed ", t); } }
Source:
<code>public void run(String realfile, String host, int port, boolean debug2, List<String> tests) throws MalformedURLException, URISyntaxException { debug = debug2; <START> String file = "reactivesocket-tck-drivers/src/main/test/resources/client$.txt"; <END> if (realfile != null) file = realfile; try { setURI(new URI("tcp://" + host + ":" + port + "/rs")); JavaClientDriver jd = new JavaClientDriver(file, JavaTCPClient::createClient, tests); jd.runTests(); } catch (Exception e) { e.printStackTrace(); } }</code><technical_language>this path is wrong</technical_language>

Target:
public void run(String realfile, String host, int port, boolean debug2, List<String> tests) throws MalformedURLException, URISyntaxException { debug = debug2; String file = "reactivesocket-tck-drivers/src/test/resources/client$.txt"; if (realfile != null) file = realfile; try { setURI(new URI("tcp://" + host + ":" + port + "/rs")); JavaClientDriver jd = new JavaClientDriver(file, JavaTCPClient::createClient, tests); jd.runTests(); } catch (Exception e) { e.printStackTrace(); } }
Source:
<code>private Frame loadFrame(String chapterSlug, String frameSlug) { <START> String complexSlug = chapterSlug + "-" + frameSlug; <END> Frame frame = mLibrary.getFrame(mSourceTranslation, chapterSlug, frameSlug); return frame; }</code><technical_language>complexSlug is in this context</technical_language>

Target:
private Frame loadFrame(String chapterSlug, String frameSlug) { Frame frame = mLibrary.getFrame(mSourceTranslation, chapterSlug, frameSlug); return frame; }
Source:
<code>public void compute( final IterableInterval< T > input, final Img< DoubleType > output ) { final int numDimensions = input.numDimensions(); if ( input.numDimensions() != 2 ) { throw new IllegalArgumentException( <START> "Cannot compute Hough circle transform for non-2D images. Got " + numDimensions + "D image." ); } <END> maxRadius = Math.max( minRadius, maxRadius ); minRadius = Math.min( minRadius, maxRadius ); final long nRadiuses = ( maxRadius - minRadius ) / stepRadius + 1; final DoubleType weight = new DoubleType( Double.NaN ); final RandomAccess< R > raWeight = weights.randomAccess( input ); final double sum = ops().stats().sum( input ).getRealDouble(); int progress = 0; final Cursor< T > cursor = input.localizingCursor(); while ( cursor.hasNext() ) { cursor.fwd(); if ( !cursor.get().get() ) continue; raWeight.setPosition( cursor ); weight.set( raWeight.get().getRealDouble() ); for ( int i = 0; i < nRadiuses; i++ ) { final IntervalView< DoubleType > slice = Views.hyperSlice( output, numDimensions, i ); final long r = minRadius + i * stepRadius; MidPointAlgorithm.add( Views.extendZero( slice ), cursor, r, weight ); } statusService.showProgress( ++progress, ( int ) sum ); } }</code><technical_language>above, Contingent usage</technical_language>

Target:
public void compute(final IterableInterval<T> input, final Img<DoubleType> output) { final long maxR = Math.max(minRadius, maxRadius); final long minR = Math.min(minRadius, maxRadius); maxRadius = maxR; minRadius = minR; final long nRadiuses = (maxRadius - minRadius) / stepRadius + 1; final DoubleType weight = new DoubleType(Double.NaN); final RandomAccess<R> raWeight = weights.randomAccess(input); final double sum = ops().stats().sum(input).getRealDouble(); int progress = 0; final Cursor<T> cursor = input.localizingCursor(); while (cursor.hasNext()) { cursor.fwd(); if (!cursor.get().get()) continue; raWeight.setPosition(cursor); weight.set(raWeight.get().getRealDouble()); for (int i = 0; i < nRadiuses; i++) { final IntervalView<DoubleType> slice = Views.hyperSlice(output, input .numDimensions(), i); final long r = minRadius + i * stepRadius; MidPointAlgorithm.add(Views.extendZero(slice), cursor, r, weight); } statusService.showProgress(++progress, (int) sum); } }
Source:
<code>public FunctionInvoker(MethodHandle methodHandle) { <START> this.methodHandle = requireNonNull(methodHandle, "Method handle is null"); <END> }</code><technical_language>"methodHandle is null"</technical_language>

Target:
public FunctionInvoker(MethodHandle methodHandle) { this.methodHandle = requireNonNull(methodHandle, "methodHandle is null"); }
Source:
<code>public void testLoadDataObjectsWithNullWorkspaceProject() { <START> assertTrue(dataObjectsService.loadDataObjects(null).isEmpty()); <END> }</code><technical_language>Please assertj assertion. In case of fail error message explaining list sizes. Current implementation print assertion error, expected true false reference list size</technical_language>

Target:
public void testLoadDataObjectsWithNullWorkspaceProject() { assertThat(dataObjectsService.loadDataObjects(null)).isEmpty(); }
Source:
<code>public void setEnabled(ThingUID thingUID, boolean enabled) { Thing thing = getThing(thingUID); if (enabled) { logger.debug("Thing will be enabled.", thing.getUID().getAsString()); if (storage != null) { storage.remove(thingUID.getAsString()); } setThingStatus(thing, buildStatusInfo(ThingStatus.UNINITIALIZED, ThingStatusDetail.NONE)); registerAndInitializeHandler(thing, findThingHandlerFactory(thing.getThingTypeUID())); } else { logger.debug("Thing will be disabled.", thing.getUID().getAsString()); if (storage != null) { storage.put(thingUID.getAsString(), enabled); } <START> setThingStatus(thing, buildStatusInfo(ThingStatus.UNINITIALIZED, ThingStatusDetail.DISABLED)); <END> unregisterAndDisposeHandler(findThingHandlerFactory(thing.getThingTypeUID()), thing, thing.getHandler()); } }</code><technical_language>this done <LINK_0>, a duplicate call</technical_language>

Target:
public void setEnabled(ThingUID thingUID, boolean enabled) { Thing thing = getThing(thingUID); if (enabled) { if (storage != null) { storage.remove(thingUID.getAsString()); } if (thing.getStatus().equals(ThingStatus.ONLINE)) { logger.debug("Thing is already in the required state.", thingUID); return; } logger.debug("Thing will be enabled.", thingUID); if (isHandlerRegistered(thing)) { initializeHandler(thing); } else { registerAndInitializeHandler(thing, findThingHandlerFactory(thing.getThingTypeUID())); } } else { if (storage != null) { storage.put(thingUID.getAsString(), enabled); } if (!thing.isEnabled()) { logger.debug("Thing is already in the required state.", thingUID); return; } logger.debug("Thing will be disabled.", thingUID); if (isHandlerRegistered(thing)) { ThingHandlerFactory thingHandlerFactory = findThingHandlerFactory(thing.getThingTypeUID()); unregisterAndDisposeHandler(thingHandlerFactory, thing, thing.getHandler()); } else { setThingStatus(thing, buildStatusInfo(ThingStatus.UNINITIALIZED, ThingStatusDetail.DISABLED)); } } }
Source:
<code>private void putLabelType(Map<String, LabelType> types, LabelType type) { LabelType old = types.get(type.getName()); <START> if (old == null || !old.canOverride()) { <END> types.put(type.getName(), type); } }</code><technical_language>remove</technical_language>

Target:
private void putLabelType(Map<String, LabelType> types, LabelType type) { LabelType old = types.get(type.getName()); if (old == null || old.canOverride()) { types.put(type.getName(), type); } }
Source:
<code>public void start(Stage primaryStage) throws <START> IOException <END> { Constants.stage = primaryStage; Constants.stage.setTitle("Bulls & Cows"); Constants.stage.setResizable(false); Pane mainPane = new Pane(); mainPane.setPrefSize(Constants.ScreenHeight, Constants.ScreenWidht); InputStream is = Files.newInputStream(Paths.get("resourses/image/Background.png")); Image image = new Image(is); is.close(); ImageView imageView = new ImageView(image); Constants.imageView = imageView; imageView.setFitWidth(Constants.ImageWidth); imageView.setFitHeight(Constants.ImageHeight); GameMenu gameMenu = new GameMenu(); mainPane.getChildren().addAll(imageView, gameMenu); Scene mainScene = new Scene(mainPane); Constants.stage.setScene(mainScene); Constants.stage.show(); }</code><technical_language>implements Constants</technical_language>

Target:
public void start(Stage primaryStage) throws IOException { GlobalVariables.stage = primaryStage; GlobalVariables.stage.setTitle("Bulls & Cows"); GlobalVariables.stage.setResizable(false); Pane mainPane = new Pane(); mainPane.setPrefSize(SCREEN_HEIGHT, SCREEN_WIDTH); InputStream is = Files.newInputStream(Paths.get("resourses/image/Background.png")); Image image = new Image(is); is.close(); ImageView imageView = new ImageView(image); GlobalVariables.imageView = imageView; imageView.setFitWidth(IMAGE_WIDTH); imageView.setFitHeight(IMAGE_HEIGHT); GameMenu gameMenu = new GameMenu(); mainPane.getChildren().addAll(imageView, gameMenu); Scene mainScene = new Scene(mainPane); GlobalVariables.stage.setScene(mainScene); GlobalVariables.stage.show(); }
Source:
<code>protected Sheet createSheet() { final BlackboardArtifact artifact = getArtifact(); BlackboardArtifact.ARTIFACT_TYPE fromID = BlackboardArtifact.ARTIFACT_TYPE.fromID(artifact.getArtifactTypeID()); if (fromID != TSK_CONTACT) { return super.createSheet(); } Sheet sheet = new Sheet(); <START> List<Tag> tags = getAllTagsFromDatabase(); <END> Sheet.Set sheetSet = sheet.get(Sheet.PROPERTIES); if (sheetSet == null) { sheetSet = Sheet.createPropertiesSet(); sheet.put(sheetSet); } sheetSet.put(new NodeProperty<>("email", Bundle.ContactNode_Email(), "", getAttributeDisplayString(artifact, TSK_EMAIL))); sheetSet.put(new NodeProperty<>("phone", Bundle.ContactNode_Phone(), "", getAttributeDisplayString(artifact, TSK_PHONE_NUMBER))); sheetSet.put(new NodeProperty<>("mobile", Bundle.ContactNode_Mobile_Number(), "", getAttributeDisplayString(artifact, TSK_PHONE_NUMBER_MOBILE))); sheetSet.put(new NodeProperty<>("home", Bundle.ContactNode_Home_Number(), "", getAttributeDisplayString(artifact, TSK_PHONE_NUMBER_HOME))); sheetSet.put(new NodeProperty<>("office", Bundle.ContactNode_Office_Number(), "", getAttributeDisplayString(artifact, TSK_PHONE_NUMBER_OFFICE))); sheetSet.put(new NodeProperty<>("url", Bundle.ContactNode_URL(), "", getAttributeDisplayString(artifact, TSK_URL))); return sheet; }</code><technical_language>unused list of tags constructed</technical_language>

Target:
protected Sheet createSheet() { final BlackboardArtifact artifact = getArtifact(); BlackboardArtifact.ARTIFACT_TYPE fromID = BlackboardArtifact.ARTIFACT_TYPE.fromID(artifact.getArtifactTypeID()); if (fromID != TSK_CONTACT) { return super.createSheet(); } Sheet sheet = new Sheet(); Sheet.Set sheetSet = sheet.get(Sheet.PROPERTIES); if (sheetSet == null) { sheetSet = Sheet.createPropertiesSet(); sheet.put(sheetSet); } sheetSet.put(new NodeProperty<>("email", Bundle.ContactNode_Email(), "", getAttributeDisplayString(artifact, TSK_EMAIL))); sheetSet.put(new NodeProperty<>("phone", Bundle.ContactNode_Phone(), "", getAttributeDisplayString(artifact, TSK_PHONE_NUMBER))); sheetSet.put(new NodeProperty<>("mobile", Bundle.ContactNode_Mobile_Number(), "", getAttributeDisplayString(artifact, TSK_PHONE_NUMBER_MOBILE))); sheetSet.put(new NodeProperty<>("home", Bundle.ContactNode_Home_Number(), "", getAttributeDisplayString(artifact, TSK_PHONE_NUMBER_HOME))); sheetSet.put(new NodeProperty<>("office", Bundle.ContactNode_Office_Number(), "", getAttributeDisplayString(artifact, TSK_PHONE_NUMBER_OFFICE))); sheetSet.put(new NodeProperty<>("url", Bundle.ContactNode_URL(), "", getAttributeDisplayString(artifact, TSK_URL))); return sheet; }
Source:
<code>public boolean onTouchEvent(MotionEvent event) { if (this.implementation.getCurrentForm() == null) { return true; } int[] x = null; int[] y = null; int size = event.getPointerCount(); if (size > 1) { x = new int[size]; y = new int[size]; for (int i = 0; i < size; i++) { x[i] = (int) event.getX(i); y[i] = (int) event.getY(i); } } Component componentAt; if (x == null) { componentAt = safetyGetComponentAt(this.implementation.getCurrentForm(), (int)event.getX(), (int)event.getY()); } else { componentAt = safetyGetComponentAt(this.implementation.getCurrentForm(), (int)x[0], (int)y[0]); } <START> boolean isPeer = (componentAt != null && componentAt instanceof PeerComponent); <END> boolean consumeEvent = !isPeer || cn1GrabbedPointer; switch (event.getAction()) { case MotionEvent.ACTION_DOWN: if (x == null) { this.implementation.pointerPressed((int) event.getX(), (int) event.getY()); } else { this.implementation.pointerPressed(x, y); } if (!isPeer) cn1GrabbedPointer = true; break; case MotionEvent.ACTION_UP: if (x == null) { this.implementation.pointerReleased((int) event.getX(), (int) event.getY()); } else { this.implementation.pointerReleased(x, y); } cn1GrabbedPointer = false; break; case MotionEvent.ACTION_CANCEL: cn1GrabbedPointer = false; break; case MotionEvent.ACTION_MOVE: if (x == null) { this.implementation.pointerDragged((int) event.getX(), (int) event.getY()); } else { this.implementation.pointerDragged(x, y); } break; } return consumeEvent; }</code><technical_language>This is redundant. instanceof return false for case of null</technical_language>

Target:
public boolean onTouchEvent(MotionEvent event) { if (this.implementation.getCurrentForm() == null) { return true; } int[] x = null; int[] y = null; int size = event.getPointerCount(); if (size > 1) { x = new int[size]; y = new int[size]; for (int i = 0; i < size; i++) { x[i] = (int) event.getX(i); y[i] = (int) event.getY(i); } } Component componentAt; if (x == null) { componentAt = safetyGetComponentAt(this.implementation.getCurrentForm(), (int)event.getX(), (int)event.getY()); } else { componentAt = safetyGetComponentAt(this.implementation.getCurrentForm(), (int)x[0], (int)y[0]); } boolean isPeer = (componentAt instanceof PeerComponent); boolean consumeEvent = !isPeer || cn1GrabbedPointer; switch (event.getAction()) { case MotionEvent.ACTION_DOWN: if (x == null) { this.implementation.pointerPressed((int) event.getX(), (int) event.getY()); } else { this.implementation.pointerPressed(x, y); } if (!isPeer) cn1GrabbedPointer = true; break; case MotionEvent.ACTION_UP: if (x == null) { this.implementation.pointerReleased((int) event.getX(), (int) event.getY()); } else { this.implementation.pointerReleased(x, y); } cn1GrabbedPointer = false; break; case MotionEvent.ACTION_CANCEL: cn1GrabbedPointer = false; break; case MotionEvent.ACTION_MOVE: if (x == null) { this.implementation.pointerDragged((int) event.getX(), (int) event.getY()); } else { this.implementation.pointerDragged(x, y); } break; } return consumeEvent; }
Source:
<code>public void appendTextToConsole(String text) { <START> appendTextToConsole(text, ConsoleTextType.NORMAL); <END> }</code><technical_language>inverted NORMAL DEFAULT</technical_language>

Target:
public void appendTextToConsole(String text) { appendTextToConsole(text, ConsoleTextType.DEFAULT); }
Source:
<code>public Optional<String> getTimedMemberStateJson() { if (tmsFactoryInitialized.compareAndSet(false, true)) { tmsFactory.init(); } if (System.nanoTime() - lastTMSUpdateNanos <= TMS_CACHE_TIMEOUT_NANOS) { return Optional.ofNullable(tmsJson.get()); } synchronized (tmsFactory) { try { <START> TimedMemberState tms = tmsFactory.createTimedMemberState(); <END> JsonObject json = new JsonObject(); json.add("timedMemberState", tms.toJson()); tmsJson.set(json.toString()); lastTMSUpdateNanos = System.nanoTime(); } catch (Throwable e) { if (e instanceof RetryableException) { logger.warning("Failed to create TimedMemberState. Will try again on next request " + "from Management Center."); } else { inspectOutOfMemoryError(e); } } } return Optional.ofNullable(tmsJson.get()); }</code><technical_language>in critical section? TimedMemberState tms = tmsFactory.createTimedMemberState(); lastTMSUpdateNanos = System.nanoTime();</technical_language>

Target:
public Optional<String> getTimedMemberStateJson() { if (tmsFactoryInitialized.compareAndSet(false, true)) { tmsFactory.init(); } if (System.nanoTime() - lastTMSUpdateNanos <= TMS_CACHE_TIMEOUT_NANOS) { return Optional.ofNullable(tmsJson.get()); } try { TimedMemberState tms; synchronized (tmsFactory) { tms = tmsFactory.createTimedMemberState(); lastTMSUpdateNanos = System.nanoTime(); } JsonObject json = new JsonObject(); json.add("timedMemberState", tms.toJson()); tmsJson.set(json.toString()); } catch (Throwable e) { if (e instanceof RetryableException) { logger.warning("Failed to create TimedMemberState. Will try again on next request " + "from Management Center."); } else { inspectOutOfMemoryError(e); } } return Optional.ofNullable(tmsJson.get()); }
Source:
<code>public static RepositoryMapping getMapping(@NonNull final IResource resource) { if (isNonWorkspace(resource)) { return null; } IPath location = resource.getLocation(); if (location == null) { return null; } return <START> getMapping(location); <END> }</code><technical_language>This iterates projects in workspace. This expensive (cf. bug 486857). Moreover, in this change iterates projects mappings. do for IResource; kill performance UI responsiveness if a substantial number of projects. Improving performance of getMapping(IPath) is a separate issue, avoid possible. nice GitProjectData prepared: finding a RepositoryMapping a (non-linked) IResource requires a short traversal logical container hierarchy. instead investigate ways remove isLinked() restriction (like did), able container hierarchy traversal</technical_language>

Target:
public static RepositoryMapping getMapping(@NonNull final IResource resource) { if (isNonWorkspace(resource)) { return null; } if (resource.isLinked(IResource.CHECK_ANCESTORS)) { IPath location = resource.getLocation(); if (location == null) { return null; } return getMapping(location); } return findMapping(resource); }
Source:
<code><START> public void killQuery(@PathParam("queryId") QueryId queryId, String reason) <END> { requireNonNull(queryId, "queryId is null"); queryManager.failQuery(queryId, new PrestoException(ADMINISTRATIVELY_KILLED, reason)); }</code><technical_language>Is this idempotent? PUT idempotent. call failQuery for a query failed</technical_language>

Target:
public Response killQuery(@PathParam("queryId") QueryId queryId, String reason) { requireNonNull(queryId, "queryId is null"); try { QueryInfo queryInfo = queryManager.getQueryInfo(queryId); if (queryInfo.getState().isDone()) { return Response.status(Status.CONFLICT).build(); } queryManager.failQuery(queryId, new PrestoException(ADMINISTRATIVELY_KILLED, reason)); if (queryInfo.getState() == QueryState.FAILED && queryInfo.getErrorCode() == StandardErrorCode.ADMINISTRATIVELY_KILLED.toErrorCode()) { return Response.status(Status.OK).build(); } else { return Response.status(Status.CONFLICT).build(); } } catch (NoSuchElementException e) { return Response.status(Status.CONFLICT).build(); } }
Source:
<code>private void clearClientTrackedAtReconnectComplete() { if (!reconnectComplete.get()) { boolean success = reconnectComplete.compareAndSet(false, true); <START> if (success) { <END> ehcacheStateService.getClientMessageTracker().reconcileTrackedClients(trackedClients); } } }</code><technical_language>Fold CAS op in if, need local var here</technical_language>

Target:
private void clearClientTrackedAtReconnectComplete() { if (!reconnectComplete.get()) { if (reconnectComplete.compareAndSet(false, true)) { ehcacheStateService.getClientMessageTracker().reconcileTrackedClients(trackedClients); } } }
Source:
<code>public org.springframework.cloud.client.ServiceInstance getLocalServiceInstance() { <START> ServiceInstance<Object> serviceInstance = serviceDiscovery.getServiceInstance(); <END> return createServiceInstance(serviceInstance.getId(), serviceInstance); }</code><technical_language>I thinking of is ServiceInstance<ZookeeperInstance> ServiceInstance<Object> curious ZookeeperInstance Object</technical_language>

Target:
public org.springframework.cloud.client.ServiceInstance getLocalServiceInstance() { ServiceInstance<ZookeeperInstance> serviceInstance = serviceDiscovery.getServiceInstance(); return createServiceInstance(serviceInstance.getId(), serviceInstance); }
Source:
<code>public List<ChangeSet> changeSet(Launcher launcher, FilePath workspace, TaskListener listener, String branch, String baseline, PrintStream output, Node node, FilePath repository) throws IOException, InterruptedException { FilePath tmpFile = workspace.createTextTempFile("tmp", "style", FILES_STYLE); try { ArgumentListBuilder logCmd = findHgExe(node, listener, false); logCmd.add("log", "--style", tmpFile.getRemote()); <START> logCmd.add("--rev", branch); <END> logCmd.add("--no-merges"); ByteArrayOutputStream baos = new ByteArrayOutputStream(); ForkOutputStream fos = new ForkOutputStream(baos, output); logCmd.add("--prune", baseline); joinWithPossibleTimeout( launch(launcher).cmds(logCmd).stdout(fos).pwd(repository), true, listener); return parsePollingLogOutput(baos); } finally { tmpFile.delete(); } }</code><technical_language>sure? hg log -r brname show tip, hg log -b brname show changesets branch (modulo other flags -M -P here)</technical_language>

Target:
public List<ChangeSet> changeSet(Launcher launcher, FilePath workspace, TaskListener listener, String branch, String baseline, PrintStream output, Node node, FilePath repository) throws IOException, InterruptedException { FilePath tmpFile = workspace.createTextTempFile("tmp", "style", FILES_STYLE); try { ArgumentListBuilder logCmd = findHgExe(node, listener, false); logCmd.add("log", "--style", tmpFile.getRemote()); logCmd.add("--branch", branch); logCmd.add("--no-merges"); ByteArrayOutputStream baos = new ByteArrayOutputStream(); ForkOutputStream fos = new ForkOutputStream(baos, output); logCmd.add("--prune", baseline); joinWithPossibleTimeout( launch(launcher).cmds(logCmd).stdout(fos).pwd(repository), true, listener); return parsePollingLogOutput(baos); } finally { tmpFile.delete(); } }
Source:
<code>CircleSelector(final double fraction) { assert (fraction >= 0); <START> assert (fraction <= 1); <END> final double p; if (fraction > 0.5) { p = 1 - fraction; positiveSelection = false; } else { p = fraction; positiveSelection = true; } radiusSquared = p / Math.PI; offset = Math.sqrt(radiusSquared - p * p / 4); }</code><technical_language>I asserts here</technical_language>

Target:
CircleSelector(final double fraction) { final double p; if (fraction > 0.5) { p = 1 - fraction; positiveSelection = false; } else { p = fraction; positiveSelection = true; } radiusSquared = p / Math.PI; if (p < 0) { throw new PicardException("This shouldn't happen..."); } offset = Math.sqrt(radiusSquared - p * p / 4); }
Source:
<code>public String _ensureParents(String name) { String s = ""; List<String> path = path(name); if (path.size() < 2) { return name; } <START> for(int i=0; i<path.size() - 1; i++) { <END> String p = path.get(i); if (TextUtils.isEmpty(s)) { s += p; } else { s += "::" + p; } long did = id(s); s = name(did); } name = s + "::" + path.get(path.size() - 1); return name; }</code><technical_language>AnkiDroid coding standards - whitespace operators stand out visually suggestion for(int i = 0; i < path.size() - 1; i++) {</technical_language>

Target:
public String _ensureParents(String name) { String s = ""; String[] path = path(name); if (path.length < 2) { return name; } for(int i = 0; i < path.length - 1; i++) { String p = path[i]; if (TextUtils.isEmpty(s)) { s += p; } else { s += "::" + p; } long did = id(s); s = name(did); } name = s + "::" + path[path.length - 1]; return name; }
Source:
<code>public SqlEnvironmentConfig setPath(String path) { <START> if (path == null) { <END> this.path = Optional.empty(); } else { this.path = Optional.of(path); } return this; }</code><technical_language>this if/else is equivalent this.path = Optional.ofNullable(path);</technical_language>

Target:
public SqlEnvironmentConfig setPath(String path) { this.path = Optional.ofNullable(path); return this; }
Source:
<code>public void scanJournal(long journalId, long journalPos, JournalScanner scanner) throws IOException { JournalChannel recLog; if (journalPos <= 0) { recLog = new JournalChannel(journalDirectory, journalId, journalPreAllocSize, journalWriteBufferSize); } else { recLog = new JournalChannel(journalDirectory, journalId, journalPreAllocSize, journalWriteBufferSize, journalPos); } int journalVersion = recLog.getFormatVersion(); try { ByteBuffer lenBuff = ByteBuffer.allocate(4); ByteBuffer recBuff = ByteBuffer.allocate(64 * 1024); while (true) { long offset = recLog.fc.position(); lenBuff.clear(); fullRead(recLog, lenBuff); if (lenBuff.remaining() != 0) { break; } lenBuff.flip(); int len = lenBuff.getInt(); if (len == 0) { break; } boolean isPaddingRecord = false; if (len == PADDING_MASK) { if (journalVersion >= JournalChannel.V5) { lenBuff.clear(); fullRead(recLog, lenBuff); if (lenBuff.remaining() != 0) { break; } lenBuff.flip(); len = lenBuff.getInt(); if (len == 0) { continue; } isPaddingRecord = true; } else { throw new IOException("Invalid record found with negative length : " + len); } } recBuff.clear(); if (recBuff.remaining() < len) { recBuff = ByteBuffer.allocate(len); } recBuff.limit(len); if (fullRead(recLog, recBuff) != len) { break; } recBuff.flip(); if (!isPaddingRecord) { scanner.process(journalVersion, offset, recBuff); } } <START> lastLogMark.setCurLogMark(journalId, recLog.fc.position()); <END> } finally { recLog.close(); } }</code><technical_language>@karanmehta93 in retrospect, i this right place update lastLogMark. part of scanner (JournalScanner) logic. scanners add entries LedgerStorage, this update logic part of JournalScanner, is created in Bookie.readJournal method</technical_language>

Target:
public void scanJournal(long journalId, long journalPos, JournalScanner scanner) throws IOException { JournalChannel recLog; if (journalPos <= 0) { recLog = new JournalChannel(journalDirectory, journalId, journalPreAllocSize, journalWriteBufferSize); } else { recLog = new JournalChannel(journalDirectory, journalId, journalPreAllocSize, journalWriteBufferSize, journalPos); } int journalVersion = recLog.getFormatVersion(); try { ByteBuffer lenBuff = ByteBuffer.allocate(4); ByteBuffer recBuff = ByteBuffer.allocate(64 * 1024); while (true) { long offset = recLog.fc.position(); lenBuff.clear(); fullRead(recLog, lenBuff); if (lenBuff.remaining() != 0) { break; } lenBuff.flip(); int len = lenBuff.getInt(); if (len == 0) { break; } boolean isPaddingRecord = false; if (len == PADDING_MASK) { if (journalVersion >= JournalChannel.V5) { lenBuff.clear(); fullRead(recLog, lenBuff); if (lenBuff.remaining() != 0) { break; } lenBuff.flip(); len = lenBuff.getInt(); if (len == 0) { continue; } isPaddingRecord = true; } else { throw new IOException("Invalid record found with negative length : " + len); } } recBuff.clear(); if (recBuff.remaining() < len) { recBuff = ByteBuffer.allocate(len); } recBuff.limit(len); if (fullRead(recLog, recBuff) != len) { break; } recBuff.flip(); if (!isPaddingRecord) { scanner.process(journalVersion, offset, recBuff); } } } finally { recLog.close(); } }
Source:
<code>public void testConversionToOnOffType() { <START> <END> assertEquals(OnOffType.ON, new QuantityType<>("1").as(OnOffType.class)); assertEquals(OnOffType.OFF, new QuantityType<>("0").as(OnOffType.class)); }</code><technical_language>remove empty line</technical_language>

Target:
public void testConversionToOnOffType() { assertEquals(OnOffType.ON, new QuantityType<>("1").as(OnOffType.class)); assertEquals(OnOffType.OFF, new QuantityType<>("0").as(OnOffType.class)); assertEquals(OnOffType.ON, new QuantityType<>("1 %").as(OnOffType.class)); assertEquals(OnOffType.ON, new QuantityType<>("100 %").as(OnOffType.class)); assertEquals(OnOffType.OFF, new QuantityType<>("0 %").as(OnOffType.class)); }
Source:
<code>public DemoApplication(@Context ServletContext servletContext) throws Exception { gondola = initializeGondola(); DemoService demoService = new DemoService(gondola); register(new AbstractBinder() { @Override protected void configure() { bind(demoService).to(DemoService.class); } }); RoutingFilter routingFilter = new RoutingFilter(gondola, new DemoRoutingHelper(gondola, demoService), new ProxyClientProvider()); register(routingFilter); packages(true, "com.yahoo.gondola.demo"); instance = this; Runtime.getRuntime().addShutdownHook(new Thread() { public void run() { try { Thread.sleep(2000); <START> Runtime.getRuntime().halt(0); <END> } catch (InterruptedException e) { } } }); }</code><technical_language>This shutdown hook a scary, a todo fix blocking spot</technical_language>

Target:
public DemoApplication(@Context ServletContext servletContext) throws Exception { gondola = initializeGondola(); DemoService demoService = new DemoService(gondola); register(new AbstractBinder() { @Override protected void configure() { bind(demoService).to(DemoService.class); } }); RoutingFilter routingFilter = new RoutingFilter(gondola, new DemoRoutingHelper(gondola, demoService), new ProxyClientProvider(), new CommandListenerProvider() ); register(routingFilter); packages(true, "com.yahoo.gondola.demo"); instance = this; Runtime.getRuntime().addShutdownHook(new Thread() { public void run() { try { Thread.sleep(2000); Runtime.getRuntime().halt(0); } catch (InterruptedException e) { } } }); }
Source:
<code>public Future<String> putBlob(BlobProperties blobProperties, byte[] userMetadata, ReadableStreamChannel channel, Callback<String> callback) { <START> if (blobProperties == null || channel == null) { <END> throw new IllegalArgumentException("blobProperties or channel must not be null"); } currentOperationsCount.incrementAndGet(); routerMetrics.putBlobOperationRate.mark(); routerMetrics.operationQueuingRate.mark(); FutureResult<String> futureResult = new FutureResult<String>(); if (isOpen.get()) { getOperationController().putBlob(blobProperties, userMetadata, channel, futureResult, callback); } else { RouterException routerException = new RouterException("Cannot accept operation because Router is closed", RouterErrorCode.RouterClosed); routerMetrics.operationDequeuingRate.mark(); routerMetrics.onPutBlobError(routerException); operationCompleteCallback.completeOperation(futureResult, callback, null, routerException); } return futureResult; }</code><technical_language>need a check for usermetadata too. is legal null</technical_language>

Target:
public Future<String> putBlob(BlobProperties blobProperties, byte[] userMetadata, ReadableStreamChannel channel, Callback<String> callback) { if (blobProperties == null || channel == null) { throw new IllegalArgumentException("blobProperties or channel must not be null"); } if (userMetadata == null) { userMetadata = new byte[0]; } currentOperationsCount.incrementAndGet(); routerMetrics.putBlobOperationRate.mark(); routerMetrics.operationQueuingRate.mark(); FutureResult<String> futureResult = new FutureResult<String>(); if (isOpen.get()) { getOperationController().putBlob(blobProperties, userMetadata, channel, futureResult, callback); } else { RouterException routerException = new RouterException("Cannot accept operation because Router is closed", RouterErrorCode.RouterClosed); routerMetrics.operationDequeuingRate.mark(); routerMetrics.onPutBlobError(routerException); operationCompleteCallback.completeOperation(futureResult, callback, null, routerException); } return futureResult; }
Source:
<code>public void verifyEmbededMap(String mapID){ waitForElementByElement(embededMap); String embededMapID = embededMap.getAttribute("data-map-id"); System.out.println(embededMapID); Assert.assertEquals(mapID,embededMapID); PageObjectLogging.log("verifyEmbededMap", <START> "Map was embeded properly", true, driver); <END> }</code><technical_language>Please param/variable in a separate line</technical_language>

Target:
public void verifyEmbededMap(String mapID){ driver.switchTo().defaultContent(); waitForElementByElement(embededMap); String embededMapID = embededMap.getAttribute("data-map-id"); Assertion.assertEquals(mapID, embededMapID); }
Source:
<code>public void noPropertiesComponent() { <START> showMessage("This component has no properties."); <END> }</code><technical_language>Consider i18n instead of hardcoding string This component properties.</technical_language>

Target:
public void noPropertiesComponent() { showMessage(i18n.noPropertiesComponent()); }
Source:
<code>public VanishManager(final VanishPlugin plugin) { this.plugin = plugin; this.announceManipulator = new VanishAnnounceManipulator(this.plugin); this.plugin.getServer().getScheduler().scheduleSyncRepeatingTask(this.plugin, this.showPlayer, 4, 4); Bukkit.getMessenger().registerIncomingPluginChannel(plugin, "vanishStatus", new PluginMessageListener() { public void onPluginMessageReceived(String channel, Player player, byte[] message) { if (channel.equals("vanishStatus") && new String(message).equals("check")) { <START> player.sendPluginMessage(plugin, "vanishStatus", isVanished(player) ? "vanishActive".getBytes() : "vanishInactive".getBytes()); <END> } } }); Bukkit.getMessenger().registerOutgoingPluginChannel(plugin, "vanishStatus"); }</code><technical_language>send strings? A single byte simpler</technical_language>

Target:
public VanishManager(final VanishPlugin plugin) { this.plugin = plugin; this.announceManipulator = new VanishAnnounceManipulator(this.plugin); this.plugin.getServer().getScheduler().scheduleSyncRepeatingTask(this.plugin, this.showPlayer, 4, 4); this.plugin.getServer().getMessenger().registerIncomingPluginChannel(this.plugin, "vanishStatus", new PluginMessageListener() { public void onPluginMessageReceived(String channel, Player player, byte[] message) { if (channel.equals("vanishStatus") && new String(message).equals("check")) { player.sendPluginMessage(plugin, "vanishStatus", isVanished(player) ? new byte[] {0x01} : new byte[] {0x00} ); } } }); this.plugin.getServer().getMessenger().registerOutgoingPluginChannel(this.plugin, "vanishStatus"); }
Source:
<code>private boolean canMaintenanceGlusterHosts(Guid clusterID, Iterable<Guid> hostIdsFromParams, List<VDS> hostList) { List<GlusterVolumeEntity> volumesInCluster = DbFacade.getInstance().getGlusterVolumeDao().getByClusterId(clusterID); boolean serverQuorumEnabled = false; double quorumRatioRequired = 0.5; <START> for (GlusterVolumeEntity <END> volume : volumesInCluster) { List<GlusterVolumeOptionEntity> volumeOptions = DbFacade.getInstance().getGlusterOptionDao().getOptionsOfVolume(volume.getId()); for (GlusterVolumeOptionEntity option : volumeOptions) { if (option.getKey().equalsIgnoreCase("cluster.server-quorum-type") && option.getValue().equals("server")) { serverQuorumEnabled = true; break; } } } if (serverQuorumEnabled) { Set<Guid> upHostIDsInCluster = new HashSet<>(); for (VDS vds : hostList) { if (vds.getStatus() == VDSStatus.Up) { upHostIDsInCluster.add(vds.getId()); } } int numOfUpHostsInCluster = upHostIDsInCluster.size(); int numOfUpHostsToBeMovedToMaintanence = 0; for (Guid vdsID : hostIdsFromParams) { if (upHostIDsInCluster.contains(vdsID)) { numOfUpHostsToBeMovedToMaintanence++; } } float newQuorumRatio = (numOfUpHostsInCluster - numOfUpHostsToBeMovedToMaintanence) / (float) hostList.size(); return newQuorumRatio >= quorumRatioRequired; } return true; }</code><technical_language>Instead of checking for server-quorum-type, check if cluster virt+gluster service enabled - want do this in HC clusters</technical_language>

Target:
private boolean canMaintenanceGlusterHosts(Guid clusterID, Iterable<Guid> hostIdsFromParams, List<VDS> hostList) { List<GlusterVolumeEntity> volumesInCluster = getDbFacade().getGlusterVolumeDao().getByClusterId(clusterID); boolean serverQuorumEnabled = false; double quorumRatioRequired = 0.5; for (GlusterVolumeEntity volume : volumesInCluster) { serverQuorumEnabled = isGlusterServerQuorumEnabled(volume); if(serverQuorumEnabled){ break; } } if (serverQuorumEnabled) { Set<Guid> upHostIDsInCluster = new HashSet<>(); for (VDS vds : hostList) { if (vds.getStatus() == VDSStatus.Up) { upHostIDsInCluster.add(vds.getId()); } } int numOfUpHostsInCluster = upHostIDsInCluster.size(); int numOfUpHostsToBeMovedToMaintanence = 0; for (Guid vdsID : hostIdsFromParams) { if (upHostIDsInCluster.contains(vdsID)) { numOfUpHostsToBeMovedToMaintanence++; } } float newQuorumRatio = (numOfUpHostsInCluster - numOfUpHostsToBeMovedToMaintanence) / (float) hostList.size(); return newQuorumRatio >= quorumRatioRequired; } return true; }
Source:
<code>private String getTopicName(Datastream datastream) { <START> return String.format("%s.%s", datastream.getName(), System.currentTimeMillis()); <END> }</code><technical_language>reasoning this change</technical_language>

Target:
private String getTopicName(Datastream datastream) { DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy_MM_dd_HH_mm_ss"); String currentTime = formatter.format(LocalDateTime.now()); return String.format("%s_%s", datastream.getName(), currentTime); }
Source:
<code>public void drawColumnNames(GameContainer container) { typeFontPlayer.drawString(container.getWidth() / 5 * 2, <START> container.getHeight() / 4, "SCORE", Color.yellow); <END> typeFontPlayer.drawString(container.getWidth() / 5 * 3, container.getHeight() / 4, "MONEY", Color.yellow); typeFontPlayer.drawString(container.getWidth() / 5 * 4, container.getHeight() / 4, "NAME", Color.yellow); }</code><technical_language>a variable store this 5, want change it, change in position instead of 3</technical_language>

Target:
private void drawColumnNames(GameContainer container) { typeFontPlayer.drawString(container.getWidth() / 5 * 2, container.getHeight() / 4, "SCORE", Color.yellow); typeFontPlayer.drawString(container.getWidth() / 5 * 3, container.getHeight() / 4, "MONEY", Color.yellow); typeFontPlayer.drawString(container.getWidth() / 5 * 4, container.getHeight() / 4, "NAME", Color.yellow); }
Source:
<code><START> protected void onActivityResult(int requestCode, int resultCode, Intent data) { <END> super.onActivityResult(requestCode, resultCode, data); if ((requestCode == REQUEST_SHOW_COLLABORATORS) && (resultCode == RESULT_OK)) { InviteCollaboratorsFragment fragment = (InviteCollaboratorsFragment) getSupportFragmentManager().findFragmentByTag(InviteCollaboratorsFragment.TAG); fragment.refreshUi(); } }</code><technical_language>I BoxCollaborationsActivity setting this result. I assume either: updating list here, if user change list press back, this update. please check</technical_language>

Target:
protected void onActivityResult(int requestCode, int resultCode, Intent data) { if (requestCode == REQUEST_SHOW_COLLABORATORS && resultCode == RESULT_OK) { InviteCollaboratorsFragment fragment = (InviteCollaboratorsFragment) getSupportFragmentManager().findFragmentByTag(InviteCollaboratorsFragment.TAG); fragment.refreshUi(); } }
Source:
<code>public void reset() { <START> uriTextMap.keySet().forEach(uri -> getOrCreateSpecificationBuilder().forgetURI(uri)); <END> uriTextMap.clear(); diagnosticsMap.clear(); impactCache.clear(); }</code><technical_language>This sounds strange: if reset internals, sense create specification builders here. If any, is required instantiate forget URI</technical_language>

Target:
public void reset() { uriTextMap.keySet().forEach(uri -> getOrCreateSpecificationBuilder().forgetURI(uri)); uriTextMap.clear(); diagnosticsMap.clear(); dependencyCache.clear(); }
Source:
<code>public Iterator<List<Object>> getDataRows() { return tableDefinitionDescriptor.getDataFile() .map(dataFile -> sqlResultDescriptorFor(dataFile).getRows().iterator()) <START> .orElse(ImmutableList.<List<Object>>of().iterator()); <END> }</code><technical_language>Collections.emptyIterator()</technical_language>

Target:
public Iterator<List<Object>> getDataRows() { return tableDefinitionDescriptor.getDataFile() .map(dataFile -> sqlResultDescriptorFor(dataFile).getRows().iterator()) .orElse(emptyIterator()); }
Source:
<code>public boolean disjoint(OGCGeometry another) { if (isEmpty() || another.isEmpty()) return true; if (this == another) return false; OGCConcreteGeometryCollection flattened1 = flatten(); if (flattened1.isEmpty()) return true; OGCConcreteGeometryCollection otherCol = new OGCConcreteGeometryCollection(another, esriSR); OGCConcreteGeometryCollection flattened2 = otherCol.flatten(); if (flattened2.isEmpty()) return true; for (int i = 0, n1 = flattened1.numGeometries(); i < n1; ++i) { OGCGeometry g1 = flattened1.geometryN(i); for (int j = 0, n2 = flattened2.numGeometries(); j < n2; ++j) { <START> OGCGeometry g2 = flattened2.geometryN(i); <END> if (!g1.disjoint(g2)) return false; } } return true; }</code><technical_language>This geometryN(j) ..(i)</technical_language>

Target:
public boolean disjoint(OGCGeometry another) { if (isEmpty() || another.isEmpty()) return true; if (this == another) return false; OGCConcreteGeometryCollection flattened1 = flatten(); if (flattened1.isEmpty()) return true; OGCConcreteGeometryCollection otherCol = new OGCConcreteGeometryCollection(another, esriSR); OGCConcreteGeometryCollection flattened2 = otherCol.flatten(); if (flattened2.isEmpty()) return true; for (int i = 0, n1 = flattened1.numGeometries(); i < n1; ++i) { OGCGeometry g1 = flattened1.geometryN(i); for (int j = 0, n2 = flattened2.numGeometries(); j < n2; ++j) { OGCGeometry g2 = flattened2.geometryN(j); if (!g1.disjoint(g2)) return false; } } return true; }
Source:
<code>private void emitModifiers(Set<Modifier> modifiers) throws IOException { if (!(modifiers instanceof EnumSet)) { <START> if(modifiers.isEmpty()) <END> modifiers = EnumSet.noneOf(Modifier.class); else modifiers = EnumSet.copyOf(modifiers); } for (Modifier modifier : modifiers) { out.append(modifier.toString()).append(' '); } }</code><technical_language>Space if. braces blocks</technical_language>

Target:
private void emitModifiers(Set<Modifier> modifiers) throws IOException { if (!modifiers.isEmpty()) { modifiers = EnumSet.copyOf(modifiers); } for (Modifier modifier : modifiers) { out.append(modifier.toString()).append(' '); } }
Source:
<code><START> private Pair<String, String[]> processAndValidateV2Payload(JSONObject obj) throws JSONException, PrivilagePayloadException { <END> Pair<String[], String[]> payload = processV2Payload(obj); if(validateV2PayloadSignature(payload.first[0], payload.first[1], payload.second)) { return new Pair(payload.first[0], payload.second); } else { throw new InvalidPrivilegeSignatureException("Signatures don't match"); } }</code><technical_language>a repetitive, I readability of this method procesesAndValidateV1Payload() helped enormously if calling processV1Payload() processV2Payload(), respectively, created named variables for of results, instead of referencing payload.first, payload[0], etc</technical_language>

Target:
private Pair<String, String[]> processAndValidateV2Payload(JSONObject obj) throws JSONException, PrivilagePayloadException { Pair<String[], String[]> payload = processV2Payload(obj); String username = payload.first[0]; String signature = payload.first[1]; String[] privileges = payload.second; if (validatePayloadSignature(getInputForSignatureValidationV2(privileges, username), signature)) { return new Pair(username, privileges); } else { throw new InvalidPrivilegeSignatureException("Signatures don't match"); } }
Source:
<code>public InsecureCryptoIvRule() { <START> addRuleChainVisit(ASTCompilationUnit.class); <END> }</code><technical_language>Adding ASTCompilationUnit effect, visiting this node. This ASTClassOrInterfaceDeclaration.class</technical_language>

Target:
public InsecureCryptoIvRule() { addRuleChainVisit(ASTClassOrInterfaceBodyDeclaration.class); }
Source:
<code>public SCMBlockLocationResponse send(RpcController controller, SCMBlockLocationRequest request) throws ServiceException { String traceId = request.getTraceID(); if (LOG.isTraceEnabled()) { LOG.trace("BlockLocationProtocol request is received: <json>{}</json>", request.getCmdType().toString(), request.toString().replaceAll("\n", "\\\\n")); } else if (LOG.isDebugEnabled()) { LOG.debug("BlockLocationProtocol request is received", request.getCmdType().toString()); } protocolMessageMetrics.increment(request.getCmdType()); try (Scope scope = TracingUtil .importAndCreateScope( "ScmBlockLocationProtocol." + request.getCmdType(), request.getTraceID())) { SCMBlockLocationResponse response = processMessage(request, traceId); if (LOG.isTraceEnabled()) { LOG.trace( "BlockLocationProtocol request is processed. Response: " + "<json>{}</json>", request.getCmdType().toString(), <START> request.toString().replaceAll("\n", "\\\\n")); <END> } return response; } }</code><technical_language>suggestion response.toString().replaceAll("\n", "\\\\n")); response is logged in processMessage()</technical_language>

Target:
public SCMBlockLocationResponse send(RpcController controller, SCMBlockLocationRequest request) throws ServiceException { String traceId = request.getTraceID(); if (LOG.isTraceEnabled()) { LOG.trace("BlockLocationProtocol request is received: <json>{}</json>", request.getCmdType().toString(), request.toString().replaceAll("\n", "\\\\n")); } else if (LOG.isDebugEnabled()) { LOG.debug("BlockLocationProtocol request is received", request.getCmdType().toString()); } protocolMessageMetrics.increment(request.getCmdType()); try (Scope scope = TracingUtil .importAndCreateScope( "ScmBlockLocationProtocol." + request.getCmdType(), request.getTraceID())) { SCMBlockLocationResponse response = processMessage(request, traceId); if (LOG.isTraceEnabled()) { LOG.trace( "BlockLocationProtocol request is processed. Response: " + "<json>{}</json>", request.getCmdType().toString(), response.toString().replaceAll("\n", "\\\\n")); } return response; } }
Source:
<code>public void shouldCheckPage404WithParent() { CustomPage.Type type = CustomPage.Type.NOTFOUND_404; <START> ; <END> given(parent.isCustomPage(message, type)).willReturn(true); plugin.init(message, parent); boolean result = plugin.isPage404(message); assertThat(result, is(equalTo(true))); verify(parent).isCustomPage(message, type); }</code><technical_language>Remove</technical_language>

Target:
public void shouldCheckPage404WithParent() { CustomPage.Type type = CustomPage.Type.NOTFOUND_404; given(parent.isCustomPage(message, type)).willReturn(true); plugin.init(message, parent); boolean result = plugin.isPage404(message); assertThat(result, is(equalTo(true))); verify(parent).isCustomPage(message, type); }
Source:
<code>public Long getLastVerifiedSeq(Client client, String useCase) { return execute(dao -> { <START> Optional<Long> lastVerifiedSeq = dao.getLastVerifiedSeq(client, useCase); <END> return lastVerifiedSeq.orElseGet(() -> setInitialProgress(client, useCase)); }); }</code><technical_language>nit: OptionalLong, box long in method</technical_language>

Target:
public long getLastVerifiedSeq(Client client, String useCase) { return execute(dao -> { OptionalLong lastVerifiedSeq = dao.getLastVerifiedSeq(client, useCase); return lastVerifiedSeq.orElseGet(() -> setInitialProgress(client, useCase)); }); }