FELIX-2477 fix procedural commands parameter inheritance


git-svn-id: https://svn.apache.org/repos/asf/felix/trunk@963973 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/gogo/shell/src/main/java/org/apache/felix/gogo/shell/Procedural.java b/gogo/shell/src/main/java/org/apache/felix/gogo/shell/Procedural.java
index 8a385c5..9c03601 100644
--- a/gogo/shell/src/main/java/org/apache/felix/gogo/shell/Procedural.java
+++ b/gogo/shell/src/main/java/org/apache/felix/gogo/shell/Procedural.java
@@ -46,7 +46,6 @@
         return results;
     }
 
-    @SuppressWarnings("unchecked")
     public Object _if(CommandSession session, Function[] fns) throws Exception
     {
         int length = fns.length;
@@ -56,20 +55,17 @@
                 "Usage: if {condition} {if-action} ... {else-action}");
         }
 
-        List<Object> args = (List<Object>) session.get("args");
-
         for (int i = 0; i < length; ++i)
         {
-            if (i == length - 1 || isTrue(fns[i++].execute(session, args)))
+            if (i == length - 1 || isTrue(fns[i++].execute(session, null)))
             {
-                return fns[i].execute(session, args);
+                return fns[i].execute(session, null);
             }
         }
 
         return null;
     }
 
-    @SuppressWarnings("unchecked")
     public boolean not(CommandSession session, Function condition) throws Exception
     {
         if (null == condition)
@@ -77,8 +73,7 @@
             return true;
         }
         
-        List<Object> args = (List<Object>) session.get("args");
-        return !isTrue(condition.execute(session, args));
+        return !isTrue(condition.execute(session, null));
     }
 
     // Reflective.coerce() prefers to construct a new Throwable(String)
@@ -102,13 +97,11 @@
             throw new IllegalArgumentException("exception not set or not Throwable.");
     }
 
-    @SuppressWarnings("unchecked")
     public Object _try(CommandSession session, Function func) throws Exception
     {
-        List<Object> args = (List<Object>) session.get("args");
         try
         {
-            return func.execute(session, args);
+            return func.execute(session, null);
         }
         catch (Exception e)
         {
@@ -117,41 +110,35 @@
         }
     }
 
-    @SuppressWarnings("unchecked")
     public Object _try(CommandSession session, Function func, Function error)
         throws Exception
     {
-        List<Object> args = (List<Object>) session.get("args");
         try
         {
-            return func.execute(session, args);
+            return func.execute(session, null);
         }
         catch (Exception e)
         {
             session.put("exception", e);
-            return error.execute(session, args);
+            return error.execute(session, null);
         }
     }
 
-    @SuppressWarnings("unchecked")
     public void _while(CommandSession session, Function condition, Function ifTrue)
         throws Exception
     {
-        List<Object> args = (List<Object>) session.get("args");
-        while (isTrue(condition.execute(session, args)))
+        while (isTrue(condition.execute(session, null)))
         {
-            ifTrue.execute(session, args);
+            ifTrue.execute(session, null);
         }
     }
 
-    @SuppressWarnings("unchecked")
     public void until(CommandSession session, Function condition, Function ifTrue)
         throws Exception
     {
-        List<Object> args = (List<Object>) session.get("args");
-        while (!isTrue(condition.execute(session, args)))
+        while (!isTrue(condition.execute(session, null)))
         {
-            ifTrue.execute(session, args);
+            ifTrue.execute(session, null);
         }
     }