Example usage for java.lang InternalError InternalError

List of usage examples for java.lang InternalError InternalError

Introduction

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

Prototype

public InternalError(Throwable cause) 

Source Link

Document

Constructs an InternalError with the specified cause and a detail message of (cause==null ?

Usage

From source file:kr.ac.kaist.wala.hybridroid.callgraph.AndroidHybridAnalysisScope.java

/**
 * Make AnalysisScope for Android hybrid application. If you want to use
 * DROIDEL as front-end, use setUpDroidelAnalysisScope method instead of
 * this.//w ww . ja v a  2s  . com
 * 
 * @param classpath
 *            the target apk file uri.
 * @param htmls
 *            JavaScript files contained in the scope.
 * @param exclusions
 *            the exclusion file.
 * @param androidLib
 *            the Android framework directory uri.
 * @return AnalysisScope for Android hybrid application.
 * @throws IOException
 */
public static AndroidHybridAnalysisScope setUpAndroidHybridAnalysisScope(String dir, URI classpath,
        Set<URL> htmls, String exclusions, URI... androidLib) throws IOException {
    AndroidHybridAnalysisScope scope;

    scope = new AndroidHybridAnalysisScope();

    File exclusionsFile = new File(exclusions);
    InputStream fs = exclusionsFile.exists() ? new FileInputStream(exclusionsFile)
            : AndroidHybridAppModel.class.getResourceAsStream(exclusions);
    scope.setExclusions(new FileOfClasses(fs));

    scope.setLoaderImpl(ClassLoaderReference.Primordial, "com.ibm.wala.dalvik.classLoader.WDexClassLoaderImpl");

    for (URI al : androidLib) {
        if (al.getPath().endsWith(".dex"))
            scope.addToScope(ClassLoaderReference.Primordial, DexFileModule.make(new File(al)));
        else if (al.getPath().endsWith(".jar"))
            scope.addToScope(ClassLoaderReference.Primordial, new JarFileModule(new JarFile(new File(al))));
        else
            throw new InternalError("Android library must be either dex or jar file: " + al.getPath());
    }

    scope.setLoaderImpl(ClassLoaderReference.Application,
            "com.ibm.wala.dalvik.classLoader.WDexClassLoaderImpl");

    scope.addToScope(ClassLoaderReference.Application, DexFileModule.make(new File(classpath)));

    if (!htmls.isEmpty())
        scope = setUpJsAnalysisScope(dir, scope, htmls);

    fs.close();

    return scope;
}

From source file:net.sf.firemox.network.NetworkActor.java

/**
 * flush the buffer or the current OutputStream
 *///from  w ww .  j a v a2 s  .co  m
public void flush() {
    try {
        outBin.flush();
    } catch (IOException e) {
        throw new InternalError("when flush outBin stream");
    }
}

From source file:net.gtaun.shoebill.data.Vector2D.java

@Override
public Vector2D clone() {
    try {/*from   w  ww  .ja v  a  2 s .c o  m*/
        return (Vector2D) super.clone();
    } catch (CloneNotSupportedException e) {
        throw new InternalError(e);
    }
}

From source file:com.facetime.cloud.server.support.UTF8HttpMessageConverter.java

@Override
protected Long getContentLength(String s, MediaType contentType) {
    if (contentType != null && contentType.getCharSet() != null) {
        Charset charset = contentType.getCharSet();
        try {/*ww w. j a v  a 2 s . c o  m*/
            return (long) s.getBytes(charset.name()).length;
        } catch (UnsupportedEncodingException ex) {
            // should not occur
            throw new InternalError(ex.getMessage());
        }
    } else {
        return null;
    }
}

From source file:nl.strohalm.cyclos.utils.Period.java

@Override
public Period clone() {
    Period newPeriod;/*from   w  w  w.  ja  v a2s.  c  o m*/
    try {
        newPeriod = (Period) super.clone();
    } catch (final CloneNotSupportedException e) {
        // this should never happen, since it is Cloneable
        throw new InternalError(e.getMessage());
    }
    newPeriod.begin = begin == null ? null : (Calendar) begin.clone();
    newPeriod.end = end == null ? null : (Calendar) end.clone();

    return newPeriod;
}

From source file:ProxyFactory.java

private synchronized Constructor getConstructor() {
    Constructor ctor = ctorRef == null ? null : (Constructor) ctorRef.get();

    if (ctor == null) {
        try {/*from w  w w  .j  a  v  a2  s  .co m*/
            ctor = Proxy.getProxyClass(getClass().getClassLoader(), interfaces)
                    .getConstructor(new Class[] { InvocationHandler.class });
        } catch (NoSuchMethodException e) {
            throw new InternalError(e.toString());
        }

        ctorRef = new SoftReference(ctor);
    }

    return ctor;
}

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

/**
 * Returns the singleton.//  www. java  2  s .  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;
}

From source file:com.sonatype.security.ldap.api.DeepEqualsBuilder.java

private static void reflectionAppend(Object lhs, Object rhs, Class clazz, EqualsBuilder builder,
        boolean useTransients, String[] excludeFields) {
    while (clazz.getSuperclass() != null) {

        Field[] fields = clazz.getDeclaredFields();
        List excludedFieldList = excludeFields != null ? Arrays.asList(excludeFields) : Collections.EMPTY_LIST;
        AccessibleObject.setAccessible(fields, true);
        for (int i = 0; i < fields.length && builder.isEquals(); i++) {
            Field f = fields[i];//  w  w  w  .ja  v  a 2 s.co  m
            if (!excludedFieldList.contains(f.getName()) && (f.getName().indexOf('$') == -1)
                    && (useTransients || !Modifier.isTransient(f.getModifiers()))
                    && (!Modifier.isStatic(f.getModifiers()))) {
                try {
                    Object lhsChild = f.get(lhs);
                    Object rhsChild = f.get(rhs);
                    Class testClass = getTestClass(lhsChild, rhsChild);
                    boolean hasEqualsMethod = classHasEqualsMethod(testClass);

                    if (testClass != null && !hasEqualsMethod) {
                        reflectionAppend(lhsChild, rhsChild, testClass, builder, useTransients, excludeFields);
                    } else {
                        builder.append(lhsChild, rhsChild);
                    }
                } catch (IllegalAccessException e) {
                    // this can't happen. Would get a Security exception instead
                    // throw a runtime exception in case the impossible happens.
                    throw new InternalError("Unexpected IllegalAccessException");
                }
            }
        }

        // now for the parent
        clazz = clazz.getSuperclass();
        reflectionAppend(lhs, rhs, clazz, builder, useTransients, excludeFields);
    }
}

From source file:com.clustercontrol.infra.composite.action.InfraModuleDoubleClickListener.java

/**
 * ?????<BR>/*  www.j  av  a 2 s  . c  om*/
 * [?]?
 * []
 * ?????????????
 * <P>
 * <ol>
 * <li>???????ID????</li>
 * <li>ID????????</li>
 * </ol>
 *
 * @param event 
 *
 * @see org.eclipse.jface.viewers.IDoubleClickListener#doubleClick(org.eclipse.jface.viewers.DoubleClickEvent)
 */
@Override
public void doubleClick(DoubleClickEvent event) {
    //ID?ID?
    if (((StructuredSelection) event.getSelection()).getFirstElement() != null) {
        String moduleId = (String) ((ArrayList<?>) ((StructuredSelection) event.getSelection())
                .getFirstElement()).get(GetInfraModuleTableDefine.MODULE_ID);

        if (moduleId == null)
            throw new InternalError("select elemnt does not have moduleId");

        String managerName = m_composite.getManagerName();
        String managementId = m_composite.getManagementId();
        InfraManagementInfo info = null;
        try {
            InfraEndpointWrapper wrapper = InfraEndpointWrapper.getWrapper(managerName);
            info = wrapper.getInfraManagement(managementId);
        } catch (HinemosUnknown_Exception | InvalidRole_Exception | InvalidUserPass_Exception
                | NotifyNotFound_Exception | InfraManagementNotFound_Exception e) {
            m_log.debug("doubleClick getInfraManagement, " + e.getMessage());
        }

        InfraModuleInfo module = null;

        if (info != null && info.getModuleList() != null) {
            for (InfraModuleInfo tmpModule : info.getModuleList()) {
                if (tmpModule.getModuleId().equals(moduleId)) {
                    module = tmpModule;
                    break;
                }
            }

            CommonDialog dialog = null;
            if (module instanceof CommandModuleInfo) {
                dialog = new CommandModuleDialog(m_composite.getShell(), managerName, managementId, moduleId,
                        PropertyDefineConstant.MODE_MODIFY);
            } else if (module instanceof FileTransferModuleInfo) {
                dialog = new FileTransferModuleDialog(m_composite.getShell(), managerName, managementId,
                        moduleId, PropertyDefineConstant.MODE_MODIFY);
            } else {
                throw new InternalError("dialog is null");
            }
            dialog.open();

            m_composite.update(m_composite.getManagerName(), m_composite.getManagementId());
        }
    }
}

From source file:com.lineage.server.templates.L1Npc.java

@Override
public L1Npc clone() {
    try {/*from ww  w.j a v  a  2s  .  c  o m*/
        return (L1Npc) (super.clone());
    } catch (final CloneNotSupportedException e) {
        throw (new InternalError(e.getMessage()));
    }
}