auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public int run(String[] argv) throws Exception { String description = "hdfs lsSnapshot <snapshotDir>: \n" + "\tGet the list of snapshots for a snapshottable directory.\n"; <START> <END> if(argv.length != 1) { System.err.println("Usage: \n" + description); return 1; } FileSystem fs = FileSystem.get(getConf()); if (! (fs instanceof DistributedFileSystem)) { System.err.println( "lsSnapshot can only be used in DistributedFileSystem"); return 1; } DistributedFileSystem dfs = (DistributedFileSystem) fs; Path snapshotRoot = new Path(argv[0]); try { SnapshotStatus[] stats = dfs.getSnapshotListing(snapshotRoot); SnapshotStatus.print(stats, System.out); } catch (IOException e) { String[] content = e.getLocalizedMessage().split("\n"); System.err.println("lsSnapshot: " + content[0]); e.printStackTrace(System.err); return 1; } return 0; }</code><technical_language>good if is a error message well, invalid number of arguments..</technical_language>

Target:
public int run(String[] argv) throws Exception { String description = "hdfs lsSnapshot <snapshotDir>: \n" + "\tGet the list of snapshots for a snapshottable directory.\n"; if(argv.length != 1) { System.err.println("Invalid no of arguments"); System.err.println("Usage: \n" + description); return 1; } Path snapshotRoot = new Path(argv[0]); try { DistributedFileSystem dfs = AdminHelper.getDFS(getConf()); SnapshotStatus[] stats = dfs.getSnapshotListing(snapshotRoot); SnapshotStatus.print(stats, System.out); } catch (Exception e) { String[] content = e.getLocalizedMessage().split("\n"); System.err.println("lsSnapshot: " + content[0]); return 1; } return 0; }
Source:
<code>public void onJobUpdate() { if(itemPanel!=null) { <START> long now = System.currentTimeMillis(); <END> if(now - lastTimeUpdatedItem > updateLabelInterval) { lastTimeUpdatedItem = now; itemPanel.readJob(); setLabel(itemPanel.getText()); } } }</code><technical_language>If System.currentTimeMillis() is called often, a performance bottleneck. Consequently, I understand, careful firing events listener</technical_language>

Target:
public void onJobUpdate() { if(!awaitingItemUpdate.getAndSet(true)) { SwingUtilities.invokeLater(new UpdateItemProperties()); } }
Source:
<code>protected static String objectWithPrecisionToString(String value, Timestamp t, Long columnLength) { int fraction = truncateNanosToColumnLength(t.getNanos(), columnLength); if (fraction == 0) return value; <START> String strFormat = "%0" + columnLength + "d"; <END> StringBuilder result = threadLocalBuilder.get(); result.append(value); result.append("."); result.append(String.format(strFormat, fraction)); return result.toString(); }</code><technical_language>totally sure, do: String strFormat = "%0" + columnLength + "d"; String fractional = String.format(strFormat, nanos).substring(0, columnLength)</technical_language>

Target:
protected static String objectWithPrecisionToString(String value, Timestamp t, Long columnLength) { if ( columnLength == 0L ) return value; int divideBy = (int) Math.pow(10, 6 + 3 - columnLength); int fractional = ((int) t.getNanos()) / divideBy; String strFractional = String.format(buildStrFormatForColLength(columnLength), fractional); StringBuilder result = threadLocalBuilder.get(); result.append(value); result.append("."); result.append(strFractional); return result.toString(); }
Source:
<code>private void checkHelixConstraints(HelixAdmin helixAdmin) { ClusterConstraints constraints = helixAdmin.getConstraints(getHelixClusterName(), ClusterConstraints.ConstraintType.MESSAGE_CONSTRAINT); ConstraintItem item = constraints.getConstraintItem("MaxStateTransitionsPerInstance"); Assert.assertEquals(".*", item.getAttributeValue(ClusterConstraints.ConstraintAttribute.INSTANCE)); Assert <START> .assertEquals("STATE_TRANSITION", item.getAttributeValue(ClusterConstraints.ConstraintAttribute.MESSAGE_TYPE)); <END> Assert.assertEquals(CommonConstants.Helix.DEFAULT_HELIX_INSTANCE_MAX_STATE_TRANSITIONS, item.getConstraintValue()); }</code><technical_language>suggestion .assertEquals(item.getAttributeValue(ClusterConstraints.ConstraintAttribute.MESSAGE_TYPE), Message.MessageType.STATE_TRANSITION.name());</technical_language>

Target:
private void checkHelixConstraints(HelixAdmin helixAdmin) { ClusterConstraints constraints = helixAdmin.getConstraints(getHelixClusterName(), ClusterConstraints.ConstraintType.MESSAGE_CONSTRAINT); ConstraintItem item = constraints.getConstraintItem("MaxStateTransitionsPerInstance"); Assert.assertEquals(item.getAttributeValue(ClusterConstraints.ConstraintAttribute.INSTANCE), ".*"); Assert.assertEquals(item.getAttributeValue(ClusterConstraints.ConstraintAttribute.MESSAGE_TYPE), Message.MessageType.STATE_TRANSITION.name()); Assert.assertEquals(item.getConstraintValue(), CommonConstants.Helix.DEFAULT_HELIX_INSTANCE_MAX_STATE_TRANSITIONS); }
Source:
<code>public SequenceReader(List<? extends Reader> readers) { int size = readers.size(); <START> fReaders = new Reader[size]; <END> for (int i = 0; i < size; i++) { fReaders[i] = readers.get(i); } }</code><technical_language>@RobberPhex If input a Collection, a Set input. consider a List internally instead of array. simpler</technical_language>

Target:
public SequenceReader(List<? extends Reader> readers) { final int size = readers.size(); fReaders = new Reader[size]; for (int i = 0; i < size; i++) { fReaders[i] = readers.get(i); } }
Source:
<code>@Test void testEqualAsCollectionSansNullability() { final SqlTypeFactoryImpl factory = new SqlTypeFactoryImpl(RelDataTypeSystem.DEFAULT); <START> <END> final RelDataType arrayNullable = new ArraySqlType(factory.createTypeWithNullability(f.sqlBigInt, true), false); final RelDataType arrayNotNull = new ArraySqlType(factory.createTypeWithNullability(f.sqlBigInt, false), false); assertThat(equalAsCollectionSansNullability(factory, arrayNullable, arrayNotNull), is(true)); final RelDataType setNullable = new MultisetSqlType(factory.createTypeWithNullability(f.sqlBigInt, true), false); final RelDataType setNotNull = new MultisetSqlType(factory.createTypeWithNullability(f.sqlBigInt, false), false); assertThat(equalAsCollectionSansNullability(factory, setNullable, setNotNull), is(true)); assertThat(equalAsCollectionSansNullability(factory, arrayNotNull, setNotNull), is(false)); }</code><technical_language>Try reuse Fixture</technical_language>

