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.af.auth.UserAndMasterPasswordMgr.java

/**
 * Returns the instance to the singleton
 * @return  the instance to the singleton
 *//*from w ww  .  j  a  v a  2  s . com*/
public static UserAndMasterPasswordMgr 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 = (UserAndMasterPasswordMgr) Class.forName(factoryNameStr).newInstance();

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

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

/**
 * Returns the instance to the singleton
 * //  www .  ja  v  a  2 s  .  c  o m
 * @return the instance to the singleton
 */
public static UIFieldFormatterMgr getInstance() {
    if (instance != null) {
        return instance;
    }

    if (StringUtils.isEmpty(factoryName)) {
        return instance = new UIFieldFormatterMgr();
    }

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

    if (StringUtils.isNotEmpty(factoryNameStr)) {
        try {
            instance = (UIFieldFormatterMgr) Class.forName(factoryNameStr).newInstance();
            instance.load();
            return instance;

        } catch (Exception e) {
            edu.ku.brc.af.core.UsageTracker.incrHandledUsageCount();
            edu.ku.brc.exceptions.ExceptionTracker.getInstance().capture(UIFieldFormatterMgr.class, e);
            InternalError error = new InternalError(
                    "Can't instantiate UIFieldFormatterMgr factory " + factoryNameStr);
            error.initCause(e);
            throw error;
        }
    }
    // should not happen
    throw new RuntimeException("Can't instantiate UIFieldFormatterMgr factory [" + factoryNameStr + "]");
}

From source file:FullThreadDump.java

/**
 * Constructs a ThreadMonitor object to get thread information in a remote
 * JVM.//from  w  w  w . j  a v a2 s  .com
 */
public ThreadMonitor(MBeanServerConnection server) throws IOException {
    this.server = server;
    this.tmbean = newPlatformMXBeanProxy(server, THREAD_MXBEAN_NAME, ThreadMXBean.class);
    try {
        objname = new ObjectName(THREAD_MXBEAN_NAME);
    } catch (MalformedObjectNameException e) {
        // should not reach here
        InternalError ie = new InternalError(e.getMessage());
        ie.initCause(e);
        throw ie;
    }
    parseMBeanInfo();
}

From source file:FullThreadDump.java

private void parseMBeanInfo() throws IOException {
    try {//from   w  ww .j  a  v a 2  s.com
        MBeanOperationInfo[] mopis = server.getMBeanInfo(objname).getOperations();

        // look for findDeadlockedThreads operations;
        boolean found = false;
        for (MBeanOperationInfo op : mopis) {
            if (op.getName().equals(findDeadlocksMethodName)) {
                found = true;
                break;
            }
        }
        if (!found) {
            // if findDeadlockedThreads operation doesn't exist,
            // the target VM is running on JDK 5 and details about
            // synchronizers and locks cannot be dumped.
            findDeadlocksMethodName = "findMonitorDeadlockedThreads";
            canDumpLocks = false;
        }
    } catch (IntrospectionException e) {
        InternalError ie = new InternalError(e.getMessage());
        ie.initCause(e);
        throw ie;
    } catch (InstanceNotFoundException e) {
        InternalError ie = new InternalError(e.getMessage());
        ie.initCause(e);
        throw ie;
    } catch (ReflectionException e) {
        InternalError ie = new InternalError(e.getMessage());
        ie.initCause(e);
        throw ie;
    }
}

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

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

    synchronized (instance) {
        if (StringUtils.isEmpty(factoryName)) {
            instance.set(new DataObjFieldFormatMgr());

        } else {

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

            if (StringUtils.isNotEmpty(factoryNameStr)) {
                try {
                    instance.set((DataObjFieldFormatMgr) Class.forName(factoryNameStr).newInstance());

                } catch (Exception e) {
                    edu.ku.brc.af.core.UsageTracker.incrHandledUsageCount();
                    edu.ku.brc.exceptions.ExceptionTracker.getInstance().capture(DataObjFieldFormatMgr.class,
                            e);
                    InternalError error = new InternalError(
                            "Can't instantiate DataObjFieldFormatMgr factory " + factoryNameStr);
                    error.initCause(e);
                    throw error;
                }
            }

            if (instance.get() == null) {
                instance.set(new DataObjFieldFormatMgr());
            }
        }

        // now that all formats have been loaded, set table/field/formatter
        // info\
        // must be executed after the instance is set
        for (DataObjSwitchFormatter format : instance.get().formatHash.values()) {
            format.setTableAndFieldInfo();
        }
    }
    return instance.get();
}

From source file:fullThreadDump.java

/**
* Constructs a ThreadMonitor object to get thread information in a remote
* JVM./*from  w w  w .  j  a  v a 2s  .  co  m*/
 * @throws IOException 
