NPE in Task Handler Impl #PL-7371

This commit is contained in:
Maxim Stepanov 2016-06-16 10:45:11 +04:00
parent 0c8e21c3f8
commit eb220fd79b
2 changed files with 6 additions and 2 deletions

View File

@ -20,6 +20,7 @@ package com.haulmont.cuba.gui.executors;
import com.haulmont.cuba.gui.components.Frame;
import com.haulmont.cuba.gui.components.Window;
import javax.annotation.Nullable;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
@ -178,6 +179,7 @@ public abstract class BackgroundTask<T, V> {
/**
* @return owner window
*/
@Nullable
public final Frame getOwnerFrame() {
return ownerFrame;
}

View File

@ -122,9 +122,11 @@ public class TaskHandlerImpl<T, V> implements BackgroundTaskHandler<V> {
if (log.isTraceEnabled()) {
Frame ownerFrame = getTask().getOwnerFrame();
String windowClass = ownerFrame.getClass().getCanonicalName();
if (ownerFrame != null) {
String windowClass = ownerFrame.getClass().getCanonicalName();
log.trace("Task was cancelled. Task: {}. User: {}. Frame: {}", taskExecutor.getTask(), getUserSession().getId(), windowClass);
log.trace("Task was cancelled. Task: {}. User: {}. Frame: {}", taskExecutor.getTask(), getUserSession().getId(), windowClass);
}
}
} else {
log.trace("Task wasn't cancelled. Execution is already cancelled. Task: {}", taskExecutor.getTask());