commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sebb <seb...@gmail.com>
Subject Re: svn commit: r824415 - in /commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl: ./ scripting/ util/introspection/
Date Tue, 13 Oct 2009 00:25:09 GMT
On 12/10/2009, henrib@apache.org <henrib@apache.org> wrote:
> Author: henrib
>  Date: Mon Oct 12 16:47:39 2009
>  New Revision: 824415
>
>  URL: http://svn.apache.org/viewvc?rev=824415&view=rev
>  Log:
>  Fixed various Javadoc / checkstyle issues
>
>  Modified:
>     commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl/ExpressionImpl.java
>     commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl/Interpreter.java
>     commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl/JexlArithmetic.java
>     commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl/Main.java
>     commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl/Script.java
>     commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl/ScriptFactory.java
>     commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl/UnifiedJEXL.java
>     commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl/scripting/Main.java
>     commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl/util/introspection/JexlMethod.java
>     commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl/util/introspection/JexlPropertyGet.java
>     commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl/util/introspection/JexlPropertySet.java
>
>  Modified: commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl/ExpressionImpl.java
>  URL: http://svn.apache.org/viewvc/commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl/ExpressionImpl.java?rev=824415&r1=824414&r2=824415&view=diff
<snip/>

>  Modified: commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl/Main.java
>  URL: http://svn.apache.org/viewvc/commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl/Main.java?rev=824415&r1=824414&r2=824415&view=diff
>  ==============================================================================
>  --- commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl/Main.java (original)
>  +++ commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl/Main.java Mon Oct
12 16:47:39 2009
>  @@ -6,14 +6,13 @@
>   * (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
>  + *      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.
>   * See the License for the specific language governing permissions and
>   * limitations under the License.
>  - *
>   */
>
>   package org.apache.commons.jexl;
>  @@ -40,30 +39,30 @@
>       *
>       * @param args (optional) filename to evaluate. Stored in the args variable.
>       *
>  -     * @throws Exception
>  +     * @throws Exception if parsing or IO fail
>       */
>      public static void main(String[] args) throws Exception {
>          JexlEngine engine = new JexlEngine();
>          JexlContext context = new HashMapContext();
>          context.getVars().put("args", args);
>  -        if (args.length == 1){
>  -            Script script = engine.createScript(new File(args[0]));
>  -            Object value = script.execute(context);
>  -            System.out.println("Return value: "+value);
>  -        } else {
>  -            BufferedReader console = new BufferedReader(new InputStreamReader(System.in));
>  -            String line;
>  -            System.out.print("> ");
>  -            while(null != (line=console.readLine())){
>  -                try {
>  +        try {
>  +            if (args.length == 1) {
>  +                Script script = engine.createScript(new File(args[0]));
>  +                Object value = script.execute(context);
>  +                System.out.println("Return value: " + value);
>  +            } else {
>  +                BufferedReader console = new BufferedReader(new InputStreamReader(System.in));
>  +                String line;
>  +                System.out.print("> ");
>  +                while (null != (line = console.readLine())) {
>                      Expression expression = engine.createExpression(line);
>                      Object value = expression.evaluate(context);
>  -                    System.out.println("Return value: "+value);
>  +                    System.out.println("Return value: " + value);
>                      System.out.print("> ");
>  -                } catch (JexlException e) {
>  -                    System.out.println(e.getLocalizedMessage());
>                  }
>              }
>  +        } catch (JexlException e) {
>  +            System.out.println(e.getLocalizedMessage());
>          }
>      }
>   }

This changes the behaviour of the application; it's definitely not a
Javadoc or checkstyle issue as mentioned in the log message.

Please don't mix code changes with other changes in the same commit.

The original code reports an error if the user enters an invalid line
and then continues.
This was intentional, as it makes it easier to test commands.
It rather defeats the pupose of command-line input if a typo means
that one has to restart the application.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
For additional commands, e-mail: dev-help@commons.apache.org


Mime
View raw message