Author: rahul
Date: Sun Aug  6 12:05:23 2006
New Revision: 429175

URL: http://svn.apache.org/viewvc?rev=429175&view=rev
Log:
- Rename ScriptFactory#newScript to ScriptFactory#createNewScript for symmetry 
with ExpressionFactory
- Synchronize just the critical region for the parser

Modified:
    
jakarta/commons/proper/jexl/trunk/src/java/org/apache/commons/jexl/ScriptFactory.java

Modified: 
jakarta/commons/proper/jexl/trunk/src/java/org/apache/commons/jexl/ScriptFactory.java
URL: 
http://svn.apache.org/viewvc/jakarta/commons/proper/jexl/trunk/src/java/org/apache/commons/jexl/ScriptFactory.java?rev=429175&r1=429174&r2=429175&view=diff
==============================================================================
--- 
jakarta/commons/proper/jexl/trunk/src/java/org/apache/commons/jexl/ScriptFactory.java
 (original)
+++ 
jakarta/commons/proper/jexl/trunk/src/java/org/apache/commons/jexl/ScriptFactory.java
 Sun Aug  6 12:05:23 2006
@@ -96,7 +96,7 @@
      *      problem parsing the script.
      */
     public static Script createScript(String scriptText) throws Exception {
-        return getInstance().newScript(scriptText);
+        return getInstance().createNewScript(scriptText);
     }
 
     /**
@@ -152,23 +152,23 @@
      *  @return Script a new script
      *  @throws Exception for a variety of reasons - mostly malformed scripts
      */
-    protected Script newScript(String scriptText) throws Exception {
+    protected Script createNewScript(String scriptText) throws Exception {
         String cleanText = cleanScript(scriptText);
+        SimpleNode script;
         // Parse the Expression
         synchronized (parser) {
             log.debug("Parsing script: " + cleanText);
-            SimpleNode script;
             try {
                 script = parser.parse(new StringReader(cleanText));
             } catch (TokenMgrError tme) {
                 throw new ParseException(tme.getMessage());
             }
-            if (script instanceof ASTJexlScript) {
-                return new ScriptImpl(cleanText, (ASTJexlScript) script);
-            } else {
-                throw new IllegalStateException("Parsed script is not "
-                    + "an ASTJexlScript");
-            }
+        }
+        if (script instanceof ASTJexlScript) {
+            return new ScriptImpl(cleanText, (ASTJexlScript) script);
+        } else {
+            throw new IllegalStateException("Parsed script is not "
+                + "an ASTJexlScript");
         }
     }
 



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to