站内搜索: 请输入搜索关键词
当前页面: 在线文档首页 > NetBeans API Javadoc (Current Development Version)

Exceptions (Utilities API) - NetBeans API Javadoc (Current Development Version)

org.openide.util 7.9.0 1

org.openide.util
Class Exceptions

java.lang.Object
  extended by org.openide.util.Exceptions

public final class Exceptions
extends Object

Useful utility and methods to work with exceptions as described in detail in the NetBeans logging guide. Allows to annotate exceptions with messages, extract such messages and provides a common utility method to report an exception.

Since:
7.2

Method Summary
static
<E extends Throwable>
E
attachLocalizedMessage(E e, String localizedMessage)
          Attaches additional localized message to given exception.
static
<E extends Throwable>
E
attachMessage(E e, String msg)
          Attaches additional message to given exception.
static String findLocalizedMessage(Throwable t)
          Extracts previously attached localized message for a given throwable.
static void printStackTrace(Throwable t)
          Notifies an exception with a severe level.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

attachMessage

public static <E extends Throwable> E attachMessage(E e,
                                                    String msg)
Attaches additional message to given exception. This message will be visible when one does e.printStackTrace().

Parameters:
e - exception to annotate
msg - the message to add to the exception
Returns:
the exception e

attachLocalizedMessage

public static <E extends Throwable> E attachLocalizedMessage(E e,
                                                             String localizedMessage)
Attaches additional localized message to given exception. This message can be extracted later by using findLocalizedMessage(java.lang.Throwable).

Parameters:
e - exception to annotate
localizedMessage - the localized message to add to the exception
Returns:
the exception e

findLocalizedMessage

public static String findLocalizedMessage(Throwable t)
Extracts previously attached localized message for a given throwable. Complements attachLocalizedMessage(E, java.lang.String).

Parameters:
t - the exception to search for a message in
Returns:
localized message attached to provided exception or null if no such message has been attached

printStackTrace

public static void printStackTrace(Throwable t)
Notifies an exception with a severe level. Such exception is going to be printed to log file and possibly also notified to alarm the user somehow.

Parameters:
t - the exception to notify

org.openide.util 7.9.0 1

Built on May 28 2007.  |  Portions Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.