auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>private boolean checkprop(String vcard, String prop) { String lines[] = vcard.split(SEPARATOR); boolean isPresent = false; for (String line : lines) { if (!Character.isWhitespace(line.charAt(0)) && !line.startsWith("=")) { String currentProp = line.split("[;:]")[0]; if (prop.equals(currentProp)) { <START> Log.e(TAG, <END> "bit.prop.equals current prop :" + prop); isPresent = true; return isPresent; } } } return isPresent; }</code><technical_language>Is this error</technical_language>

Target:
private boolean checkprop(String vcard, String prop) { String lines[] = vcard.split(SEPARATOR); boolean isPresent = false; for (String line : lines) { if (!Character.isWhitespace(line.charAt(0)) && !line.startsWith("=")) { String currentProp = line.split("[;:]")[0]; if (prop.equals(currentProp)) { Log.d(TAG, "bit.prop.equals current prop :" + prop); isPresent = true; return isPresent; } } } return isPresent; }
Source:
<code>public SegmentMetadataQuery withFinalizedAnalysisTypes(SegmentMetadataQueryConfig config) { <START> return Druids.SegmentMetadataQueryBuilder <END> .copy(this) .analysisTypes(com.google.common.base.Objects.firstNonNull(analysisTypes, config.getDefaultAnalysisTypes())) .build(); }</code><technical_language>create a new query object if analysisTypes non-null, return this</technical_language>

Target:
public SegmentMetadataQuery withFinalizedAnalysisTypes(SegmentMetadataQueryConfig config) { if (analysisTypes != null) { return this; } return Druids.SegmentMetadataQueryBuilder .copy(this) .analysisTypes(config.getDefaultAnalysisTypes()) .build(); }
Source:
<code>public OauthAuthenticationResult authenticate(HttpServletRequest httpRequest) { Assert.notNull(httpRequest, "httpRequest argument cannot be null."); Assert.isInstanceOf(javax.servlet.http.HttpServletRequest.class, httpRequest, "The specified httpRequest argument must be an instance of " + HTTP_SERVLET_REQUEST_FQCN); com.stormpath.sdk.impl.http.ServletHttpRequest stmpHttpRequest = new com.stormpath.sdk.impl.http.ServletHttpRequest(httpRequest); <START> return (OauthAuthenticationResult) Applications.oauthRequestAuthenticator(application).authenticate(stmpHttpRequest); <END> }</code><technical_language>casting is redundant</technical_language>

Target:
public OauthAuthenticationResult authenticate(HttpServletRequest httpRequest) { Assert.notNull(httpRequest, "httpRequest argument cannot be null."); Assert.isInstanceOf(javax.servlet.http.HttpServletRequest.class, httpRequest, "The specified httpRequest argument must be an instance of " + HTTP_SERVLET_REQUEST_FQCN); com.stormpath.sdk.impl.http.ServletHttpRequest stmpHttpRequest = new com.stormpath.sdk.impl.http.ServletHttpRequest(httpRequest); return Applications.oauthRequestAuthenticator(application).authenticate(stmpHttpRequest); }
Source:
<code>void fireChildRead(Http2Frame frame) { assert eventLoop().inEventLoop(); if (!isActive()) { ReferenceCountUtil.release(frame); } else { final RecvByteBufAllocator.Handle allocHandle = unsafe.recvBufAllocHandle(); flowControlledBytes += unsafe.doRead0(frame, allocHandle); if (allocHandle.continueReading()) { if (!readCompletePending) { readCompletePending = true; addChannelToReadCompletePendingQueue(); } } else { <START> unsafe.notifyReadComplete(allocHandle, true); <END> } } }</code><technical_language>essentially eager-reading, trigger read complete addChannelToReadCompletePendingQueue();? This avoid readComplete calls can. aside, care allocHandle.continueReading() this point, honestly this strategy</technical_language>

Target:
void fireChildRead(Http2Frame frame) { assert eventLoop().inEventLoop(); if (!isActive()) { ReferenceCountUtil.release(frame); } else { unsafe.doRead0(frame); if (!readCompletePending) { readCompletePending = true; addChannelToReadCompletePendingQueue(); } } }
Source:
<code><START> public void loadSymbols() throws IOException { <END> Section symbolsTableSection = null; Section dynamicSymbolSection = null; if (symbols == null) { Section section[] = getSections(Section.SHT_SYMTAB); if (section.length > 0) { symbolsTableSection = section[0]; symbolsTable = loadSymbolsBySection(section[0]); } else { symbolsTable = new Symbol[0]; } section = getSections(Section.SHT_DYNSYM); if (section.length > 0) { dynamicSymbolSection = section[0]; dynamicSymbols = loadSymbolsBySection(section[0]); } else { dynamicSymbols = new Symbol[0]; } if (symbolsTableSection != null) { symbols = symbolsTable; } else if (dynamicSymbolSection != null) { symbols = dynamicSymbols; } } }</code><technical_language>is wrong this method: 1) code duplication extracted another method 2) load tables 3) while assuming Section.SHT_SYMTAB a priority for some reason</technical_language>

Target:
public void loadSymbols() throws IOException { Section symbolsTableSection = null; Section dynamicSymbolSection = null; if (symbols == null) { Section section[] = getSections(Section.SHT_SYMTAB); if (section.length > 0) { symbolsTableSection = section[0]; symbolsTable = loadSymbolsBySection(section[0]); } else { symbolsTableSection = null; symbolsTable = new Symbol[0]; } section = getSections(Section.SHT_DYNSYM); if (section.length > 0) { dynamicSymbolSection = section[0]; dynamicSymbols = loadSymbolsBySection(section[0]); } else { dynamicSymbolSection = null; dynamicSymbols = new Symbol[0]; } if (symbolsTableSection != null) { symbols = symbolsTable; } else if (dynamicSymbolSection != null) { symbols = dynamicSymbols; } } }
Source:
<code>private void processResponseCookies(Map<String, List<String>> headerFields) { if (http.getCookieFile() != null && http.getSaveCookies()) { List<HttpCookie> foundCookies = new LinkedList<>(); <START> for (Map.Entry<String, List<String>> headerField : headerFields.entrySet()) { <END> if (headerField.getValue() == null || headerField.getValue().size() == 0) { continue; } if (headerField.getKey().equalsIgnoreCase(HDR_SET_COOKIE)) { foundCookies.addAll(processCookieHeader(HDR_SET_COOKIE, headerField.getValue())); } else if (headerField.getKey().equalsIgnoreCase(HDR_SET_COOKIE2)) { foundCookies.addAll(processCookieHeader(HDR_SET_COOKIE2, headerField.getValue())); } } if (foundCookies.size() > 0) { cookies.addAll(foundCookies); relevantCookies.addAll(foundCookies); try { NetscapeCookieFile.write(Paths.get(http.getCookieFile()), cookies, baseUrl, new Date()); } catch (IOException e) { LOG.warn("Could not persist received cookies.", e); } } } }</code><technical_language><LINK_0></technical_language>

