List of usage examples for java.lang RuntimeException RuntimeException
public RuntimeException(Throwable cause)
From source file:Main.java
public static final String encodeURL(String str) { try {/*ww w. j a va 2s.c om*/ return URLEncoder.encode(str, "utf-8"); } catch (UnsupportedEncodingException e) { throw new RuntimeException(e); } }
From source file:Main.java
public static java.lang.CharSequence getRelativeTimeSpanString(long time, long now, long minResolution) { throw new RuntimeException("Stub!"); }
From source file:Main.java
public static Object getField(String paramString, Object paramObject) throws Exception { if (TextUtils.isEmpty(paramString)) throw new RuntimeException("field name can not be empty"); if (paramObject == null) throw new RuntimeException("target object can not be null"); Field localField = paramObject.getClass().getDeclaredField(paramString); if (localField == null) throw new RuntimeException("target object: " + paramObject.getClass().getName() + " do not have this field: " + paramString); localField.setAccessible(true);/*from w ww . java 2 s. co m*/ return localField.get(paramObject); }
From source file:Main.java
/** * @param val the value to check/* w w w .java 2 s . c o m*/ * @param tag the tag to log */ public static void checkEmpty(String val, String tag) { if (TextUtils.isEmpty(val)) { throw new RuntimeException(tag + " can't be empty"); } }
From source file:Main.java
public static void checkMainThread() { boolean error = false; if (Looper.myLooper() == null || Looper.getMainLooper() != Looper.myLooper()) { error = true;/* w w w . jav a2s . c o m*/ } if (error == true) { throw new RuntimeException("Must be in UI thread!"); } }
From source file:Main.java
static int toGoalIndex(char c) { if ('1' <= c && c <= '9') { final int index = c - '1'; return index; }// ww w. j av a 2 s. co m if ('A' <= c && c <= 'Z') { final int index = c - 'A' + 9; return index; } throw new RuntimeException("invalid character: " + c); }
From source file:Main.java
public static float[] spatialSampling(android.gesture.Gesture gesture, int bitmapSize, boolean keepAspectRatio) { throw new RuntimeException("Stub!"); }
From source file:Main.java
public static Node evalSimpleXPathOnDom(String xpath, Node node) { if (xpath.charAt(0) != '/') { throw new RuntimeException("Not Implemented!"); }// w w w . ja va2 s . co m String[] tags = xpath.substring(1).split("/"); for (int i = 0; i < tags.length; i++) { String tag = tags[i]; node = selectNode(node, tag); if (node == null) { return null; } } return node; }
From source file:Main.java
public static int getResourceId(Context context, String key, String type) throws RuntimeException { int resource = context.getResources().getIdentifier(key, type, context.getPackageName()); if (resource == 0) { throw new RuntimeException("Missing resource " + key); }/*from ww w.j a v a 2s. com*/ return resource; }
From source file:Main.java
/***/ public static void joinThreads(Thread[] threads) { for (int i = 0; i < threads.length; i++) { try {//from w w w .j a va 2 s . c o m threads[i].join(); } catch (InterruptedException e) { throw new RuntimeException(e); } } }