manifoldcf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kwri...@apache.org
Subject svn commit: r1162528 - /incubator/lcf/trunk/framework/script-engine/src/main/java/org/apache/manifoldcf/scriptengine/ScriptParser.java
Date Sun, 28 Aug 2011 14:11:50 GMT
Author: kwright
Date: Sun Aug 28 14:11:50 2011
New Revision: 1162528

URL: http://svn.apache.org/viewvc?rev=1162528&view=rev
Log:
Interactive mode now restarts after ScriptException

Modified:
    incubator/lcf/trunk/framework/script-engine/src/main/java/org/apache/manifoldcf/scriptengine/ScriptParser.java

Modified: incubator/lcf/trunk/framework/script-engine/src/main/java/org/apache/manifoldcf/scriptengine/ScriptParser.java
URL: http://svn.apache.org/viewvc/incubator/lcf/trunk/framework/script-engine/src/main/java/org/apache/manifoldcf/scriptengine/ScriptParser.java?rev=1162528&r1=1162527&r2=1162528&view=diff
==============================================================================
--- incubator/lcf/trunk/framework/script-engine/src/main/java/org/apache/manifoldcf/scriptengine/ScriptParser.java
(original)
+++ incubator/lcf/trunk/framework/script-engine/src/main/java/org/apache/manifoldcf/scriptengine/ScriptParser.java
Sun Aug 28 14:11:50 2011
@@ -1164,15 +1164,33 @@ public class ScriptParser
           i++;
         }
         sp.addVariable("__args__",va);
+        TokenStream ts = new BasicTokenStream(reader);
+        sp.parseStatements(ts);
+        Token t = ts.peek();
+        if (t != null)
+          t.throwException("Characters after end of script");
       }
       else
+      {
         reader = new InputStreamReader(System.in);
       
-      TokenStream ts = new BasicTokenStream(reader);
-      sp.parseStatements(ts);
-      Token t = ts.peek();
-      if (t != null)
-        t.throwException("Characters after end of script");
+        while (true)
+        {
+          try
+          {
+            TokenStream ts = new BasicTokenStream(reader);
+            sp.parseStatements(ts);
+            Token t = ts.peek();
+            if (t != null)
+              t.throwException("Characters after end of script");
+            break;
+          }
+          catch (ScriptException e)
+          {
+            System.out.println("Error: "+e.getMessage());
+          }
+        }
+      }
     }
     catch (Exception e)
     {



Mime
View raw message