Target:
private void processResponseCookies( Map<String, List<String>> headerFields) { if (http.getCookieFile() != null && http.getSaveCookies()) { List<HttpCookie> foundCookies = new LinkedList<>(); for (Map.Entry<String, List<String>> headerField : headerFields .entrySet()) { if (headerField.getValue() == null || headerField.getValue().size() == 0) { continue; } if (headerField.getKey().equalsIgnoreCase(HDR_SET_COOKIE)) { foundCookies.addAll(processCookieHeader(HDR_SET_COOKIE, headerField.getValue())); } else if (headerField.getKey() .equalsIgnoreCase(HDR_SET_COOKIE2)) { foundCookies.addAll(processCookieHeader(HDR_SET_COOKIE2, headerField.getValue())); } } if (foundCookies.size() > 0) { cookies.addAll(foundCookies); relevantCookies.addAll(foundCookies); try { NetscapeCookieFile.write(Paths.get(http.getCookieFile()), cookies, baseUrl, new Date()); } catch (IOException e) { LOG.warn(JGitText.get().couldNotPersistCookies, e); } } } }
Source:
<code>public Object createOrPropagate(Throwable t) throws Exception { if (checkNotNull(t, "throwable") != null && t.getMessage().contains("Could not find key") && <START> returnValueOnCodeOrNull(t, true, equalTo(404)) != null) { <END> return null; } throw propagate(t); }</code><technical_language>HttpUtils.contains404(t)</technical_language>

Target:
public Object createOrPropagate(Throwable t) throws Exception { if (checkNotNull(t, "throwable") != null && t.getMessage().contains("Key not found") && HttpUtils.contains404(t)) { return null; } throw propagate(t); }
Source:
<code>public boolean schemaExists() throws GoraException { boolean exists = false; try (Statement stmt = connection.createStatement()) { String tableExistsSQL = IgniteSQLBuilder.tableExists(igniteMapping.getTableName()); ResultSet executeQuery = stmt.executeQuery(tableExistsSQL); executeQuery.close(); exists = true; } catch (SQLException ex) { <START> if (ex.getSQLState() != null && ex.getSQLState().equals("42000")) { <END> exists = false; } else { throw new GoraException(ex); } } return exists; }</code><technical_language>move constants a separate constant file</technical_language>

Target:
public boolean schemaExists() throws GoraException { try (Statement stmt = connection.createStatement()) { String tableExistsSQL = IgniteSQLBuilder.tableExists(igniteMapping.getTableName()); ResultSet executeQuery = stmt.executeQuery(tableExistsSQL); executeQuery.close(); return true; } catch (SQLException ex) { if (ex.getSQLState() != null && ex.getSQLState().equals(IgniteBackendConstants.DEFAULT_IGNITE_TABLE_NOT_EXISTS_CODE)) { return false; } else { throw new GoraException(ex); } } }
Source:
<code>public void testAppDataMetaData() { Client client = generateClient(); Map<String, Object> app = client.getAppData().getAppDataMetaData(); <START> assertEquals(6, app.size()); <END> assertEquals("Bugsnag Android Tests", app.get("name")); assertEquals("com.bugsnag.android.test", app.get("packageName")); assertEquals("1.0", app.get("versionName")); assertNotNull(app.get("memoryUsage")); assertNotNull(app.get("lowMemory")); }</code><technical_language>is 6th item? assertion for that</technical_language>

Target:
public void testAppDataMetaData() { Client client = generateClient(); Map<String, Object> app = client.getAppData().getAppDataMetaData(); assertEquals(6, app.size()); assertEquals("Bugsnag Android Tests", app.get("name")); assertEquals("com.bugsnag.android.test", app.get("packageName")); assertEquals("1.0", app.get("versionName")); assertNotNull(app.get("memoryUsage")); assertTrue(app.containsKey("activeScreen")); assertNotNull(app.get("lowMemory")); }
Source:
<code>public HttpResponse doResourceBundle(StaplerRequest request) { String baseName = request.getParameter("baseName"); if (baseName == null) { return HttpResponses.errorJSON("Mandatory parameter 'baseName' not specified."); } String language = request.getParameter("language"); String country = request.getParameter("country"); String variant = request.getParameter("variant"); try { Locale locale = request.getLocale(); if (language != null && country != null && variant != null) { locale = new Locale(language, country, variant); } else if (language != null && country != null) { locale = new Locale(language, country); } else if (language != null) { locale = new Locale(language); } return HttpResponses.okJSON(ResourceBundleUtil.getBundle(baseName, locale)); } catch (MissingResourceException e) { return HttpResponses.errorJSON(e.getMessage(), HttpServletResponse.SC_NOT_FOUND); } catch (Exception e) { <START> return HttpResponses.errorJSON(e.getMessage(), HttpServletResponse.SC_INTERNAL_SERVER_ERROR); <END> } }</code><technical_language>I sense, strictly speaking is needed for fixing issue wrt loading bundles plugins, I missing something</technical_language>

