From 6c8f5643e87a443880b147c78e91a85441b19790 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Roland=20H=C3=A4der?= Date: Tue, 19 Apr 2016 14:30:08 +0200 Subject: [PATCH] Added exception for mismatching password+repeated --- .../DataRepeatMismatchException.java | 1 + ...mailAddressAlreadyRegisteredException.java | 1 + .../exceptions/UserNotFoundException.java | 1 + .../UserPasswordMismatchException.java | 1 + .../UserPasswordRepeatMismatchException.java | 44 +++++++++++++++++++ .../exceptions/UserStatusLockedException.java | 1 + .../UserStatusUnconfirmedException.java | 1 + 7 files changed, 50 insertions(+) create mode 100644 src/org/mxchange/jusercore/exceptions/UserPasswordRepeatMismatchException.java diff --git a/src/org/mxchange/jusercore/exceptions/DataRepeatMismatchException.java b/src/org/mxchange/jusercore/exceptions/DataRepeatMismatchException.java index eaca057..7606d6e 100644 --- a/src/org/mxchange/jusercore/exceptions/DataRepeatMismatchException.java +++ b/src/org/mxchange/jusercore/exceptions/DataRepeatMismatchException.java @@ -36,4 +36,5 @@ public class DataRepeatMismatchException extends Exception { public DataRepeatMismatchException (final String message) { super(message); } + } diff --git a/src/org/mxchange/jusercore/exceptions/EmailAddressAlreadyRegisteredException.java b/src/org/mxchange/jusercore/exceptions/EmailAddressAlreadyRegisteredException.java index 742fcce..261933c 100644 --- a/src/org/mxchange/jusercore/exceptions/EmailAddressAlreadyRegisteredException.java +++ b/src/org/mxchange/jusercore/exceptions/EmailAddressAlreadyRegisteredException.java @@ -40,4 +40,5 @@ public class EmailAddressAlreadyRegisteredException extends Exception { // Call super contructor super(MessageFormat.format("User {0} already registered with number {1} at record id {2}. Maybe forgot to call isRegistered(user) ?", user, user.getUserName(), user.getUserId())); } + } diff --git a/src/org/mxchange/jusercore/exceptions/UserNotFoundException.java b/src/org/mxchange/jusercore/exceptions/UserNotFoundException.java index 298640e..c8710f7 100644 --- a/src/org/mxchange/jusercore/exceptions/UserNotFoundException.java +++ b/src/org/mxchange/jusercore/exceptions/UserNotFoundException.java @@ -49,4 +49,5 @@ public class UserNotFoundException extends Exception { public UserNotFoundException (final Long userId) { super(MessageFormat.format("User id {0} not found.", userId)); //NOI18N } + } diff --git a/src/org/mxchange/jusercore/exceptions/UserPasswordMismatchException.java b/src/org/mxchange/jusercore/exceptions/UserPasswordMismatchException.java index a2a6486..55db22b 100644 --- a/src/org/mxchange/jusercore/exceptions/UserPasswordMismatchException.java +++ b/src/org/mxchange/jusercore/exceptions/UserPasswordMismatchException.java @@ -40,4 +40,5 @@ public class UserPasswordMismatchException extends Exception { public UserPasswordMismatchException (final User user) { super(MessageFormat.format("Password for user {0} does not match stored password.", user)); } + } diff --git a/src/org/mxchange/jusercore/exceptions/UserPasswordRepeatMismatchException.java b/src/org/mxchange/jusercore/exceptions/UserPasswordRepeatMismatchException.java new file mode 100644 index 0000000..8a28369 --- /dev/null +++ b/src/org/mxchange/jusercore/exceptions/UserPasswordRepeatMismatchException.java @@ -0,0 +1,44 @@ +/* + * Copyright (C) 2016 Roland Haeder + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ +package org.mxchange.jusercore.exceptions; + +import java.text.MessageFormat; +import org.mxchange.jusercore.model.user.User; + +/** + * An exception thrown when the entered password did not match the stored + * password. + *

+ * @author Roland Haeder + */ +public class UserPasswordRepeatMismatchException extends Exception { + + /** + * Serial number + */ + private static final long serialVersionUID = 51_782_450_671_256_594L; + + /** + * Creates an exception with given user instance + *

+ * @param user User instance + */ + public UserPasswordRepeatMismatchException (final User user) { + super(MessageFormat.format("Passwords don't match, userId={0}", user.getUserId())); + } + +} diff --git a/src/org/mxchange/jusercore/exceptions/UserStatusLockedException.java b/src/org/mxchange/jusercore/exceptions/UserStatusLockedException.java index b63076a..bb96e7f 100644 --- a/src/org/mxchange/jusercore/exceptions/UserStatusLockedException.java +++ b/src/org/mxchange/jusercore/exceptions/UserStatusLockedException.java @@ -40,4 +40,5 @@ public class UserStatusLockedException extends Exception { // Call super contructor super(MessageFormat.format("User account with user name {0} is locked.", user.getUserName())); } + } diff --git a/src/org/mxchange/jusercore/exceptions/UserStatusUnconfirmedException.java b/src/org/mxchange/jusercore/exceptions/UserStatusUnconfirmedException.java index 1b3f280..543cb80 100644 --- a/src/org/mxchange/jusercore/exceptions/UserStatusUnconfirmedException.java +++ b/src/org/mxchange/jusercore/exceptions/UserStatusUnconfirmedException.java @@ -40,4 +40,5 @@ public class UserStatusUnconfirmedException extends Exception { // Call super contructor super(MessageFormat.format("User account with user name {0} is unconfirmed.", user.getUserName())); } + } -- 2.39.5