Browse Source

Improve AbstractTestCase error reporting

Change-Id: I40e1d087bb18742f8d28adadc3d0f442d8cc923b
tags/7.4.0.beta3
Johannes Dahlström 9 years ago
parent
commit
a5d8097f03

+ 2
- 2
server/src/com/vaadin/server/DefaultErrorHandler.java View File

@@ -67,10 +67,10 @@ public class DefaultErrorHandler implements ErrorHandler {
*
* @since 7.2
* @param t
* throwable given for default error handler
* a throwable passed to ErrorHandler
* @return the throwable that is relevant for Vaadin users
*/
private static Throwable findRelevantThrowable(Throwable t) {
public static Throwable findRelevantThrowable(Throwable t) {
try {
if ((t instanceof RpcInvocationException)
&& (t.getCause() instanceof InvocationTargetException)) {

+ 6
- 12
uitest/src/com/vaadin/tests/components/AbstractComponentTest.java View File

@@ -14,6 +14,7 @@ import com.vaadin.event.FieldEvents.BlurNotifier;
import com.vaadin.event.FieldEvents.FocusEvent;
import com.vaadin.event.FieldEvents.FocusListener;
import com.vaadin.event.FieldEvents.FocusNotifier;
import com.vaadin.server.DefaultErrorHandler;
import com.vaadin.server.Resource;
import com.vaadin.server.ThemeResource;
import com.vaadin.tests.util.Log;
@@ -714,19 +715,12 @@ public abstract class AbstractComponentTest<T extends AbstractComponent>

@Override
public void error(com.vaadin.server.ErrorEvent event) {
String logMsg = "Exception occured, "
+ event.getThrowable().getClass().getName();

String exceptionMsg = event.getThrowable().getMessage();
if (exceptionMsg != null && exceptionMsg.length() > 0) {
logMsg += exceptionMsg;
}
log.log(logMsg);
final Throwable t = event.getThrowable();
if (t != null) {
t.printStackTrace();
}
final Throwable throwable = DefaultErrorHandler
.findRelevantThrowable(event.getThrowable());

log.log("Exception occured, " + throwable.getClass().getName() + ": "
+ throwable.getMessage());
throwable.printStackTrace();
}

@Override

Loading…
Cancel
Save