Target:
@Test void testEqualAsCollectionSansNullability() { assertThat( equalAsCollectionSansNullability(f.typeFactory, f.arrayBigInt, f.arrayBigIntNullable), is(true)); assertThat( equalAsCollectionSansNullability(f.typeFactory, f.multisetBigInt, f.multisetBigIntNullable), is(true)); assertThat( equalAsCollectionSansNullability(f.typeFactory, f.arrayBigInt, f.multisetBigInt), is(false)); }
Source:
<code>public int requestNetworkScan(int subId, NetworkScanRequest request, Messenger messenger, IBinder binder, String callingPackage) { TelephonyPermissions.enforceCallingOrSelfModifyPermissionOrCarrierPrivilege( mApp, subId, "requestNetworkScan"); final long identity = Binder.clearCallingIdentity(); try { LocationAccessPolicy.LocationPermissionResult locationResult = LocationAccessPolicy.checkLocationPermission(mApp, new LocationAccessPolicy.LocationPermissionQuery.Builder() .setCallingPackage(callingPackage) .setCallingPid(Binder.getCallingPid()) <START> .setCallingUid(Binder.getCallingUid()) <END> .setMethod("requestNetworkScan") .setMinSdkVersionForFine(Build.VERSION_CODES.Q) .build()); if (locationResult != LocationAccessPolicy.LocationPermissionResult.ALLOWED) { SecurityException e = checkNetworkRequestForSanitizedLocationAccess(request); if (e != null) { if (locationResult == LocationAccessPolicy.LocationPermissionResult.DENIED_HARD) { throw e; } else { loge(e.getMessage()); return TelephonyScanManager.INVALID_SCAN_ID; } } } return mNetworkScanRequestTracker.startNetworkScan( request, messenger, binder, getPhone(subId), callingPackage); } finally { Binder.restoreCallingIdentity(identity); } }</code><technical_language>Is need caller ID in location permission check</technical_language>

Target:
public int requestNetworkScan(int subId, NetworkScanRequest request, Messenger messenger, IBinder binder, String callingPackage) { TelephonyPermissions.enforceCallingOrSelfModifyPermissionOrCarrierPrivilege( mApp, subId, "requestNetworkScan"); LocationAccessPolicy.LocationPermissionResult locationResult = LocationAccessPolicy.checkLocationPermission(mApp, new LocationAccessPolicy.LocationPermissionQuery.Builder() .setCallingPackage(callingPackage) .setCallingPid(Binder.getCallingPid()) .setCallingUid(Binder.getCallingUid()) .setMethod("requestNetworkScan") .setMinSdkVersionForFine(Build.VERSION_CODES.Q) .build()); if (locationResult != LocationAccessPolicy.LocationPermissionResult.ALLOWED) { SecurityException e = checkNetworkRequestForSanitizedLocationAccess(request); if (e != null) { if (locationResult == LocationAccessPolicy.LocationPermissionResult.DENIED_HARD) { throw e; } else { loge(e.getMessage()); return TelephonyScanManager.INVALID_SCAN_ID; } } } final long identity = Binder.clearCallingIdentity(); try { return mNetworkScanRequestTracker.startNetworkScan( request, messenger, binder, getPhone(subId), callingPackage); } finally { Binder.restoreCallingIdentity(identity); } }
Source:
<code><START> private void setBundleWFPath(Bundle... bundles) throws Exception { <END> for (Bundle bundle : bundles) { bundle.setProcessWorkflow(WORKFLOW_PATH); } }</code><technical_language>plesae specific exceptions</technical_language>

Target:
private void setBundleWFPath(Bundle... bundles) { for (Bundle bundle : bundles) { bundle.setProcessWorkflow(workflowPath); } }
Source:
<code>public CompletionStage<Result> query() { final JsonNode body = request().body().asJson(); if (body == null) { <START> return CompletableFuture.completedFuture(Results.badRequest(createErrorJson("null body for query"))); <END> } try { final MetricsQuery query = _mapper.treeToValue(body, MetricsQuery.class); final CompletionStage<TimeSeriesResult> response = _queryExecutor.executeQuery(query.getQuery()); return response.<JsonNode>thenApply(_mapper::valueToTree).thenApply(Results::ok); } catch (final RuntimeException ex) { return CompletableFuture.completedFuture(Results.internalServerError(createErrorJson(ex))); } catch (final QueryExecutionException ex) { return CompletableFuture.completedFuture(Results.badRequest(createErrorJson(ex.getProblems()))); } catch (final JsonProcessingException e) { return CompletableFuture.completedFuture(Results.badRequest(createErrorJson(e))); } }</code><technical_language>question of this English-only string</technical_language>

Target:
public CompletionStage<Result> query() { final JsonNode body = request().body().asJson(); if (body == null) { return CompletableFuture.completedFuture( Results.badRequest(createErrorJson("request.UNEXPECTED_EMPTY_BODY", Collections.emptyList()))); } try { final MetricsQuery query = _mapper.treeToValue(body, MetricsQuery.class); final QueryExecutor queryExecutor = _queryExecutorRegistry.getExecutor(query.getExecutor()); if (queryExecutor == null) { throw new QueryExecutionException( "Unknown query executor", ImmutableList.of( new QueryProblem.Builder() .setProblemCode("query_problem.UNKNOWN_EXECUTOR") .build())); } final CompletionStage<MetricsQueryResult> response = queryExecutor.executeQuery(query.toInternal()); return response .thenApply(models.view.MetricsQueryResult::fromInternal) .<JsonNode>thenApply(_mapper::valueToTree) .thenApply(Results::ok); } catch (final RuntimeException ex) { return CompletableFuture.completedFuture(Results.internalServerError(createErrorJson(ex, "request.UNKNOWN_ERROR"))); } catch (final QueryExecutionException ex) { return CompletableFuture.completedFuture(Results.badRequest(createErrorJson(ex.getProblems()))); } catch (final JsonProcessingException ex) { return CompletableFuture.completedFuture(Results.badRequest(createErrorJson(ex, "request.BAD_REQUEST"))); } }
Source:
<code>private void verifySnapshotStatus(Client client, String expectedType, int expectCount, boolean checkVoltDBCrashed) { boolean success = true; try { int cnt = 0; VoltTable rslt = null; int matchCount = 0; while (cnt < 60) { rslt = client.callProcedure("@Statistics", "SNAPSHOTSTATUS", 0).getResults()[0]; int expectedRowCount = 3; if (expectedType.equals("COMMANDLOG")) { <START> expectedRowCount += 3; END> } if (rslt.getRowCount() == expectedRowCount) { matchCount = 0; while (rslt.advanceRow()) { String type = rslt.getString("TYPE"); assertTrue(type.equals(expectedType) || type.equals("COMMANDLOG")); if (type.equals(expectedType)) { matchCount++; success &= rslt.getString("RESULT").equals("SUCCESS"); } } if (!success && !(checkVoltDBCrashed && !VoltDB.wasCrashCalled)) break; } Thread.sleep(100); cnt++; } assert(cnt < 60); assertEquals(expectCount, matchCount); } catch (Exception e) { } assertFalse(success); }</code><technical_language>expectCount *= 2; remove expectCount</technical_language>

