Example usage for java.lang RuntimeException RuntimeException

List of usage examples for java.lang RuntimeException RuntimeException

Introduction

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

Prototype

public RuntimeException(Throwable cause) 

Source Link

Document

Constructs a new runtime exception with the specified cause and a detail message of (cause==null ?

Usage

From source file:Main.java

private static Runnable uncheck(RunnableEx ex) {
    return () -> {
        try {//from  w ww . j a v a2s .c om
            ex.accept();
        } catch (InterruptedException e) {
            throw new RuntimeException(e);
        }
    };
}

From source file:Main.java

public static void checkGlError(String op) {
    int error;//  w  w  w .  j ava  2s .  c  o  m
    while ((error = GLES20.glGetError()) != GLES20.GL_NO_ERROR) {
        Log.e("ES20_ERROR", op + ": glError " + error);
        throw new RuntimeException(op + ": glError " + error);
    }
}

From source file:Main.java

static void assertUriSafe(@Nullable Uri uri) {
    if (uri == null || TextUtils.isEmpty(uri.getScheme()) || TextUtils.isEmpty(uri.getHost())) {
        throw new RuntimeException("Unsafe uri provided");
    }/*  ww w  . j av a 2 s .  com*/
}

From source file:Main.java

public static void sleepPeriod(double period) {
    try {//from   w w  w. jav a2  s  . c o  m
        long millis = (long) (period * 1000);
        int nanos = (int) ((period * 1000 - millis) * 1000000);
        Thread.sleep(millis, nanos);
    } catch (InterruptedException e) {
        throw new RuntimeException(e);
    }
}

From source file:Main.java

public static android.graphics.Bitmap extractThumbnail(android.graphics.Bitmap source, int width, int height,
        int options) {
    throw new RuntimeException("Stub!");
}

From source file:Main.java

public static long queryNumEntries(android.database.sqlite.SQLiteDatabase db, java.lang.String table,
        java.lang.String selection) {
    throw new RuntimeException("Stub!");
}

From source file:Main.java

public static KeyStore androidKeyStore() {
    try {/*from  w  ww .ja va2s.  c o m*/
        KeyStore keyStore = KeyStore.getInstance("AndroidKeyStore");
        keyStore.load(null);
        return keyStore;
    } catch (Exception expt) {
        expt.printStackTrace();
        throw new RuntimeException(expt);
    }
}

From source file:Main.java

public static Object getProperty(Object receiver, Method m) {
    try {//from  w ww.  j  a  v a2  s. c o m
        return m.invoke(receiver);
    } catch (IllegalArgumentException e) {
        throw new RuntimeException(e);
    } catch (IllegalAccessException e) {
        throw new RuntimeException(e);
    } catch (InvocationTargetException e) {
        throw new RuntimeException(e);
    }
}

From source file:Main.java

public static String getDocumentText(final Document document) {
    try {//from  www .ja v a 2 s  . c om
        return document.getText(0, document.getLength());
    } catch (BadLocationException e) {
        throw new RuntimeException(e);
    }
}

From source file:Main.java

public static android.gesture.OrientedBoundingBox computeOrientedBoundingBox(float[] originalPoints) {
    throw new RuntimeException("Stub!");
}