001// *************************************************************************************************************************** 002// * Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file * 003// * distributed with this work for additional information regarding copyright ownership. The ASF licenses this file * 004// * to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance * 005// * with the License. You may obtain a copy of the License at * 006// * * 007// * http://www.apache.org/licenses/LICENSE-2.0 * 008// * * 009// * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an * 010// * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the * 011// * specific language governing permissions and limitations under the License. * 012// *************************************************************************************************************************** 013package org.apache.juneau; 014 015import java.text.*; 016 017/** 018 * General runtime operation exception that can occur in any of the context classes. 019 */ 020public final class ContextRuntimeException extends FormattedRuntimeException { 021 022 private static final long serialVersionUID = 1L; 023 024 /** 025 * Constructor. 026 * 027 * @param cause The cause of this exception. 028 * @param message The {@link MessageFormat}-style message. 029 * @param args Optional {@link MessageFormat}-style arguments. 030 */ 031 public ContextRuntimeException(Throwable cause, String message, Object... args) { 032 super(cause, getMessage(cause, message, null), args); 033 } 034 035 /** 036 * Constructor. 037 * 038 * @param message The error message. 039 * @param args Arguments passed in to the {@code String.format()} method. 040 */ 041 public ContextRuntimeException(String message, Object...args) { 042 this(null, message, args); 043 } 044 045 /** 046 * Constructor. 047 * 048 * @param cause The initial cause of the exception. 049 */ 050 public ContextRuntimeException(Throwable cause) { 051 this(cause, null); 052 } 053 054 /** 055 * @deprecated Use {@link #ContextRuntimeException(String, Object...)} 056 */ 057 @SuppressWarnings("javadoc") 058 @Deprecated 059 public ContextRuntimeException(String message) { 060 super(message); 061 } 062 063 /** 064 * @deprecated {@link #ContextRuntimeException(Throwable)} 065 */ 066 @Deprecated 067 @Override /* Throwable */ 068 public synchronized ContextRuntimeException initCause(Throwable cause) { 069 super.initCause(cause); 070 return this; 071 } 072}