Target:
private void verifySnapshotStatus(Client client, String expectedType, int expectCount, boolean checkVoltDBCrashed) { boolean success = true; try { int cnt = 0; VoltTable rslt = null; int matchCount = 0; while (cnt < 60) { rslt = client.callProcedure("@Statistics", "SNAPSHOTSTATUS", 0).getResults()[0]; if (rslt.getRowCount() == expectCount) { matchCount = 0; while (rslt.advanceRow()) { String type = rslt.getString("TYPE"); assertTrue(type.equals(expectedType) || type.equals("COMMANDLOG")); if (type.equals(expectedType)) { matchCount++; success &= rslt.getString("RESULT").equals("SUCCESS"); } } if (!success && !(checkVoltDBCrashed && !VoltDB.wasCrashCalled)) break; } Thread.sleep(100); cnt++; } assert(cnt < 60); assertEquals(expectCount, matchCount); } catch (Exception e) { } assertFalse(success); }
Source:
<code>private List<Rule> getRulesByLength(final int length) { <START> for (Map.Entry<Range, List<Rule>> e : rules.entrySet()) { <END> if (e.getKey().includes(length)) { return e.getValue(); } } return null; }</code><technical_language>Consider a streaming implementation: final Optional<List<Rule>> match = rules.entrySet().stream() .filter(e -> e.getKey().includes(length)) .map(Map.Entry::getValue) .findFirst(); return match.isPresent() ? match.get() : null; clearer, time I avoid declaring Map.Entry<A, B> reason enough</technical_language>

Target:
private List<Rule> getRulesByLength(final int length) { final Optional<List<Rule>> match = rules.entrySet().stream().filter( e -> e.getKey().includes(length)).map(Map.Entry::getValue).findFirst(); return match.isPresent() ? match.get() : null; }
Source:
<code>void roundNumericValues(final List<MeasurementRow> measurementRowList) { for (final MeasurementRow row : measurementRowList) { for (final MeasurementData data : row.getDataList()) { if (data.getMeasurementVariable().getVariableType().getId() == VariableType.TRAIT.getId() && data.isNumeric() && data.getValue() != null && !data.getValue().isEmpty()) { <START> String value = StringUtils.stripEnd(String.format ("%.2f", Double.parseDouble(data.getValue())), "0"); <END> data.setValue(StringUtils.stripEnd(value, ".")); } } } }</code><technical_language>equals for comparison checking ==. flagged Sonar violation</technical_language>

Target:
void roundNumericValues(final List<MeasurementRow> measurementRowList) { for (final MeasurementRow row : measurementRowList) { for (final MeasurementData data : row.getDataList()) { if (data.getMeasurementVariable().getVariableType().getId().equals(VariableType.TRAIT.getId()) && data.isNumeric() && data.getValue() != null && !data.getValue().isEmpty()) { String value = StringUtils.stripEnd(String.format ("%.2f", Double.parseDouble(data.getValue())), "0"); data.setValue(StringUtils.stripEnd(value, ".")); } } } }
Source:
<code>public static boolean isBuildFolderInPerstentModel(IFolder folder) { try { IProject project = folder.getProject(); Optional<IPath> modelBuildDir = CorePlugin.modelPersistence().loadModel(project).getBuildDir(); if (!modelBuildDir.isPresent()) { return false; } <START> IPath relativePath = RelativePathUtils.getRelativePath(project.getFullPath(), folder.getFullPath()); <END> return relativePath.equals(modelBuildDir.get()); } catch (Exception e) { CorePlugin.logger().debug(String.format("Could not check whether folder %s is a build folder.", folder.getFullPath()), e); return false; } }</code><technical_language>store build folder a full path, relativize again? need in mind this is called for folder is added/removed/changed</technical_language>

Target:
public static boolean isBuildFolderInPerstentModel(IFolder folder) { try { IProject project = folder.getProject(); IPath modelBuildDir = CorePlugin.modelPersistence().loadModel(project).getBuildDir(); if (modelBuildDir == null) { return false; } return folder.getProjectRelativePath().equals(modelBuildDir); } catch (Exception e) { CorePlugin.logger().debug(String.format("Could not check whether folder %s is a build folder.", folder.getFullPath()), e); return false; } }
Source:
<code>private String getUrl(String baseUrl, String path) throws MalformedURLException { if (baseUrl.indexOf("://") > 0) { return new URL(new URL(baseUrl), path).toExternalForm(); } else { return <START> baseUrl + trimTrailingSlash(baseUrl) <END> + "/" + CharMatcher.is('/').trimLeadingFrom(path); } }</code><technical_language>Is correct 2 times baseUrl here</technical_language>

Target:
private String getUrl(String baseUrl, String path) { return trimTrailingSlash(baseUrl) + path; }
Source:
<code>private boolean isVm(Guid id) { try { getEntity(org.ovirt.engine.core.common.businessentities.VM.class, VdcQueryType.GetVmByVmId, queryParams, id.toString()); return true; } catch (WebFaultException e) { return false; <START> } <END> }</code><technical_language>if WebFaultException caused absence of permissions execute this query?..., suggest runQuery() analysing return-value instead</technical_language>

Target:
private boolean isVm(Guid id) { return runQuery(VdcQueryType.GetVmByVmId, queryParams).getReturnValue() instanceof VM; }
Source:
<code>ScriptIntrinsic(long id, RenderScript rs) { super(id, rs); if (id == 0) { <START> throw new RSRuntimeException("Loading of script failed."); <END> } }</code><technical_language>intrinsic-specific error</technical_language>