Target:
public HttpResponse doResourceBundle(StaplerRequest request) { String baseName = request.getParameter("baseName"); if (baseName == null) { return HttpResponses.errorJSON("Mandatory parameter 'baseName' not specified."); } String language = request.getParameter("language"); String country = request.getParameter("country"); String variant = request.getParameter("variant"); try { Locale locale = request.getLocale(); if (language != null && country != null && variant != null) { locale = new Locale(language, country, variant); } else if (language != null && country != null) { locale = new Locale(language, country); } else if (language != null) { locale = new Locale(language); } return HttpResponses.okJSON(ResourceBundleUtil.getBundle(baseName, locale)); } catch (Exception e) { return HttpResponses.errorJSON(e.getMessage()); } }
Source:
<code>public static int getNeighborIndexAtFace(int pos, EnumFacing facing) { switch (facing) { case DOWN: if ((pos >> renderChunkSizeBit * 2 & renderChunkMaxPos) == 0) { return -1; } return pos - visGraphDY; case UP: if ((pos >> renderChunkSizeBit * 2 & renderChunkMaxPos) == renderChunkMaxPos) { return -1; } return pos + visGraphDY; case NORTH: if ((pos >> renderChunkSizeBit & renderChunkMaxPos) == 0) { return -1; } return pos - visGraphDZ; case SOUTH: if ((pos >> renderChunkSizeBit & renderChunkMaxPos) == renderChunkMaxPos) { return -1; } return pos + visGraphDZ; case WEST: if ((pos >> 0 & renderChunkMaxPos) == 0) { return -1; } return pos - visGraphDX; case EAST: if ((pos >> 0 & renderChunkMaxPos) == renderChunkMaxPos) { return -1; } <START> return pos + visGraphDX; <END> default: return -1; } }</code><technical_language>switch-case is awful... is move repeating code out of it</technical_language>

Target:
public static int getNeighborIndexAtFace(int pos, EnumFacing facing) { int x = pos & renderChunkMaxPos; int y = pos >> renderChunkSizeBit * 2 & renderChunkMaxPos; int z = pos >> renderChunkSizeBit & renderChunkMaxPos; switch (facing) { case DOWN: if (y == 0) return -1; return pos - visGraphDY; case UP: if (y == renderChunkMaxPos) return -1; return pos + visGraphDY; case NORTH: if (z == 0) return -1; return pos - visGraphDZ; case SOUTH: if (z == renderChunkMaxPos) return -1; return pos + visGraphDZ; case WEST: if (x == 0) return -1; return pos - visGraphDX; case EAST: if (x == renderChunkMaxPos) return -1; return pos + visGraphDX; default: return -1; } }
Source:
<code>public void testTableScanNodeSymbolMapping() { PlanBuilder builder = new PlanBuilder(new PlanNodeIdAllocator(), metadata); <START> Symbol custkey = builder.symbol("custkey", BIGINT); <END> Symbol orderkey = builder.symbol("orderkey", BIGINT); TableScanNode tableScanNode = builder.tableScan( new TableHandle( new ConnectorId("local"), new TpchTableHandle("local", "orders", TINY_SCALE_FACTOR)), ImmutableMap.of( custkey, new TpchColumnHandle(custkey.getName(), BIGINT), orderkey, new TpchColumnHandle(orderkey.getName(), BIGINT))); SymbolMapper symbolMapper = SymbolMapper.builder() .put(custkey, orderkey) .put(orderkey, A) .build(); TableScanNode mappedTopNNode = symbolMapper.map(tableScanNode); assertEquals(mappedTopNNode.getOutputSymbols(), singletonList(A)); }</code><technical_language>is overload PlanBuilder.symbol(String) defaults BIGINT</technical_language>

Target:
public void testTableScanNodeSymbolMapping() { PlanBuilder builder = new PlanBuilder(new PlanNodeIdAllocator(), metadata); Symbol custkey = builder.symbol("custkey"); Symbol orderkey = builder.symbol("orderkey"); TableScanNode tableScanNode = builder.tableScan( new TableHandle( new ConnectorId("local"), new TpchTableHandle("local", "orders", TINY_SCALE_FACTOR)), ImmutableList.of(custkey, orderkey), ImmutableMap.of( custkey, new TpchColumnHandle(custkey.getName(), BIGINT), orderkey, new TpchColumnHandle(orderkey.getName(), BIGINT)), custkey.toSymbolReference()); SymbolMapper symbolMapper = SymbolMapper.builder() .put(custkey, orderkey) .put(orderkey, A) .build(); TableScanNode mappedTopNNode = symbolMapper.map(tableScanNode); assertEquals(mappedTopNNode.getOutputSymbols(), singletonList(A)); assertEquals(mappedTopNNode.getOriginalConstraint(), A.toSymbolReference()); }
Source:
<code>public void shouldValidateOnBudgetTotalForTrueParam() { <START> configureParameterServiceForSuspensionCheck(new Boolean(true)); <END> assertTrue(suspensionCategory.shouldValidateOnBudgetTotal()); }</code><technical_language>alternatively Boolean.TRUE Boolean.FALSE for test case setups if needed</technical_language>

Target:
public void shouldValidateOnBudgetTotalForTrueParam() { configureParameterServiceForSuspensionCheck(Boolean.TRUE); assertTrue(suspensionCategory.shouldValidateOnBudgetTotal()); }
Source:
<code>protected void gatherOrderExprs( Blackboard bb, SqlSelect select, SqlNodeList orderList, List<SqlNode> extraOrderExprs, List<RelFieldCollation> collationList) { assert bb.root != null : "precondition: child != null"; assert select != null; if (orderList == null) { return; } if (!config.isKeepSortInSubQuery() && !bb.top) { <START> SqlNode offset = select.getOffset(); <END> if ((offset == null || (offset instanceof SqlLiteral && ((SqlLiteral) offset).bigDecimalValue() .equals(BigDecimal.ZERO))) && select.getFetch() == null) { return; } } for (SqlNode orderItem : orderList) { collationList.add( convertOrderItem(select, orderItem, extraOrderExprs, RelFieldCollation.Direction.ASCENDING, RelFieldCollation.NullDirection.UNSPECIFIED)); } }</code><technical_language>&& !bb.top removed</technical_language>

Target:
protected void gatherOrderExprs( Blackboard bb, SqlSelect select, SqlNodeList orderList, List<SqlNode> extraOrderExprs, List<RelFieldCollation> collationList) { assert bb.root != null : "precondition: child != null"; assert select != null; if (orderList == null) { return; } if (removeSortInSubquery(bb.top)) { SqlNode offset = select.getOffset(); if ((offset == null || (offset instanceof SqlLiteral && ((SqlLiteral) offset).bigDecimalValue() .equals(BigDecimal.ZERO))) && select.getFetch() == null) { return; } } for (SqlNode orderItem : orderList) { collationList.add( convertOrderItem(select, orderItem, extraOrderExprs, RelFieldCollation.Direction.ASCENDING, RelFieldCollation.NullDirection.UNSPECIFIED)); } }
Source:
<code>private void performPaymentWorksDisapprovalCancelProcessingForVendor(VendorDetail vendorDetail, String kfsDocumentNumber, String maintenanceAction) { if (isExistingPaymentWorksVendor(kfsDocumentNumber) && (isMaintenanceActionNewOrNewWithExisting(maintenanceAction))) { getPaymentWorksBatchUtilityService().registerKfsPvenDisapprovalForExistingPaymentWorksVendor(kfsDocumentNumber, vendorDetail); <START> } <END> }</code><technical_language>Is a plain "else" block needed log cases PaymentWorks processing is needed</technical_language>

