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:org.eclipse.gyrex.admin.ui.jobs.internal.ScheduleEntriesPage.java

@Override
public void setArguments(final String[] args) {
    super.setArguments(args);
    if (args.length >= 3) {

        final String contextPath = args[1];
        final String scheduleId = args[2];

        final String storageKey = new ContextHashUtil(new Path(contextPath)).toInternalId(scheduleId);
        try {// w w w .j ava2s.c om
            final ScheduleImpl schedule = ScheduleStore.load(storageKey,
                    ScheduleManagerImpl.getExternalId(storageKey), false);
            if (schedule != null) {
                setSchedule(schedule);
            } else
                throw new IllegalArgumentException(
                        String.format("Schedule %s not found in context %s", scheduleId, contextPath));
        } catch (final BackingStoreException e) {
            throw new UnhandledException(e);
        }
    }
}

From source file:org.eclipse.gyrex.context.internal.registry.ContextRegistryImpl.java

public void removeDefinition(final ContextDefinition contextDefinition) {
    checkClosed();/*from ww w. j av a 2s. c  o  m*/
    try {
        removeDefinition(contextDefinition.getPath());
    } catch (final RuntimeException e) {
        throw e;
    } catch (final Exception e) {
        throw new UnhandledException(e);
    }
}

From source file:org.mule.module.fws.api.FwsPaginatedIterable.java

@Override
protected final Page firstPage() {
    try {/*from   ww  w  . ja v  a  2 s .c  o  m*/
        return firstFwsPage();
    } catch (RemoteException e) {
        throw new UnhandledException(e);
    }
}

From source file:org.mule.module.fws.api.FwsPaginatedIterable.java

@Override
@SuppressWarnings("unchecked")
protected final Page nextPage(Page currentPage) {
    try {//ww w . java 2 s.  co  m
        Page nextPage = (Page) currentPage.getClass().newInstance();
        PropertyUtils.copyProperties(nextPage, nextFwsPage(currentPage));
        return nextPage;
    } catch (RemoteException e) {
        throw new UnhandledException(e);
    } catch (Exception e) {
        throw new AssertionError(e);
    }
}

From source file:org.mule.module.hbase.api.ByteArrayConverter.java

/**
 * Converts the given object into a byte array. If the object is a byte array, is
 * is returned as is. If the object is an string, it is written in the provided
 * conversionCharset given by constructor. Any other serializable object is
 * converted into a byte array using serialization.
 * //from   w  w w .ja va2s .  c o  m
 * @param o
 * @return a byte array representation of the given object
 */
public byte[] toByteArray(Object o) {
    if (o instanceof byte[]) {
        return (byte[]) o;
    }
    if (o instanceof String) {
        return ((String) o).getBytes(conversionCharset);
    }
    if (o instanceof Serializable) {
        ByteArrayOutputStream out = new ByteArrayOutputStream();
        try {
            new ObjectOutputStream(out).writeObject(o);
        } catch (IOException e) {
            throw new UnhandledException(e);
        }
        return out.toByteArray();
    }
    throw new IllegalArgumentException("Object " + o + " can not be converted to byte array");
}

From source file:org.mule.module.netsuite.api.model.expression.filter.FilterExpressionBuilder.java

private RuntimeException soften(Exception e) {
    return (RuntimeException) (e instanceof RuntimeException ? e : new UnhandledException(e));
}

From source file:org.mule.module.netsuite.api.paging.SavedRecordSearchIterable.java

private SearchRecord createAdvancedSearch() {
    SearchRecord search = recordType.newAdvancedSearchInstance();
    try {/*from w  w  w.  j  av a  2 s .c o  m*/
        PropertyUtils.setProperty(search, "savedSearchId", savedSearchId);
    } catch (Exception e) {
        throw new UnhandledException(e);
    }
    return search;
}

From source file:org.mule.module.netsuite.api.util.XmlGregorianCalendarFactory.java

public static XmlGregorianCalendarFactory newInstance() {
    try {/* w  w w. j a  v  a2 s. co m*/
        return new XmlGregorianCalendarFactory(DatatypeFactory.newInstance());
    } catch (DatatypeConfigurationException e) {
        throw new UnhandledException(e);
    }
}

From source file:org.mule.module.s3.S3ContentUtils.java

private static File toTempFile(InputStream streamContent) {
    try {//from   w  w  w  .  ja  v a2s. c o m
        File tempFile = File.createTempFile("mules3", ".tmp");
        IOUtils.copy(streamContent, new FileOutputStream(tempFile));
        return tempFile;
    } catch (IOException e) {
        throw new UnhandledException(e);
    }
}

From source file:org.mule.module.s3.S3ContentUtils.java

private static org.apache.commons.httpclient.HttpMethod getHttpMethod(Object inputStream) {
    try {/*ww  w.ja va2  s . c o  m*/
        Field field = Class.forName("org.mule.transport.http.ReleasingInputStream").getDeclaredField("method");
        field.setAccessible(true);
        return (org.apache.commons.httpclient.HttpMethod) field.get(inputStream);
    } catch (Exception e) {
        throw new UnhandledException(e);
    }
}