com.gemstone.gemfire.GemFireException Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of gemfire-core Show documentation
Show all versions of gemfire-core Show documentation
TIBCO ComputeDB store based off Pivotal GemFireXD
/*
* Copyright (c) 2010-2015 Pivotal Software, Inc. All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License"); you
* may not use this file except in compliance with the License. You
* may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
* implied. See the License for the specific language governing
* permissions and limitations under the License. See accompanying
* LICENSE file.
*/
package com.gemstone.gemfire;
import com.gemstone.gemfire.distributed.DistributedMember;
/**
* This is the abstract superclass of exceptions that are thrown to
* indicate incorrect usage of GemFire.
*
* Since these exceptions are unchecked, this class really
* ought to be called GemFireRuntimeException
;
* however, the current name is retained for compatibility's sake.
*
* @author David Whitlock
* @see com.gemstone.gemfire.GemFireCheckedException
* @see com.gemstone.gemfire.cache.CacheRuntimeException
*/
// Implementation note: This class is abstract so that we are forced
// to have more specific exception types. We want to avoid using
// GemFireException to describe an arbitrary error condition (think
// GsError).
public abstract class GemFireException extends RuntimeException {
/** The cause of this GemFireException
*/
// private Throwable cause;
////////////////////// Constructors //////////////////////
/**
* Creates a new GemFireException
with no detailed message.
*/
public GemFireException() {
super();
}
/**
* Creates a new GemFireException
with the given detail
* message.
*/
public GemFireException(String message) {
super(message);
}
/**
* Creates a new GemFireException
with the given detail
* message and cause.
*/
public GemFireException(String message, Throwable cause) {
super(message, cause);
// this.cause = cause;
}
/**
* Creates a new GemFireException
with the given cause and
* no detail message
*/
public GemFireException(Throwable cause) {
super(cause);
// this.cause = cause;
}
//////////////////// Instance Methods ////////////////////
/**
* Returns the cause of this GemFireException
or
* null
if the cause is nonexistent or unknown.
*/
// public Throwable getCause() {
// return this.cause;
// }
/**
* Returns the root cause of this GemFireException
or
* null
if the cause is nonexistent or unknown.
*/
public Throwable getRootCause() {
if ( this.getCause() == null ) {
return null;
}
Throwable root = this.getCause();
while ( root.getCause() != null ) {
root = root.getCause();
}
return root;
}
private transient DistributedMember origin;
public DistributedMember getOrigin() {
return this.origin;
}
public void setOrigin(DistributedMember origin) {
this.origin = origin;
}
// public void printStackTrace() {
// super.printStackTrace();
// if (this.cause != null) {
// System.err.println("Caused by:");
// this.cause.printStackTrace();
// }
// }
// public void printStackTrace(java.io.PrintWriter pw) {
// super.printStackTrace(pw);
//
// if (this.cause != null) {
// pw.println("Caused by:");
// this.cause.printStackTrace(pw);
// }
// }
//
// public String getMessage() {
// if (this.cause != null) {
// String ourMsg = super.getMessage();
// if (ourMsg == null || ourMsg.length() == 0) {
// //ourMsg = super.toString(); //causes inifinite recursion
// ourMsg = "";
// }
// StringBuffer sb = new StringBuffer(ourMsg);
// sb.append(" Caused by: ");
// String causeMsg = this.cause.getMessage();
// if (causeMsg == null || causeMsg.length() == 0) {
// causeMsg = this.cause.toString();
// }
// sb.append(causeMsg);
// return sb.toString();
// } else {
// return super.getMessage();
// }
// }
/**
* Represent the receiver as well as the cause
*/
// public String toString() {
// String result = super.toString();
// if (cause != null) {
// result = result + ", caused by " + cause.toString();
// }
// return result;
// }
}