diff --git a/core/src/main/java/hudson/model/Cause.java b/core/src/main/java/hudson/model/Cause.java index 3a62ef413a..6f7b6038e2 100644 --- a/core/src/main/java/hudson/model/Cause.java +++ b/core/src/main/java/hudson/model/Cause.java @@ -28,7 +28,6 @@ import java.util.Arrays; import java.util.List; import hudson.diagnosis.OldDataMonitor; -import hudson.model.Queue.*; import hudson.util.XStream2; import org.kohsuke.stapler.export.Exported; import org.kohsuke.stapler.export.ExportedBean; @@ -62,6 +61,14 @@ public abstract class Cause { @Exported(visibility=3) abstract public String getShortDescription(); + /** + * Report a line to the listener about this cause. + * @since 1.362 + */ + public void print(TaskListener listener) { + listener.getLogger().println(getShortDescription()); + } + /** * Fall back implementation when no other type is available. * @deprecated since 2009-02-08 diff --git a/core/src/main/java/hudson/model/StreamBuildListener.java b/core/src/main/java/hudson/model/StreamBuildListener.java index 2d2f6e0039..be10f0d118 100644 --- a/core/src/main/java/hudson/model/StreamBuildListener.java +++ b/core/src/main/java/hudson/model/StreamBuildListener.java @@ -70,7 +70,7 @@ public class StreamBuildListener extends StreamTaskListener implements BuildList if (causes==null || causes.isEmpty()) l.println("Started"); else for (Cause cause : causes) { - l.println(cause.getShortDescription()); + cause.print(this); } } diff --git a/core/src/main/java/hudson/model/TaskListener.java b/core/src/main/java/hudson/model/TaskListener.java index 434c671daf..b17ab828b7 100644 --- a/core/src/main/java/hudson/model/TaskListener.java +++ b/core/src/main/java/hudson/model/TaskListener.java @@ -60,7 +60,7 @@ import java.util.Formatter; */ public interface TaskListener extends Serializable { /** - * This writer will receive the output of the build. + * This writer will receive the output of the build * * @return * must be non-null.