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.analysis.resource.AndroidDecompiler.java

public static String decompile(String apk) {
    if (!apk.endsWith(".apk"))
        throw new InternalError("only support apk file : " + apk);
    File apkFile = new File(apk);
    if (!apkFile.exists())
        throw new InternalError("the file does not exist : " + apk);

    try {//  w  w w .  ja va  2 s.  c o m
        String path = apkFile.getCanonicalPath();
        String toPath = path.substring(0, path.length() - 4);
        String[] cmds = { "-f", "d", path, "-o", toPath };
        //         String apktool = Shell.walaProperties.getProperty(WalaProperties.ANDROID_APK_TOOL);
        //         File f = new File(apktool);
        //         if(!f.exists() || !f.isFile()){
        //            throw new InternalError("Cannot find APK tool: " + apktool);
        //         }
        //         String[] cmd = {"java", "-jar", apktool, "-f", "d", path, "-o", toPath};
        //         ProcessBuilder pb = new ProcessBuilder();
        //         pb.command(cmd);
        ////         System.out.println(pb.command().toString());
        //         Process p = pb.start();
        //         BufferedReader br = new BufferedReader(new InputStreamReader(p.getInputStream()));
        //         BufferedReader bre = new BufferedReader(new InputStreamReader(p.getErrorStream()));
        //         
        //         String r = null;
        //         while((r = br.readLine()) != null){
        //            System.out.println(r);
        //         }
        //         
        //         while((r = bre.readLine()) != null){
        //            System.err.println(r);
        //         }
        //         
        //         int res = p.waitFor();
        //         if(res != 0){
        //            throw new InternalError("failed to decompile: " + path);
        //         }
        brut.apktool.Main.main(cmds);
        if (!SystemUtils.IS_OS_WINDOWS)
            permission(toPath);
        return toPath;
    } catch (Exception e) {
        e.printStackTrace();
    }
    return null;
}

From source file:Main.java

/**
 * Determine the appropriate {@link WritablePixelFormat} type that can
 * be used to transfer data into the indicated BufferedImage.
 * //w ww.  j  a  v a2 s . c  om
 * @param bimg the BufferedImage that will be used as a destination for
 *             a {@code PixelReader<IntBuffer>#getPixels()} operation.
 * @return 
 */
private static WritablePixelFormat<IntBuffer> getAssociatedPixelFormat(BufferedImage bimg) {
    switch (bimg.getType()) {
    // We lie here for xRGB, but we vetted that the src data was opaque
    // so we can ignore the alpha.  We use ArgbPre instead of Argb
    // just to get a loop that does not have divides in it if the
    // PixelReader happens to not know the data is opaque.
    case BufferedImage.TYPE_INT_RGB:
    case BufferedImage.TYPE_INT_ARGB_PRE:
        return PixelFormat.getIntArgbPreInstance();
    case BufferedImage.TYPE_INT_ARGB:
        return PixelFormat.getIntArgbInstance();
    default:
        // Should not happen...
        throw new InternalError("Failed to validate BufferedImage type");
    }
}

From source file:gov.nih.nci.calims2.business.inventory.container.CoordinateHelper.java

/**
 * Converts a given integer into a coordinate label according to the label type.
 * /*from  w w w .jav a 2  s .c  om*/
 * @param labelType The label type
 * @param maximum The maximum number of values in the dimension
 * @param value The value to convert
 * @return The label corresponding to the given value
 */
public static String getCoordinateString(LayoutLabelType labelType, int maximum, int value) {
    switch (labelType) {
    case DIGITS: {
        String result = Integer.toString(value + 1);
        while (result.length() < 2) {
            result = "0" + result;
        }
        return result;
    }
    case ALL_LOWER_CASE: {
        return convertValue('a', maximum, value);
    }
    case ALL_UPPER_CASE: {
        return convertValue('A', maximum, value);
    }
    default: {
        throw new InternalError("Can not happen");
    }
    }
}

From source file:com.medlog.webservice.vo.DiaryAnalysisVO.java

@Override
public Object clone() {

    try {//from  w w  w.j  a  va 2s .  c o  m
        Object copy = super.clone();
        if (copy != null && copy != this) {
            return copy;
        }
    } catch (CloneNotSupportedException e) {
        // this should never happen
        throw new InternalError(e.toString());
    }
    return ObjUtl.cloneObjectDeepInstance(this);
}

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

/**
 * Returns the instance to the singleton
 * @return  the instance to the singleton
 *//*from   w  ww.  j  a  v a2 s . c o  m*/
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:ml.shifu.shifu.container.meta.MetaGroup.java

@Override
public MetaGroup clone() {
    MetaGroup metaGroup = null;/*ww  w.  jav  a 2  s. c  o m*/
    try {
        metaGroup = (MetaGroup) super.clone();
    } catch (CloneNotSupportedException e) {
        // This should never happen
        throw new InternalError(e.toString());
    }

    // copy group
    metaGroup.setGroup(group);

    // copy meta list, if not null
    if (CollectionUtils.isNotEmpty(metaList)) {
        List<MetaItem> metas = new ArrayList<MetaItem>();
        for (MetaItem metaItem : metaList) {
            metas.add(metaItem.clone());
        }
        metaGroup.setMetaList(metas);
    }

    return metaGroup;
}

From source file:edu.cornell.med.icb.goby.compression.ChunkCodecHelper.java

public static synchronized ChunkCodec withRegistrationCode(final byte registrationCode) {

    codecLoader.reload();/*from ww  w  . j ava  2  s . c o m*/
    for (final ChunkCodec chunkCodec : codecLoader) {
        if (chunkCodec.registrationCode() == registrationCode) {
            return chunkCodec;

        }
    }
    throw new InternalError("Codec registration code not recognized: " + registrationCode);

}

From source file:com.tdispatch.passenger.core.TDDialogFragment.java

protected int getLayoutId() {
    throw new InternalError("LayoutId have to be specified");
}

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

/**
 * Returns the instance to the singleton
 * @return  the instance to the singleton
 *///from ww  w.  j a v  a 2s. 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:com.clustercontrol.approval.etc.action.ApprovalAction.java

@Override
public Object execute(ExecutionEvent event) throws ExecutionException {
    //?/*from   w  w  w .j  a  va2s . c  o m*/
    IWorkbenchPage page = HandlerUtil.getActiveWorkbenchWindow(event).getActivePage();

    //?
    try {
        page.showView(ApprovalView.ID);
        IViewPart viewPart = page.findView(ApprovalView.ID);
        if (viewPart == null)
            throw new InternalError("viewPart is null.");
        ApprovalView view = (ApprovalView) viewPart.getAdapter(ApprovalView.class);
        if (view == null) {
            m_log.info("execute: view is null");
            return null;
        }
        view.setFocus();
    } catch (PartInitException e) {
    }
    return null;
}