Target:
private void performPaymentWorksDisapprovalCancelProcessingForVendor(VendorDetail vendorDetail, String kfsDocumentNumber, String maintenanceAction) { if (isExistingPaymentWorksVendor(kfsDocumentNumber) && (isMaintenanceActionNewOrNewWithExisting(maintenanceAction))) { getPaymentWorksBatchUtilityService().registerKfsPvenDisapprovalForExistingPaymentWorksVendor(kfsDocumentNumber, vendorDetail); } else { LOG.info("performPaymentWorksDisapprovalCancelProcessingForVendor: No PVEN Disapproval processing performed for PMW because not existing PMW vendor with maintenance action currently being tracked for PMW."); } }
Source:
<code>public void onNext(T t) { if (done) { return; } long i = index; UnicastProcessor<T> w = window; if (i == 0) { getAndIncrement(); w = UnicastProcessor.<T>create(bufferSize, this); window = w; actual.onNext(w); } i++; if (w != null) { w.onNext(t); } if (i == size) { window = null; <START> assert w != null; <END> w.onComplete(); } if (i == skip) { index = 0; } else { index = i; } }</code><technical_language>Please remove asserts</technical_language>

Target:
public void onNext(T t) { if (done) { return; } long i = index; UnicastProcessor<T> w = window; if (i == 0) { getAndIncrement(); w = UnicastProcessor.<T>create(bufferSize, this); window = w; actual.onNext(w); } i++; if (w != null) { w.onNext(t); } if (i == size) { window = null; w.onComplete(); } if (i == skip) { index = 0; } else { index = i; } }
Source:
<code>public static SimplePriceIndexValues of( PriceIndex index, LocalDate valuationDate, NodalCurve curve, LocalDateDoubleTimeSeries fixings, DoubleArray seasonality) { <START> ArgChecker.isFalse(curve instanceof SeasonalNodalCurve, "curve shoudl not be adjusted twice for seasonality"); <END> YearMonth lastMonth = YearMonth.from(fixings.getLatestDate()); double nbMonth = YearMonth.from(valuationDate).until(lastMonth, MONTHS); DoubleArray x = curve.getXValues(); ArgChecker.isTrue(nbMonth < x.get(0), "The first estimation month should be after the last known index fixing"); SeasonalNodalCurve seasonalCurve = SeasonalNodalCurve .of(curve, valuationDate, lastMonth, nbMonth, SeasonalityDefinition.of(seasonality, ShiftType.SCALED)); return new SimplePriceIndexValues(index, valuationDate, seasonalCurve, fixings, seasonality); }</code><technical_language>Spelling</technical_language>

Target:
public static SimplePriceIndexValues of( PriceIndex index, LocalDate valuationDate, NodalCurve curve, LocalDateDoubleTimeSeries fixings, DoubleArray seasonality) { ArgChecker.isFalse(curve instanceof InflationNodalCurve, "Curve cannot be adjusted twice for seasonality"); YearMonth lastMonth = YearMonth.from(fixings.getLatestDate()); double nbMonth = YearMonth.from(valuationDate).until(lastMonth, MONTHS); DoubleArray x = curve.getXValues(); ArgChecker.isTrue(nbMonth < x.get(0), "The first estimation month should be after the last known index fixing"); InflationNodalCurve seasonalCurve = InflationNodalCurve.of( curve, valuationDate, lastMonth, nbMonth, SeasonalityDefinition.of(seasonality, ShiftType.SCALED)); return new SimplePriceIndexValues(index, valuationDate, seasonalCurve, fixings, seasonality); }
Source:
<code>public MeasurementFilter getDefaultMeasurementFilter() throws IOException { if (defaultMeasurementFilter != null) { return defaultMeasurementFilter; } if (!prototypeFilterPath.isEmpty()) { defaultMeasurementFilter = PrototypeMeasurementFilter.loadFromPath( prototypeFilterPath); } else { defaultMeasurementFilter = new TagMeasurementFilter( meterNameRegex, tagNameRegex, tagValueRegex); <START> } <END> return defaultMeasurementFilter; }</code><technical_language>FYI, for internal plugins do similar a single property sets a filter expression. expression is query portion of Atlas stack language: <LINK_0> main reason is regex is hard precisely target dimensional ids. filters exclude is easier for a user express in addition should. Atlas expression familiar users this is targeting , I is worth considering cumbersome regexes for expressing common filters</technical_language>

Target:
public Predicate<Measurement> getDefaultMeasurementFilter() throws IOException { if (defaultMeasurementFilter != null) { return defaultMeasurementFilter; } if (!prototypeFilterPath.isEmpty()) { defaultMeasurementFilter = PrototypeMeasurementFilter.loadFromPath( prototypeFilterPath); } else { defaultMeasurementFilter = ALL_MEASUREMENTS_FILTER; } return defaultMeasurementFilter; }
Source:
<code><T> T clientSetup(Function<HttpPipeline, T> clientBuilder) { TokenCredential credential; if (interceptorManager.isPlaybackMode()) { credential = resource -> Mono.just(new AccessToken("Some fake token", OffsetDateTime.now(ZoneOffset.UTC).plus(Duration.ofMinutes(30)))); } else { credential = new DefaultAzureCredentialBuilder().build(); } HttpClient httpClient; final List<HttpPipelinePolicy> policies = new ArrayList<>(); <START> policies.add(new UserAgentPolicy(null, AzureKeyVaultConfiguration.SDK_NAME, AzureKeyVaultConfiguration.SDK_VERSION, Configuration.getGlobalConfiguration().clone(), SecretServiceVersion.getLatest())); <END> HttpPolicyProviders.addBeforeRetryPolicies(policies); policies.add(new RetryPolicy()); policies.add(new BearerTokenAuthenticationPolicy(credential, SecretAsyncClient.KEY_VAULT_SCOPE)); policies.addAll(policies); HttpPolicyProviders.addAfterRetryPolicies(policies); policies.add(new HttpLoggingPolicy(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BODY_AND_HEADERS))); if (interceptorManager.isPlaybackMode()) { httpClient = interceptorManager.getPlaybackClient(); policies.add(interceptorManager.getRecordPolicy()); } else { httpClient = new NettyAsyncHttpClientBuilder().wiretap(true).build(); policies.add(interceptorManager.getRecordPolicy()); } HttpPipeline pipeline = new HttpPipelineBuilder() .policies(policies.toArray(new HttpPipelinePolicy[0])) .httpClient(httpClient) .build(); T client; client = clientBuilder.apply(pipeline); return Objects.requireNonNull(client); }</code><technical_language>leave this code was, you</technical_language>

