
com.sun.messaging.jms.InvalidDestinationException Maven / Gradle / Ivy
/*
* Copyright (c) 2000, 2020 Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2021 Contributors to the Eclipse Foundation
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v. 2.0, which is available at
* http://www.eclipse.org/legal/epl-2.0.
*
* This Source Code may also be made available under the following Secondary
* Licenses when the conditions for such availability set forth in the
* Eclipse Public License v. 2.0 are satisfied: GNU General Public License,
* version 2 with the GNU Classpath Exception, which is available at
* https://www.gnu.org/software/classpath/license.html.
*
* SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
*/
package com.sun.messaging.jms;
import java.io.*;
import com.sun.messaging.jmq.jmsclient.logging.Loggable;
/**
*
* This exception must be thrown when a destination either is not understood by a provider or is no longer valid.
**/
public class InvalidDestinationException extends jakarta.jms.InvalidDestinationException implements Loggable {
private static final long serialVersionUID = -7588060084651052287L;
private boolean isLogged = false;
/**
* Constructs a InvalidDestinationException
with the specified reason and error code.
*
* @param reason a description of the exception
* @param errorCode a string specifying the vendor-specific error code
**/
public InvalidDestinationException(String reason, String errorCode) {
super(reason, errorCode);
}
/**
*
*
* If running under J2SE1.4 or above, this method will also set the cause of the
* InvalidDestinationException
. When a backtrace of the InvalidDestinationException
is printed
* using {@link java.lang.Exception#printStackTrace printStackTrace} using {@link java.lang.Throwable#printStackTrace
* printStackTrace} a backtrace of the cause will also get printed.
*
**/
@Override
public synchronized void setLinkedException(Exception ex) {
super.setLinkedException(ex);
try {
initCause(ex);
} catch (Throwable t) {
}
}
/**
*
*
* If running under versions of the Java platform prior to J2SE1.4, this method will also print the backtrace of the
* exception linked to this InvalidDestinationException
and obtained via
* {@link jakarta.jms.JMSException#getLinkedException jakarta.jms.JMSException.getLinkedException()}
**/
@Override
public void printStackTrace() {
this.printStackTrace(System.err);
}
/**
* {@inheritDoc}
*
* If running under versions of the Java platform prior to J2SE1.4, this method will also print the backtrace of the
* exception linked to this InvalidDestinationException
and obtained via
* {@link jakarta.jms.JMSException#getLinkedException jakarta.jms.JMSException.getLinkedException()}
**/
@Override
public void printStackTrace(PrintStream s) {
Throwable cause;
super.printStackTrace(s);
try {
getCause();
} catch (Throwable t) {
if ((cause = getLinkedException()) != null) {
synchronized (s) {
s.print("Caused by: ");
}
cause.printStackTrace(s);
}
}
}
/**
*
*
* If running under versions of the Java platform prior to J2SE1.4, this method will also print the backtrace of the
* exception linked to this InvalidDestinationException
and obtained via
* {@link jakarta.jms.JMSException#getLinkedException}
**/
@Override
public void printStackTrace(PrintWriter s) {
Throwable cause;
super.printStackTrace(s);
try {
getCause();
} catch (Throwable t) {
if ((cause = getLinkedException()) != null) {
synchronized (s) {
s.print("Caused by: "); // + cause.toString());
}
cause.printStackTrace(s);
}
}
}
/**
* set state to true if this object is logged.
*
* @param state boolean
*/
@Override
public void setLogState(boolean state) {
this.isLogged = state;
}
/**
* get logging state of this object.
*
* @return boolean true if this object is logged.
*/
@Override
public boolean getLogState() {
return this.isLogged;
}
}