Target:
ScriptIntrinsic(long id, RenderScript rs) { super(id, rs); if (id == 0) { throw new RSRuntimeException("Loading of ScriptIntrinsic failed."); } }
Source:
<code>public final static Type fun(Type... elems) { final int last = elems.length-1; <START> Type t = elems[last]; <END> for (int n = last-1; n >= 0; n--) { t = new FunType (elems[n], t); } return t; }</code><technical_language>This fails ArrayIndexOutOfBoundsException a zero-element elems array (same app)</technical_language>

Target:
public final static Type fun(Type... elems) { if (elems.length == 0) { throw new IllegalArgumentException("can not create an empty function type"); } final int last = elems.length - 1; Type t = elems[last]; for (int n = last - 1; n >= 0; n--) { t = new FunType(elems[n], t); } return t; }
Source:
<code>@Override public Date read(JsonReader in) throws IOException { Date out; if (in.peek() == JsonToken.NULL) { in.nextNull(); out = null; <START> } else <END> try { out = ISO8601Utils.parse(in.nextString().replace(' ', 'T') + "Z", new ParsePosition(0)); } catch (ParseException e) { throw new IOException(e); } return out; }</code><technical_language>here, adding { }</technical_language>

Target:
@Override public Date read(JsonReader in) throws IOException { Date out; if (in.peek() == JsonToken.NULL) { in.nextNull(); out = null; } else { try { out = ISO8601Utils.parse(in.nextString().replace(' ', 'T') + "Z", new ParsePosition(0)); } catch (ParseException e) { throw new IOException(e); } } return out; }
Source:
<code>public void configure(Map configurationValues) { if ( configurationValues == null ) { throw new IllegalArgumentException( "invalid configuration file: should not be null" ); } keyspace = (String) configurationValues.get( CASSANDRA_KEYSPACE ); url = (String) configurationValues.get( CASSANDRA_URL ); configurationMode = (String) configurationValues.get( OgmConfiguration.HIBERNATE_OGM_GENERATE_SCHEMA ); if ( !OgmConfiguration.GenerateSchemaValue.isValid( configurationMode ) ) { log.unexpectedConfiguration(OgmConfiguration.HIBERNATE_OGM_GENERATE_SCHEMA, OgmConfiguration.HIBERNATE_OGM_GENERATE_SCHEMA_DEFAULT.getValue()); configurationMode = OgmConfiguration.HIBERNATE_OGM_GENERATE_SCHEMA_DEFAULT.getValue(); } if ( keyspace == null ) { <START> throw new HibernateException( "Unable to get keyspace value from configuration on key " + CASSANDRA_KEYSPACE ); <END> } }</code><technical_language>throw log.unabledToGetKeyspace( ... )</technical_language>

Target:
public void configure(Map configurationValues) { if ( configurationValues == null ) { throw new IllegalArgumentException( "invalid configuration file: should not be null" ); } keyspace = (String) configurationValues.get( CASSANDRA_KEYSPACE ); url = (String) configurationValues.get( CASSANDRA_URL ); configurationMode = (String) configurationValues.get( OgmConfiguration.HIBERNATE_OGM_GENERATE_SCHEMA ); if ( !OgmConfiguration.GenerateSchemaValue.isValid( configurationMode ) ) { log.unexpectedConfiguration(OgmConfiguration.HIBERNATE_OGM_GENERATE_SCHEMA, OgmConfiguration.HIBERNATE_OGM_GENERATE_SCHEMA_DEFAULT.getValue()); configurationMode = OgmConfiguration.HIBERNATE_OGM_GENERATE_SCHEMA_DEFAULT.getValue(); } if ( keyspace == null ) { log.unableToGetKeyspace( CASSANDRA_KEYSPACE ); throw log.unableToGetKeyspace( CASSANDRA_KEYSPACE ); } }
Source:
<code>public DownloadRuntime[] findDownloadRuntimes(String pattern, IProgressMonitor monitor) { <START> monitor.beginTask("Locating Matching Downloadable Runtimes", 1000); <END> RuntimeRangeRepresentation rep = new RuntimeRangeRepresentation(pattern); DownloadRuntime[] arr = RuntimeCoreActivator.getDefault().getDownloadRuntimeArray(new SubProgressMonitor(monitor, 800)); IProgressMonitor subMon = new SubProgressMonitor(monitor, 200); subMon.beginTask("Filtering Downloadable Runtimes", arr.length * 100); ArrayList<DownloadRuntime> list = new ArrayList<DownloadRuntime>(arr.length); for( int i = 0; i < arr.length; i++ ) { String rtType = (String)arr[i].getProperty(DownloadRuntimesProvider.LABEL_WTP_RUNTIME); if( rep.wtpId.equals(rtType)) { if( rep.stacksRuntimeType == null ) list.add(arr[i]); else { if( rep.stacksRuntimeType.equals(arr[i].getProperty(DownloadRuntimesProvider.LABEL_RUNTIME_TYPE))) { if( rep.beginVersion == null ) { list.add(arr[i]); } else { String version = arr[i].getVersion(); if( rep.matchesVersion(version)) list.add(arr[i]); } } } } subMon.worked(100); } subMon.done(); monitor.done(); return (DownloadRuntime[]) list.toArray(new DownloadRuntime[list.size()]); }</code><technical_language>delegate a private method a RuntimeRangeRepresentation argument instead</technical_language>

Target:
public DownloadRuntime[] findDownloadRuntimes(String pattern, IProgressMonitor monitor) { RuntimeRangeRepresentation rep = new RuntimeRangeRepresentation(pattern); return findDownloadRuntimes(rep, monitor); }
Source:
<code><START> public OutputFormatBuilder.OutputOptions<T> clientProperties(Properties clientProperties) { <END> this.clientInfo = Objects.requireNonNull(clientInfo, "ClientInfo must not be null"); return this; }</code><technical_language>ClientInfo.from() is needed</technical_language>