Target:
<T> T clientSetup(Function<HttpPipeline, T> clientBuilder) { TokenCredential credential; if (interceptorManager.isPlaybackMode()) { credential = resource -> Mono.just(new AccessToken("Some fake token", OffsetDateTime.now(ZoneOffset.UTC).plus(Duration.ofMinutes(30)))); } else { credential = new DefaultAzureCredentialBuilder().build(); } HttpClient httpClient; final List<HttpPipelinePolicy> policies = new ArrayList<>(); policies.add(new UserAgentPolicy(AzureKeyVaultConfiguration.SDK_NAME, AzureKeyVaultConfiguration.SDK_VERSION, Configuration.getGlobalConfiguration().clone(), SecretServiceVersion.getLatest())); HttpPolicyProviders.addBeforeRetryPolicies(policies); policies.add(new RetryPolicy()); policies.add(new BearerTokenAuthenticationPolicy(credential, SecretAsyncClient.KEY_VAULT_SCOPE)); policies.addAll(policies); HttpPolicyProviders.addAfterRetryPolicies(policies); policies.add(new HttpLoggingPolicy(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BODY_AND_HEADERS))); if (interceptorManager.isPlaybackMode()) { httpClient = interceptorManager.getPlaybackClient(); policies.add(interceptorManager.getRecordPolicy()); } else { httpClient = new NettyAsyncHttpClientBuilder().wiretap(true).build(); policies.add(interceptorManager.getRecordPolicy()); } HttpPipeline pipeline = new HttpPipelineBuilder() .policies(policies.toArray(new HttpPipelinePolicy[0])) .httpClient(httpClient) .build(); T client; client = clientBuilder.apply(pipeline); return Objects.requireNonNull(client); }
Source:
<code>public void testGetLowerUnboundSplits() throws Throwable { long ts = nextTimestamp(); initTableValues(ts); String url = getUrl() + ";" + PhoenixRuntime.CURRENT_SCN_ATTRIB + "=" + ts; Properties props = PropertiesUtil.deepCopy(TEST_PROPERTIES); Connection conn = DriverManager.getConnection(url, props); PreparedStatement stmt = conn.prepareStatement("ANALYZE STABLE"); stmt.execute(); conn.close(); conn = DriverManager.getConnection(url, props); conn.createStatement().executeQuery("SELECT * FROM STABLE"); Scan scan = new Scan(); scan.setStartRow(HConstants.EMPTY_START_ROW); scan.setStopRow(K1); List<KeyRange> keyRanges = getSplits(conn, ts, scan); <START> assertEquals("Unexpected number of splits: " + keyRanges, 1, keyRanges.size()); <END> }</code><technical_language>assert guidepost byte[] here</technical_language>

Target:
public void testGetLowerUnboundSplits() throws Throwable { long ts = nextTimestamp(); initTableValues(ts); String url = getUrl() + ";" + PhoenixRuntime.CURRENT_SCN_ATTRIB; Properties props = PropertiesUtil.deepCopy(TEST_PROPERTIES); Connection conn = DriverManager.getConnection(url, props); PreparedStatement stmt = conn.prepareStatement("ANALYZE STABLE"); stmt.execute(); conn.createStatement().executeQuery("SELECT * FROM STABLE"); conn.close(); Scan scan = new Scan(); scan.setStartRow(HConstants.EMPTY_START_ROW); scan.setStopRow(K1); List<KeyRange> keyRanges = getSplits(conn, ts, scan); assertEquals("Unexpected number of splits: " + keyRanges, 2, keyRanges.size()); assertEquals(newKeyRange(KeyRange.UNBOUND, KMIN), keyRanges.get(0)); assertEquals(newKeyRange(KMIN, K3), keyRanges.get(1)); }
Source:
<code>private void removeInvalidRefs() { LOG.debug("removeInvalidRefs()"); ArrayList<WeakReference<PluginRepository>> copy = new ArrayList<>(prs); for(WeakReference<PluginRepository> ref: copy) { if(ref.get() == null) { prs.remove(ref); } } <START> LOG.debug("removed "+(copy.size()-prs.size())+" references, remaining "+prs.size()); <END> }</code><technical_language>Parameterized logging</technical_language>

Target:
private void removeInvalidRefs() { LOG.debug("removeInvalidRefs()"); ArrayList<WeakReference<PluginRepository>> copy = new ArrayList<>(prs); for(WeakReference<PluginRepository> ref: copy) { if(ref.get() == null) { prs.remove(ref); } } LOG.debug("removed references, remaining {}", copy.size()-prs.size(), prs.size()); }
Source:
<code>public void install() { final VDS host = getSelectedItem(); InstallModel model = new InstallModel(); model.setVds(host); setWindow(model); model.setTitle(ConstantsManager.getInstance().getConstants().installHostTitle()); model.setHelpTag(HelpTag.install_host); model.setHashName("install_host"); model.getOVirtISO().setIsAvailable(false); model.getOverrideIpTables().setIsAvailable(false); model.getHostVersion().setEntity(host.getHostOs()); model.getHostVersion().setIsAvailable(false); getWindow().startProgress(); model.getUserPassword().setIsAvailable(true); model.getUserPassword().setIsChangeable(true); model.getOverrideIpTables().setIsAvailable(true); model.getOverrideIpTables().setEntity(true); model.getActivateHostAfterInstall().setEntity(true); if(host.getClusterSupportsGlusterService()) { model.getReconfigureGluster().setIsAvailable(true); } else { model.getReconfigureGluster().setIsAvailable(false); } <START> model.getReconfigureGluster().setEntity(model.getReconfigureGluster().getEntity()); <END> addInstallCommands(model, host, false); getWindow().stopProgress(); }</code><technical_language>setting - set some default other fields? e.g model.getReconfigureGluster().setEntity(true);</technical_language>

