Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

LPS-53487 Document changes in BREAKING_CHANGES #23962

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 0 additions & 1 deletion portal-impl/src/com/liferay/portal/service.xml
Expand Up @@ -3431,7 +3431,6 @@
<exception>RequiredRole</exception>
<exception>RequiredUser</exception>
<exception>RequiredUserGroup</exception>
<exception>ReservedUserId</exception>
<exception>ResourcePrimKey</exception>
<exception>RoleAssignment</exception>
<exception>RoleName</exception>
Expand Down
Expand Up @@ -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() {
Expand Down
18 changes: 18 additions & 0 deletions portal-service/src/com/liferay/portal/UserIdException.java
Expand Up @@ -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
Expand Down Expand Up @@ -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;

}

}
2 changes: 1 addition & 1 deletion portal-web/docroot/html/portlet/login/create_account.jsp
Expand Up @@ -68,14 +68,14 @@ birthdayCalendar.set(Calendar.YEAR, 1970);
<liferay-ui:error exception="<%= NoSuchRegionException.class %>" message="please-select-a-region" />
<liferay-ui:error exception="<%= PhoneNumberException.class %>" message="please-enter-a-valid-phone-number" />
<liferay-ui:error exception="<%= RequiredFieldException.class %>" message="please-fill-out-all-required-fields" />
<liferay-ui:error exception="<%= ReservedUserIdException.class %>" message="the-user-id-you-requested-is-reserved" />
<liferay-ui:error exception="<%= TermsOfUseException.class %>" message="you-must-agree-to-the-terms-of-use" />
<liferay-ui:error exception="<%= UserEmailAddressException.class %>" message="please-enter-a-valid-email-address" />
<liferay-ui:error exception="<%= UserEmailAddressException.MustNotBeDuplicate.class %>" message="the-email-address-you-requested-is-already-taken" />
<liferay-ui:error exception="<%= UserEmailAddressException.MustNotBePOP3User.class %>" message="the-email-address-you-requested-is-reserved" />
<liferay-ui:error exception="<%= UserEmailAddressException.MustNotBeReserved.class %>" message="the-email-address-you-requested-is-reserved" />
<liferay-ui:error exception="<%= UserEmailAddressException.MustNotUseCompanyMx.class %>" message="the-email-address-you-requested-is-not-valid-because-its-domain-is-reserved" />
<liferay-ui:error exception="<%= UserIdException.class %>" message="please-enter-a-valid-user-id" />
<liferay-ui:error exception="<%= UserIdException.MustNotBeReserved.class %>" message="the-user-id-you-requested-is-reserved" />

<liferay-ui:error exception="<%= UserPasswordException.MustBeLonger.class %>">

Expand Down
1 change: 0 additions & 1 deletion portal-web/docroot/html/portlet/login/init.jsp
Expand Up @@ -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" %><%@
Expand Down
1 change: 0 additions & 1 deletion portal-web/docroot/html/portlet/users_admin/init.jsp
Expand Up @@ -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" %><%@
Expand Down
Expand Up @@ -187,8 +187,8 @@ else {
</div>

<c:if test="<%= selUser != null %>">
<liferay-ui:error exception="<%= ReservedUserIdException.class %>" message="the-user-id-you-requested-is-reserved" />
<liferay-ui:error exception="<%= UserIdException.class %>" message="please-enter-a-valid-user-id" />
<liferay-ui:error exception="<%= UserIdException.MustNotBeReserved.class %>" message="the-user-id-you-requested-is-reserved" />

<aui:input name="userId" type="resource" value="<%= String.valueOf(selUser.getUserId()) %>" />
</c:if>
Expand Down
30 changes: 30 additions & 0 deletions readme/7.0/BREAKING_CHANGES.markdown
Expand Up @@ -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.

---------------------------------------