Target:
public OutputFormatBuilder.OutputOptions<T> clientProperties(Properties clientProperties) { this.clientInfo = ClientInfo.from(Objects.requireNonNull(clientProperties, "ClientInfo must not be null")); return this; }
Source:
<code>public void canIterate() throws Exception { final MkStorage storage = new MkStorage.InFile(); final Repo repo = repo(storage); final String[] paths = { "foo/bar/1", "foo/bar/2", "foo/baz", }; for (final String path : paths) { this.addContent(repo, path); } MatcherAssert.assertThat( repo.contents().iterate("foo/bar", "ref-1"), <START> Matchers.<Content>iterableWithSize(2) <END> ); }</code><technical_language>check actual content Content iterate right items (it's critical thing)</technical_language>

Target:
public void canIterate() throws IOException { final MkStorage storage = new MkStorage.InFile(); final Repo repo = repo(storage); final Content[] correct = this.addContent( repo, "foo/bar/1", "foo/bar/2" ); this.addContent(repo, "foo/baz", "foo/boo"); MatcherAssert.assertThat( repo.contents().iterate("foo/bar", "ref-1"), Matchers.contains(correct) ); }
Source:
<code>public boolean isSnapshot(String version) { <START> return StringUtils.isNotBlank(version) && StringUtils.endsWithIgnoreCase(version, "SNAPSHOT"); <END> }</code><technical_language>please this extra bit more specific -SNAPSHOT? Thanks! :)</technical_language>

Target:
public boolean isSnapshot(String version) { return StringUtils.isNotBlank(version) && StringUtils.endsWithIgnoreCase(version, "-SNAPSHOT"); }
Source:
<code>public TkText(final String body) { super( new Take() { @Override @SuppressWarnings("PMD.AvoidThrowingRawExceptionTypes") public Response act(final Request req) { try { new RqPrint(req).printBody(); } catch (final IOException exc) { <START> throw new RuntimeException(exc); <END> } return new RsText(body); } } ); }</code><technical_language>@exper0 throw IllegalStateException instead, remove suppress</technical_language>

Target:
public TkText(final String body) { super( new Take() { @Override public Response act(final Request req) { try { new RqPrint(req).printBody(); } catch (final IOException exc) { throw new IllegalStateException(exc); } return new RsText(body); } } ); }
Source:
<code>T[] getLeaf(int index) { if (depthShift == 0) { return (T[]) array; } else if (depthShift == BRANCHING_BASE) { return getAt(array, firstDigit(offset + index, depthShift)); <START> } else { <END> index += offset; Object[] leaf = getAt(array, firstDigit(index, depthShift)); for (int shift = depthShift - BRANCHING_BASE; shift > 0; shift -= BRANCHING_BASE) { leaf = getAt(leaf, digit(index, shift)); } return (T[]) leaf; } }</code><technical_language>else branch covers depthShift > 0 && (depthShift < BRANCHING_BASE || depthShift > BRANCHING_BASE), right? asking get depthShift BRANCHING_BASE..</technical_language>

Target:
Object getLeaf(int index) { if (depthShift == 0) { return array; } else if (depthShift == BRANCHING_BASE) { return obj().getAt(array, firstDigit(offset + index, depthShift)); } else { index += offset; Object leaf = obj().getAt(array, firstDigit(index, depthShift)); for (int shift = depthShift - BRANCHING_BASE; shift > 0; shift -= BRANCHING_BASE) { leaf = obj().getAt(leaf, digit(index, shift)); } return leaf; } }
Source:
<code>public HandlerResult handle(ProcessState state, ProcessInstance process) { final ExternalEvent event = (ExternalEvent) state.getResource(); if (!ExternalEventConstants.KIND_STACK_EVENT.equals(event.getKind())) { return null; } lockManager.lock(new ExternalEventLock(STACK_LOCK_NAME, event.getAccountId(), event.getExternalId()), new LockCallbackNoReturn() { @Override public void doWithLockNoResult() { Map<String, Object> stackData = CollectionUtils .toMap(DataUtils.getFields(event).get(FIELD_STACK)); if (stackData.isEmpty()) { log.warn("Empty stack for externalStackEvent: {}.", event); return; } <START> String kind = stackData.get(ObjectMetaDataManager.KIND_FIELD) != null <END> ? stackData.get(ObjectMetaDataManager.KIND_FIELD).toString() : null; if (StringUtils.isEmpty(kind) || schemaFactory.getSchema(kind) == null) { log.warn("Couldn't find schema for stack type [{}]. Returning.", kind); return; } if (StringUtils.equals(event.getEventType(), TYPE_STACK_DELETE)) { deleteStack(event, stackData); } } }); return null; }</code><technical_language>need this dynamic schema type for stack; for services dynamic schema definition for k8s (and other external services), anynore</technical_language>

Target:
public HandlerResult handle(ProcessState state, ProcessInstance process) { final ExternalEvent event = (ExternalEvent) state.getResource(); if (!ExternalEventConstants.KIND_STACK_EVENT.equals(event.getKind())) { return null; } lockManager.lock(new ExternalEventLock(STACK_LOCK_NAME, event.getAccountId(), event.getExternalId()), new LockCallbackNoReturn() { @Override public void doWithLockNoResult() { Map<String, Object> stackData = CollectionUtils .toMap(DataUtils.getFields(event).get(FIELD_STACK)); if (stackData.isEmpty()) { log.warn("Empty stack for externalStackEvent: {}.", event); return; } if (StringUtils.equals(event.getEventType(), TYPE_STACK_DELETE)) { deleteStack(event, stackData); } } }); return null; }
Source:
<code>public MarshallableEntry<K, V> loadEntry(Object key) throws PersistenceException { if (configuration.rawValues()) { Object unwrappedKey; if (key instanceof WrappedByteArray) { unwrappedKey = ((WrappedByteArray) key).getBytes(); } else { unwrappedKey = key; } MetadataValue<?> value = remoteCache.getWithMetadata(unwrappedKey); if (value != null) { Metadata metadata = new EmbeddedMetadata.Builder() .version(new NumericVersion(value.getVersion())) .lifespan(value.getLifespan(), TimeUnit.SECONDS) .maxIdle(value.getMaxIdle(), TimeUnit.SECONDS).build(); long created = value.getCreated(); long lastUsed = value.getLastUsed(); Object realValue = value.getValue(); if (realValue instanceof byte[]) { realValue = new WrappedByteArray((byte[]) realValue); } return entryFactory.create(key, realValue, metadata, created, lastUsed); } else { return null; } } else { if (key instanceof WrappedByteArray) { key = ((WrappedByteArray) key).getBytes(); } <START> StoreEntry entry = (StoreEntry) remoteCache.get(key); <END> return entry == null ? null : entryFactory.create(key, entry.getValue(), entry.getMetadata(), entry.getCreated(), entry.getLastUsed()); } }</code><technical_language>Huh, surprised remoteCache.getWithMetadata() here, I guess care direct access remote cache</technical_language>