Target:
public void install() { final VDS host = getSelectedItem(); InstallModel model = new InstallModel(); model.setVds(host); setWindow(model); model.setTitle(ConstantsManager.getInstance().getConstants().installHostTitle()); model.setHelpTag(HelpTag.install_host); model.setHashName("install_host"); model.getOVirtISO().setIsAvailable(false); model.getOverrideIpTables().setIsAvailable(false); model.getHostVersion().setEntity(host.getHostOs()); model.getHostVersion().setIsAvailable(false); getWindow().startProgress(); model.getUserPassword().setIsAvailable(true); model.getUserPassword().setIsChangeable(true); model.getOverrideIpTables().setIsAvailable(true); model.getOverrideIpTables().setEntity(true); model.getActivateHostAfterInstall().setEntity(true); if(host.getClusterSupportsGlusterService()) { model.getReconfigureGluster().setIsAvailable(true); } else { model.getReconfigureGluster().setIsAvailable(false); } addInstallCommands(model, host, false); getWindow().stopProgress(); }
Source:
<code>protected IValidationError decorate(IValidationError error, IValidatable<Date> validatable) { error = super.decorate(error, validatable); if (error instanceof ValidationError) { ValidationError ve = (ValidationError) error; ve.setVariable("inputdate", validatable.getValue()); if (format != null) { <START> WebSession session = WebSession.get(); <END> Locale locale = session.getLocale(); if (locale == null) { locale = Locale.getDefault(Locale.Category.FORMAT); } SimpleDateFormat sdf = new SimpleDateFormat(format, locale); if (getMinimum() != null) { ve.setVariable("minimum", sdf.format(getMinimum())); } if (getMaximum() != null) { ve.setVariable("maximum", sdf.format(getMaximum())); } ve.setVariable("inputdate", sdf.format(validatable.getValue())); } } return error; }</code><technical_language>check is a Session if (Session.exists()) { ... } Session.get() create a new one</technical_language>

Target:
protected IValidationError decorate(IValidationError error, IValidatable<Date> validatable) { error = super.decorate(error, validatable); if (error instanceof ValidationError) { ValidationError ve = (ValidationError) error; ve.setVariable("inputdate", validatable.getValue()); if (format != null) { Locale locale; if (Session.exists()) { Session session = Session.get(); locale = session.getLocale(); if (locale == null) { locale = Locale.getDefault(Locale.Category.FORMAT); } } else { locale = Locale.getDefault(Locale.Category.FORMAT); } SimpleDateFormat sdf = new SimpleDateFormat(format, locale); if (getMinimum() != null) { ve.setVariable("minimum", sdf.format(getMinimum())); } if (getMaximum() != null) { ve.setVariable("maximum", sdf.format(getMaximum())); } ve.setVariable("inputdate", sdf.format(validatable.getValue())); } } return error; }
Source:
<code>public void publishSegment(DataSegment segment) throws IOException { if (taskToolbox.getTaskActionClient().submit(new SetLockCriticalStateAction(segment.getInterval(), TaskLockCriticalState.UPGRADE))) { taskToolbox.publishSegments(ImmutableList.of(segment)); } else { throw new ISE( "WTF?! Lock upgrade failed for interval [%s] for RealtimeIndex Task !! This is really bad !! Is there a higher priority task running ?", segment.getInterval() <START> ); <END> } }</code><technical_language>is lock downgraded/released in this case ?</technical_language>

Target:
public void publishSegment(DataSegment segment) throws IOException { if (taskToolbox.getTaskActionClient().submit(new SetLockCriticalStateAction(segment.getInterval(), TaskLockCriticalState.UPGRADE))) { taskToolbox.publishSegments(ImmutableList.of(segment)); } else { throw new ISE( "WTF?! Lock upgrade failed for interval [%s] ! Is there a higher priority task running ?", segment.getInterval() ); } }
Source:
<code>public boolean setLeashHolder(Entity holder) { <START> if (this instanceof EnderDragon || this instanceof Wither || this instanceof Player || this instanceof Bat) { <END> return false; } if (this.leashHolder != null) { this.leashHolder.leashedEntities.remove(this); } if (holder == null) { this.leashHolder = null; leashHolderChanged = true; return true; } if (holder.isDead()) { return false; } this.leashHolder = (GlowEntity) holder; this.leashHolder.leashedEntities.add(this); leashHolderChanged = true; return true; }</code><technical_language>getType() instead</technical_language>

Target:
public boolean setLeashHolder(Entity holder) { if (!GlowLeashHitch.isAllowedLeashHolder(this.getType())) { return false; } if (this.leashHolder != null) { this.leashHolder.leashedEntities.remove(this); } if (holder == null) { this.leashHolder = null; leashHolderChanged = true; return true; } if (holder.isDead()) { return false; } this.leashHolder = (GlowEntity) holder; this.leashHolder.leashedEntities.add(this); leashHolderChanged = true; return true; }
Source:
<code>public CompletableFuture<Void> shutdownDispatching() { <START> return shutdownLatch.await(); <END> }</code><technical_language>Rename suggestion: 'initiateShutdown'. await is misleading, wait (which is a good thing)</technical_language>

Target:
public CompletableFuture<Void> shutdownDispatching() { commandProcessor.removeLocalSubscriptions(); return shutdownLatch.initiateShutdown(); }
Source:
<code>public void postOpen(final ObserverContext<RegionCoprocessorEnvironment> c) { if (this.disabled) { super.postOpen(c); return; } if (this.stopped) { <START> initBuilderAndWriter(c.getEnvironment()); <END> } long start = EnvironmentEdgeManager.currentTimeMillis(); Multimap<HTableInterfaceReference, Mutation> updates = failedIndexEdits.getEdits(c.getEnvironment().getRegion()); try { if (updates == null || updates.size() == 0) { return; } LOGGER.info("Found some outstanding index updates that didn't succeed during" + " WAL replay - attempting to replay now."); try { writer.writeAndHandleFailure(updates, true, ScanUtil.UNKNOWN_CLIENT_VERSION); } catch (IOException e) { LOGGER.error("During WAL replay of outstanding index updates, " + "Exception is thrown instead of killing server during index writing", e); } } finally { long duration = EnvironmentEdgeManager.currentTimeMillis() - start; if (duration >= slowPostOpenThreshold) { if (LOGGER.isDebugEnabled()) { LOGGER.debug(getCallTooSlowMessage("postOpen", duration, slowPostOpenThreshold)); } metricSource.incrementNumSlowPostOpenCalls(); } metricSource.updatePostOpenTime(duration); } }</code><technical_language>This re-enable a stopped indexer. I guess some cases want this</technical_language>

