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());
}
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());
}
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());
}
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());
}
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;
}
Aggregations