Target:
public MarshallableEntry<K, V> loadEntry(Object key) throws PersistenceException { if (configuration.rawValues()) { Object unwrappedKey; if (key instanceof WrappedByteArray) { unwrappedKey = ((WrappedByteArray) key).getBytes(); } else { unwrappedKey = key; } MetadataValue<?> value = remoteCache.getWithMetadata(unwrappedKey); if (value != null) { Metadata metadata = new EmbeddedMetadata.Builder() .version(new NumericVersion(value.getVersion())) .lifespan(value.getLifespan(), TimeUnit.SECONDS) .maxIdle(value.getMaxIdle(), TimeUnit.SECONDS).build(); long created = value.getCreated(); long lastUsed = value.getLastUsed(); Object realValue = value.getValue(); if (realValue instanceof byte[]) { realValue = new WrappedByteArray((byte[]) realValue); } return entryFactory.create(key, realValue, metadata, created, lastUsed); } else { return null; } } else { if (key instanceof WrappedByteArray) { key = ((WrappedByteArray) key).getBytes(); } MarshalledValue value = (MarshalledValue) remoteCache.get(key); return value == null ? null : entryFactory.create(key, value); } }
Source:
<code>public AttachedToSurfaceFamily(BlockFamilyDefinition definition, BlockBuilderHelper blockBuilder) { <START> super(definition, blockBuilder); <END> Map<Side, Block> blockMap = Maps.newEnumMap(Side.class); if (definition.getData().hasSection("top")) { Block block = blockBuilder.constructSimpleBlock(definition, "top"); block.setDirection(Side.TOP); blockMap.put(Side.TOP, block); } if (definition.getData().hasSection("front")) { for (Rotation rot : Rotation.horizontalRotations()) { Side side = rot.rotate(Side.FRONT); blockMap.put(side, blockBuilder.constructTransformedBlock(definition, side.toString().toLowerCase(Locale.ENGLISH), rot)); } } if (definition.getData().hasSection("bottom")) { Block block = blockBuilder.constructSimpleBlock(definition, "bottom"); block.setDirection(Side.BOTTOM); blockMap.put(Side.BOTTOM, block); } for (Side side : Side.values()) { Block block = blockMap.get(side); if (block != null) { this.blocks.put(side, block); block.setBlockFamily(this); block.setUri(new BlockUri(definition.getUrn(), new Name(side.name()))); } } if (this.blocks.containsKey(Side.TOP)) { archetype = this.blocks.get(Side.TOP); } else { archetype = this.blocks.get(Side.FRONT); } this.setBlockUri(new BlockUri(definition.getUrn())); this.setCategory(definition.getCategories()); }</code><technical_language>Calls super method is empty in base class</technical_language>

Target:
public AttachedToSurfaceFamily(BlockFamilyDefinition definition, BlockBuilderHelper blockBuilder) { super(definition, blockBuilder); Map<Side, Block> blockMap = Maps.newEnumMap(Side.class); if (definition.getData().hasSection("top")) { Block block = blockBuilder.constructSimpleBlock(definition, "top"); block.setDirection(Side.TOP); blockMap.put(Side.TOP, block); } if (definition.getData().hasSection("front")) { for (Rotation rot : Rotation.horizontalRotations()) { Side side = rot.rotate(Side.FRONT); blockMap.put(side, blockBuilder.constructTransformedBlock(definition, side.toString().toLowerCase(Locale.ENGLISH), rot)); } } if (definition.getData().hasSection("bottom")) { Block block = blockBuilder.constructSimpleBlock(definition, "bottom"); block.setDirection(Side.BOTTOM); blockMap.put(Side.BOTTOM, block); } for (Side side : Side.values()) { Block block = blockMap.get(side); if (block != null) { blocks.put(side, block); block.setBlockFamily(this); block.setUri(new BlockUri(definition.getUrn(), new Name(side.name()))); } } if (blocks.containsKey(Side.TOP)) { archetype = blocks.get(Side.TOP); } else { archetype = blocks.get(Side.FRONT); } setBlockUri(new BlockUri(definition.getUrn())); setCategory(definition.getCategories()); }
Source:
<code><START> public void updateDynamicSetting( String setting, String update ) <END> throws IllegalArgumentException, InvalidSettingException { verifyValidDynamicSetting( setting ); String oldValue; String newValue; if ( update == null || update.isEmpty() ) { boolean hasDefault = overriddenDefaults.containsKey( setting ); oldValue = hasDefault ? params.put( setting, overriddenDefaults.get( setting ) ) : params.remove( setting ); newValue = getDefaultValueOf( setting ); } else { Map<String,String> newEntry = stringMap( setting, update ); List<SettingValidator> settingValidators = configOptions.stream() .map( ConfigOptions::settingGroup ) .collect( Collectors.toList() ); for ( SettingValidator validator : settingValidators ) { validator.validate( newEntry, ignore -> ); } synchronized ( params ) { oldValue = getDefaultValueOf( setting ); params.put( setting, update ); } newValue = update; } log.info( "Setting changed: '%s' changed from '%s' to '%s'", setting, oldValue, newValue ); updateListeners.getOrDefault( setting, emptyList() ).forEach( l -> l.accept( oldValue, newValue ) ); }</code><technical_language>more closer inspections I synchronize method. newValue oldValue pair races main reason log change is current state is. synchronization, log messages guaranteed reflect order of log messages is coupled order of changes</technical_language>

Target:
public void updateDynamicSetting( String setting, String update ) throws IllegalArgumentException, InvalidSettingException { verifyValidDynamicSetting( setting ); synchronized ( params ) { String oldValue; String newValue; if ( update == null || update.isEmpty() ) { String overriddenDefault = overriddenDefaults.get( setting ); boolean hasDefault = overriddenDefault != null; oldValue = hasDefault ? params.put( setting, overriddenDefault ) : params.remove( setting ); newValue = getDefaultValueOf( setting ); } else { Map<String,String> newEntry = stringMap( setting, update ); List<SettingValidator> settingValidators = configOptions.stream() .map( ConfigOptions::settingGroup ) .collect( Collectors.toList() ); for ( SettingValidator validator : settingValidators ) { validator.validate( newEntry, ignore -> ); } oldValue = getDefaultValueOf( setting ); params.put( setting, update ); newValue = update; } log.info( "Setting changed: '%s' changed from '%s' to '%s'", setting, oldValue, newValue ); updateListeners.getOrDefault( setting, emptyList() ).forEach( l -> l.accept( oldValue, newValue ) ); } }
Source:
<code>protected boolean isVanityPath(String pathScope, String vanityPath, SlingHttpServletRequest request) throws RepositoryException { final long start = System.currentTimeMillis(); final Map<String, String> params = new HashMap<>(); params.put("path", StringUtils.defaultIfEmpty(pathScope, DEFAULT_PATH_SCOPE)); params.put("property", NameConstants.PN_SLING_VANITY_PATH); params.put("property.value", vanityPath); params.put("p.limit", "1"); params.put("p.guessTotal", "true"); log.debug("Searching for vanity path [ ] under [ ]", vanityPath, pathScope); <START> final Query query = queryBuilder.createQuery(PredicateGroup.create(params), request.getResourceResolver().adaptTo(Session.class)); <END> final SearchResult result = query.getResult(); if (result.getTotalMatches() > 0) { if (log.isDebugEnabled()) { log.debug("Found matching Sling vanity path [ ] on [ ]", vanityPath, result.getHits().get(0).getPath()); } if (result.hasMore()) { log.warn("Found more than 1 resources that match the Sling vanity path [ ]", vanityPath); } return true; } else { log.debug("Could not find a resource with the Sling vanity path [ ]", vanityPath); } log.debug("Look-up of Sling vanity path [ ] took [ ] ms", vanityPath, System.currentTimeMillis() - start); return false; }</code><technical_language>If I understood correctly, this query is executed request (in error case). Is understanding correct? In case this a huge performance impact if this query is backed optimized Oak index</technical_language>

