org.apache.commons.lang.UnhandledException Java Examples

The following examples show how to use org.apache.commons.lang.UnhandledException. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: ExprUtil.java    From antsdb with GNU Lesser General Public License v3.0 6 votes vote down vote up
/**
    * <p>Unescapes any Java literals found in the <code>String</code>.
    * For example, it will turn a sequence of <code>'\'</code> and
    * <code>'n'</code> into a newline character, unless the <code>'\'</code>
    * is preceded by another <code>'\'</code>.</p>
    * 
    * @param str  the <code>String</code> to unescape, may be null
    * @return a new unescaped <code>String</code>, <code>null</code> if null string input
    */
public static String unescape(String str) {
       if (str == null) {
           return null;
       }
       try {
           StringWriter writer = new StringWriter(str.length());
           unescapeJava(writer, str);
           return writer.toString();
       } 
       catch (IOException ioe) {
           // this should never ever happen while writing to a StringWriter
           throw new UnhandledException(ioe);
       }
	
}