*/
public ThreadMonitor(MBeanServerConnection server, boolean stats) throws IOException {
    this.server = server;
    this.stats = stats;
    this.tmbean = newPlatformMXBeanProxy(server, THREAD_MXBEAN_NAME, ThreadMXBean.class);
    try {
        objname = new ObjectName(THREAD_MXBEAN_NAME);
    } catch (MalformedObjectNameException e) {
        // should not reach here
        InternalError ie = new InternalError(e.getMessage());
        ie.initCause(e);
        throw ie;
    }
    parseMBeanInfo();
}

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

public BusinessRulesIFace createBusinessRule() {
    BusinessRulesIFace businessRule = null;
    if (StringUtils.isNotEmpty(businessRulesClassName)) {
        try {/*from www  . j a va2  s  . c  om*/
            businessRule = (BusinessRulesIFace) Class.forName(businessRulesClassName).newInstance();

        } catch (Exception e) {
            edu.ku.brc.af.core.UsageTracker.incrHandledUsageCount();
            edu.ku.brc.exceptions.ExceptionTracker.getInstance().capture(View.class, e);

            InternalError error = new InternalError(
                    "Can't instantiate BusinessRulesIFace [" + businessRulesClassName + "]");
            error.initCause(e);
            throw error;
        }

    } else if (useDefaultBusRules) {
        businessRule = DBTableIdMgr.getInstance().getBusinessRule(className);
    }

    return businessRule;
}

From source file:fullThreadDump.java

private void parseMBeanInfo() throws IOException {
    try {/*from   w  ww  . j a  v  a  2 s  . c  o  m*/
        MBeanOperationInfo[] mopis = server.getMBeanInfo(objname).getOperations();
        // look for findDeadlockedThreads operations;
        boolean found = false;
        for (MBeanOperationInfo op : mopis) {
            if (op.getName().equals(findDeadlocksMethodName)) {
                found = true;
                break;
            }
        }
        if (!found) {
            // if findDeadlockedThreads operation doesn't exist,
            // the target VM is running on JDK 5 and details about
            // synchronizers and locks cannot be dumped.
            findDeadlocksMethodName = "findMonitorDeadlockedThreads";
            canDumpLocks = false;
        }
    } catch (IntrospectionException e) {
        InternalError ie = new InternalError(e.getMessage());
        ie.initCause(e);
        throw ie;
    } catch (InstanceNotFoundException e) {
        InternalError ie = new InternalError(e.getMessage());
        ie.initCause(e);
        throw ie;
    } catch (ReflectionException e) {
        InternalError ie = new InternalError(e.getMessage());
        ie.initCause(e);
        throw ie;
    }
}

From source file:edu.ku.brc.specify.datamodel.SpUIView.java

@Transient
public BusinessRulesIFace createBusinessRule() {
    BusinessRulesIFace businessRule = null;
    if (StringUtils.isNotEmpty(businessRulesClassName)) {
        if (StringUtils.isNotEmpty(businessRulesClassName)) {
            try {
                businessRule = (BusinessRulesIFace) Class.forName(businessRulesClassName).newInstance();

            } catch (Exception e) {
                edu.ku.brc.af.core.UsageTracker.incrHandledUsageCount();
                edu.ku.brc.exceptions.ExceptionTracker.getInstance().capture(SpUIView.class, e);

                InternalError error = new InternalError(
                        "Can't instantiate BusinessRulesIFace [" + businessRulesClassName + "]");
                error.initCause(e);
                throw error;
            }//from   ww  w  .  ja v a2s. co m

        } else if (useDefaultBusRule) {
            businessRule = DBTableIdMgr.getInstance().getBusinessRule(javaClassName);
        }

    }
    return businessRule;
}

From source file:edu.ku.brc.af.prefs.AppPreferences.java

/**
 * @param factoryClassName/*www  .  j  ava  2 s.  co m*/
 * @param factoryNm
 * @return
 */
private AppPrefsIOIFace createFactoryIO(final String factoryNm) {
    this.saverClassName = System.getProperty(factoryNm, null);
    if (this.saverClassName == null) {
        throw new InternalError("System Property '" + factoryNm + "' must be set!"); //$NON-NLS-1$ //$NON-NLS-2$
    }

    AppPrefsIOIFace prefIO = null;
    try {
        prefIO = (AppPrefsIOIFace) Class.forName(this.saverClassName).newInstance();
        prefIO.setAppPrefsMgr(this);

    } catch (Exception e) {
        edu.ku.brc.af.core.UsageTracker.incrHandledUsageCount();
        edu.ku.brc.exceptions.ExceptionTracker.getInstance().capture(AppPreferences.class, e);
        InternalError error = new InternalError(
                "Can't instantiate " + this.saverClassName + " factory for " + factoryNm); //$NON-NLS-1$ //$NON-NLS-2$
        error.initCause(e);
        throw error;
    }
    return prefIO;
}