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:Main.java

static void initReflection() {
    try {/*from w w  w  .  j  av a2s. c om*/

        // lightweight dispatcher
        dispatcherField = Container.class.getDeclaredField("dispatcher");
        dispatcherField.setAccessible(true);

        Class<?> dispatcherCls = Class.forName("java.awt.LightweightDispatcher");
        newLightweightDispatcher = dispatcherCls.getDeclaredConstructor(new Class[] { Container.class });
        newLightweightDispatcher.setAccessible(true);

        dispatchMethod = dispatcherCls.getDeclaredMethod("dispatchEvent", AWTEvent.class);
        dispatchMethod.setAccessible(true);

        enableEvents = dispatcherCls.getDeclaredMethod("enableEvents", new Class[] { long.class });
        enableEvents.setAccessible(true);

    } catch (Exception ex) {

        System.err.println(ex);

        InternalError err = new InternalError();
        err.initCause(ex);
        throw err;
    }
}

From source file:edu.ku.brc.af.core.RecordSetFactory.java

/**
 * Returns the instance to the singleton
 * @return  the instance to the singleton
 *///www  .j a  va  2 s.c om
public static RecordSetFactory getInstance() {
    if (instance != null) {
        return instance;
    }

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

    if (isNotEmpty(factoryNameStr)) {
        try {
            return instance = (RecordSetFactory) Class.forName(factoryNameStr).newInstance();

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

From source file:edu.ku.brc.af.auth.SecurityMgr.java

/**
 * Returns the instance to the singleton
 * @return  the instance to the singleton
 *//*w  w  w . ja va2  s  .  com*/
public static SecurityMgr getInstance() {
    if (instance != null) {
        return instance;
    }

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

    if (isNotEmpty(factoryNameStr)) {
        try {
            return instance = (SecurityMgr) Class.forName(factoryNameStr).newInstance();

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

From source file:edu.ku.brc.af.core.expresssearch.QueryAdjusterForDomain.java

/**
 * Returns the instance to the singleton
 * @return  the instance to the singleton
 *//* ww w.ja  va  2s  . c  o  m*/
public static QueryAdjusterForDomain getInstance() {
    if (instance != null) {
        return instance;
    }

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

    if (isNotEmpty(factoryNameStr)) {
        try {
            return instance = (QueryAdjusterForDomain) Class.forName(factoryNameStr).newInstance();

        } catch (Exception e) {
            edu.ku.brc.af.core.UsageTracker.incrHandledUsageCount();
            edu.ku.brc.exceptions.ExceptionTracker.getInstance().capture(QueryAdjusterForDomain.class, e);
            InternalError error = new InternalError(
                    "Can't instantiate ExpressSearchSQLAdjuster factory " + factoryNameStr); //$NON-NLS-1$
            error.initCause(e);
            throw error;
        }
    }
    // if not factory than pass an instance of this in
    // and this does nothing to the SQL.
    return instance = new QueryAdjusterForDomain();
}

From source file:edu.ku.brc.dbsupport.SchemaUpdateService.java

/**
 * Returns the instance of the AppContextMgr.
 * @return the instance of the AppContextMgr.
 *///from ww  w. jav  a  2s . co m
public static SchemaUpdateService 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 = (SchemaUpdateService) Class.forName(factoryNameStr).newInstance();
            return instance;

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

From source file:edu.ku.brc.af.ui.weblink.WebLinkMgr.java

/**
 * Returns the instance to the singleton
 * @return  the instance to the singleton
 *///from w  w  w  .ja v a2 s . c  om
public static WebLinkMgr getInstance() {
    if (instance != null) {
        return instance;
    }

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

    if (isNotEmpty(factoryNameStr)) {
        try {
            return instance = (WebLinkMgr) Class.forName(factoryNameStr).newInstance();

        } catch (Exception e) {
            edu.ku.brc.af.core.UsageTracker.incrHandledUsageCount();
            edu.ku.brc.exceptions.ExceptionTracker.getInstance().capture(WebLinkMgr.class, e);
            InternalError error = new InternalError("Can't instantiate WebLink factory " + factoryNameStr); //$NON-NLS-1$
            error.initCause(e);
            throw error;
        }
    }
    // if not factory than pass an instance of this in
    // and this does nothing to the SQL.
    return instance = new WebLinkMgr();
}

From source file:edu.ku.brc.af.core.db.BackupServiceFactory.java

/**
 * Returns the instance to the singleton
 * @return  the instance to the singleton
 *//* w  w  w.j a v a 2  s  . co m*/
public static BackupServiceFactory getInstance() {
    if (instance != null) {
        return instance;
    }

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

    if (isNotEmpty(factoryNameStr)) {
        try {
            return instance = (BackupServiceFactory) Class.forName(factoryNameStr).newInstance();

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

From source file:edu.ku.brc.af.core.SchemaI18NService.java

/**
 * Returns the instance of the AppContextMgr.
 * @return the instance of the AppContextMgr.
 *///from   ww  w  .  j a  v a2 s. c om
public static SchemaI18NService 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 = (SchemaI18NService) Class.forName(factoryNameStr).newInstance();
            return instance;

        } catch (Exception e) {
            edu.ku.brc.af.core.UsageTracker.incrHandledUsageCount();
            edu.ku.brc.exceptions.ExceptionTracker.getInstance().capture(SchemaI18NService.class, e);
            InternalError error = new InternalError(
                    "Can't instantiate SchemaI18NService factory " + factoryNameStr); //$NON-NLS-1$
            error.initCause(e);
            throw error;
        }
    }
    throw new RuntimeException("The System porpoerty [" + factoryName + "] has not been set up!"); //$NON-NLS-1$ //$NON-NLS-2$
}

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

/**
 * Returns the instance to the singleton
 * //from w  ww  .  j a v a2s . com
 * @return the instance to the singleton
 */
public static TypeSearchForQueryFactory getInstance() {
    if (instance != null) {
        return instance;
    }

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

    if (isNotEmpty(factoryNameStr)) {
        try {
            return instance = (TypeSearchForQueryFactory) Class.forName(factoryNameStr).newInstance();

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

From source file:edu.ku.brc.af.core.db.DBTableIdMgr.java

/**
 * Returns the singleton./* ww w  . j a v  a  2s  .co  m*/
 * @return the singleton.
 */
public static DBTableIdMgr getInstance() {
    if (instance != null) {
        return instance;
    }

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

    if (isNotEmpty(factoryNameStr)) {
        try {
            instance = (DBTableIdMgr) Class.forName(factoryNameStr).newInstance();
            instance.initialize();
            return instance;

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