Target:
protected boolean isVanityPath(String pathScope, String vanityPath, SlingHttpServletRequest request) throws RepositoryException { final Resource vanityResource = request.getResourceResolver().resolve(vanityPath); if (vanityResource != null) { String targetPath = null; if (vanityResource.isResourceType("sling:redirect")) { targetPath = vanityResource.getValueMap().get("sling:target", String.class); } else if (!StringUtils.equals(vanityPath, vanityResource.getPath())) { targetPath = vanityResource.getPath(); } if (targetPath != null && StringUtils.startsWith(targetPath, StringUtils.defaultIfEmpty(pathScope, DEFAULT_PATH_SCOPE))) { log.debug("Found vanity resource at [ ] for sling:vanityPath [ ]", targetPath, vanityPath); return true; } } return false; }
Source:
<code>private void updateRngDevice() { if (getParameters().isUpdateRngDevice()) { VdcQueryReturnValue query = getBackend().runInternalQuery(VdcQueryType.GetRngDevice, new IdQueryParameters(getParameters().getVmId())); @SuppressWarnings("unchecked") List<VmRngDevice> rngDevs = query.getReturnValue(); VdcReturnValueBase rngCommandResult = null; if (rngDevs.isEmpty()) { if (getParameters().getRngDevice() != null) { RngDeviceParameters params = new RngDeviceParameters(getParameters().getRngDevice(), true); rngCommandResult = getBackend().runInternalAction(VdcActionType.AddRngDevice, params); } } else { if (getParameters().getRngDevice() == null) { RngDeviceParameters params = new RngDeviceParameters(rngDevs.get(0), true); rngCommandResult = getBackend().runInternalAction(VdcActionType.RemoveRngDevice, params); } else { RngDeviceParameters params = new RngDeviceParameters(getParameters().getRngDevice(), true); params.getRngDevice().setDeviceId(rngDevs.get(0).getDeviceId()); rngCommandResult = getBackend().runInternalAction(VdcActionType.UpdateRngDevice, params); } } if (rngCommandResult != null && !rngCommandResult.getSucceeded()) { <START> getReturnValue().setSucceeded(false); <END> } } }</code><technical_language>good set succeeded false, overridden of method, method return boolean check</technical_language>

Target:
private boolean updateRngDevice() { if (getParameters().isUpdateRngDevice()) { VdcQueryReturnValue query = getBackend().runInternalQuery(VdcQueryType.GetRngDevice, new IdQueryParameters(getParameters().getVmId())); @SuppressWarnings("unchecked") List<VmRngDevice> rngDevs = query.getReturnValue(); VdcReturnValueBase rngCommandResult = null; if (rngDevs.isEmpty()) { if (getParameters().getRngDevice() != null) { RngDeviceParameters params = new RngDeviceParameters(getParameters().getRngDevice(), true); rngCommandResult = getBackend().runInternalAction(VdcActionType.AddRngDevice, params); } } else { if (getParameters().getRngDevice() == null) { RngDeviceParameters params = new RngDeviceParameters(rngDevs.get(0), true); rngCommandResult = getBackend().runInternalAction(VdcActionType.RemoveRngDevice, params); } else { RngDeviceParameters params = new RngDeviceParameters(getParameters().getRngDevice(), true); params.getRngDevice().setDeviceId(rngDevs.get(0).getDeviceId()); rngCommandResult = getBackend().runInternalAction(VdcActionType.UpdateRngDevice, params); } } if (rngCommandResult != null && !rngCommandResult.getSucceeded()) { return false; } } return true; }
Source:
<code>public ServiceResponse<SolverInstanceList> getSolvers(String containerId) { checkMandatoryParameter( "ContainerID", containerId ); if( config.isRest() ) { String uri = getURI( containerId ); return makeHttpGetRequestAndCreateServiceResponse( uri, SolverInstanceList.class ); } else { <START> return null; <END> } }</code><technical_language>more meaningful throw UnsupportedOperationException null get people worried work while simply supported/implemented</technical_language>

Target:
public ServiceResponse<SolverInstanceList> getSolvers(String containerId) { checkMandatoryParameter( "ContainerID", containerId ); if( config.isRest() ) { String uri = getURI( containerId ); return makeHttpGetRequestAndCreateServiceResponse( uri, SolverInstanceList.class ); } else { throw new UnsupportedOperationException( "JMS is not supported at the moment." ); } }
Source:
<code>public String getNamespaceId(String namespaceName) { <START> String namespaceId = namespaces.get(namespaceName); <END> if (namespaceId == null) { log.debug("The namespaceId was not in the namespace map, need to fetch it from the OpenShift Master."); namespaceId = getProjectId(namespaceName); if (namespaceId != null) { namespaces.putIfAbsent(namespaceName, namespaceId); } } return namespaceId; }</code><technical_language>computeIfAbsent reduce multiple queries Kubernetes master, <LINK_0></technical_language>

