Author: dion
Date: Tue Apr 25 23:27:48 2006
New Revision: 397104

URL: http://svn.apache.org/viewcvs?rev=397104&view=rev
Log:
Checkstyle

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

Modified: 
jakarta/commons/proper/jexl/trunk/src/java/org/apache/commons/jexl/ScriptFactory.java
URL: 
http://svn.apache.org/viewcvs/jakarta/commons/proper/jexl/trunk/src/java/org/apache/commons/jexl/ScriptFactory.java?rev=397104&r1=397103&r2=397104&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
 Tue Apr 25 23:27:48 2006
@@ -1,12 +1,12 @@
 /*
  * Copyright 2002-2006 The Apache Software Foundation.
- * 
+ *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
  * You may obtain a copy of the License at
- * 
+ *
  *      http://www.apache.org/licenses/LICENSE-2.0
- * 
+ *
  * Unless required by applicable law or agreed to in writing, software
  * distributed under the License is distributed on an "AS IS" BASIS,
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -55,10 +55,11 @@
         LogFactory.getLog("org.apache.commons.jexl.ScriptFactory");
 
     /**
-     * The singleton ScriptFactory also holds a single instance of [EMAIL 
PROTECTED] Parser}.
-     * When parsing expressions, ScriptFactory synchronizes on Parser.
+     * The singleton ScriptFactory also holds a single instance of 
+     * [EMAIL PROTECTED] Parser}. When parsing expressions, ScriptFactory 
+     * synchronizes on Parser.
      */
-    protected static Parser parser = new Parser(new StringReader(";")); 
//$NON-NLS-1$
+    protected static Parser parser = new Parser(new StringReader(";"));
 
     /**
      * ScriptFactory is a singleton and this is the private
@@ -70,14 +71,15 @@
      * Private constructor, the single instance is always obtained
      * with a call to getInstance().
      */
-    private ScriptFactory(){}
+    private ScriptFactory() {
+
+    }
 
     /**
      * Returns the single instance of ScriptFactory.
      * @return the instance of ScriptFactory.
      */
-    protected static  ScriptFactory getInstance()
-    {
+    protected static  ScriptFactory getInstance() {
         return factory;
     }
 
@@ -86,11 +88,12 @@
      * This method parses the script which validates the syntax.
      * 
      * @param scriptText A String containing valid JEXL syntax
-     * @return A [EMAIL PROTECTED] Script} which can be executed with a [EMAIL 
PROTECTED] JexlContext}.
-     * @throws Exception An exception can be thrown if there is a problem 
parsing the script.
+     * @return A [EMAIL PROTECTED] Script} which can be executed with a 
+     *      [EMAIL PROTECTED] JexlContext}.
+     * @throws Exception An exception can be thrown if there is a 
+     *      problem parsing the script.
      */
-    public static Script createScript(String scriptText) throws Exception
-    {
+    public static Script createScript(String scriptText) throws Exception {
         return getInstance().newScript(scriptText);
     }
 
@@ -98,17 +101,20 @@
      * Creates a Script from a [EMAIL PROTECTED] File} containing valid JEXL 
syntax. 
      * This method parses the script and validates the syntax.
      * 
-     * @param scriptFile A [EMAIL PROTECTED] File} containing valid JEXL 
syntax. Must not be null. Must be a readable file.
-     * @return A [EMAIL PROTECTED] Script} which can be executed with a [EMAIL 
PROTECTED] JexlContext}.
-     * @throws Exception An exception can be thrown if there is a problem 
parsing the script.
+     * @param scriptFile A [EMAIL PROTECTED] File} containing valid JEXL 
syntax.
+     *      Must not be null. Must be a readable file.
+     * @return A [EMAIL PROTECTED] Script} which can be executed with a 
+     *      [EMAIL PROTECTED] JexlContext}.
+     * @throws Exception An exception can be thrown if there is a problem 
+     *      parsing the script.
      */
-    public static Script createScript(File scriptFile) throws Exception
-    {
+    public static Script createScript(File scriptFile) throws Exception {
         if (scriptFile == null) {
-            throw new NullPointerException("scriptFile passed to 
ScriptFactory.createScript is null");
+            throw new NullPointerException("scriptFile is null");
         }
         if (!scriptFile.canRead()) {
-            throw new IOException("Can't read scriptFile (" + 
scriptFile.getCanonicalPath() +")");
+            throw new IOException("Can't read scriptFile (" 
+                + scriptFile.getCanonicalPath() + ")");
         }
         BufferedReader reader = new BufferedReader(new FileReader(scriptFile));
         return createScript(readerToString(reader));
@@ -119,18 +125,21 @@
      * Creates a Script from a [EMAIL PROTECTED] URL} containing valid JEXL 
syntax. 
      * This method parses the script and validates the syntax.
      * 
-     * @param scriptUrl A [EMAIL PROTECTED] URL} containing valid JEXL syntax. 
Must not be null. Must be a readable file.
-     * @return A [EMAIL PROTECTED] Script} which can be executed with a [EMAIL 
PROTECTED] JexlContext}.
-     * @throws Exception An exception can be thrown if there is a problem 
parsing the script.
+     * @param scriptUrl A [EMAIL PROTECTED] URL} containing valid JEXL syntax.
+     *      Must not be null. Must be a readable file.
+     * @return A [EMAIL PROTECTED] Script} which can be executed with a 
+     *      [EMAIL PROTECTED] JexlContext}.
+     * @throws Exception An exception can be thrown if there is a problem
+     *      parsing the script.
      */
