diff --git a/src/main/java/org/springframework/roo/shell/AbstractShell.java b/src/main/java/org/springframework/roo/shell/AbstractShell.java
index 28f4eac0..6551d2e9 100644
--- a/src/main/java/org/springframework/roo/shell/AbstractShell.java
+++ b/src/main/java/org/springframework/roo/shell/AbstractShell.java
@@ -209,12 +209,8 @@ public abstract class AbstractShell extends AbstractShellStatusPublisher impleme
exitShellRequest = (ExitShellRequest) result;
// Give ProcessManager a chance to close down its threads before the overall OSGi framework is terminated (ROO-1938)
executionStrategy.terminate();
- } else if (result instanceof Iterable>) {
- for (Object o : (Iterable>) result) {
- logger.info(o.toString());
- }
} else {
- logger.info(result.toString());
+ handleExecutionResult(result);
}
}
@@ -446,4 +442,24 @@ public abstract class AbstractShell extends AbstractShellStatusPublisher impleme
logger.log(level, message);
}
}
+
+ /**
+ * Handles the result of execution of a command. Given result is
+ * expected to be not null. If result is a
+ * {@link java.lang.Iterable} object, it will be iterated through to print
+ * the output of toString. For other type of objects, simply output
+ * of toString is shown. Subclasses can alter this implementation
+ * to handle the result differently.
+ *
+ * @param result not null result of execution of a command.
+ */
+ protected void handleExecutionResult(Object result) {
+ if (result instanceof Iterable>) {
+ for (Object o : (Iterable>) result) {
+ logger.info(o.toString());
+ }
+ } else {
+ logger.info(result.toString());
+ }
+ }
}