Example usage for org.apache.commons.lang UnhandledException UnhandledException

List of usage examples for org.apache.commons.lang UnhandledException UnhandledException

Introduction

In this page you can find the example usage for org.apache.commons.lang UnhandledException UnhandledException.

Prototype

public UnhandledException(Throwable cause) 

Source Link

Document

Constructs the exception using a cause.

Usage

From source file:com.netsuite.webservices.platform.core_2010_2.types.SearchRecordType.java

public SearchRecord newSearchInstance() {
    try {/*from w  w w  .  ja  v  a  2s  .c  o  m*/
        return searchClass.newInstance();
    } catch (Exception e) {
        throw new UnhandledException(e);
    }
}

From source file:com.netsuite.webservices.platform.core_2010_2.types.SearchRecordType.java

public SearchRecord newAdvancedSearchInstance() {
    if (advancedSearchClass == null) {
        throw new UnsupportedOperationException();
    }//from  w  w  w. ja  v a 2 s  .  co m
    try {
        return advancedSearchClass.newInstance();
    } catch (Exception e) {
        throw new UnhandledException(e);
    }
}

From source file:com.prowidesoftware.swift.model.field.SwiftParseUtils.java

/**
 * Separate the given string in lines using readline
 *
 * @param value//  ww w .  j a  v  a2  s  .  c om
 * @return list of found lines
 */
public static List<String> getLines(final String value) {
    final List<String> result = new ArrayList<String>();
    if (value != null) {
        final BufferedReader br = new BufferedReader(new StringReader(value));
        try {
            String l = br.readLine();
            while (l != null) {
                result.add(l);
                l = br.readLine();
            }
        } catch (final IOException e) {
            throw new UnhandledException(e);
        }
    }
    return result;
}

From source file:com.orientalcomics.profile.util.text.html.Entities.java

/**
 * <p>/*from w  w w .  ja  v  a2s.  c  o  m*/
 * Escapes the characters in a <code>String</code>.
 * </p>
 * 
 * <p>
 * For example, if you have called addEntity(&quot;foo&quot;, 0xA1), escape(&quot;\u00A1&quot;) will return
 * &quot;&amp;foo;&quot;
 * </p>
 * 
 * @param str
 *            The <code>String</code> to escape.
 * @return A new escaped <code>String</code>.
 */
public String escape(String str) {
    StringWriter stringWriter = createStringWriter(str);
    try {
        this.escape(stringWriter, str);
    } catch (IOException e) {
        // This should never happen because ALL the StringWriter methods called by #escape(Writer, String) do not
        // throw IOExceptions.
        throw new UnhandledException(e);
    }
    return stringWriter.toString();
}

From source file:com.orientalcomics.profile.util.text.html.Entities.java

/**
 * <p>/*w  w  w  .  ja  v a 2 s. c om*/
 * Unescapes the entities in a <code>String</code>.
 * </p>
 * 
 * <p>
 * For example, if you have called addEntity(&quot;foo&quot;, 0xA1), unescape(&quot;&amp;foo;&quot;) will return
 * &quot;\u00A1&quot;
 * </p>
 * 
 * @param str
 *            The <code>String</code> to escape.
 * @return A new escaped <code>String</code>.
 */
public String unescape(String str) {
    int firstAmp = str.indexOf('&');
    if (firstAmp < 0) {
        return str;
    } else {
        StringWriter stringWriter = createStringWriter(str);
        try {
            this.doUnescape(stringWriter, str, firstAmp);
        } catch (IOException e) {
            // This should never happen because ALL the StringWriter methods called by #escape(Writer, String) 
            // do not throw IOExceptions.
            throw new UnhandledException(e);
        }
        return stringWriter.toString();
    }
}

From source file:org.beangle.commons.collection.CollectUtils.java

public static Map<?, ?> convertToMap(Collection<?> coll, String keyProperty) {
    Map<Object, Object> map = newHashMap();
    for (Object obj : coll) {
        Object key = null;/*w w  w.j a  v  a2 s.  c  o  m*/
        try {
            key = PropertyUtils.getProperty(obj, keyProperty);
        } catch (Exception e) {
            throw new UnhandledException(e);
        }
        map.put(key, obj);
    }
    return map;
}

From source file:org.beangle.commons.collection.CollectUtils.java

public static Map<?, ?> convertToMap(Collection<?> coll, String keyProperty, String valueProperty) {
    Map<Object, Object> map = newHashMap();
    for (Object obj : coll) {
        Object key = null;//from w w  w .  j a  va 2s .  c  o m
        Object value = null;
        try {
            key = PropertyUtils.getProperty(obj, keyProperty);
            value = PropertyUtils.getProperty(obj, valueProperty);
        } catch (Exception e) {
            throw new UnhandledException(e);
        }
        map.put(key, value);
    }
    return map;
}

From source file:org.beangle.commons.collection.predicates.PropertyEqualPredicate.java

public boolean evaluate(Object arg0) {
    try {//from w  ww  .ja v a  2  s.  com
        return ObjectUtils.equals(PropertyUtils.getProperty(arg0, propertyName), propertyValue);
    } catch (Exception e) {
        throw new UnhandledException(e);
    }
}

From source file:org.carewebframework.common.MiscUtil.java

/**
 * Converts a checked exception to unchecked. If the original exception is already unchecked, it
 * is simply returned./*from   www  .ja  v a2 s . c  o  m*/
 *
 * @param e The original exception.
 * @return The returned unchecked exception.
 */
public static RuntimeException toUnchecked(Throwable e) {
    if (e instanceof InvocationTargetException) {
        e = ((InvocationTargetException) e).getTargetException();
    }

    if (e instanceof RuntimeException) {
        return (RuntimeException) e;
    }

    return new UnhandledException(e);
}

From source file:org.codehaus.groovy.grails.web.converters.AbstractConverter.java

@Override
public String toString() {
    FastStringWriter writer = new FastStringWriter();
    try {//from www .ja  v a  2 s . c  om
        render(writer);
    } catch (Exception e) {
        throw new UnhandledException(e);
    }
    return writer.toString();
}