001/* 002 * The contents of this file are subject to the terms of the Common Development and 003 * Distribution License (the License). You may not use this file except in compliance with the 004 * License. 005 * 006 * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the 007 * specific language governing permission and limitations under the License. 008 * 009 * When distributing Covered Software, include this CDDL Header Notice in each file and include 010 * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL 011 * Header, with the fields enclosed by brackets [] replaced by your own identifying 012 * information: "Portions Copyrighted [year] [name of copyright owner]". 013 * 014 * Copyright 2011-2015 ForgeRock AS. 015 */ 016 017package org.forgerock.json.resource; 018 019/** 020 * An exception that is thrown during a operation on a resource when such an 021 * operation would result in a conflict. For example: when a patch conflicts 022 * with the object state. For MVCC version required/failed failures use those 023 * specific exceptions instead, 024 * 025 * @see PreconditionFailedException 026 * @see PreconditionRequiredException 027 */ 028public class ConflictException extends ResourceException { 029 030 private static final long serialVersionUID = 1L; 031 032 /** 033 * Constructs a new exception with {@code null} as its detail message. 034 */ 035 public ConflictException() { 036 super(ResourceException.CONFLICT); 037 } 038 039 /** 040 * Constructs a new exception with the specified detail message. 041 * 042 * @param message 043 * The detail message. 044 */ 045 public ConflictException(final String message) { 046 super(ResourceException.CONFLICT, message); 047 } 048 049 /** 050 * Constructs a new exception with the specified detail message and cause. 051 * 052 * @param message 053 * The detail message. 054 * @param cause 055 * The exception which caused this exception to be thrown. 056 */ 057 public ConflictException(final String message, final Throwable cause) { 058 super(ResourceException.CONFLICT, message, cause); 059 } 060 061 /** 062 * Constructs a new exception with the specified cause. 063 * 064 * @param cause 065 * The exception which caused this exception to be thrown. 066 */ 067 public ConflictException(final Throwable cause) { 068 super(ResourceException.CONFLICT, cause); 069 } 070}