1 /*
2 * The contents of this file are subject to the terms of the Common Development and
3 * Distribution License (the License). You may not use this file except in compliance with the
4 * License.
5 *
6 * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the
7 * specific language governing permission and limitations under the License.
8 *
9 * When distributing Covered Software, include this CDDL Header Notice in each file and include
10 * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL
11 * Header, with the fields enclosed by brackets [] replaced by your own identifying
12 * information: "Portions Copyrighted [year] [name of copyright owner]".
13 *
14 * Copyright © 2011 ForgeRock AS. All rights reserved.
15 */
16
17 package org.forgerock.json.resource;
18
19 /**
20 * An exception that is thrown during a operation on a resource when the
21 * requested operation is malformed.
22 */
23 public class BadRequestException extends ResourceException {
24
25 private static final long serialVersionUID = 1L;
26
27 /**
28 * Constructs a new exception with {@code null} as its detail message.
29 */
30 public BadRequestException() {
31 super(ResourceException.BAD_REQUEST);
32 }
33
34 /**
35 * Constructs a new exception with the specified detail message.
36 *
37 * @param message
38 * The detail message.
39 */
40 public BadRequestException(final String message) {
41 super(ResourceException.BAD_REQUEST, message);
42 }
43
44 /**
45 * Constructs a new exception with the specified detail message and cause.
46 *
47 * @param message
48 * The detail message.
49 * @param cause
50 * The exception which caused this exception to be thrown.
51 */
52 public BadRequestException(final String message, final Throwable cause) {
53 super(ResourceException.BAD_REQUEST, message, cause);
54 }
55
56 /**
57 * Constructs a new exception with the specified cause.
58 *
59 * @param cause
60 * The exception which caused this exception to be thrown.
61 */
62 public BadRequestException(final Throwable cause) {
63 super(ResourceException.BAD_REQUEST, cause);
64 }
65
66 }