-    public static Script createScript(URL scriptUrl) throws Exception
-    {
+    public static Script createScript(URL scriptUrl) throws Exception {
         if (scriptUrl == null) {
-            throw new NullPointerException("scriptUrl passed to 
ScriptFactory.createScript is null");
+            throw new NullPointerException("scriptUrl is null");
         }
         URLConnection connection = scriptUrl.openConnection();
         
-        BufferedReader reader = new BufferedReader(new 
InputStreamReader(connection.getInputStream()));
+        BufferedReader reader = new BufferedReader(
+            new InputStreamReader(connection.getInputStream()));
         return createScript(readerToString(reader));
     }
 
@@ -144,14 +153,14 @@
     protected Script newScript(String scriptText) throws Exception {
         String cleanText = cleanScript(scriptText);
         // Parse the Expression
-        synchronized(parser)
-        {
+        synchronized (parser) {
             log.debug("Parsing script: " + cleanText);
             SimpleNode script = parser.parse(new StringReader(cleanText));
             if (script instanceof ASTJexlScript) {
                 return new ScriptImpl(cleanText, (ASTJexlScript) script);
             } else {
-                throw new IllegalStateException("Parsed script is not an 
ASTJexlScript");
+                throw new IllegalStateException("Parsed script is not "
+                    + "an ASTJexlScript");
             }
         }
     }
@@ -159,24 +168,26 @@
     /**
      * @todo move to ParseUtils?
      * Trims the expression and adds a semi-colon if missing.
-     * @param expression to clean
+     * @param script to clean
      * @return trimmed expression ending in a semi-colon
      */
     private String cleanScript(String script) {
         String expr = script.trim();
-        if (!expr.endsWith(";"))
-        {
+        if (!expr.endsWith(";")) {
             expr += ";";
         }
         return expr;
     }
     
     /**
-     * Read a buffered reader into a StringBuffer and return a String with the 
contents of the reader.
+     * Read a buffered reader into a StringBuffer and return a String with
+     * the contents of the reader.
+     * @param reader to be read.
      * @return the contents of the reader as a String.
      * @throws IOException on any error reading the reader.
      */
-    private static String readerToString(BufferedReader reader) throws 
IOException {
+    private static String readerToString(BufferedReader reader)
+        throws IOException {
         StringBuffer buffer = new StringBuffer();
         try {
             String line = null;

Modified: 
jakarta/commons/proper/jexl/trunk/src/java/org/apache/commons/jexl/ScriptImpl.java
URL: 
http://svn.apache.org/viewcvs/jakarta/commons/proper/jexl/trunk/src/java/org/apache/commons/jexl/ScriptImpl.java?rev=397104&r1=397103&r2=397104&view=diff
==============================================================================
--- 
jakarta/commons/proper/jexl/trunk/src/java/org/apache/commons/jexl/ScriptImpl.java
 (original)
+++ 
jakarta/commons/proper/jexl/trunk/src/java/org/apache/commons/jexl/ScriptImpl.java
 Tue Apr 25 23:27:48 2006
@@ -1,12 +1,12 @@
 /*
- * Copyright 2002,2004 The Apache Software Foundation.
- * 
+ * Copyright 2002-2006 The Apache Software Foundation.
+ *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
  * You may obtain a copy of the License at
- * 
+ *
  *      http://www.apache.org/licenses/LICENSE-2.0
- * 
+ *
  * Unless required by applicable law or agreed to in writing, software
  * distributed under the License is distributed on an "AS IS" BASIS,
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -24,11 +24,16 @@
  */
 class ScriptImpl implements Script {
 
-    /** text of the script */
+    /** text of the script. */
     private final String text;
-    /** syntax tree */
+    /** syntax tree. */
     private final ASTJexlScript parsedScript;
     
+    /**
+     * Create a new Script from the given string and parsed syntax.
+     * @param scriptText the text of the script.
+     * @param scriptTree the parsed script.
+     */
     public ScriptImpl(String scriptText, ASTJexlScript scriptTree) {
         text = scriptText;
         parsedScript = scriptTree;
@@ -36,6 +41,9 @@
 
     /**
      * @see Script#execute(JexlContext)
+     * @return the value of the script. Usually the value of the last 
+     *      executed statement. 
+     * @throws Exception on any error.
      */
     public Object execute(JexlContext context) throws Exception {
         // TODO Auto-generated method stub



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

Reply via email to