blob: a5e351fd9adb6c35de09ce2149f4a56968244b7a [file] [log] [blame]
<!DOCTYPE HTML>
<!-- NewPage -->
<html lang="en">
<head>
<!-- Generated by javadoc (11.0.4) on Fri Sep 20 12:10:30 CEST 2019 -->
<title>Exceptions (Apache SIS 1.0 API)</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta name="dc.created" content="2019-09-20">
<meta name="keywords" content="org.apache.sis.util.Exceptions class">
<meta name="keywords" content="getLocalizedMessage()">
<meta name="keywords" content="setMessage()">
<meta name="keywords" content="messageEquals()">
<meta name="keywords" content="formatChainedMessages()">
<meta name="keywords" content="unwrap()">
<link rel="stylesheet" type="text/css" href="../../../../stylesheet.css" title="Style">
<link rel="stylesheet" type="text/css" href="../../../../sis.css" title="Style">
<link rel="stylesheet" type="text/css" href="../../../../jquery/jquery-ui.css" title="Style">
<script type="text/javascript" src="../../../../script.js"></script>
<script type="text/javascript" src="../../../../jquery/jszip/dist/jszip.min.js"></script>
<script type="text/javascript" src="../../../../jquery/jszip-utils/dist/jszip-utils.min.js"></script>
<!--[if IE]>
<script type="text/javascript" src="../../../../jquery/jszip-utils/dist/jszip-utils-ie.min.js"></script>
<![endif]-->
<script type="text/javascript" src="../../../../jquery/jquery-3.3.1.js"></script>
<script type="text/javascript" src="../../../../jquery/jquery-migrate-3.0.1.js"></script>
<script type="text/javascript" src="../../../../jquery/jquery-ui.js"></script>
</head>
<body>
<script type="text/javascript"><!--
try {
if (location.href.indexOf('is-external=true') == -1) {
parent.document.title="Exceptions (Apache SIS 1.0 API)";
}
}
catch(err) {
}
//-->
var data = {"i0":9,"i1":9,"i2":9,"i3":9,"i4":9};
var tabs = {65535:["t0","All Methods"],1:["t1","Static Methods"],8:["t4","Concrete Methods"]};
var altColor = "altColor";
var rowColor = "rowColor";
var tableTab = "tableTab";
var activeTableTab = "activeTableTab";
var pathtoroot = "../../../../";
var useModuleDirectories = false;
loadScripts(document, 'script');</script>
<noscript>
<div>JavaScript is disabled on your browser.</div>
</noscript>
<header role="banner">
<nav role="navigation">
<div class="fixedNav">
<!-- ========= START OF TOP NAVBAR ======= -->
<div class="topNav"><a id="navbar.top">
<!-- -->
</a>
<div class="skipNav"><a href="#skip.navbar.top" title="Skip navigation links">Skip navigation links</a></div>
<a id="navbar.top.firstrow">
<!-- -->
</a>
<ul class="navList" title="Navigation">
<li><a href="../../../../index.html">Overview</a></li>
<li><a href="package-summary.html">Package</a></li>
<li class="navBarCell1Rev">Class</li>
<li><a href="class-use/Exceptions.html">Use</a></li>
<li><a href="package-tree.html">Tree</a></li>
<li><a href="../../../../deprecated-list.html">Deprecated</a></li>
<li><a href="../../../../index-all.html">Index</a></li>
<li><a href="../../../../help-doc.html">Help</a></li>
</ul>
</div>
<div class="subNav">
<ul class="navList" id="allclasses_navbar_top">
<li><a href="../../../../allclasses.html">All&nbsp;Classes</a></li>
</ul>
<ul class="navListSearch">
<li><label for="search">SEARCH:</label>
<input type="text" id="search" value="search" disabled="disabled">
<input type="reset" id="reset" value="reset" disabled="disabled">
</li>
</ul>
<div>
<script type="text/javascript"><!--
allClassesLink = document.getElementById("allclasses_navbar_top");
if(window==top) {
allClassesLink.style.display = "block";
}
else {
allClassesLink.style.display = "none";
}
//-->
</script>
<noscript>
<div>JavaScript is disabled on your browser.</div>
</noscript>
</div>
<div>
<ul class="subNavList">
<li>Summary:&nbsp;</li>
<li>Nested&nbsp;|&nbsp;</li>
<li>Field&nbsp;|&nbsp;</li>
<li>Constr&nbsp;|&nbsp;</li>
<li><a href="#method.summary">Method</a></li>
</ul>
<ul class="subNavList">
<li>Detail:&nbsp;</li>
<li>Field&nbsp;|&nbsp;</li>
<li>Constr&nbsp;|&nbsp;</li>
<li><a href="#method.detail">Method</a></li>
</ul>
</div>
<a id="skip.navbar.top">
<!-- -->
</a></div>
<!-- ========= END OF TOP NAVBAR ========= -->
</div>
<div class="navPadding">&nbsp;</div>
<script type="text/javascript"><!--
$('.navPadding').css('padding-top', $('.fixedNav').css("height"));
//-->
</script>
</nav>
</header>
<!-- ======== START OF CLASS DATA ======== -->
<main role="main">
<div class="header">
<div class="subTitle"><span class="packageLabelInType">Package</span>&nbsp;<a href="package-summary.html">org.apache.sis.util</a></div>
<h2 title="Class Exceptions" class="title">Class Exceptions</h2>
</div>
<div class="contentContainer">
<ul class="inheritance">
<li><a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html?is-external=true" title="class or interface in java.lang" class="externalLink">Object</a></li>
<li>
<ul class="inheritance">
<li><a href="Static.html" title="class in org.apache.sis.util">Static</a></li>
<li>
<ul class="inheritance">
<li>Exceptions</li>
</ul>
</li>
</ul>
</li>
</ul>
<div class="description">
<ul class="blockList">
<li class="blockList">
<hr>
<pre>public final class <span class="typeNameLabel">Exceptions</span>
extends <a href="Static.html" title="class in org.apache.sis.util">Static</a></pre>
<div class="block">Static methods working with <a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Exception.html?is-external=true" title="class or interface in java.lang" class="externalLink"><code>Exception</code></a> instances.</div>
<dl>
<dt><span class="simpleTagLabel">Since:</span></dt>
<dd>0.3</dd>
<p><font size="-1">Defined in the <code>sis-utility</code> module</font></p>
</dl>
</li>
</ul>
</div>
<div class="summary">
<ul class="blockList">
<li class="blockList">
<!-- ========== METHOD SUMMARY =========== -->
<section role="region">
<ul class="blockList">
<li class="blockList"><a id="method.summary">
<!-- -->
</a>
<h3>Method Summary</h3>
<table class="memberSummary">
<caption><span id="t0" class="activeTableTab"><span>All Methods</span><span class="tabEnd">&nbsp;</span></span><span id="t1" class="tableTab"><span><a href="javascript:show(1);">Static Methods</a></span><span class="tabEnd">&nbsp;</span></span><span id="t4" class="tableTab"><span><a href="javascript:show(8);">Concrete Methods</a></span><span class="tabEnd">&nbsp;</span></span></caption>
<tr>
<th class="colFirst" scope="col">Modifier and Type</th>
<th class="colSecond" scope="col">Method</th>
<th class="colLast" scope="col">Description</th>
</tr>
<tr id="i0" class="altColor">
<td class="colFirst"><code>static <a href="https://docs.oracle.com/javase/8/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang" class="externalLink">String</a></code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#formatChainedMessages(java.util.Locale,java.lang.String,java.lang.Throwable)">formatChainedMessages</a></span>&#8203;(<a href="https://docs.oracle.com/javase/8/docs/api/java/util/Locale.html?is-external=true" title="class or interface in java.util" class="externalLink">Locale</a>&nbsp;locale,
<a href="https://docs.oracle.com/javase/8/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang" class="externalLink">String</a>&nbsp;header,
<a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Throwable.html?is-external=true" title="class or interface in java.lang" class="externalLink">Throwable</a>&nbsp;cause)</code></th>
<td class="colLast">
<div class="block">Returns a string which contain the given message on the first line, followed by the
<a href="#getLocalizedMessage(java.lang.Throwable,java.util.Locale)">localized message</a> of the given exception
on the next line.</div>
</td>
</tr>
<tr id="i1" class="rowColor">
<td class="colFirst"><code>static <a href="https://docs.oracle.com/javase/8/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang" class="externalLink">String</a></code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#getLocalizedMessage(java.lang.Throwable,java.util.Locale)">getLocalizedMessage</a></span>&#8203;(<a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Throwable.html?is-external=true" title="class or interface in java.lang" class="externalLink">Throwable</a>&nbsp;exception,
<a href="https://docs.oracle.com/javase/8/docs/api/java/util/Locale.html?is-external=true" title="class or interface in java.util" class="externalLink">Locale</a>&nbsp;locale)</code></th>
<td class="colLast">
<div class="block">Returns the message of the given exception, localized in the given locale if possible.</div>
</td>
</tr>
<tr id="i2" class="altColor">
<td class="colFirst"><code>static boolean</code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#messageEquals(java.lang.Throwable,java.lang.Throwable)">messageEquals</a></span>&#8203;(<a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Throwable.html?is-external=true" title="class or interface in java.lang" class="externalLink">Throwable</a>&nbsp;first,
<a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Throwable.html?is-external=true" title="class or interface in java.lang" class="externalLink">Throwable</a>&nbsp;second)</code></th>
<td class="colLast">
<div class="block">Returns <code>true</code> if the given exceptions are of the same class and contains the same message.</div>
</td>
</tr>
<tr id="i3" class="rowColor">
<td class="colFirst"><code>static &lt;T extends <a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Throwable.html?is-external=true" title="class or interface in java.lang" class="externalLink">Throwable</a>&gt;<br>T</code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#setMessage(T,java.lang.String,boolean)">setMessage</a></span>&#8203;(T&nbsp;exception,
<a href="https://docs.oracle.com/javase/8/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang" class="externalLink">String</a>&nbsp;message,
boolean&nbsp;append)</code></th>
<td class="colLast">
<div class="block">Returns an exception of the same kind and with the same stack trace than the given
exception, but with a different message.</div>
</td>
</tr>
<tr id="i4" class="altColor">
<td class="colFirst"><code>static <a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Exception.html?is-external=true" title="class or interface in java.lang" class="externalLink">Exception</a></code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#unwrap(java.lang.Exception)">unwrap</a></span>&#8203;(<a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Exception.html?is-external=true" title="class or interface in java.lang" class="externalLink">Exception</a>&nbsp;exception)</code></th>
<td class="colLast">
<div class="block">If the given exception is a wrapper for another exception, returns the unwrapped exception.</div>
</td>
</tr>
</table>
<ul class="blockList">
<li class="blockList"><a id="methods.inherited.from.class.Object">
<!-- -->
</a>
<h3>Methods inherited from class&nbsp;<a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html?is-external=true" title="class or interface in java.lang" class="externalLink">Object</a></h3>
<code><a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html?is-external=true#clone()" title="class or interface in java.lang" class="externalLink">clone</a>, <a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html?is-external=true#equals(java.lang.Object)" title="class or interface in java.lang" class="externalLink">equals</a>, <a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html?is-external=true#finalize()" title="class or interface in java.lang" class="externalLink">finalize</a>, <a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html?is-external=true#getClass()" title="class or interface in java.lang" class="externalLink">get­Class</a>, <a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html?is-external=true#hashCode()" title="class or interface in java.lang" class="externalLink">hash­Code</a>, <a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html?is-external=true#notify()" title="class or interface in java.lang" class="externalLink">notify</a>, <a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html?is-external=true#notifyAll()" title="class or interface in java.lang" class="externalLink">notify­All</a>, <a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html?is-external=true#toString()" title="class or interface in java.lang" class="externalLink">to­String</a>, <a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html?is-external=true#wait()" title="class or interface in java.lang" class="externalLink">wait</a>, <a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html?is-external=true#wait(long)" title="class or interface in java.lang" class="externalLink">wait</a>, <a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html?is-external=true#wait(long,int)" title="class or interface in java.lang" class="externalLink">wait</a></code></li>
</ul>
</li>
</ul>
</section>
</li>
</ul>
</div>
<div class="details">
<ul class="blockList">
<li class="blockList">
<!-- ============ METHOD DETAIL ========== -->
<section role="region">
<ul class="blockList">
<li class="blockList"><a id="method.detail">
<!-- -->
</a>
<h3>Method Detail</h3>
<a id="getLocalizedMessage(java.lang.Throwable,java.util.Locale)">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>getLocalizedMessage</h4>
<pre class="methodSignature">public static&nbsp;<a href="https://docs.oracle.com/javase/8/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang" class="externalLink">String</a>&nbsp;getLocalizedMessage&#8203;(<a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Throwable.html?is-external=true" title="class or interface in java.lang" class="externalLink">Throwable</a>&nbsp;exception,
<a href="https://docs.oracle.com/javase/8/docs/api/java/util/Locale.html?is-external=true" title="class or interface in java.util" class="externalLink">Locale</a>&nbsp;locale)</pre>
<div class="block">Returns the message of the given exception, localized in the given locale if possible.
Some exceptions created by SIS can format a message in different locales. This method
returns such localized message if possible, or fallback on the standard JDK methods otherwise.
More specifically:
<ul>
<li>If the given <code>exception</code> is null, then this method returns <code>null</code>.</li>
<li>Otherwise if the given <code>locale</code> is null, then this method returns <a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Throwable.html?is-external=true#getMessage()" title="class or interface in java.lang" class="externalLink"><code>Throwable​.get­Message()</code></a>.
This is consistent with the <a href="Localized.html" title="interface in org.apache.sis.util"><code>Localized</code></a> policy saying that null locale stands for "unlocalized"
message (usually in English) or message in the JVM <a href="https://docs.oracle.com/javase/8/docs/api/java/util/Locale.html?is-external=true#getDefault()" title="class or interface in java.util" class="externalLink">default locale</a>.</li>
<li>Otherwise if the given <code>exception</code> is an instance of <a href="LocalizedException.html" title="interface in org.apache.sis.util"><code>Localized­Exception</code></a> providing
a non-null <a href="LocalizedException.html#getInternationalMessage()">international message</a>,
then this method returns the result of <a href="http://www.geoapi.org/3.0/javadoc/org/opengis/util/InternationalString.html?is-external=true#toString(java.util.Locale)" title="class or interface in org.opengis.util" class="externalLink"><code>International­String​.to­String(Locale)</code></a>.</li>
<li>Otherwise this method returns <a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Throwable.html?is-external=true#getLocalizedMessage()" title="class or interface in java.lang" class="externalLink"><code>Throwable​.get­Localized­Message()</code></a>.</li>
</ul></div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>exception</code> - the exception from which to get the localize message, or <code>null</code>.</dd>
<dd><code>locale</code> - the preferred locale for the message, or <code>null</code> for the JVM default locale.
This locale is honored on a <cite>best-effort</cite> basis only.</dd>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>the message in the given locale if possible, or <code>null</code> if the <code>exception</code>
argument was <code>null</code> or if the exception does not contain a message.</dd>
<dt><span class="seeLabel">See Also:</span></dt>
<dd><a href="LocalizedException.html#getLocalizedMessage()"><code>Localized­Exception​.get­Localized­Message()</code></a></dd>
</dl>
</li>
</ul>
<a id="setMessage(java.lang.Throwable,java.lang.String,boolean)">
<!-- -->
</a><a id="setMessage(T,java.lang.String,boolean)">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>setMessage</h4>
<pre class="methodSignature">public static&nbsp;&lt;T extends <a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Throwable.html?is-external=true" title="class or interface in java.lang" class="externalLink">Throwable</a>&gt;&nbsp;T&nbsp;setMessage&#8203;(T&nbsp;exception,
<a href="https://docs.oracle.com/javase/8/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang" class="externalLink">String</a>&nbsp;message,
boolean&nbsp;append)</pre>
<div class="block">Returns an exception of the same kind and with the same stack trace than the given
exception, but with a different message. This method simulates the functionality
that we would have if <a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Throwable.html?is-external=true" title="class or interface in java.lang" class="externalLink"><code>Throwable</code></a> defined a <code>set­Message(String)</code> method.
We use this method when an external library throws an exception of the right type,
but with too few details.
<p>This method tries to create a new exception using reflection. The exception class needs
to provide a public constructor expecting a single <a href="https://docs.oracle.com/javase/8/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang" class="externalLink"><code>String</code></a> argument. If the
exception class does not provide such constructor, then the given exception is returned
unchanged.</p></div>
<dl>
<dt><span class="paramLabel">Type Parameters:</span></dt>
<dd><code>T</code> - the type of the exception.</dd>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>exception</code> - the exception to copy with a different message.</dd>
<dd><code>message</code> - the message to set in the exception to be returned.</dd>
<dd><code>append</code> - if <code>true</code>, the existing message in the original exception (if any)
will be happened after the provided message.</dd>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>a new exception with the given message, or the given exception if the exception
class does not provide public <code>Exception(String)</code> constructor.</dd>
</dl>
</li>
</ul>
<a id="messageEquals(java.lang.Throwable,java.lang.Throwable)">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>messageEquals</h4>
<pre class="methodSignature">public static&nbsp;boolean&nbsp;messageEquals&#8203;(<a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Throwable.html?is-external=true" title="class or interface in java.lang" class="externalLink">Throwable</a>&nbsp;first,
<a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Throwable.html?is-external=true" title="class or interface in java.lang" class="externalLink">Throwable</a>&nbsp;second)</pre>
<div class="block">Returns <code>true</code> if the given exceptions are of the same class and contains the same message.
This method does not compare the <a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Throwable.html?is-external=true#getStackTrace()" title="class or interface in java.lang" class="externalLink">stack trace</a>,
<a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Throwable.html?is-external=true#getCause()" title="class or interface in java.lang" class="externalLink">cause</a> or <a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Throwable.html?is-external=true#getSuppressed()" title="class or interface in java.lang" class="externalLink">suppressed exceptions</a>.</div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>first</code> - the first exception, or <code>null</code>.</dd>
<dd><code>second</code> - the second exception, or <code>null</code>.</dd>
<dt><span class="returnLabel">Returns:</span></dt>
<dd><code>true</code> if both exceptions are <code>null</code>, or both exceptions are non-null,
of the same class and with the same <a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Throwable.html?is-external=true#getMessage()" title="class or interface in java.lang" class="externalLink">message</a>.</dd>
<dt><span class="simpleTagLabel">Since:</span></dt>
<dd>1.0</dd>
</dl>
</li>
</ul>
<a id="formatChainedMessages(java.util.Locale,java.lang.String,java.lang.Throwable)">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>formatChainedMessages</h4>
<pre class="methodSignature">public static&nbsp;<a href="https://docs.oracle.com/javase/8/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang" class="externalLink">String</a>&nbsp;formatChainedMessages&#8203;(<a href="https://docs.oracle.com/javase/8/docs/api/java/util/Locale.html?is-external=true" title="class or interface in java.util" class="externalLink">Locale</a>&nbsp;locale,
<a href="https://docs.oracle.com/javase/8/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang" class="externalLink">String</a>&nbsp;header,
<a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Throwable.html?is-external=true" title="class or interface in java.lang" class="externalLink">Throwable</a>&nbsp;cause)</pre>
<div class="block">Returns a string which contain the given message on the first line, followed by the
<a href="#getLocalizedMessage(java.lang.Throwable,java.util.Locale)">localized message</a> of the given exception
on the next line. If the exception has a <a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Throwable.html?is-external=true#getCause()" title="class or interface in java.lang" class="externalLink">causes</a>, then
the class name and the localized message of the cause are formatted on the next line
and the process is repeated for the whole cause chain, omitting duplicated messages.
<p><a href="https://docs.oracle.com/javase/8/docs/api/java/sql/SQLException.html?is-external=true" title="class or interface in java.sql" class="externalLink"><code>SQLException</code></a> is handled especially in order to process the
<a href="https://docs.oracle.com/javase/8/docs/api/java/sql/SQLException.html?is-external=true#getNextException()" title="class or interface in java.sql" class="externalLink">next exception</a> instead than the cause.</p>
<p>This method does not format the stack trace.</p></div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>locale</code> - the preferred locale for the exception message, or <code>null</code>.</dd>
<dd><code>header</code> - the message to insert on the first line, or <code>null</code> if none.</dd>
<dd><code>cause</code> - the exception, or <code>null</code> if none.</dd>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>the formatted message, or <code>null</code> if both the header was <code>null</code>
and no exception provide a message.</dd>
</dl>
</li>
</ul>
<a id="unwrap(java.lang.Exception)">
<!-- -->
</a>
<ul class="blockListLast">
<li class="blockList">
<h4>unwrap</h4>
<pre class="methodSignature">public static&nbsp;<a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Exception.html?is-external=true" title="class or interface in java.lang" class="externalLink">Exception</a>&nbsp;unwrap&#8203;(<a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Exception.html?is-external=true" title="class or interface in java.lang" class="externalLink">Exception</a>&nbsp;exception)</pre>
<div class="block">If the given exception is a wrapper for another exception, returns the unwrapped exception.
Otherwise returns the given argument unchanged. An exception is considered a wrapper if:
<ul>
<li>It is an instance of <a href="https://docs.oracle.com/javase/8/docs/api/java/lang/reflect/InvocationTargetException.html?is-external=true" title="class or interface in java.lang.reflect" class="externalLink"><code>Invocation­Target­Exception</code></a> (could be wrapping anything).</li>
<li>It is an instance of <a href="collection/BackingStoreException.html" title="class in org.apache.sis.util.collection"><code>Backing­Store­Exception</code></a> (typically wrapping a checked exception).</li>
<li>It is an instance of <a href="https://docs.oracle.com/javase/8/docs/api/java/io/UncheckedIOException.html?is-external=true" title="class or interface in java.io" class="externalLink"><code>Unchecked­IOException</code></a> (wrapping a <a href="https://docs.oracle.com/javase/8/docs/api/java/io/IOException.html?is-external=true" title="class or interface in java.io" class="externalLink"><code>IOException</code></a>).</li>
<li>It is an instance of <a href="https://docs.oracle.com/javase/8/docs/api/java/nio/file/DirectoryIteratorException.html?is-external=true" title="class or interface in java.nio.file" class="externalLink"><code>Directory­Iterator­Exception</code></a> (wrapping a <a href="https://docs.oracle.com/javase/8/docs/api/java/io/IOException.html?is-external=true" title="class or interface in java.io" class="externalLink"><code>IOException</code></a>).</li>
<li>It is a parent type of the cause. For example some JDBC drivers wrap <a href="https://docs.oracle.com/javase/8/docs/api/java/sql/SQLException.html?is-external=true" title="class or interface in java.sql" class="externalLink"><code>SQLException</code></a>
in other <code>SQLException</code> without additional information.</li>
</ul>
<div class="note"><b>Note:</b>
<a href="https://docs.oracle.com/javase/8/docs/api/java/security/PrivilegedActionException.html?is-external=true" title="class or interface in java.security" class="externalLink"><code>Privileged­Action­Exception</code></a> is also a wrapper exception, but is not included in above list
because it is used in very specific contexts.</div>
This method uses only the exception class as criterion;
it does not verify if the exception messages are the same.</div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>exception</code> - the exception to unwrap (may be <code>null</code>.</dd>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>the unwrapped exception (may be the given argument itself).</dd>
<dt><span class="simpleTagLabel">Since:</span></dt>
<dd>0.8</dd>
</dl>
</li>
</ul>
</li>
</ul>
</section>
</li>
</ul>
</div>
</div>
</main>
<!-- ========= END OF CLASS DATA ========= -->
<footer role="contentinfo">
<nav role="navigation">
<!-- ======= START OF BOTTOM NAVBAR ====== -->
<div class="bottomNav"><a id="navbar.bottom">
<!-- -->
</a>
<div class="skipNav"><a href="#skip.navbar.bottom" title="Skip navigation links">Skip navigation links</a></div>
<a id="navbar.bottom.firstrow">
<!-- -->
</a>
<ul class="navList" title="Navigation">
<li><a href="../../../../index.html">Overview</a></li>
<li><a href="package-summary.html">Package</a></li>
<li class="navBarCell1Rev">Class</li>
<li><a href="class-use/Exceptions.html">Use</a></li>
<li><a href="package-tree.html">Tree</a></li>
<li><a href="../../../../deprecated-list.html">Deprecated</a></li>
<li><a href="../../../../index-all.html">Index</a></li>
<li><a href="../../../../help-doc.html">Help</a></li>
</ul>
</div>
<div class="subNav">
<ul class="navList" id="allclasses_navbar_bottom">
<li><a href="../../../../allclasses.html">All&nbsp;Classes</a></li>
</ul>
<div>
<script type="text/javascript"><!--
allClassesLink = document.getElementById("allclasses_navbar_bottom");
if(window==top) {
allClassesLink.style.display = "block";
}
else {
allClassesLink.style.display = "none";
}
//-->
</script>
<noscript>
<div>JavaScript is disabled on your browser.</div>
</noscript>
</div>
<div>
<ul class="subNavList">
<li>Summary:&nbsp;</li>
<li>Nested&nbsp;|&nbsp;</li>
<li>Field&nbsp;|&nbsp;</li>
<li>Constr&nbsp;|&nbsp;</li>
<li><a href="#method.summary">Method</a></li>
</ul>
<ul class="subNavList">
<li>Detail:&nbsp;</li>
<li>Field&nbsp;|&nbsp;</li>
<li>Constr&nbsp;|&nbsp;</li>
<li><a href="#method.detail">Method</a></li>
</ul>
</div>
<a id="skip.navbar.bottom">
<!-- -->
</a></div>
<!-- ======== END OF BOTTOM NAVBAR ======= -->
</nav>
<p class="legalCopy"><small>Copyright &#169; 2010&#x2013;2019 <a href="https://www.apache.org/">The Apache Software Foundation</a>. All rights reserved.</small></p>
</footer>
</body>
</html>