Example usage for java.lang InternalError initCause

List of usage examples for java.lang InternalError initCause

Introduction

In this page you can find the example usage for java.lang InternalError initCause.

Prototype

public synchronized Throwable initCause(Throwable cause) 

Source Link

Document

Initializes the cause of this throwable to the specified value.

Usage

From source file:edu.ku.brc.ui.UIRegistry.java

/**
 * Returns the ViewBasedFacory for the application.
 * @return the ViewBasedFacory for the application
 *//*from   w  w w  .j a  v a2s. c o  m*/
public static ViewBasedDialogFactoryIFace getViewbasedFactory() {
    if (instance.viewbasedFactory == null) {
        String className = System.getProperty("edu.ku.brc.ui.ViewBasedDialogFactoryIFace", null);
        if (StringUtils.isNotEmpty(className)) {
            try {
                instance.viewbasedFactory = (ViewBasedDialogFactoryIFace) Class.forName(className)
                        .newInstance();

            } catch (Exception e) {
                InternalError error = new InternalError(
                        "Can't instantiate ViewBasedDialogFactoryIFace factory " + className);
                error.initCause(e);
                throw error;
            }

        } else {
            throw new InternalError(MISSING_FACTORY_MSG);
        }
    }

    return instance.viewbasedFactory;
}

From source file:edu.ku.brc.af.ui.forms.ViewFactory.java

/**
 * Returns the singleton for the ViewSetMgr.
 * @return the singleton for the ViewSetMgr
 *///w  w  w.j  ava2 s.  c  o  m
public static ViewFactory getInstance() {
    if (instance != null) {
        return instance;

    }
    // else
    String factoryNameStr = AccessController.doPrivileged(new PrivilegedAction<String>() {
        public String run() {
            return System.getProperty(factoryName);
        }
    });

    if (factoryNameStr != null) {
        try {
            instance = (ViewFactory) Class.forName(factoryNameStr).newInstance();
            return instance;

        } catch (Exception e) {
            edu.ku.brc.af.core.UsageTracker.incrHandledUsageCount();
            edu.ku.brc.exceptions.ExceptionTracker.getInstance().capture(AppContextMgr.class, e);
            InternalError error = new InternalError("Can't instantiate ViewFactory factory " + factoryNameStr); //$NON-NLS-1$
            error.initCause(e);
            throw error;
        }
    }
    return instance = new ViewFactory();
}