diff --git a/portal-impl/src/com/liferay/portal/service.xml b/portal-impl/src/com/liferay/portal/service.xml index f1552e6c998342..2fdeef66ea8afb 100644 --- a/portal-impl/src/com/liferay/portal/service.xml +++ b/portal-impl/src/com/liferay/portal/service.xml @@ -3431,7 +3431,6 @@ RequiredRole RequiredUser RequiredUserGroup - ReservedUserId ResourcePrimKey RoleAssignment RoleName diff --git a/portal-service/src/com/liferay/portal/ReservedUserIdException.java b/portal-service/src/com/liferay/portal/ReservedUserIdException.java index 497c468cc49d55..2fc4fb19d9b9e3 100644 --- a/portal-service/src/com/liferay/portal/ReservedUserIdException.java +++ b/portal-service/src/com/liferay/portal/ReservedUserIdException.java @@ -18,7 +18,10 @@ /** * @author Brian Wing Shun Chan + * @deprecated As of 7.0.0, replaced by {@link + * UserIdException.MustNotBeReserved} */ +@Deprecated public class ReservedUserIdException extends PortalException { public ReservedUserIdException() { diff --git a/portal-service/src/com/liferay/portal/UserIdException.java b/portal-service/src/com/liferay/portal/UserIdException.java index 5b1af04b328750..6dffdda1620fc9 100644 --- a/portal-service/src/com/liferay/portal/UserIdException.java +++ b/portal-service/src/com/liferay/portal/UserIdException.java @@ -15,6 +15,7 @@ package com.liferay.portal; import com.liferay.portal.kernel.exception.PortalException; +import com.liferay.portal.kernel.util.StringUtil; /** * @author Brian Wing Shun Chan @@ -61,4 +62,21 @@ public MustNotBeNull() { } + public static class MustNotBeReserved extends UserIdException { + + public MustNotBeReserved(long userId, String[] reservedUserIds) { + super( + String.format( + "User ID %s must not be a reserved one such as: %s", userId, + StringUtil.merge(reservedUserIds))); + + this.userId = userId; + this.reservedUserIds = reservedUserIds; + } + + public final String[] reservedUserIds; + public final long userId; + + } + } \ No newline at end of file diff --git a/portal-web/docroot/html/portlet/login/create_account.jsp b/portal-web/docroot/html/portlet/login/create_account.jsp index 7b8b387044cfcb..58bc49b20e6e20 100644 --- a/portal-web/docroot/html/portlet/login/create_account.jsp +++ b/portal-web/docroot/html/portlet/login/create_account.jsp @@ -68,7 +68,6 @@ birthdayCalendar.set(Calendar.YEAR, 1970); - @@ -76,6 +75,7 @@ birthdayCalendar.set(Calendar.YEAR, 1970); + diff --git a/portal-web/docroot/html/portlet/login/init.jsp b/portal-web/docroot/html/portlet/login/init.jsp index 050e2b82873913..ae14b40ffc189b 100644 --- a/portal-web/docroot/html/portlet/login/init.jsp +++ b/portal-web/docroot/html/portlet/login/init.jsp @@ -35,7 +35,6 @@ page import="com.liferay.portal.PasswordExpiredException" %><%@ page import="com.liferay.portal.PhoneNumberException" %><%@ page import="com.liferay.portal.RequiredFieldException" %><%@ page import="com.liferay.portal.RequiredReminderQueryException" %><%@ -page import="com.liferay.portal.ReservedUserIdException" %><%@ page import="com.liferay.portal.SendPasswordException" %><%@ page import="com.liferay.portal.TermsOfUseException" %><%@ page import="com.liferay.portal.UserActiveException" %><%@ diff --git a/portal-web/docroot/html/portlet/users_admin/init.jsp b/portal-web/docroot/html/portlet/users_admin/init.jsp index 6fcbe39c28e442..a07ce7fdd52756 100644 --- a/portal-web/docroot/html/portlet/users_admin/init.jsp +++ b/portal-web/docroot/html/portlet/users_admin/init.jsp @@ -37,7 +37,6 @@ page import="com.liferay.portal.OrganizationParentException" %><%@ page import="com.liferay.portal.PhoneNumberException" %><%@ page import="com.liferay.portal.RequiredOrganizationException" %><%@ page import="com.liferay.portal.RequiredUserException" %><%@ -page import="com.liferay.portal.ReservedUserIdException" %><%@ page import="com.liferay.portal.UserEmailAddressException" %><%@ page import="com.liferay.portal.UserFieldException" %><%@ page import="com.liferay.portal.UserIdException" %><%@ diff --git a/portal-web/docroot/html/portlet/users_admin/user/details.jsp b/portal-web/docroot/html/portlet/users_admin/user/details.jsp index 59026cad48b6f6..3124f6d8003e47 100644 --- a/portal-web/docroot/html/portlet/users_admin/user/details.jsp +++ b/portal-web/docroot/html/portlet/users_admin/user/details.jsp @@ -187,8 +187,8 @@ else { - + diff --git a/readme/7.0/BREAKING_CHANGES.markdown b/readme/7.0/BREAKING_CHANGES.markdown index e152c07ef58a42..c133eb7c42e7f9 100644 --- a/readme/7.0/BREAKING_CHANGES.markdown +++ b/readme/7.0/BREAKING_CHANGES.markdown @@ -942,4 +942,34 @@ necessary information about why the exception was thrown and its context. In particular, it contains the problematic email address, and the list of reserved email addresses. +--------------------------------------- + +### Replaced `ReservedUserIdException` with `UserIdException` inner classes +- **Date:** 2015-Feb-10 +- **JIRA Ticket:** LPS-53487 + +#### What changed? + +`ReservedUserIdException` has been deprecated and replaced with +`UserIdException.MustNotBeReserved`. + +#### Who is affected? + +This affects developers who have written code that catches the +`ReservedUserIdException` while calling the affected methods. + +#### How should I update my code? + +You should replace catching exception `ReservedUserIdException` with +catching exception `UserIdException.MustNotBeReserved`. + +#### Why was this change made? + +A new pattern has been defined for exceptions that provides higher expressivity +in their names and also more information regarding why the exception was thrown. + +The new exception `UserIdException.MustNotBeReserved` has all the necessary +information about why the exception was thrown and its context. In particular, +it contains the problematic user ID and the list of reserved user IDs. + --------------------------------------- \ No newline at end of file