Target:
public String getNamespaceId(String namespaceName) { return namespaces.computeIfAbsent(namespaceName, n -> getProjectId(namespaceName, token)); }
Source:
<code>public void revokeOffer_afterOneAcceptedIt() { final String offerToken = createOffer(user, "test", AccessLevel.WRITE, null); <START> final SyncUser user2 = UserFactory.createUniqueUser(); <END> final SyncUser user3 = UserFactory.createUniqueUser(); final PermissionManager pm1 = user.getPermissionManager(); final PermissionManager pm2 = user2.getPermissionManager(); final PermissionManager pm3 = user3.getPermissionManager(); looperThread.closeAfterTest(pm1); looperThread.closeAfterTest(pm2); looperThread.closeAfterTest(pm3); pm2.acceptOffer(offerToken, new PermissionManager.AcceptOfferCallback() { @Override public void onSuccess(String realmUrl, Permission permission) { pm1.revokeOffer(offerToken, new PermissionManager.RevokeOfferCallback() { @Override public void onSuccess() { pm3.acceptOffer(offerToken, new PermissionManager.AcceptOfferCallback() { @Override public void onSuccess(String realmUrl, Permission permission) { fail("Offer should have been revoked"); } @Override public void onError(ObjectServerError error) { assertEquals(ErrorCode.INVALID_PARAMETERS, error.getErrorCode()); looperThread.testComplete(); } }); } @Override public void onError(ObjectServerError error) { fail(error.toString()); } }); } @Override public void onError(ObjectServerError error) { fail(error.toString()); } }); }</code><technical_language>I missing something, this finality is unnecessary</technical_language>

Target:
public void revokeOffer_afterOneAcceptedIt() { final String offerToken = createOffer(user, "test", AccessLevel.WRITE, null); SyncUser user2 = UserFactory.createUniqueUser(); SyncUser user3 = UserFactory.createUniqueUser(); final PermissionManager pm1 = user.getPermissionManager(); PermissionManager pm2 = user2.getPermissionManager(); final PermissionManager pm3 = user3.getPermissionManager(); looperThread.closeAfterTest(pm1); looperThread.closeAfterTest(pm2); looperThread.closeAfterTest(pm3); pm2.acceptOffer(offerToken, new PermissionManager.AcceptOfferCallback() { @Override public void onSuccess(String realmUrl, Permission permission) { pm1.revokeOffer(offerToken, new PermissionManager.RevokeOfferCallback() { @Override public void onSuccess() { pm3.acceptOffer(offerToken, new PermissionManager.AcceptOfferCallback() { @Override public void onSuccess(String realmUrl, Permission permission) { fail("Offer should have been revoked"); } @Override public void onError(ObjectServerError error) { assertEquals(ErrorCode.INVALID_PARAMETERS, error.getErrorCode()); looperThread.testComplete(); } }); } @Override public void onError(ObjectServerError error) { fail(error.toString()); } }); } @Override public void onError(ObjectServerError error) { fail(error.toString()); } }); }
Source:
<code>private void sendToKafka(final String topic, MemoryBoundLinkedBlockingQueue<String> recordQueue, Callback callback) { ObjectContainer<String> objectToSend; try { while (true) { objectToSend = recordQueue.take(); producer.send(new ProducerRecord<>(topic, objectToSend.getData()), callback); } } <START> catch (InterruptedException e) { <END> log.warn(e, "Failed to take record from queue!"); } }</code><technical_language>suggestion catch (Throwable e) {</technical_language>

Target:
private void sendToKafka(final String topic, MemoryBoundLinkedBlockingQueue<String> recordQueue, Callback callback) { ObjectContainer<String> objectToSend; try { while (true) { objectToSend = recordQueue.take(); producer.send(new ProducerRecord<>(topic, objectToSend.getData()), callback); } } catch (Throwable e) { log.warn(e, "Exception while getting record from queue or producer send, Events would not be emitted anymore."); } }
Source:
<code>private void doAuthAction(@StringRes int messageId, String twoStepCode, boolean shouldSendTwoStepSMS) { if (!NetworkUtils.checkConnection(getActivity())) { return; } mInProgressMessageId = messageId; startProgress(); mOldSitesIDs = SiteUtils.getCurrentSiteIds(mSiteStore, false); if (isSocialLogin2fa && !shouldSendTwoStepSMS) { setAuthCodeTypeAndNonce(twoStepCode); <START> AccountStore.PushSocialAuthPayload payload = new AccountStore.PushSocialAuthPayload(mUserId, mType, mNonce, twoStepCode); <END> mDispatcher.dispatch(AccountActionBuilder.newPushSocialAuthAction(payload)); } else { AccountStore.AuthenticatePayload payload = new AccountStore.AuthenticatePayload(mEmailAddress, mPassword); payload.twoStepCode = twoStepCode; payload.shouldSendTwoStepSms = shouldSendTwoStepSMS; mDispatcher.dispatch(AuthenticationActionBuilder.newAuthenticateAction(payload)); } }</code><technical_language>limit this line 120chars. Thanks</technical_language>

Target:
private void doAuthAction(@StringRes int messageId, String twoStepCode, boolean shouldSendTwoStepSMS) { if (!NetworkUtils.checkConnection(getActivity())) { return; } mInProgressMessageId = messageId; startProgress(); mOldSitesIDs = SiteUtils.getCurrentSiteIds(mSiteStore, false); if (isSocialLogin && !shouldSendTwoStepSMS) { setAuthCodeTypeAndNonce(twoStepCode); AccountStore.PushSocialAuthPayload payload = new AccountStore.PushSocialAuthPayload(mUserId, mType, mNonce, twoStepCode); mDispatcher.dispatch(AccountActionBuilder.newPushSocialAuthAction(payload)); } else { AccountStore.AuthenticatePayload payload = new AccountStore.AuthenticatePayload(mEmailAddress, mPassword); payload.twoStepCode = twoStepCode; payload.shouldSendTwoStepSms = shouldSendTwoStepSMS; mDispatcher.dispatch(AuthenticationActionBuilder.newAuthenticateAction(payload)); } }
Source:
<code>private Flux<ServerSentEvent<String>> circuitBreakerStreamEvents(String s) { <START> WebClient client = WebClient.create("http://localhost:" + randomServerPort); <END> ParameterizedTypeReference<ServerSentEvent<String>> type = new ParameterizedTypeReference<ServerSentEvent<String>>() { }; Flux<ServerSentEvent<String>> eventStream = client.get() .uri(s) .accept(MediaType.TEXT_EVENT_STREAM) .retrieve() .bodyToFlux(type) .take(2); return eventStream; }</code><technical_language>Is WebTestClient here? is a guide WebTestClient for streaming responses: <LINK_0> please StepVerifier subscribe stream verify streams emits event</technical_language>

Target:
private Flux<ServerSentEvent<String>> circuitBreakerStreamEvents(String s) { Flux<ServerSentEvent<String>> eventStream = webStreamClient.get() .uri(s) .accept(MediaType.TEXT_EVENT_STREAM) .retrieve() .bodyToFlux(type) .take(2); return eventStream; }