Target:
public void postOpen(final ObserverContext<RegionCoprocessorEnvironment> c) { if (this.disabled) { super.postOpen(c); return; } if (this.stopped) { try { initBuilderAndWriter(c.getEnvironment()); } catch (IOException e) { LOG.error("Init builder and writer failed", e); } } long start = EnvironmentEdgeManager.currentTimeMillis(); Multimap<HTableInterfaceReference, Mutation> updates = failedIndexEdits.getEdits(c.getEnvironment().getRegion()); try { if (updates == null || updates.size() == 0) { return; } LOGGER.info("Found some outstanding index updates that didn't succeed during" + " WAL replay - attempting to replay now."); try { writer.writeAndHandleFailure(updates, true, ScanUtil.UNKNOWN_CLIENT_VERSION); } catch (IOException e) { LOGGER.error("During WAL replay of outstanding index updates, " + "Exception is thrown instead of killing server during index writing", e); } } finally { long duration = EnvironmentEdgeManager.currentTimeMillis() - start; if (duration >= slowPostOpenThreshold) { if (LOGGER.isDebugEnabled()) { LOGGER.debug(getCallTooSlowMessage("postOpen", duration, slowPostOpenThreshold)); } metricSource.incrementNumSlowPostOpenCalls(); } metricSource.updatePostOpenTime(duration); } }
Source:
<code>protected boolean canDoAction() { String sshPublicKey = getParameters().getUserProfile().getSshPublicKey(); if (sshPublicKey == null || sshPublicKey.isEmpty()) { log.info("Provided SSH key for user '{}'", <START> (sshPublicKey == null) ?"null" :"empty", <END> getUserId().toString()); return true; } if (!OpenSSHUtils.isPublicKeyValid(sshPublicKey)) { log.warn("Provided invalid SSH key for user '{}'", getUserId().toString()); return failCanDoAction(VdcBllMessages.ACTION_TYPE_FAILED_INVALID_PUBLIC_SSH_KEY); } log.info("Provided valid SSH key for user '{}'", getUserId().toString()); return true; }</code><technical_language>is real reason log this, i think, is a log for commands execution audit logs if this (and others below) please change debug</technical_language>

Target:
protected boolean canDoAction() { String sshPublicKey = getParameters().getUserProfile().getSshPublicKey(); if (sshPublicKey == null || sshPublicKey.isEmpty()) { return true; } if (!OpenSSHUtils.isPublicKeyValid(sshPublicKey)) { return failCanDoAction(VdcBllMessages.ACTION_TYPE_FAILED_INVALID_PUBLIC_SSH_KEY); } return true; }
Source:
<code>public void handlePut(ActionParameters params) throws ActionException { checkForAdminPermission(params); final MaplayerGroup maplayerGroup = new MaplayerGroup(); <START> populateFromRequest(params, maplayerGroup); <END> final int id = oskariMapLayerGroupService.insert(maplayerGroup); final MaplayerGroup savedMapLayerGroup = oskariMapLayerGroupService.find(id); ResponseHelper.writeResponse(params, savedMapLayerGroup.getAsJSON()); }</code><technical_language>Instead of passing maplayerGroup a parameter populateFromRequest create function return it</technical_language>

Target:
public void handlePut(ActionParameters params) throws ActionException { params.requireAdminUser(); MaplayerGroup maplayerGroup = populateFromRequest(params.getPayLoadJSON()); if(!isAllowedGroupDepth(maplayerGroup)) { throw new ActionParamsException("Maximum group depth is 3"); } final int id = oskariMapLayerGroupService.insert(maplayerGroup); final MaplayerGroup savedMapLayerGroup = oskariMapLayerGroupService.find(id); ResponseHelper.writeResponse(params, savedMapLayerGroup.getAsJSON()); }
Source:
<code>public void testCompletionPerPrefixFirstChar() { for (ContentProposal prefix : availablePrefixes) { String firstChar = prefix.getProposal().substring(0, 1); List<ContentProposal> proposals = getProposals(firstChar); ContentProposalConverter converter = new ContentProposalConverter(firstChar); assertEquals("Proposals should contains only one proposal", 1, proposals.size()); assertTrue("Proposals should be contained by available prefixes", availablePrefixes.containsAll(proposals)); <START> <END> for (ContentProposal proposal : proposals) { IContentProposal jfaceProposal = converter.convertToJFaceContentProposal(proposal); assertEquals("", proposal.getProposal(), firstChar + jfaceProposal.getContent()); assertEquals("JFace proposal cursor position is not well computed", proposal.getCursorPosition() - (proposal.getProposal().length() - jfaceProposal.getContent().length()), jfaceProposal.getCursorPosition()); } } }</code><technical_language>check is proposal, write a for explicitely element</technical_language>

