Here you can find the source of toRuntimeException(Exception ex)
public static RuntimeException toRuntimeException(Exception ex)
//package com.java2s; //License from project: Open Source License public class Main { public static RuntimeException toRuntimeException(Exception ex) { if (ex instanceof RuntimeException) { return (RuntimeException) ex; } else {/*from w ww .ja va 2 s .c o m*/ return new RuntimeException(ex); } } }