List of usage examples for java.lang RuntimeException RuntimeException
public RuntimeException(Throwable cause)
From source file:Main.java
public static void mkdirs(File dir_) { if (dir_ == null) { return;// w w w .j a va 2s . c o m } if ((!(dir_.exists())) && (!(dir_.mkdirs()))) { throw new RuntimeException("fail to make " + dir_.getAbsolutePath()); } }
From source file:Main.java
public static void sleep(long millis) { if (millis < 0) { return;//from w w w . ja va 2s . c om } try { Thread.sleep(millis); } catch (InterruptedException e) { throw new RuntimeException(e); } }
From source file:Main.java
public static void pause(long timeMillis) { try {//from ww w . ja va 2s. c o m TimeUnit.MILLISECONDS.sleep(timeMillis); } catch (InterruptedException e) { throw new RuntimeException("Interrupted in pause !"); } }
From source file:Main.java
/** * Fail the test/*from w w w . j ava 2 s .co m*/ * * @param message * The message to describe the failure */ public static void fail(String message) { throw new RuntimeException(message); }
From source file:Main.java
public static int lastIndexOf(java.lang.CharSequence s, char ch, int last) { throw new RuntimeException("Stub!"); }
From source file:Main.java
public final static void assertTrue(boolean condition) { if (!condition) { throw new RuntimeException("assertion failed."); }/*from w ww .j a va2 s . c o m*/ }
From source file:Main.java
public static int indexOf(java.lang.CharSequence s, char ch, int start) { throw new RuntimeException("Stub!"); }
From source file:Main.java
public static <T> T getSingle(List<T> collection) { boolean hasAnyElements = collection != null && !collection.isEmpty(); if (!hasAnyElements) { throw new RuntimeException("Collection is null or empty"); }// ww w. j a va 2 s .co m boolean hasMultipleResults = collection.size() > 1; if (hasMultipleResults) { throw new RuntimeException("Collection contains multiple elements"); } return collection.get(0); }
From source file:Main.java
public static String getGlideDefaultPath(Context context) { if (context == null) { throw new RuntimeException("context can't be null"); }/*from w w w . ja v a 2 s . com*/ String path = context.getCacheDir().getAbsolutePath(); if (isSDCard()) { String directory = Environment.getExternalStorageDirectory() + "/GankLy/cache/img"; File file = new File(directory); if (!file.exists()) { if (file.mkdirs()) { return directory; } } } return path; }
From source file:Main.java
public static void setSystemLookAndFeel() { try {// ww w. j av a 2 s . co m UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); } catch (Exception e) { throw new RuntimeException(e); } }