auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public Resource getConfigFile(String profile, String label, String path) { Assert.isTrue( configClientProperties.getName() != null && !configClientProperties.getName().isEmpty(), "Spring application name is undefined."); Assert.isTrue( <START> configClientProperties.getUri().length > 0 && <END> configClientProperties.getUri()[0] != null && !configClientProperties.getUri()[0].isEmpty(), "Config server URI is undefined."); if (profile == null) { profile = configClientProperties.getProfile(); if (profile == null || profile.isEmpty()) { profile = "default"; } } if (label == null) { label = configClientProperties.getLabel(); } String url = configClientProperties.getUri()[0] + "/" + configClientProperties.getName() + "/" + profile + "/" + (label == null ? path + "?useDefaultLabel" : label + "/" + path); ResponseEntity<Resource> forEntity = restTemplate.getForEntity(url, Resource.class); return forEntity.getBody(); }</code><technical_language>Consider Assert.notEmpty() and/or Assert.hasText() instead of checks in isTrue block. Otherwise, wrong this. this a cleaner: Assert.notEmpty(configClientProperties.getUri(), "Config server URI is undefined"); Assert.hasText(configClientProperties.getUri()[0], "Config server URI is undefined.");</technical_language>

Target:
public Resource getConfigFile(String profile, String label, String path) { Assert.isTrue( configClientProperties.getName() != null && !configClientProperties.getName().isEmpty(), "Spring application name is undefined."); Assert.notEmpty(configClientProperties.getUri(), "Config server URI is undefined"); Assert.hasText(configClientProperties.getUri()[0], "Config server URI is undefined."); if (profile == null) { profile = configClientProperties.getProfile(); if (profile == null || profile.isEmpty()) { profile = "default"; } } if (label == null) { label = configClientProperties.getLabel(); } String url = configClientProperties.getUri()[0] + "/" + configClientProperties.getName() + "/" + profile + "/" + (label == null ? path + "?useDefaultLabel" : label + "/" + path); ResponseEntity<Resource> forEntity = restTemplate.getForEntity(url, Resource.class); return forEntity.getBody(); }
Source:
<code>public GeocodingProvider(@AppContext Context context, Preferences preferences) { cache = new LruCache<>(40); <START> if(true == preferences.getGeocodeEnabled()) { <END> if ("".equals(preferences.getOpenCageGeocoderApiKey())) { geocoder = new GeocoderGoogle(context); } else { geocoder = new GeocoderOpencage(preferences.getOpenCageGeocoderApiKey()); } } else { geocoder = new GeocoderNone(); } }</code><technical_language>This simplified suggestion if (preferences.getGeocodeEnabled()) {</technical_language>

Target:
public GeocodingProvider(@AppContext Context context, Preferences preferences) { cache = new LruCache<>(40); if(preferences.getGeocodeEnabled()) { if ("".equals(preferences.getOpenCageGeocoderApiKey())) { geocoder = new GeocoderGoogle(context); } else { geocoder = new GeocoderOpencage(preferences.getOpenCageGeocoderApiKey()); } } else { geocoder = new GeocoderNone(); } }
Source:
<code>public void configure(Map stormConf, JsonNode filterParams) { JsonNode node = filterParams.get("useText"); if (node != null && node.asBoolean()) { useText = true; } node = filterParams.get("keyName"); if (node != null && node.isTextual()) { key_name = node.asText("signature"); } node = filterParams.get("keyNameCopy"); if (node != null && node.isTextual()) { copyKeyName = node.asText("signatureOld"); <START> System.out.println("HERE: signatureOld" + copyKeyName); <END> } }</code><technical_language>yuk! a System.out! remove a slf4j logger</technical_language>

Target:
public void configure(Map stormConf, JsonNode filterParams) { JsonNode node = filterParams.get("useText"); if (node != null && node.asBoolean()) { useText = true; } node = filterParams.get("keyName"); if (node != null && node.isTextual()) { key_name = node.asText("signature"); } node = filterParams.get("keyNameCopy"); if (node != null && node.isTextual() && StringUtils.isNotBlank(node.asText(""))) { copyKeyName = node.asText("signatureOld"); } }
Source:
<code>private Account configureMockAccount(String username) { final ProfileImage profileImage = mock(ProfileImage.class); when(profileImage.hasImage()).thenReturn(true); <START> when(profileImage.getImageUrlLarge()).thenReturn("<LINK_0>"); <END> final Account account = mock(Account.class); when(account.getUsername()).thenReturn(username); when(account.getProfileImage()).thenReturn(profileImage); return account; }</code><technical_language>related existing implementation. implementation change, mocked object consistent overall</technical_language>

Target:
private Account configureMockAccount(String username) { final ProfileImage profileImage = mock(ProfileImage.class); when(profileImage.hasImage()).thenReturn(true); when(profileImage.getImageUrlLarge()).thenReturn("file:/ final Account account = mock(Account.class); when(account.getUsername()).thenReturn(username); when(account.getProfileImage()).thenReturn(profileImage); return account; }
Source:
<code>public void registerPasswordPolicy() { RealmRepresentation realm = testRealm().toRepresentation(); realm.setPasswordPolicy(LengthPasswordPolicyProviderFactory.ID); testRealm().update(realm); try { loginPage.open(); loginPage.clickRegister(); registerPage.assertCurrent(); registerPage.register("firstName", "lastName", "registerPasswordPolicy@email", "registerPasswordPolicy", "pass", "pass"); registerPage.assertCurrent(); assertEquals("Invalid password: minimum length 8.", registerPage.getError()); events.expectRegister("registerPasswordPolicy", "registerPasswordPolicy@email") .removeDetail(Details.USERNAME) .removeDetail(Details.EMAIL) .user((String) null).error("invalid_registration").assertEvent(); registerPage.register("firstName", "lastName", "registerPasswordPolicy@email", "registerPasswordPolicy", "password", "password"); assertEquals(RequestType.AUTH_RESPONSE, appPage.getRequestType()); String userId = events.expectRegister("registerPasswordPolicy", "registerPasswordPolicy@email").assertEvent().getUserId(); events.expectLogin().user(userId).detail(Details.USERNAME, "registerpasswordpolicy").assertEvent(); } finally { } }</code><technical_language>Please remove this. Tests intent a string a constant here. a constant example mistake renames ID of provider resulting in test passing, existing password policy strings longer work</technical_language>

Target:
public void registerPasswordPolicy() { RealmRepresentation realm = testRealm().toRepresentation(); realm.setPasswordPolicy("length"); testRealm().update(realm); try { loginPage.open(); loginPage.clickRegister(); registerPage.assertCurrent(); registerPage.register("firstName", "lastName", "registerPasswordPolicy@email", "registerPasswordPolicy", "pass", "pass"); registerPage.assertCurrent(); assertEquals("Invalid password: minimum length 8.", registerPage.getError()); events.expectRegister("registerPasswordPolicy", "registerPasswordPolicy@email") .removeDetail(Details.USERNAME) .removeDetail(Details.EMAIL) .user((String) null).error("invalid_registration").assertEvent(); registerPage.register("firstName", "lastName", "registerPasswordPolicy@email", "registerPasswordPolicy", "password", "password"); assertEquals(RequestType.AUTH_RESPONSE, appPage.getRequestType()); String userId = events.expectRegister("registerPasswordPolicy", "registerPasswordPolicy@email").assertEvent().getUserId(); events.expectLogin().user(userId).detail(Details.USERNAME, "registerpasswordpolicy").assertEvent(); } finally { } }
Source:
<code>private String progress(VoltDBInterface instance) { String p = "complete"; if (!instance.getNodeStartupComplete()) { int[] n = instance.getNodeStartupProgress(); if (n[1] > 0) { if (n[0] < 0) n[0] = 0; <START> if (n[0] > n[1]) n[0] = n[1]; <END> p = String.format("%d/%d (%d%%)", n[0], n[1], (n[0] * 100) / n[1]); } else { p = "pending"; } } return p; }</code><technical_language>Code standard recommends putting blocks for if loops single line</technical_language>

Target:
private String progress(VoltDBInterface instance) { String p = "complete"; if (!instance.getNodeStartupComplete()) { int[] n = instance.getNodeStartupProgress(); if (n[1] > 0) { if (n[0] < 0) { n[0] = 0; } if (n[0] > n[1]) { n[0] = n[1]; } p = String.format("%d/%d (%d%%)", n[0], n[1], (n[0] * 100) / n[1]); } else { p = "pending"; } } return p; }
Source:
<code>public static PlanToSpecTransformer forMime(ManagementContext mgmt, String mime) { ServiceLoader<PlanToSpecTransformer> loader = ServiceLoader.load(PlanToSpecTransformer.class); for (PlanToSpecTransformer transformer : loader) { transformer.injectManagementContext(mgmt); if (transformer.accepts(mime)) { return transformer; } } <START> return null; <END> }</code><technical_language>[minor] throw a RuntimeException null</technical_language>

Target:
public static PlanToSpecTransformer forMime(ManagementContext mgmt, String mime) { Collection<PlanToSpecTransformer> transformers = all(mgmt); for (PlanToSpecTransformer transformer : transformers) { if (transformer.accepts(mime)) { return transformer; } } throw new IllegalStateException("PlanToSpecTransformer for type " + mime + " not found. Registered transformers are: " + transformers); }
Source:
<code>public T call() throws Exception { while (true) { try { return this.callable.call(); } catch (Exception e) { <START> log.warn("Retry failed"); <END> if (this.context.isExceptionRetryable(e)) { log.warn("Retry failed"); this.context.decreaseAttempts(); if (this.context.getNumberOfAttempts() <= 0) { throw e; } this.context.waitOperation(); continue; } else { throw e; } } } }</code><technical_language>below</technical_language>

Target:
public T call() throws Exception { while (true) { try { return this.callable.call(); } catch (Exception e) { log.warn("Retry failed"); if (log.isDebugEnabled()) { log.debug(e.getMessage(), e); } if (this.context.isExceptionRetryable(e)) { this.context.decreaseAttempts(); if (this.context.getNumberOfAttempts() <= 0) { throw e; } this.context.waitOperation(); continue; } else { throw e; } } } }
Source:
<code>public Mapping copyForInheritanceTo(SourceMethod method) { Mapping mapping = new Mapping( sourceName, constant, javaExpression, targetName, dateFormat, defaultValue, isIgnored, mirror, sourceAnnotationValue, targetAnnotationValue, selectionParameters, dependsOnAnnotationValue, dependsOn ); if ( sourceReference != null ) { mapping.sourceReference = sourceReference.copyForInheritanceTo( method ); } <START> mapping.targetReference = targetReference; <END> return mapping; }</code><technical_language>related inheriting mappings @MappingConfig classes, try out in a test</technical_language>

Target:
public Mapping copyForInheritanceTo(SourceMethod method) { Mapping mapping = new Mapping( sourceName, constant, javaExpression, targetName, defaultValue, isIgnored, mirror, sourceAnnotationValue, targetAnnotationValue, formattingParameters, selectionParameters, dependsOnAnnotationValue, dependsOn ); if ( sourceReference != null ) { mapping.sourceReference = sourceReference.copyForInheritanceTo( method ); } mapping.targetReference = targetReference; return mapping; }
Source:
<code>public int compareTo(final SubscriptionBillingEvent o) { <START> if (!getEffectiveDate().equals(o.getEffectiveDate())) { <END> return getEffectiveDate().compareTo(o.getEffectiveDate()); } else { return getTotalOrdering().compareTo(o.getTotalOrdering()); } }</code><technical_language>compareTo</technical_language>

Target:
public int compareTo(final SubscriptionBillingEvent o) { if (getEffectiveDate().compareTo(o.getEffectiveDate()) != 0) { return getEffectiveDate().compareTo(o.getEffectiveDate()); } else if (getTotalOrdering().compareTo(o.getTotalOrdering()) != 0) { return getTotalOrdering().compareTo(o.getTotalOrdering()); } else { final Date effectiveDate = getPlan().getCatalog().getEffectiveDate(); final Date oEeffectiveDate = o.getPlan().getCatalog().getEffectiveDate(); return effectiveDate.compareTo(oEeffectiveDate); } }
Source:
<code>private Connection getNewConnection(String host, String user, String passwd, String properties) { Connection newConn = null; String dbURL="jdbc:mysql://" + host + "/" + properties; logger.fine("Getting new MySQL Connection " + dbURL + " " + user + "/" + passwd.replaceAll(".", "*")); try { if (!connectionInitialized) { Class.forName("com.mysql.jdbc.Driver").newInstance(); connectionInitialized = true; } newConn = DriverManager.getConnection(dbURL, user, passwd); if (newConn == null) { <START> logger.severe("Unable to obtain a new database connection, check your MySQL configuration settings."); <END> } } catch (Exception e) { logger.severe("Unable to obtain a new database connection, check your MySQL configuration settings. " + e.getMessage()); } return newConn; }</code><technical_language>log dbURL, user, passwd avoid possibility of turn fine logging run plugin again. :smiley_cat:</technical_language>

Target:
private Connection getNewConnection(String host, String user, String passwd, String properties) { Connection newConn = null; String dbURL="jdbc:mysql://" + host + "/" + properties; String connectionInfo = dbURL + " " + user + "/PASSWORD_FILTERED"; logger.fine("Getting new MySQL Connection: " + connectionInfo); try { if (!connectionInitialized) { Class.forName("com.mysql.jdbc.Driver").newInstance(); connectionInitialized = true; } newConn = DriverManager.getConnection(dbURL, user, passwd); if (newConn == null) { logger.severe("Unable to obtain a new database connection: " + connectionInfo + ", check your MySQL configuration settings."); } } catch (Exception e) { logger.severe("Unable to obtain a new database connection: " + connectionInfo + ", check your MySQL configuration settings. " + e.getMessage()); } return newConn; }
Source:
<code>public void testSQLSelectInsertWithAPI() throws IOException, ClassNotFoundException { LogicalPlan dag = new LogicalPlan(); String schemaIn = "{\"separator\":\",\",\"quoteChar\":\"\\\"\",\"fields\":[" + "{\"name\":\"RowTime\",\"type\":\"Date\",\"constraints\":{\"format\":\"dd/MM/yyyy hh:mm:ss\"}}," + "{\"name\":\"id\",\"type\":\"Integer\"}," + "{\"name\":\"Product\",\"type\":\"String\"}," + "{\"name\":\"units\",\"type\":\"Integer\"}]}"; String schemaOut = "{\"separator\":\",\",\"quoteChar\":\"\\\"\",\"fields\":[" + "{\"name\":\"RowTime\",\"type\":\"Date\",\"constraints\":{\"format\":\"dd/MM/yyyy hh:mm:ss\"}}," + "{\"name\":\"Product\",\"type\":\"String\"}]}"; SQLExecEnvironment.getEnvironment() <START> .registerTable("ORDERS", new FileEndpoint("/tmp/test", new CSVMessageFormat(schemaIn))) <END> .registerTable("SALES", new FileEndpoint("/tmp/output", "out.tmp", new CSVMessageFormat(schemaOut))) .executeSQL(dag, "INSERT INTO SALES SELECT STREAM FLOOR(ROWTIME TO HOUR), SUBSTRING(PRODUCT, 0, 5) " + "FROM ORDERS WHERE id > 3"); dag.validate(); }</code><technical_language>other tests write isolated temp files, else this is poison for CI</technical_language>

Target:
public void testSQLSelectInsertWithAPI() throws IOException, ClassNotFoundException { LogicalPlan dag = new LogicalPlan(); String schemaIn = "{\"separator\":\",\",\"quoteChar\":\"\\\"\",\"fields\":[" + "{\"name\":\"RowTime\",\"type\":\"Date\",\"constraints\":{\"format\":\"dd/MM/yyyy hh:mm:ss\"}}," + "{\"name\":\"id\",\"type\":\"Integer\"}," + "{\"name\":\"Product\",\"type\":\"String\"}," + "{\"name\":\"units\",\"type\":\"Integer\"}]}"; String schemaOut = "{\"separator\":\",\",\"quoteChar\":\"\\\"\",\"fields\":[" + "{\"name\":\"RowTime\",\"type\":\"Date\",\"constraints\":{\"format\":\"dd/MM/yyyy hh:mm:ss\"}}," + "{\"name\":\"Product\",\"type\":\"String\"}]}"; SQLExecEnvironment.getEnvironment() .registerTable("ORDERS", new FileEndpoint("dummyFilePathInput", new CSVMessageFormat(schemaIn))) .registerTable("SALES", new FileEndpoint("dummyFilePathOutput", "out.tmp", new CSVMessageFormat(schemaOut))) .executeSQL(dag, "INSERT INTO SALES SELECT STREAM FLOOR(ROWTIME TO HOUR), SUBSTRING(PRODUCT, 0, 5) " + "FROM ORDERS WHERE id > 3"); dag.validate(); }
Source:
<code>private void createViewerPage() { Display display= getSite().getShell().getDisplay(); fViewerPage = new Composite(fPagebook, SWT.NULL); fViewerPage.setLayoutData(new GridData(GridData.FILL_BOTH)); fViewerPage.setSize(100, 100); fViewerPage.setLayout(new FillLayout()); <START> fProviders = getContentProviders(); <END> fLabelProviders = getLabelProviders(); fContentProvider= new CHContentProvider(this, display); fLabelProvider = new CHLabelProvider(this, display, fContentProvider); fTreeViewer= new ExtendedTreeViewer(fViewerPage); fTreeViewer.setContentProvider(fContentProvider); fTreeViewer.setLabelProvider(new DecoratingCLabelProvider(fLabelProvider)); fTreeViewer.setAutoExpandLevel(2); fTreeViewer.addOpenListener(new IOpenListener() { @Override public void open(OpenEvent event) { onShowSelectedReference(event.getSelection()); } }); if (fProviders !=null) { for (ICHEContentProvider provider : fProviders) { fTreeViewer.addOpenListener(provider.getCCallHierarchyOpenListener()); } } }</code><technical_language>fProviders is assigned getContentProviders too</technical_language>

Target:
private void createViewerPage() { Display display= getSite().getShell().getDisplay(); fViewerPage = new Composite(fPagebook, SWT.NULL); fViewerPage.setLayoutData(new GridData(GridData.FILL_BOTH)); fViewerPage.setSize(100, 100); fViewerPage.setLayout(new FillLayout()); fProviders = CHEProviderSettings.getCCallHierarchyContentProviders(); fLabelProviders = CHEProviderSettings.getCCallHierarchyLabelProviders(); fContentProvider= new CHContentProvider(this, display); fLabelProvider = new CHLabelProvider(this, display, fContentProvider); fTreeViewer= new ExtendedTreeViewer(fViewerPage); fTreeViewer.setContentProvider(fContentProvider); fTreeViewer.setLabelProvider(new DecoratingCLabelProvider(fLabelProvider)); fTreeViewer.setAutoExpandLevel(2); fTreeViewer.addOpenListener(new IOpenListener() { @Override public void open(OpenEvent event) { onShowSelectedReference(event.getSelection()); } }); if (fProviders !=null) { for (ICHEContentProvider provider : fProviders) { fTreeViewer.addOpenListener(provider.getCCallHierarchyOpenListener()); } } }
Source:
<code>private String getPersistentStorageName(String prefix, AzureCredentialView acv, String region, String resourceGroup) { String subscriptionIdPart = encodeString(acv.getSubscriptionId().replaceAll("-", "").toLowerCase()); String regionInitials = WordUtils.initials(Region.findByLabelOrName(region).label(), ' ').toLowerCase(); String resourceGroupPart = encodeString(resourceGroup); String result = String.format("%s%s%s%s", prefix, regionInitials, subscriptionIdPart, resourceGroupPart); if (result.length() > MAX_LENGTH_OF_RESOURCE_NAME) { result = result.substring(0, MAX_LENGTH_OF_RESOURCE_NAME); } LOGGER.debug("Storage account name: {}", result); <START> String message = "Welcome to Tutorialspoint.com"; <END> encodeString(message); return result; }</code><technical_language>I this line deleted</technical_language>

Target:
private String getPersistentStorageName(String prefix, AzureCredentialView acv, String region, String resourceGroup) { String subscriptionIdPart = encodeString(acv.getSubscriptionId().replaceAll("-", "").toLowerCase()); String regionInitials = WordUtils.initials(Region.findByLabelOrName(region).label(), ' ').toLowerCase(); String resourceGroupPart = encodeString(resourceGroup); String result = String.format("%s%s%s%s", prefix, regionInitials, subscriptionIdPart, resourceGroupPart); if (result.length() > MAX_LENGTH_OF_RESOURCE_NAME) { result = result.substring(0, MAX_LENGTH_OF_RESOURCE_NAME); } LOGGER.debug("Storage account name: {}", result); return result; }
Source:
<code>static String prepareDataSourceInfo( String dataSourceInfo ) { StringBuilder sb = new StringBuilder(); Map<String, String> parameters = DataSourceInfoUtil.parseDataSourceInfo( dataSourceInfo ); <START> parameters.forEach( ( key, value ) -> { <END> String unescapedValue = StringEscapeUtils.unescapeXml( value ); String valueWithEscapedQuotes = DataSourceInfoUtil.escapeQuotes( unescapedValue ); sb.append( key ); sb.append( "=\"" ); sb.append( valueWithEscapedQuotes ); sb.append( "\"" ); sb.append( ";" ); } ); return sb.toString(); }</code><technical_language>Lambda expressions in 6.x</technical_language>

Target:
static String prepareDataSourceInfo( String dataSourceInfo ) { StringBuilder sb = new StringBuilder(); Map<String, String> parameters = DataSourceInfoUtil.parseDataSourceInfo( dataSourceInfo ); for ( Map.Entry<String, String> entry : parameters.entrySet() ) { String unescapedValue = StringEscapeUtils.unescapeXml( entry.getValue() ); String valueWithEscapedQuotes = DataSourceInfoUtil.escapeQuotes( unescapedValue ); sb.append( entry.getKey() ); sb.append( "=\"" ); sb.append( valueWithEscapedQuotes ); sb.append( "\"" ); sb.append( ";" ); } return sb.toString(); }
Source:
<code>public void addTask(String workflowName, String jobName, TaskConfig taskConfig, long timeoutMs) throws Exception { if (timeoutMs < DEFAULT_SLEEP) { throw new IllegalArgumentException( String.format("Timeout is less than the minimum acceptable timeout value which is %s ms", DEFAULT_SLEEP)); } long endTime = System.currentTimeMillis() + timeoutMs; validateAddTaskConfigs(workflowName, jobName, taskConfig); String nameSpaceJobName = TaskUtil.getNamespacedJobName(workflowName, jobName); WorkflowContext workflowContext = getWorkflowContext(workflowName); JobContext jobContext = getJobContext(nameSpaceJobName); if (workflowContext == null || jobContext == null) { addTaskToJobConfig(workflowName, jobName, taskConfig, endTime); return; } TaskState jobState = workflowContext.getJobState(nameSpaceJobName); <START> if (jobState == null) { <END> addTaskToJobConfig(workflowName, jobName, taskConfig, endTime); return; } if (ILLEGAL_JOB_STATES_FOR_TASK_MODIFICATION.contains(jobState)) { throw new HelixException( String.format("Job %s is in illegal state to accept new task. Job State is %s", nameSpaceJobName, jobState)); } addTaskToJobConfig(workflowName, jobName, taskConfig, endTime); }</code><technical_language>This if condition is covered below</technical_language>

Target:
public void addTask(String workflowName, String jobName, TaskConfig taskConfig, long timeoutMs) throws TimeoutException, InterruptedException { if (timeoutMs < DEFAULT_SLEEP) { throw new IllegalArgumentException( String.format("Timeout is less than the minimum acceptable timeout value which is %s ms", DEFAULT_SLEEP)); } long endTime = System.currentTimeMillis() + timeoutMs; validateAddTaskConfigs(workflowName, jobName, taskConfig); String nameSpaceJobName = TaskUtil.getNamespacedJobName(workflowName, jobName); WorkflowContext workflowContext = getWorkflowContext(workflowName); JobContext jobContext = getJobContext(nameSpaceJobName); if (workflowContext == null || jobContext == null) { addTaskToJobConfig(workflowName, jobName, taskConfig, endTime); return; } TaskState jobState = workflowContext.getJobState(nameSpaceJobName); if (ILLEGAL_JOB_STATES_FOR_TASK_MODIFICATION.contains(jobState)) { throw new HelixException( String.format("Job %s is in illegal state to accept new task. Job State is %s", nameSpaceJobName, jobState)); } addTaskToJobConfig(workflowName, jobName, taskConfig, endTime); }
Source:
<code>public Builder() { <START> this(15 * 60 * 1000L, 524288000L, 100, 5, 15, 10, 1, false, null, 0.001F); <END> }</code><technical_language>clue this number chosen? Is absolute relative value? I preserve existing behavior default, production deployments constantly adding new data anyway, in case necessarily sense stop rebalancing. Also, a small number large clusters completely stop rebalancing incremental improvement is typically small</technical_language>

Target:
public Builder() { this(15 * 60 * 1000L, 524288000L, 100, 5, 15, 10, 1, false, null, BalancerStrategy.DEFAULT_BALANCER_SLOPE); }
Source:
<code>public void testTelemetryDisabledByDefault() throws Exception { TestUtils.assertMemoryLeak(() -> { <START> try (CairoEngine engine = new CairoEngine(configuration, null)) { <END> try (Path path = new Path()) { Assert.assertEquals(TableUtils.TABLE_DOES_NOT_EXIST, TableUtils.exists(FF, path, root, "telemetry")); Assert.assertEquals(TableUtils.TABLE_DOES_NOT_EXIST, TableUtils.exists(FF, path, root, "telemetry_config")); } } }); }</code><technical_language>engine is unused</technical_language>

Target:
public void testTelemetryDisabledByDefault() throws Exception { TestUtils.assertMemoryLeak(() -> { try (Path path = new Path()) { Assert.assertEquals(TableUtils.TABLE_DOES_NOT_EXIST, TableUtils.exists(FF, path, root, "telemetry")); Assert.assertEquals(TableUtils.TABLE_DOES_NOT_EXIST, TableUtils.exists(FF, path, root, "telemetry_config")); } }); }
Source:
<code>public String toString() { <START> return createQuery(queryMixin.getMetadata().getWhere()).toString(); <END> }</code><technical_language>able reuse asDBObject in toString()? I if diverge, reduces repetition right now</technical_language>

Target:
public String toString() { return asDBObject().toString(); }
Source:
<code>public void VEGalleryTests_001_AddGallery() { int numOfMedias = 9; int numOfGalleries = 1; articleName = PageContent.ARTICLE_NAME_PREFIX + article.getTimeStamp(); VisualEditorPageObject ve = article.openVEOnArticle(wikiURL, articleName); ve.verifyVEToolBarPresent(); ve.verifyEditorSurfacePresent(); ve.typeTextArea(PageContent.ARTICLE_TEXT); <START> VisualEditorInsertGalleryDialog galleryDialog = ve.clickGalleryButton(); <END> galleryDialog = galleryDialog.searchMedia("he"); ve = galleryDialog.addExistingMedia(numOfMedias); ve.verifyGalleries(numOfGalleries); ve.verifyMediasInGallery(numOfMedias); VisualEditorSaveChangesDialog saveChangesDialog = ve.clickPublishButton(); article = saveChangesDialog.savePage(); article.verifyVEPublishComplete(); article.logOut(wikiURL); }</code><technical_language>this test is failing line 47 assertion error</technical_language>

Target:
public void VEGalleryTests_001_AddGallery() { int numOfMedias = 9; int numOfGalleries = 1; articleName = PageContent.ARTICLE_NAME_PREFIX + article.getTimeStamp(); VisualEditorPageObject ve = article.openVEOnArticle(wikiURL, articleName); ve.verifyVEToolBarPresent(); ve.verifyEditorSurfacePresent(); ve.typeTextArea(PageContent.ARTICLE_TEXT); VisualEditorInsertGalleryDialog galleryDialog = ve.clickGalleryButton(); galleryDialog = galleryDialog.searchMedia("he"); ve = galleryDialog.addExistingMedia(numOfMedias); ve.verifyGalleries(numOfGalleries); ve.verifyMediasInGallery(numOfMedias); ve.publish(); article.logOut(wikiURL); }
Source:
<code>public void writeObject(ObjectOutput output, CacheContainerAdmin.AdminFlag flag) throws IOException { <START> output.writeUTF(flag.name()); <END> }</code><technical_language>ordinal values()[offset] instead of writing entire name? do find Externalizer for enums, worth still</technical_language>

Target:
public void writeObject(ObjectOutput output, CacheContainerAdmin.AdminFlag flag) throws IOException { MarshallUtil.marshallEnum(flag, output); }
Source:
<code>public static AllTypes copyOrUpdate(Realm realm, AllTypes object, boolean update, Map<RealmObject,RealmObjectProxy> cache) { if (((RealmObject) object).realm != null && ((RealmObject) object).realm.threadId != realm.threadId) { throw new IllegalArgumentException( <START> "Objects belonging to Realm instances in other threads cannot be copied into this Realm instance."); <END> } if (((RealmObject) object).realm != null && ((RealmObject) object).realm.getPath().equals(realm.getPath())) { return object; } AllTypes realmObject = null; boolean canUpdate = update; if (canUpdate) { Table table = realm.getTable(AllTypes.class); long pkColumnIndex = table.getPrimaryKey(); if (((AllTypesRealmProxyInterface) object).realmGet$columnString() == null) { throw new IllegalArgumentException("Primary key value must not be null."); } long rowIndex = table.findFirstString(pkColumnIndex, ((AllTypesRealmProxyInterface) object).realmGet$columnString()); if (rowIndex != TableOrView.NO_MATCH) { realmObject = new AllTypesRealmProxy(realm.schema.getColumnInfo(AllTypes.class)); ((RealmObject) realmObject).realm = realm; ((RealmObject) realmObject).row = table.getUncheckedRow(rowIndex); cache.put(object, (RealmObjectProxy) realmObject); } else { canUpdate = false; } } if (canUpdate) { return update(realm, realmObject, object, cache); } else { return copy(realm, object, update, cache); } }</code><technical_language>"belonging" -> "which belong"</technical_language>

Target:
public static AllTypes copyOrUpdate(Realm realm, AllTypes object, boolean update, Map<RealmObject,RealmObjectProxy> cache) { if (((RealmObject) object).realm != null && ((RealmObject) object).realm.threadId != realm.threadId) { throw new IllegalArgumentException( "Objects which belong to Realm instances in other threads cannot be copied into this Realm instance."); } if (((RealmObject) object).realm != null && ((RealmObject) object).realm.getPath().equals(realm.getPath())) { return object; } AllTypes realmObject = null; boolean canUpdate = update; if (canUpdate) { Table table = realm.getTable(AllTypes.class); long pkColumnIndex = table.getPrimaryKey(); if (((AllTypesRealmProxyInterface) object).realmGet$columnString() == null) { throw new IllegalArgumentException("Primary key value must not be null."); } long rowIndex = table.findFirstString(pkColumnIndex, ((AllTypesRealmProxyInterface) object).realmGet$columnString()); if (rowIndex != TableOrView.NO_MATCH) { realmObject = new AllTypesRealmProxy(realm.schema.getColumnInfo(AllTypes.class)); ((RealmObject) realmObject).realm = realm; ((RealmObject) realmObject).row = table.getUncheckedRow(rowIndex); cache.put(object, (RealmObjectProxy) realmObject); } else { canUpdate = false; } } if (canUpdate) { return update(realm, realmObject, object, cache); } else { return copy(realm, object, update, cache); } }
Source:
<code>List<DiscoveryNode> resolve() { if (serviceName != null && !serviceName.isEmpty()) { return getSimpleDiscoveryNodes(client.endpointsByName(serviceName)); } else if (serviceLabel != null && !serviceLabel.isEmpty()) { return getSimpleDiscoveryNodes(client.endpointsByLabel(serviceLabel, serviceLabelValue)); } else if (podLabel != null && !podLabel.isEmpty()) { <START> logger.warning("Using Pod label to discover nodes..."); <END> return getSimpleDiscoveryNodes(client.endpointsByPodLabel(podLabel, podLabelValue)); } return getSimpleDiscoveryNodes(client.endpoints()); }</code><technical_language>1. is "warning" logging level? I "debug" (maybe "info", if try it, logs frequently, "debug"). 2. Also, I logging, add for other cases (2 lines above, 4 lines above)</technical_language>

Target:
List<DiscoveryNode> resolve() { if (serviceName != null && !serviceName.isEmpty()) { logger.fine("Using service name to discover nodes."); return getSimpleDiscoveryNodes(client.endpointsByName(serviceName)); } else if (serviceLabel != null && !serviceLabel.isEmpty()) { logger.fine("Using service label to discover nodes."); return getSimpleDiscoveryNodes(client.endpointsByServiceLabel(serviceLabel, serviceLabelValue)); } else if (podLabel != null && !podLabel.isEmpty()) { logger.fine("Using pod label to discover nodes."); return getSimpleDiscoveryNodes(client.endpointsByPodLabel(podLabel, podLabelValue)); } return getSimpleDiscoveryNodes(client.endpoints()); }
Source:
<code>public void testDeserialize() throws StripeException { LegalEntity le = APIResource.GSON.fromJson(legalEntityHash, LegalEntity.class); assertEquals("sole_prop", le.getType()); assertEquals("business name", le.getBusinessName()); assertEquals("12 Grove Street", le.getAddress().getLine1()); assertEquals(null, le.getAddress().getLine2()); assertEquals("New York", le.getAddress().getCity()); assertEquals("NY", le.getAddress().getState()); assertEquals("10014", le.getAddress().getPostalCode()); assertEquals("US", le.getAddress().getCountry()); assertEquals("Monica", le.getFirstName()); assertEquals("Geller", le.getLastName()); assertEquals(new Integer(4), le.getDob().getDay()); assertEquals(new Integer(4), le.getDob().getMonth()); <START> assertEquals(new Integer(1969), le.getDob().getYear()); <END> assertEquals(new LinkedList<Object>(), le.getAdditionalOwners()); assertEquals("verified", le.getVerification().getStatus()); assertEquals(null, le.getVerification().getDocument()); assertEquals(null, le.getVerification().getDetails()); }</code><technical_language>I autoboxing means this necessary, fine</technical_language>

Target:
public void testDeserialize() throws StripeException, IOException { String json = resource("legal_entity.json"); LegalEntity le = APIResource.GSON.fromJson(json, LegalEntity.class); assertEquals("sole_prop", le.getType()); assertEquals("business name", le.getBusinessName()); assertEquals("12 Grove Street", le.getAddress().getLine1()); assertEquals(null, le.getAddress().getLine2()); assertEquals("New York", le.getAddress().getCity()); assertEquals("NY", le.getAddress().getState()); assertEquals("10014", le.getAddress().getPostalCode()); assertEquals("US", le.getAddress().getCountry()); assertEquals("Monica", le.getFirstName()); assertEquals("Geller", le.getLastName()); assertEquals(new Integer(4), le.getDob().getDay()); assertEquals(new Integer(4), le.getDob().getMonth()); assertEquals(new Integer(1969), le.getDob().getYear()); assertEquals(new LinkedList<Object>(), le.getAdditionalOwners()); assertEquals("verified", le.getVerification().getStatus()); assertEquals(null, le.getVerification().getDocument()); assertEquals(null, le.getVerification().getDetails()); }
Source:
<code>public static EObject getExpectedSide(Match match, DifferenceSource source, boolean mergeRightToLeft) { if (match != null) { final Comparison comparison = match.getComparison(); if (comparison.isThreeWay() && mergeRightToLeft == (source == DifferenceSource.LEFT)) { EObject origin = match.getOrigin(); if (origin != null) { return origin; } } if (mergeRightToLeft) { return match.getRight(); } else { return match.getLeft(); } } <START> return null; <END> }</code><technical_language>"EObject result" a single "return" statement</technical_language>

Target:
public static EObject getExpectedSide(Match match, DifferenceSource source, boolean mergeRightToLeft) { EObject result = null; if (match != null) { final Comparison comparison = match.getComparison(); if (comparison.isThreeWay() && mergeRightToLeft == (source == DifferenceSource.LEFT) && match.getOrigin() != null) { result = match.getOrigin(); } else if (mergeRightToLeft) { result = match.getRight(); } else { result = match.getLeft(); } } return result; }
Source:
<code>public void duplicateAttachmentTest(){ BasicDocumentRevision doc1Rev1 = datastore.createDocument(bodyOne); BasicDocumentRevision doc2Rev1 = datastore.createDocument(bodyTwo); File attachmentFile = new File("fixture","attachment_1.txt"); Attachment att1 = new UnsavedFileAttachment(attachmentFile,"text/plain"); Attachment att2 = new UnsavedFileAttachment(attachmentFile,"text/plain"); List<Attachment> doc1Atts = new ArrayList<Attachment>(); <START> List<Attachment>doc2Atts = new ArrayList<Attachment>(); <END> doc1Atts.add(att1); doc2Atts.add(att2); DocumentRevision newRevisionDoc1,newRevisionDoc2 = null; try{ newRevisionDoc1 = datastore.updateAttachments(doc1Rev1, doc1Atts); Assert.assertNotNull("Doc1 revision is null",newRevisionDoc1); List<? extends Attachment> attsForRev = datastore.attachmentsForRevision(newRevisionDoc1); Assert.assertEquals("Didn't get expected number of attachments", doc1Atts.size(), attsForRev.size()); newRevisionDoc2 = datastore.updateAttachments(doc2Rev1,doc2Atts); Assert.assertNotNull("Doc2 revision is null",newRevisionDoc2); attsForRev = datastore.attachmentsForRevision(newRevisionDoc2); Assert.assertEquals("Didn't get expected number of attachments", doc2Atts.size(), attsForRev.size()); } catch (ConflictException conflictException){ Assert.fail("Conflict Exception thrown "+conflictException); } }</code><technical_language>spacing</technical_language>

Target:
public void duplicateAttachmentTest() { BasicDocumentRevision doc1Rev1 = datastore.createDocument(bodyOne); BasicDocumentRevision doc2Rev1 = datastore.createDocument(bodyTwo); File attachmentFile = new File("fixture", "attachment_1.txt"); Attachment att1 = new UnsavedFileAttachment(attachmentFile, "text/plain"); Attachment att2 = new UnsavedFileAttachment(attachmentFile, "text/plain"); List<Attachment> doc1Atts = new ArrayList<Attachment>(); List<Attachment> doc2Atts = new ArrayList<Attachment>(); doc1Atts.add(att1); doc2Atts.add(att2); DocumentRevision newRevisionDoc1 = null; DocumentRevision newRevisionDoc2 = null; try { newRevisionDoc1 = datastore.updateAttachments(doc1Rev1, doc1Atts); Assert.assertNotNull("Doc1 revision is null", newRevisionDoc1); List<? extends Attachment> attsForRev = datastore .attachmentsForRevision(newRevisionDoc1); Assert.assertEquals("Didn't get expected number of attachments", doc1Atts.size(), attsForRev.size()); newRevisionDoc2 = datastore.updateAttachments(doc2Rev1, doc2Atts); Assert.assertNotNull("Doc2 revision is null", newRevisionDoc2); attsForRev = datastore.attachmentsForRevision(newRevisionDoc2); Assert.assertEquals("Didn't get expected number of attachments", doc2Atts.size(), attsForRev.size()); } catch (ConflictException conflictException) { Assert.fail("Conflict Exception thrown "+conflictException); } }
Source:
<code>public WiresCanvas.View removeShape( final ShapeView<?> shapeView ) { <START> if ( org.kie.workbench.common.stunner.client.lienzo.canvas.wires.WiresUtils.isWiresShape( shapeView ) ) { <END> WiresShape wiresShape = ( WiresShape ) shapeView; wiresManager.deregister( wiresShape ); } else if ( org.kie.workbench.common.stunner.client.lienzo.canvas.wires.WiresUtils.isWiresShape( shapeView ) ) { WiresConnector wiresConnector = ( WiresConnector ) shapeView; wiresManager.deregister( wiresConnector ); } else { super.removeShape( shapeView ); } return this; }</code><technical_language>@romartin ... this</technical_language>

Target:
public WiresCanvas.View removeShape( final ShapeView<?> shapeView ) { if ( WiresUtils.isWiresShape( shapeView ) ) { WiresShape wiresShape = ( WiresShape ) shapeView; wiresManager.deregister( wiresShape ); } else if ( WiresUtils.isWiresShape( shapeView ) ) { WiresConnector wiresConnector = ( WiresConnector ) shapeView; wiresManager.deregister( wiresConnector ); } else { super.removeShape( shapeView ); } return this; }
Source:
<code>public void deleteAllEmailsInTrashBin() throws BlobstoreFailureException{ List<AdminEmailAttributes> emailsInTrashBin = getAdminEmailsInTrashBin(); for (AdminEmailAttributes a : emailsInTrashBin){ <START> if (a.getGroupReceiver() != null && !JDOHelper.isDeleted(a)){ <END> for(String key : a.getGroupReceiver()){ BlobKey blobKey = new BlobKey(key); deleteAdminEmailUploadedFile(blobKey); } } } deleteEntities(emailsInTrashBin); }</code><technical_language>This check removed, <code>getAdminEmailsInTrashBin</code> check. Anyway, <code>isDeleted</code> called for Entity classes, EntityAttributes, I</technical_language>

Target:
public void deleteAllEmailsInTrashBin() throws BlobstoreFailureException{ List<AdminEmailAttributes> emailsInTrashBin = getAdminEmailsInTrashBin(); for (AdminEmailAttributes a : emailsInTrashBin){ if (a.getGroupReceiver() != null){ for(String key : a.getGroupReceiver()){ BlobKey blobKey = new BlobKey(key); deleteAdminEmailUploadedFile(blobKey); } } } deleteEntities(emailsInTrashBin); }
Source:
<code>public void showDialog() { <START> if (appContext.getResources().length == 1) { <END> Resource resource = appContext.getResource(); if (resource instanceof Container) { view.setMessage(constant.addToIndexFolder(resource.getName())); } else { view.setMessage(constant.addToIndexFile(resource.getName())); } } else { view.setMessage(constant.addToIndexMultiSelect()); } view.setUpdated(false); view.showDialog(); }</code><technical_language>appContext.getResources() null add additional checking for that</technical_language>

Target:
public void showDialog() { Resource[] resources = appContext.getResources(); checkState(resources != null && resources.length > 0); if (resources.length == 1) { Resource resource = appContext.getResource(); if (resource instanceof Container) { view.setMessage(constant.addToIndexFolder(resource.getName())); } else { view.setMessage(constant.addToIndexFile(resource.getName())); } } else { view.setMessage(constant.addToIndexMultiSelect()); } view.setUpdated(false); view.showDialog(); }
Source:
<code>public static <K> Map<K, Object> sanitize(Map<K, ?> input, Set<Object> visited) { Map<K, Object> result = Maps.newLinkedHashMap(); for (Map.Entry<K, ?> e : input.entrySet()) { <START> if (Entities.isSecret("" + e.getKey())) <END> result.put(e.getKey(), "xxxxxxxx"); else if (e.getValue() instanceof Map) { if (visited.contains(e.getValue())) { continue; } visited.add(e.getValue()); result.put(e.getKey(), sanitize((Map<?, ?>) e.getValue(), visited)); } else { result.put(e.getKey(), e.getValue()); } } return result; }</code><technical_language>move Entities.isSecret Sanitizer well? Entities.SECRET_NAMES (deprecated in place of course)</technical_language>

Target:
static <K> Map<K, Object> sanitize(Map<K, ?> input, Set<Object> visited) { return newInstance().apply(input, visited); }
Source:
<code>public Context start(String spanName, Context context, ProcessKind processKind) { Objects.requireNonNull(spanName, "'spanName' cannot be null."); Objects.requireNonNull(context, "'context' cannot be null."); Objects.requireNonNull(processKind, "'processKind' cannot be null."); Span span; Builder spanBuilder; switch (processKind) { case SEND: spanBuilder = getOrDefault(context, SPAN_BUILDER_KEY, null, Builder.class); if (spanBuilder == null) { return Context.NONE; } span = spanBuilder.setSpanKind(Span.Kind.PRODUCER).startSpan(); if (span.isRecording()) { addSpanRequestAttributes(span, context, spanName); } return context.addData(PARENT_SPAN_KEY, span); case MESSAGE: spanBuilder = getSpanBuilder(spanName, context); <START> span = spanBuilder.setSpanKind(Span.Kind.PRODUCER).startSpan(); <END> context = setContextData(span); return context.addData(PARENT_SPAN_KEY, span); case PROCESS: return startScopedSpan(spanName, context); default: return Context.NONE; } }</code><technical_language>please change Send span (line 81 Client kind)</technical_language>

Target:
public Context start(String spanName, Context context, ProcessKind processKind) { Objects.requireNonNull(spanName, "'spanName' cannot be null."); Objects.requireNonNull(context, "'context' cannot be null."); Objects.requireNonNull(processKind, "'processKind' cannot be null."); Span span; Builder spanBuilder; switch (processKind) { case SEND: spanBuilder = getOrDefault(context, SPAN_BUILDER_KEY, null, Builder.class); if (spanBuilder == null) { return Context.NONE; } span = spanBuilder.setSpanKind(Span.Kind.CLIENT).startSpan(); if (span.isRecording()) { addSpanRequestAttributes(span, context, spanName); } return context.addData(PARENT_SPAN_KEY, span); case MESSAGE: spanBuilder = getSpanBuilder(spanName, context); span = spanBuilder.setSpanKind(Span.Kind.PRODUCER).startSpan(); context = setContextData(span); return context.addData(PARENT_SPAN_KEY, span); case PROCESS: return startScopedSpan(spanName, context); default: return Context.NONE; } }
Source:
<code>public ByReference() { <START> } <END></code><technical_language>leave this empty - add call (implicit) _super()_ this enables setting a breakpoint in constructor</technical_language>

Target:
public ByReference() { super(); }
Source:
<code>public void notifyKeyTransferFinished(int segment, boolean expectValues, boolean cancelled) { SegmentState update; if (expectValues) { update = SegmentState.VALUE_TRANSFER; <START> } else if (cancelled) { <END> update = SegmentState.NOT_OWNED; } else { update = SegmentState.OWNED; } SegmentState previous = segmentStates.getAndSet(segment, update); log.tracef("Finished transfer for segment %d = %s -> %s", segment, previous, update); CompletableFuture<Void> blockedFuture = blockedFutures.get(segment); if (blockedFuture != null) { blockedFuture.completeExceptionally(new CacheException("Segment state transition did not complete correctly.")); } if (trace) { if (expectValues) { log.tracef("Node %s, segment %d has all keys in, expects value transfer", rpcManager.getAddress(), segment); } else { log.tracef("Node %s, segment %d did not transfer any keys, segment is owned now", rpcManager.getAddress(), segment); } } }</code><technical_language>check cancelled expectValues</technical_language>

Target:
public void notifyKeyTransferFinished(int segment, boolean expectValues, boolean cancelled) { SegmentState update; if (cancelled) { update = SegmentState.NOT_OWNED; assert !expectValues; } else if (expectValues) { update = SegmentState.VALUE_TRANSFER; } else { update = SegmentState.OWNED; } SegmentState previous = segmentStates.getAndSet(segment, update); if (trace) { log.tracef("Finished transfer for segment %d = %s -> %s", segment, previous, update); } CompletableFuture<Void> blockedFuture = blockedFutures.get(segment); if (blockedFuture != null) { blockedFuture.completeExceptionally(new CacheException("Segment state transition did not complete correctly.")); } if (trace) { if (expectValues) { log.tracef("Node %s, segment %d has all keys in, expects value transfer", rpcManager.getAddress(), segment); } else { log.tracef("Node %s, segment %d did not transfer any keys, segment is owned now", rpcManager.getAddress(), segment); } } }
Source:
<code>Bitmap execute(Request request) throws IOException { BitmapHunter hunter = BitmapHunter.forRequest(context, this, dispatcher, request, downloader); <START> return hunter.hunt(); <END> }</code><technical_language>Inline hunter. return BH.fR(..).hunt()</technical_language>

Target:
Bitmap execute(Request request) throws IOException { return BitmapHunter.forRequest(context, this, dispatcher, request, downloader).hunt(); }
Source:
<code>private Map<String, File> getFileMap(File folder) throws IOException { if (!folder.isDirectory()) { throw new IOException("Supplied path was not a directory"); } Map<String, File> result = new HashMap<>(); for (File file : folder.listFiles()) { if (file.isDirectory()) { result.putAll(getFileMap(file)); continue; } <START> result.put(file.getName(), file); <END> } return result; }</code><technical_language>this assumes file a name in a tree? keys relative paths instead</technical_language>

Target:
private Map<String, File> getFileMap(File folder) throws IOException { if (!folder.isDirectory()) { throw new IOException("Supplied path was not a directory"); } Map<String, File> result = new HashMap<>(); for (File file : folder.listFiles()) { if (file.isDirectory()) { result.putAll(getFileMap(file)); continue; } result.put(getFileName(folder.getAbsolutePath(), file), file); } return result; }
Source:
<code>public void testCircularReferencesWithPrototype() { DefaultListableBeanFactory xbf = new DefaultListableBeanFactory(); XmlBeanDefinitionReader reader = new XmlBeanDefinitionReader(xbf); reader.setValidationMode(XmlBeanDefinitionReader.VALIDATION_NONE); reader.loadBeanDefinitions(REFTYPES_CONTEXT); <START> xbf.getBean("jennys"); <END> assertThatExceptionOfType(BeanCreationException.class).isThrownBy(() -> xbf.getBean("jennys")) .matches(ex -> ex.contains(BeanCurrentlyInCreationException.class)); assertThatExceptionOfType(BeanCreationException.class).isThrownBy(() -> xbf.getBean("davids")) .matches(ex -> ex.contains(BeanCurrentlyInCreationException.class)); }</code><technical_language>suggestion This line test fail</technical_language>

Target:
public void testCircularReferencesWithPrototype() { DefaultListableBeanFactory xbf = new DefaultListableBeanFactory(); XmlBeanDefinitionReader reader = new XmlBeanDefinitionReader(xbf); reader.setValidationMode(XmlBeanDefinitionReader.VALIDATION_NONE); reader.loadBeanDefinitions(REFTYPES_CONTEXT); assertThatExceptionOfType(BeanCreationException.class).isThrownBy(() -> xbf.getBean("jenny_prototype")) .matches(ex -> ex.contains(BeanCurrentlyInCreationException.class)); assertThatExceptionOfType(BeanCreationException.class).isThrownBy(() -> xbf.getBean("david_prototype")) .matches(ex -> ex.contains(BeanCurrentlyInCreationException.class)); }