Search in sources :

Example 26 with UndeclaredThrowableException

use of java.lang.reflect.UndeclaredThrowableException in project j2objc by google.

the class UndeclaredThrowableExceptionTest method test_UndeclaredThrowableException_LThrowable.

/**
     * {@link java.lang.reflect.UndeclaredThrowableException#UndeclaredThrowableException(java.lang.Throwable)}
     */
public void test_UndeclaredThrowableException_LThrowable() {
    UndeclaredThrowableException e = new UndeclaredThrowableException((Exception) null);
    assertNotNull(e);
    assertNull(e.getCause());
}
Also used : UndeclaredThrowableException(java.lang.reflect.UndeclaredThrowableException)

Example 27 with UndeclaredThrowableException

use of java.lang.reflect.UndeclaredThrowableException in project j2objc by google.

the class UndeclaredThrowableExceptionTest method test_getUndeclaredThrowable.

/**
     * {@link java.lang.reflect.UndeclaredThrowableException#getUndeclaredThrowable()}
     */
public void test_getUndeclaredThrowable() {
    UndeclaredThrowableException e = new UndeclaredThrowableException(null);
    assertNotNull(e);
    assertNull(e.getUndeclaredThrowable());
}
Also used : UndeclaredThrowableException(java.lang.reflect.UndeclaredThrowableException)

Example 28 with UndeclaredThrowableException

use of java.lang.reflect.UndeclaredThrowableException in project j2objc by google.

the class UndeclaredThrowableExceptionTests method test_Constructor_Throwable.

/**
     * java.lang.reflect.UndeclaredThrowableException#UndeclaredThrowableException(java.lang.Throwable)
     */
public void test_Constructor_Throwable() throws Exception {
    UndeclaredThrowableException e = new UndeclaredThrowableException(throwable);
    assertEquals("Wrong cause returned", throwable, e.getCause());
    assertEquals("Wrong throwable returned", throwable, e.getUndeclaredThrowable());
}
Also used : UndeclaredThrowableException(java.lang.reflect.UndeclaredThrowableException)

Example 29 with UndeclaredThrowableException

use of java.lang.reflect.UndeclaredThrowableException in project j2objc by google.

the class UndeclaredThrowableExceptionTests method test_getUndeclaredThrowable.

/**
     * java.lang.reflect.UndeclaredThrowableException#getUndeclaredThrowable()
     */
public void test_getUndeclaredThrowable() throws Exception {
    UndeclaredThrowableException ute = new UndeclaredThrowableException(throwable);
    assertSame("Wrong undeclared throwable returned", throwable, ute.getUndeclaredThrowable());
}
Also used : UndeclaredThrowableException(java.lang.reflect.UndeclaredThrowableException)

Example 30 with UndeclaredThrowableException

use of java.lang.reflect.UndeclaredThrowableException in project XobotOS by xamarin.

the class AbstractHttpClient method execute.

// non-javadoc, see interface HttpClient
public <T> T execute(final HttpHost target, final HttpRequest request, final ResponseHandler<? extends T> responseHandler, final HttpContext context) throws IOException, ClientProtocolException {
    if (responseHandler == null) {
        throw new IllegalArgumentException("Response handler must not be null.");
    }
    HttpResponse response = execute(target, request, context);
    T result;
    try {
        result = responseHandler.handleResponse(response);
    } catch (Throwable t) {
        HttpEntity entity = response.getEntity();
        if (entity != null) {
            try {
                entity.consumeContent();
            } catch (Throwable t2) {
                // Log this exception. The original exception is more
                // important and will be thrown to the caller.
                this.log.warn("Error consuming content after an exception.", t2);
            }
        }
        if (t instanceof Error) {
            throw (Error) t;
        }
        if (t instanceof RuntimeException) {
            throw (RuntimeException) t;
        }
        if (t instanceof IOException) {
            throw (IOException) t;
        }
        throw new UndeclaredThrowableException(t);
    }
    // Handling the response was successful. Ensure that the content has
    // been fully consumed.
    HttpEntity entity = response.getEntity();
    if (entity != null) {
        // Let this exception go to the caller.
        entity.consumeContent();
    }
    return result;
}
Also used : HttpEntity(org.apache.http.HttpEntity) UndeclaredThrowableException(java.lang.reflect.UndeclaredThrowableException) HttpResponse(org.apache.http.HttpResponse) IOException(java.io.IOException)

Aggregations

UndeclaredThrowableException (java.lang.reflect.UndeclaredThrowableException)121 IOException (java.io.IOException)36 InvocationTargetException (java.lang.reflect.InvocationTargetException)14 YarnException (org.apache.hadoop.yarn.exceptions.YarnException)14 Test (org.junit.Test)12 BufferedReader (java.io.BufferedReader)10 InputStreamReader (java.io.InputStreamReader)10 ServerSocket (java.net.ServerSocket)10 Socket (java.net.Socket)9 PollStatus (org.opennms.netmgt.poller.PollStatus)9 HashMap (java.util.HashMap)8 PrivilegedExceptionAction (java.security.PrivilegedExceptionAction)7 AuthorizationException (org.apache.hadoop.security.authorize.AuthorizationException)7 BadRequestException (org.apache.hadoop.yarn.webapp.BadRequestException)7 Method (java.lang.reflect.Method)6 AccessControlException (java.security.AccessControlException)6 SQLException (java.sql.SQLException)6 Path (javax.ws.rs.Path)6 Produces (javax.ws.rs.Produces)6 UserGroupInformation (org.apache.hadoop.security.UserGroupInformation)6