diff --git a/core/src/main/java/hudson/model/Executor.java b/core/src/main/java/hudson/model/Executor.java
index bd5ea5d7da9ad98565032db1810df24060daf79e..4f021a4de3f572426d0b3505353ce22eba7ad80c 100644
--- a/core/src/main/java/hudson/model/Executor.java
+++ b/core/src/main/java/hudson/model/Executor.java
@@ -27,6 +27,7 @@ import hudson.Util;
import hudson.model.Queue.*;
import hudson.FilePath;
import hudson.model.queue.SubTask;
+import hudson.model.queue.Tasks;
import hudson.model.queue.WorkUnit;
import hudson.util.TimeUnit2;
import hudson.util.InterceptingProxy;
@@ -351,7 +352,7 @@ public class Executor extends Thread implements ModelObject {
public void doStop( StaplerRequest req, StaplerResponse rsp ) throws IOException, ServletException {
Queue.Executable e = executable;
if(e!=null) {
- e.getParent().getOwnerTask().checkAbortPermission();
+ Tasks.getOwnerTaskOf(e.getParent()).checkAbortPermission();
interrupt();
}
rsp.forwardToPreviousPage(req);
@@ -362,7 +363,7 @@ public class Executor extends Thread implements ModelObject {
*/
public boolean hasStopPermission() {
Queue.Executable e = executable;
- return e!=null && e.getParent().getOwnerTask().hasAbortPermission();
+ return e!=null && Tasks.getOwnerTaskOf(e.getParent()).hasAbortPermission();
}
public Computer getOwner() {
diff --git a/core/src/main/java/hudson/model/Queue.java b/core/src/main/java/hudson/model/Queue.java
index 5d10a52725688c07616a709f61a993fc2315ac14..63670c0cd2a166ce863d4299810b5707bd4ebb9f 100644
--- a/core/src/main/java/hudson/model/Queue.java
+++ b/core/src/main/java/hudson/model/Queue.java
@@ -42,6 +42,7 @@ import hudson.model.queue.MappingWorksheet;
import hudson.model.queue.MappingWorksheet.Mapping;
import hudson.model.queue.QueueSorter;
import hudson.model.queue.QueueTaskDispatcher;
+import hudson.model.queue.Tasks;
import hudson.model.queue.WorkUnit;
import hudson.model.Node.Mode;
import hudson.model.listeners.SaveableListener;
@@ -1057,12 +1058,18 @@ public class Queue extends ResourceController implements Saveable {
/**
* Obtains the {@link SubTask}s that constitute this task.
*
+ *
* The collection returned by this method must also contain the primary {@link SubTask}
* represented by this {@link Task} object itself as the first element.
* The returned value is read-only.
*
+ *
* At least size 1.
*
+ *
+ * Since this is a newly added method, the invocation may results in {@link AbstractMethodError}.
+ * Use {@link Tasks#getSubTasksOf(Task)} that avoids this.
+ *
* @since 1.FATTASK
*/
Collection extends SubTask> getSubTasks();
diff --git a/core/src/main/java/hudson/model/queue/MappingWorksheet.java b/core/src/main/java/hudson/model/queue/MappingWorksheet.java
index 98ac130e3d7969fa57ba6b103aa98187e497d24b..b6d89a7555df5382c9f6c42a5fcfb71a8aeea056 100644
--- a/core/src/main/java/hudson/model/queue/MappingWorksheet.java
+++ b/core/src/main/java/hudson/model/queue/MappingWorksheet.java
@@ -294,8 +294,8 @@ public class MappingWorksheet {
// group execution units into chunks. use of LinkedHashMap ensures that the main work comes at the top
Map