Target:
public void testCompletionPerPrefixFirstChar() { for (ContentProposal emptyExpression : availableEmptyExpressions) { String firstChar = emptyExpression.getProposal().substring(0, 1); List<ContentProposal> proposals = getProposals(firstChar); ContentProposalConverter converter = new ContentProposalConverter(firstChar); assertEquals("Proposals should contains only one proposal", 1, proposals.size()); assertTrue("Proposals should be contained by available empty expressions", availableEmptyExpressions.containsAll(proposals)); ContentProposal proposal = proposals.get(0); IContentProposal jfaceProposal = converter.convertToJFaceContentProposal(proposal); assertEquals("", proposal.getProposal(), firstChar + jfaceProposal.getContent()); assertEquals("JFace proposal cursor position is not well computed", proposal.getCursorPosition() - (proposal.getProposal().length() - jfaceProposal.getContent().length()), jfaceProposal.getCursorPosition()); } }
Source:
<code>public void observePIP(@Observes ProcessInjectionPoint<PoorWorker, String> pip) { <START> listOfProducerEvents.add(pip); <END> }</code><technical_language>of [ActionSequence](<LINK_0> store class information avoid this instanceof check</technical_language>

Target:
public void observePIP(@Observes ProcessInjectionPoint<PoorWorker, String> pip) { ActionSequence.addAction(PRODUCER_SEQ, "PIP"); }
Source:
<code>public void execute(JobExecutionContext context) throws JobExecutionException { Logger.debug(this, "Running UsersToDeleteThread - " + new Date()); try { run(); } finally { try { HibernateUtil.closeSession(); } catch (DotHibernateException e) { <START> Logger.warn(this, e.getMessage(), e); <END> } } }</code><technical_language>Remove entire wrapper finally block</technical_language>

Target:
public void execute(JobExecutionContext context) throws JobExecutionException { Logger.debug(this, "Running UsersToDeleteThread - " + new Date()); run(); }
Source:
<code>private void fillInMetadata(DepositMetadata depositMetadata, Workflow workflow, WorkflowVersion workflowVersion) { depositMetadata.setTitle(workflow.getWorkflowPath()); depositMetadata.setUploadType(DepositMetadata.UploadTypeEnum.SOFTWARE); String description = workflow.getDescription(); String descriptionStr = (description == null || description.isEmpty()) ? "no description" : workflow.getDescription(); depositMetadata.setDescription(descriptionStr); DepositMetadata.AccessRightEnum accessRight = (depositMetadata.getAccessRight() == null) ? DepositMetadata.AccessRightEnum.OPEN : depositMetadata.getAccessRight(); depositMetadata.setAccessRight(accessRight); if (accessRight == DepositMetadata.AccessRightEnum.OPEN || accessRight == DepositMetadata.AccessRightEnum.EMBARGOED) { <START> String license = (depositMetadata.getLicense() == null || depositMetadata.getLicense().isEmpty()) <END> ? "CC-BY-4.0" : depositMetadata.getLicense(); depositMetadata.setLicense(license); } depositMetadata.setVersion(workflowVersion.getName()); setMetadataKeywords(depositMetadata, workflow); setMetadataRelatedIdentifiers(depositMetadata, workflow); setMetadataCreator(depositMetadata, workflow); setMetadataPublicationDate(depositMetadata, workflowVersion); setMetadataCommunities(depositMetadata); }</code><technical_language>simplify this line StringUtils.isEmpty(depositMetadata.getLicense())</technical_language>

Target:
private void fillInMetadata(DepositMetadata depositMetadata, Workflow workflow, WorkflowVersion workflowVersion) { depositMetadata.setTitle(workflow.getWorkflowPath()); depositMetadata.setUploadType(DepositMetadata.UploadTypeEnum.SOFTWARE); String description = workflow.getDescription(); String descriptionStr = (description == null || description.isEmpty()) ? "no description" : workflow.getDescription(); depositMetadata.setDescription(descriptionStr); depositMetadata.setVersion(workflowVersion.getName()); setMetadataKeywords(depositMetadata, workflow); setMetadataRelatedIdentifiers(depositMetadata, workflow); setMetadataCreator(depositMetadata, workflow); setMetadataPublicationDate(depositMetadata, workflowVersion); setMetadataCommunities(depositMetadata); }
Source:
<code>private SerializedValue getSerializedValue(RestAction<?> action, Object object) throws ActionException { String bodyClass = action.getBodyClass(); <START> List<String> contentTypes = action.getClientProducedContentTypes(); <END> if (bodyClass != null) { Serialization serialization = findSerialization(bodyClass, contentTypes); if (serialization != null) { return serialize(serialization, object, bodyClass, contentTypes); } } throw new ActionException("Unable to serialize request body. No serializer found."); }</code><technical_language>move this line 121 122</technical_language>

Target:
private SerializedValue getSerializedValue(RestAction<?> action, Object object) throws ActionException { String bodyClass = action.getBodyClass(); if (bodyClass != null) { List<ContentType> contentTypes = action.getClientProducedContentTypes(); Serialization serialization = findSerialization(bodyClass, contentTypes); if (serialization != null) { return serialize(serialization, object, bodyClass, contentTypes); } } throw new ActionException("Unable to serialize request body. No serializer found."); }
Source:
<code>public ExternalDatabaseStatus getStatus(AuthenticatedContext ac, DatabaseStack dbStack) { AwsCredentialView credentialView = new AwsCredentialView(ac.getCloudCredential()); String regionName = ac.getCloudContext().getLocation().getRegion().value(); AmazonRDS rdsClient = awsClient.createRdsClient(credentialView, regionName); String dbInstanceIdentifier = dbStack.getDatabaseServer().getServerId(); DescribeDBInstancesRequest describeDBInstancesRequest = new DescribeDBInstancesRequest().withDBInstanceIdentifier(dbInstanceIdentifier); DescribeDBInstancesResult describeDBInstancesResult; try { describeDBInstancesResult = rdsClient.describeDBInstances(describeDBInstancesRequest); } catch (DBInstanceNotFoundException ex) { <START> LOGGER.debug("DB Instance does not exists: {}", ex.getMessage()); <END> return ExternalDatabaseStatus.DELETED; } catch (RuntimeException ex) { throw new CloudConnectorException(ex.getMessage(), ex); } return describeDBInstancesResult.getDBInstances() .stream() .map(i -> getExternalDatabaseStatus(i.getDBInstanceStatus())) .findFirst() .get(); }</code><technical_language>typo: exists => exist</technical_language>

Target:
public ExternalDatabaseStatus getStatus(AuthenticatedContext ac, DatabaseStack dbStack) { AwsCredentialView credentialView = new AwsCredentialView(ac.getCloudCredential()); String regionName = ac.getCloudContext().getLocation().getRegion().value(); AmazonRDS rdsClient = awsClient.createRdsClient(credentialView, regionName); String dbInstanceIdentifier = dbStack.getDatabaseServer().getServerId(); DescribeDBInstancesRequest describeDBInstancesRequest = new DescribeDBInstancesRequest().withDBInstanceIdentifier(dbInstanceIdentifier); DescribeDBInstancesResult describeDBInstancesResult; try { describeDBInstancesResult = rdsClient.describeDBInstances(describeDBInstancesRequest); } catch (DBInstanceNotFoundException ex) { LOGGER.debug("DB Instance does not exist: {}", ex.getMessage()); return ExternalDatabaseStatus.DELETED; } catch (RuntimeException ex) { throw new CloudConnectorException(ex.getMessage(), ex); } return describeDBInstancesResult.getDBInstances() .stream() .map(i -> getExternalDatabaseStatus(i.getDBInstanceStatus())) .findFirst() .get(); }