diff options
12 files changed, 33 insertions, 33 deletions
diff --git a/server/sonar-db-dao/src/main/java/org/sonar/db/organization/OrganizationDto.java b/server/sonar-db-dao/src/main/java/org/sonar/db/organization/OrganizationDto.java index 3ae32fae970..d8a40ea81fc 100644 --- a/server/sonar-db-dao/src/main/java/org/sonar/db/organization/OrganizationDto.java +++ b/server/sonar-db-dao/src/main/java/org/sonar/db/organization/OrganizationDto.java @@ -53,7 +53,7 @@ public class OrganizationDto { * - When {@link UserIdentity#getLogin()} is not null, it's a slug of the login * - When {@link UserIdentity#getLogin()} is null, it's a slug of the name appended to a random number * - * Length is set to 300 (As login length is 255, the size must be higher than 255). + * Length is set to 255 (As login length is 255, the size must be at least 255). */ private String key; diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v74/IncreaseOrganizationsKeeAndNameLength.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v74/IncreaseOrganizationsKeeAndNameLength.java index ca5fa844c06..a8fdccc2164 100644 --- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v74/IncreaseOrganizationsKeeAndNameLength.java +++ b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v74/IncreaseOrganizationsKeeAndNameLength.java @@ -41,14 +41,14 @@ public class IncreaseOrganizationsKeeAndNameLength extends DdlChange { context.execute(new AlterColumnsBuilder(getDialect(), ORGANIZATIONS_TABLE) .updateColumn(newVarcharColumnDefBuilder() .setColumnName("kee") - .setLimit(300) + .setLimit(255) .setIsNullable(false) .build()) .build()); context.execute(new AlterColumnsBuilder(getDialect(), ORGANIZATIONS_TABLE) .updateColumn(newVarcharColumnDefBuilder() .setColumnName("name") - .setLimit(300) + .setLimit(255) .setIsNullable(false) .build()) .build()); diff --git a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v74/IncreaseOrganizationsKeeAndNameLengthTest.java b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v74/IncreaseOrganizationsKeeAndNameLengthTest.java index 46d2f19ebbd..9b2f41a8827 100644 --- a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v74/IncreaseOrganizationsKeeAndNameLengthTest.java +++ b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v74/IncreaseOrganizationsKeeAndNameLengthTest.java @@ -41,8 +41,8 @@ public class IncreaseOrganizationsKeeAndNameLengthTest { public void column_is_updated() throws SQLException { underTest.execute(); - db.assertColumnDefinition("organizations", "kee", VARCHAR, 300, false); - db.assertColumnDefinition("organizations", "name", VARCHAR, 300, false); + db.assertColumnDefinition("organizations", "kee", VARCHAR, 255, false); + db.assertColumnDefinition("organizations", "name", VARCHAR, 255, false); } @Test diff --git a/server/sonar-server/src/main/java/org/sonar/server/organization/OrganizationValidation.java b/server/sonar-server/src/main/java/org/sonar/server/organization/OrganizationValidation.java index 1e5f148e26f..9e3f7f32443 100644 --- a/server/sonar-server/src/main/java/org/sonar/server/organization/OrganizationValidation.java +++ b/server/sonar-server/src/main/java/org/sonar/server/organization/OrganizationValidation.java @@ -24,9 +24,9 @@ import javax.annotation.Nullable; public interface OrganizationValidation { int KEY_MIN_LENGTH = 1; - int KEY_MAX_LENGTH = 300; + int KEY_MAX_LENGTH = 255; int NAME_MIN_LENGTH = 1; - int NAME_MAX_LENGTH = 300; + int NAME_MAX_LENGTH = 255; int DESCRIPTION_MAX_LENGTH = 256; int URL_MAX_LENGTH = 256; diff --git a/server/sonar-server/src/test/java/org/sonar/server/organization/OrganizationValidationImplTest.java b/server/sonar-server/src/test/java/org/sonar/server/organization/OrganizationValidationImplTest.java index cda78442412..ce971cac47a 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/organization/OrganizationValidationImplTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/organization/OrganizationValidationImplTest.java @@ -33,7 +33,7 @@ public class OrganizationValidationImplTest { private static final String STRING_64_CHARS = STRING_32_CHARS + STRING_32_CHARS; private static final String STRING_256_CHARS = STRING_64_CHARS + STRING_64_CHARS + STRING_64_CHARS + STRING_64_CHARS; - private static final String STRING_300_CHARS = Strings.repeat("a", 300); + private static final String STRING_255_CHARS = Strings.repeat("a", 255); @Rule public ExpectedException expectedException = ExpectedException.none(); @@ -65,9 +65,9 @@ public class OrganizationValidationImplTest { } @Test - public void checkValidKey_does_not_fail_if_arg_is_1_to_300_chars_long() { + public void checkValidKey_does_not_fail_if_arg_is_1_to_255_chars_long() { String str = "a"; - for (int i = 0; i < 299; i++) { + for (int i = 0; i < 254; i++) { underTest.checkKey(str); str += "a"; } @@ -75,10 +75,10 @@ public class OrganizationValidationImplTest { @Test public void checkValidKey_throws_IAE_when_more_than_300_characters() { - String key = STRING_300_CHARS + "b"; + String key = STRING_255_CHARS + "b"; expectedException.expect(IllegalArgumentException.class); - expectedException.expectMessage("Key '" + key + "' must be at most 300 chars long"); + expectedException.expectMessage("Key '" + key + "' must be at most 255 chars long"); underTest.checkKey(key); } @@ -115,20 +115,20 @@ public class OrganizationValidationImplTest { } @Test - public void checkValidName_does_not_fail_if_arg_is_1_to_300_chars_long() { + public void checkValidName_does_not_fail_if_arg_is_1_to_255_chars_long() { String str = "a"; - for (int i = 0; i < 299; i++) { + for (int i = 0; i < 254; i++) { underTest.checkName(str); str += "a"; } } @Test - public void checkValidName_throws_IAE_when_more_than_300_characters() { - String str = STRING_300_CHARS + "b"; + public void checkValidName_throws_IAE_when_more_than_255_characters() { + String str = STRING_255_CHARS + "b"; expectedException.expect(IllegalArgumentException.class); - expectedException.expectMessage("Name '" + str + "' must be at most 300 chars long"); + expectedException.expectMessage("Name '" + str + "' must be at most 255 chars long"); underTest.checkName(str); } diff --git a/server/sonar-server/src/test/java/org/sonar/server/organization/ws/CreateActionTest.java b/server/sonar-server/src/test/java/org/sonar/server/organization/ws/CreateActionTest.java index 3c98626eaeb..8516115fb36 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/organization/ws/CreateActionTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/organization/ws/CreateActionTest.java @@ -520,13 +520,13 @@ public class CreateActionTest { .matches(WebService.Param::isRequired) .matches(param -> "Foo Company".equals(param.exampleValue())) .matches(param -> param.minimumLength().equals(1)) - .matches(param -> param.maximumLength().equals(300)) + .matches(param -> param.maximumLength().equals(255)) .matches(param -> param.description() != null); assertThat(action.param("key")) .matches(param -> !param.isRequired()) .matches(param -> "foo-company".equals(param.exampleValue())) .matches(param -> param.minimumLength().equals(1)) - .matches(param -> param.maximumLength().equals(300)) + .matches(param -> param.maximumLength().equals(255)) .matches(param -> param.description() != null); assertThat(action.param("description")) .matches(param -> !param.isRequired()) diff --git a/server/sonar-server/src/test/java/org/sonar/server/organization/ws/UpdateActionTest.java b/server/sonar-server/src/test/java/org/sonar/server/organization/ws/UpdateActionTest.java index 74867b34a59..bc87c95e913 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/organization/ws/UpdateActionTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/organization/ws/UpdateActionTest.java @@ -83,7 +83,7 @@ public class UpdateActionTest { .matches(param -> !param.isRequired()) .matches(param -> "Foo Company".equals(param.exampleValue())) .matches(param -> param.minimumLength().equals(1)) - .matches(param -> param.maximumLength().equals(300)) + .matches(param -> param.maximumLength().equals(255)) .matches(param -> param.description() != null); assertThat(action.param("description")) .matches(param -> !param.isRequired()) diff --git a/server/sonar-web/src/main/js/apps/create/organization/OrganizationDetailsStep.tsx b/server/sonar-web/src/main/js/apps/create/organization/OrganizationDetailsStep.tsx index 7ae7f7867bb..e2b81934afc 100644 --- a/server/sonar-web/src/main/js/apps/create/organization/OrganizationDetailsStep.tsx +++ b/server/sonar-web/src/main/js/apps/create/organization/OrganizationDetailsStep.tsx @@ -84,11 +84,11 @@ export default class OrganizationDetailsStep extends React.PureComponent<Props, errors.avatar = translate('onboarding.create_organization.avatar.error'); } - if (name.length > 300) { + if (name.length > 255) { errors.name = translate('onboarding.create_organization.display_name.error'); } - if (key.length > 300 || !/^[a-z0-9][a-z0-9-]*[a-z0-9]?$/.test(key)) { + if (key.length > 255 || !/^[a-z0-9][a-z0-9-]*[a-z0-9]?$/.test(key)) { errors.key = translate('onboarding.create_organization.organization_name.error'); } @@ -134,7 +134,7 @@ export default class OrganizationDetailsStep extends React.PureComponent<Props, required={true} touched={touched.key} value={values.key}> - {props => <input autoFocus={true} maxLength={300} {...props} />} + {props => <input autoFocus={true} maxLength={255} {...props} />} </OrganizationDetailsInput> <div className="big-spacer-top"> <ResetButtonLink onClick={this.handleAdditionalClick}> diff --git a/server/sonar-web/src/main/js/apps/create/organization/__tests__/OrganizationDetailsStep-test.tsx b/server/sonar-web/src/main/js/apps/create/organization/__tests__/OrganizationDetailsStep-test.tsx index 5eb6b9a65b4..aad43c0a619 100644 --- a/server/sonar-web/src/main/js/apps/create/organization/__tests__/OrganizationDetailsStep-test.tsx +++ b/server/sonar-web/src/main/js/apps/create/organization/__tests__/OrganizationDetailsStep-test.tsx @@ -78,7 +78,7 @@ it('should validate', () => { avatar: '', description: '', name: '', - key: 'x'.repeat(301), + key: 'x'.repeat(256), url: '' }) ).rejects.toEqual({ key: 'onboarding.create_organization.organization_name.error' }); @@ -91,7 +91,7 @@ it('should validate', () => { instance.handleValidate({ avatar: '', description: '', - name: 'x'.repeat(301), + name: 'x'.repeat(256), key: 'foo', url: '' }) diff --git a/server/sonar-web/src/main/js/apps/organizations/components/OrganizationEdit.tsx b/server/sonar-web/src/main/js/apps/organizations/components/OrganizationEdit.tsx index 28e99ee3a3e..03a0be23ef9 100644 --- a/server/sonar-web/src/main/js/apps/organizations/components/OrganizationEdit.tsx +++ b/server/sonar-web/src/main/js/apps/organizations/components/OrganizationEdit.tsx @@ -119,7 +119,7 @@ export class OrganizationEdit extends React.PureComponent<Props, State> { <input disabled={this.state.loading} id="organization-name" - maxLength={300} + maxLength={255} name="name" onChange={e => this.setState({ name: e.target.value })} required={true} diff --git a/server/sonar-web/src/main/js/apps/organizations/components/__tests__/__snapshots__/OrganizationEdit-test.tsx.snap b/server/sonar-web/src/main/js/apps/organizations/components/__tests__/__snapshots__/OrganizationEdit-test.tsx.snap index 63cf648f317..71bc33ee084 100644 --- a/server/sonar-web/src/main/js/apps/organizations/components/__tests__/__snapshots__/OrganizationEdit-test.tsx.snap +++ b/server/sonar-web/src/main/js/apps/organizations/components/__tests__/__snapshots__/OrganizationEdit-test.tsx.snap @@ -40,7 +40,7 @@ exports[`smoke test 1`] = ` <input disabled={false} id="organization-name" - maxLength={300} + maxLength={255} name="name" onChange={[Function]} required={true} @@ -176,7 +176,7 @@ exports[`smoke test 2`] = ` <input disabled={false} id="organization-name" - maxLength={300} + maxLength={255} name="name" onChange={[Function]} required={true} @@ -327,7 +327,7 @@ exports[`smoke test 3`] = ` <input disabled={true} id="organization-name" - maxLength={300} + maxLength={255} name="name" onChange={[Function]} required={true} diff --git a/sonar-core/src/main/resources/org/sonar/l10n/core.properties b/sonar-core/src/main/resources/org/sonar/l10n/core.properties index 644d6701f58..6e18b2aea7e 100644 --- a/sonar-core/src/main/resources/org/sonar/l10n/core.properties +++ b/sonar-core/src/main/resources/org/sonar/l10n/core.properties @@ -2607,9 +2607,9 @@ organization.description=Description organization.description.description=Description of the organization. organization.edit=Edit Organization organization.key=Key -organization.key.description=Key of the organization (up to 300 characters). All chars must be lower-case letters (a to z), digits or dash (but dash can neither be trailing nor heading). When not specified, the key is computed from the name. +organization.key.description=Key of the organization (up to 255 characters). All chars must be lower-case letters (a to z), digits or dash (but dash can neither be trailing nor heading). When not specified, the key is computed from the name. organization.name=Name -organization.name.description=Name of the organization (up to 300 characters). +organization.name.description=Name of the organization (up to 255 characters). organization.updated=Organization details have been updated. organization.url=Url organization.url.description=Url of the homepage of the organization. @@ -2706,13 +2706,13 @@ onboarding.create_project.select_repositories=Select repositories onboarding.create_organization.page.header=Create Organization onboarding.create_organization.page.description=An organization is a space where a team or a whole company can collaborate accross many projects.{break}To analyze a private project you must subscribe your organization to a paid plan. From {price} a month. {more} onboarding.create_organization.organization_name=Organization Name -onboarding.create_organization.organization_name.description=Up to 300 characters. All chars must be lower-case letters (a to z), digits or dash (but dash can neither be trailing nor heading). The display name can be specified in the additional info. +onboarding.create_organization.organization_name.description=Up to 255 characters. All chars must be lower-case letters (a to z), digits or dash (but dash can neither be trailing nor heading). The display name can be specified in the additional info. onboarding.create_organization.organization_name.error=The provided value doesn't match the expected format. onboarding.create_organization.organization_name.taken=This name is already taken. onboarding.create_organization.add_additional_info=Add additional info onboarding.create_organization.hide_additional_info=Hide additional info onboarding.create_organization.display_name=Display Name -onboarding.create_organization.display_name.description=Up to 300 characters +onboarding.create_organization.display_name.description=Up to 255 characters onboarding.create_organization.display_name.error=The provided value doesn't match the expected format. onboarding.create_organization.avatar=Avatar onboarding.create_organization.avatar.description=Url of a small image that represents the organization (preferably 30px height). |