commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From simonetrip...@apache.org
Subject svn commit: r1103095 [16/24] - in /incubator/ognl/trunk/src: main/java/org/apache/commons/ognl/ main/java/org/apache/commons/ognl/enhance/ main/java/org/apache/commons/ognl/internal/ test/java/org/apache/commons/ognl/ test/java/org/apache/commons/ognl/...
Date Sat, 14 May 2011 13:18:36 GMT
Modified: incubator/ognl/trunk/src/main/java/org/apache/commons/ognl/ParseException.java
URL: http://svn.apache.org/viewvc/incubator/ognl/trunk/src/main/java/org/apache/commons/ognl/ParseException.java?rev=1103095&r1=1103094&r2=1103095&view=diff
==============================================================================
--- incubator/ognl/trunk/src/main/java/org/apache/commons/ognl/ParseException.java (original)
+++ incubator/ognl/trunk/src/main/java/org/apache/commons/ognl/ParseException.java Sat May 14 13:18:29 2011
@@ -22,196 +22,194 @@
 package org.apache.commons.ognl;
 
 /**
- * This exception is thrown when parse errors are encountered.
- * You can explicitly create objects of this exception type by
- * calling the method generateParseException in the generated
- * parser.
- *
- * You can modify this class to customize your error reporting
- * mechanisms so long as you retain the public fields.
+ * This exception is thrown when parse errors are encountered. You can explicitly create objects of this exception type
+ * by calling the method generateParseException in the generated parser. You can modify this class to customize your
+ * error reporting mechanisms so long as you retain the public fields.
  */
-public class ParseException extends Exception {
+public class ParseException
+    extends Exception
+{
+
+    /**
+     * This constructor is used by the method "generateParseException" in the generated parser. Calling this constructor
+     * generates a new object of this type with the fields "currentToken", "expectedTokenSequences", and "tokenImage"
+     * set. The boolean flag "specialConstructor" is also set to true to indicate that this constructor was used to
+     * create this object. This constructor calls its super class with the empty string to force the "toString" method
+     * of parent class "Throwable" to print the error message in the form: ParseException: <result of getMessage>
+     */
+    public ParseException( Token currentTokenVal, int[][] expectedTokenSequencesVal, String[] tokenImageVal )
+    {
+        super( "" );
+        specialConstructor = true;
+        currentToken = currentTokenVal;
+        expectedTokenSequences = expectedTokenSequencesVal;
+        tokenImage = tokenImageVal;
+    }
 
-  /**
-   * This constructor is used by the method "generateParseException"
-   * in the generated parser.  Calling this constructor generates
-   * a new object of this type with the fields "currentToken",
-   * "expectedTokenSequences", and "tokenImage" set.  The boolean
-   * flag "specialConstructor" is also set to true to indicate that
-   * this constructor was used to create this object.
-   * This constructor calls its super class with the empty string
-   * to force the "toString" method of parent class "Throwable" to
-   * print the error message in the form:
-   *     ParseException: <result of getMessage>
-   */
-  public ParseException(Token currentTokenVal,
-                        int[][] expectedTokenSequencesVal,
-                        String[] tokenImageVal
-                       )
-  {
-    super("");
-    specialConstructor = true;
-    currentToken = currentTokenVal;
-    expectedTokenSequences = expectedTokenSequencesVal;
-    tokenImage = tokenImageVal;
-  }
-
-  /**
-   * The following constructors are for use by you for whatever
-   * purpose you can think of.  Constructing the exception in this
-   * manner makes the exception behave in the normal way - i.e., as
-   * documented in the class "Throwable".  The fields "errorToken",
-   * "expectedTokenSequences", and "tokenImage" do not contain
-   * relevant information.  The JavaCC generated code does not use
-   * these constructors.
-   */
-
-  public ParseException() {
-    super();
-    specialConstructor = false;
-  }
-
-  /** Constructor with message. */
-  public ParseException(String message) {
-    super(message);
-    specialConstructor = false;
-  }
-
-  /**
-   * This variable determines which constructor was used to create
-   * this object and thereby affects the semantics of the
-   * "getMessage" method (see below).
-   */
-  protected boolean specialConstructor;
-
-  /**
-   * This is the last token that has been consumed successfully.  If
-   * this object has been created due to a parse error, the token
-   * followng this token will (therefore) be the first error token.
-   */
-  public Token currentToken;
-
-  /**
-   * Each entry in this array is an array of integers.  Each array
-   * of integers represents a sequence of tokens (by their ordinal
-   * values) that is expected at this point of the parse.
-   */
-  public int[][] expectedTokenSequences;
-
-  /**
-   * This is a reference to the "tokenImage" array of the generated
-   * parser within which the parse error occurred.  This array is
-   * defined in the generated ...Constants interface.
-   */
-  public String[] tokenImage;
-
-  /**
-   * This method has the standard behavior when this object has been
-   * created using the standard constructors.  Otherwise, it uses
-   * "currentToken" and "expectedTokenSequences" to generate a parse
-   * error message and returns it.  If this object has been created
-   * due to a parse error, and you do not catch it (it gets thrown
-   * from the parser), then this method is called during the printing
-   * of the final stack trace, and hence the correct error message
-   * gets displayed.
-   */
-  public String getMessage() {
-    if (!specialConstructor) {
-      return super.getMessage();
+    /**
+     * The following constructors are for use by you for whatever purpose you can think of. Constructing the exception
+     * in this manner makes the exception behave in the normal way - i.e., as documented in the class "Throwable". The
+     * fields "errorToken", "expectedTokenSequences", and "tokenImage" do not contain relevant information. The JavaCC
+     * generated code does not use these constructors.
+     */
+
+    public ParseException()
+    {
+        super();
+        specialConstructor = false;
     }
-    StringBuffer expected = new StringBuffer();
-    int maxSize = 0;
-    for (int i = 0; i < expectedTokenSequences.length; i++) {
-      if (maxSize < expectedTokenSequences[i].length) {
-        maxSize = expectedTokenSequences[i].length;
-      }
-      for (int j = 0; j < expectedTokenSequences[i].length; j++) {
-        expected.append(tokenImage[expectedTokenSequences[i][j]]).append(' ');
-      }
-      if (expectedTokenSequences[i][expectedTokenSequences[i].length - 1] != 0) {
-        expected.append("...");
-      }
-      expected.append(eol).append("    ");
+
+    /** Constructor with message. */
+    public ParseException( String message )
+    {
+        super( message );
+        specialConstructor = false;
     }
-    StringBuilder retval = new StringBuilder("Encountered \"");
-    Token tok = currentToken.next;
-    for (int i = 0; i < maxSize; i++) {
-      if (i != 0) retval.append(" ");
-      if (tok.kind == 0) {
-        retval.append(tokenImage[0]);
-        break;
-      }
-      retval.append(" ").append(tokenImage[tok.kind]);
-      retval.append(" \"");
-      retval.append(add_escapes(tok.image));
-      retval.append(" \"");
-      tok = tok.next; 
+
+    /**
+     * This variable determines which constructor was used to create this object and thereby affects the semantics of
+     * the "getMessage" method (see below).
+     */
+    protected boolean specialConstructor;
+
+    /**
+     * This is the last token that has been consumed successfully. If this object has been created due to a parse error,
+     * the token followng this token will (therefore) be the first error token.
+     */
+    public Token currentToken;
+
+    /**
+     * Each entry in this array is an array of integers. Each array of integers represents a sequence of tokens (by
+     * their ordinal values) that is expected at this point of the parse.
+     */
+    public int[][] expectedTokenSequences;
+
+    /**
+     * This is a reference to the "tokenImage" array of the generated parser within which the parse error occurred. This
+     * array is defined in the generated ...Constants interface.
+     */
+    public String[] tokenImage;
+
+    /**
+     * This method has the standard behavior when this object has been created using the standard constructors.
+     * Otherwise, it uses "currentToken" and "expectedTokenSequences" to generate a parse error message and returns it.
+     * If this object has been created due to a parse error, and you do not catch it (it gets thrown from the parser),
+     * then this method is called during the printing of the final stack trace, and hence the correct error message gets
+     * displayed.
+     */
+    public String getMessage()
+    {
+        if ( !specialConstructor )
+        {
+            return super.getMessage();
+        }
+        StringBuffer expected = new StringBuffer();
+        int maxSize = 0;
+        for ( int i = 0; i < expectedTokenSequences.length; i++ )
+        {
+            if ( maxSize < expectedTokenSequences[i].length )
+            {
+                maxSize = expectedTokenSequences[i].length;
+            }
+            for ( int j = 0; j < expectedTokenSequences[i].length; j++ )
+            {
+                expected.append( tokenImage[expectedTokenSequences[i][j]] ).append( ' ' );
+            }
+            if ( expectedTokenSequences[i][expectedTokenSequences[i].length - 1] != 0 )
+            {
+                expected.append( "..." );
+            }
+            expected.append( eol ).append( "    " );
+        }
+        StringBuilder retval = new StringBuilder( "Encountered \"" );
+        Token tok = currentToken.next;
+        for ( int i = 0; i < maxSize; i++ )
+        {
+            if ( i != 0 )
+                retval.append( " " );
+            if ( tok.kind == 0 )
+            {
+                retval.append( tokenImage[0] );
+                break;
+            }
+            retval.append( " " ).append( tokenImage[tok.kind] );
+            retval.append( " \"" );
+            retval.append( add_escapes( tok.image ) );
+            retval.append( " \"" );
+            tok = tok.next;
+        }
+        retval.append( "\" at line " ).append( currentToken.next.beginLine ).append( ", column " ).append( currentToken.next.beginColumn );
+        retval.append( "." ).append( eol );
+        if ( expectedTokenSequences.length == 1 )
+        {
+            retval.append( "Was expecting:" ).append( eol ).append( "    " );
+        }
+        else
+        {
+            retval.append( "Was expecting one of:" ).append( eol ).append( "    " );
+        }
+        retval.append( expected.toString() );
+        return retval.toString();
     }
-    retval.append("\" at line ").append(currentToken.next.beginLine).append(", column ").append(currentToken.next.beginColumn);
-    retval.append(".").append(eol);
-    if (expectedTokenSequences.length == 1) {
-      retval.append("Was expecting:").append(eol).append("    ");
-    } else {
-      retval.append("Was expecting one of:").append(eol).append("    ");
+
+    /**
+     * The end of line string for this machine.
+     */
+    protected String eol = System.getProperty( "line.separator", "\n" );
+
+    /**
+     * Used to convert raw characters to their escaped version when these raw version cannot be used as part of an ASCII
+     * string literal.
+     */
+    protected String add_escapes( String str )
+    {
+        StringBuffer retval = new StringBuffer();
+        char ch;
+        for ( int i = 0; i < str.length(); i++ )
+        {
+            switch ( str.charAt( i ) )
+            {
+                case 0:
+                    continue;
+                case '\b':
+                    retval.append( "\\b" );
+                    continue;
+                case '\t':
+                    retval.append( "\\t" );
+                    continue;
+                case '\n':
+                    retval.append( "\\n" );
+                    continue;
+                case '\f':
+                    retval.append( "\\f" );
+                    continue;
+                case '\r':
+                    retval.append( "\\r" );
+                    continue;
+                case '\"':
+                    retval.append( "\\\"" );
+                    continue;
+                case '\'':
+                    retval.append( "\\\'" );
+                    continue;
+                case '\\':
+                    retval.append( "\\\\" );
+                    continue;
+                default:
+                    if ( ( ch = str.charAt( i ) ) < 0x20 || ch > 0x7e )
+                    {
+                        String s = "0000" + Integer.toString( ch, 16 );
+                        retval.append( "\\u" + s.substring( s.length() - 4, s.length() ) );
+                    }
+                    else
+                    {
+                        retval.append( ch );
+                    }
+                    continue;
+            }
+        }
+        return retval.toString();
     }
-    retval.append(expected.toString());
-    return retval.toString();
-  }
-
-  /**
-   * The end of line string for this machine.
-   */
-  protected String eol = System.getProperty("line.separator", "\n");
- 
-  /**
-   * Used to convert raw characters to their escaped version
-   * when these raw version cannot be used as part of an ASCII
-   * string literal.
-   */
-  protected String add_escapes(String str) {
-      StringBuffer retval = new StringBuffer();
-      char ch;
-      for (int i = 0; i < str.length(); i++) {
-        switch (str.charAt(i))
-        {
-           case 0 :
-              continue;
-           case '\b':
-              retval.append("\\b");
-              continue;
-           case '\t':
-              retval.append("\\t");
-              continue;
-           case '\n':
-              retval.append("\\n");
-              continue;
-           case '\f':
-              retval.append("\\f");
-              continue;
-           case '\r':
-              retval.append("\\r");
-              continue;
-           case '\"':
-              retval.append("\\\"");
-              continue;
-           case '\'':
-              retval.append("\\\'");
-              continue;
-           case '\\':
-              retval.append("\\\\");
-              continue;
-           default:
-              if ((ch = str.charAt(i)) < 0x20 || ch > 0x7e) {
-                 String s = "0000" + Integer.toString(ch, 16);
-                 retval.append("\\u" + s.substring(s.length() - 4, s.length()));
-              } else {
-                 retval.append(ch);
-              }
-              continue;
-        }
-      }
-      return retval.toString();
-   }
 
 }
 /* JavaCC - OriginalChecksum=a0a2f59968d58ccc3e57dbd91056ba6e (do not edit this line) */

Modified: incubator/ognl/trunk/src/main/java/org/apache/commons/ognl/PropertyAccessor.java
URL: http://svn.apache.org/viewvc/incubator/ognl/trunk/src/main/java/org/apache/commons/ognl/PropertyAccessor.java?rev=1103095&r1=1103094&r2=1103095&view=diff
==============================================================================
--- incubator/ognl/trunk/src/main/java/org/apache/commons/ognl/PropertyAccessor.java (original)
+++ incubator/ognl/trunk/src/main/java/org/apache/commons/ognl/PropertyAccessor.java Sat May 14 13:18:29 2011
@@ -22,21 +22,18 @@ package org.apache.commons.ognl;
 import java.util.Map;
 
 /**
- * This interface defines methods for setting and getting a property from a target object. A
- * "property" in this case is a named data value that takes the generic form of an Object---the same
- * definition as is used by beans. But the operational semantics of the term will vary by
- * implementation of this interface: a bean-style implementation will get and set properties as
- * beans do, by reflection on the target object's class, but other implementations are possible,
+ * This interface defines methods for setting and getting a property from a target object. A "property" in this case is
+ * a named data value that takes the generic form of an Object---the same definition as is used by beans. But the
+ * operational semantics of the term will vary by implementation of this interface: a bean-style implementation will get
+ * and set properties as beans do, by reflection on the target object's class, but other implementations are possible,
  * such as one that uses the property name as a key into a map.
  * <p>
- * An implementation of this interface will often require that its target objects all be of some
- * particular type. For example, the MapPropertyAccessor class requires that its targets all
- * implement the java.util.Map interface.
+ * An implementation of this interface will often require that its target objects all be of some particular type. For
+ * example, the MapPropertyAccessor class requires that its targets all implement the java.util.Map interface.
  * <p>
- * Note that the "name" of a property is represented by a generic Object. Some implementations may
- * require properties' names to be Strings, while others may allow them to be other types---for
- * example, ArrayPropertyAccessor treats Number names as indexes into the target object, which must
- * be an array.
+ * Note that the "name" of a property is represented by a generic Object. Some implementations may require properties'
+ * names to be Strings, while others may allow them to be other types---for example, ArrayPropertyAccessor treats Number
+ * names as indexes into the target object, which must be an array.
  * 
  * @author Luke Blanshard (blanshlu@netscape.net)
  * @author Drew Davidson (drew@ognl.org)
@@ -46,65 +43,47 @@ public interface PropertyAccessor
 
     /**
      * Extracts and returns the property of the given name from the given target object.
-     *
-     * @param context
-     *          The current execution context.
-     * @param target
-     *            the object to get the property from
-     * @param name
-     *            the name of the property to get.
      * 
+     * @param context The current execution context.
+     * @param target the object to get the property from
+     * @param name the name of the property to get.
      * @return the current value of the given property in the given object
-     * @exception OgnlException
-     *                if there is an error locating the property in the given object
+     * @exception OgnlException if there is an error locating the property in the given object
      */
-    Object getProperty(Map context, Object target, Object name)
+    Object getProperty( Map context, Object target, Object name )
         throws OgnlException;
 
     /**
      * Sets the value of the property of the given name in the given target object.
-     *
-     * @param context
-     *          The current execution context.
-     * @param target
-     *            the object to set the property in
-     * @param name
-     *            the name of the property to set
-     * @param value
-     *            the new value for the property.
      * 
-     * @exception OgnlException
-     *                if there is an error setting the property in the given object
+     * @param context The current execution context.
+     * @param target the object to set the property in
+     * @param name the name of the property to set
+     * @param value the new value for the property.
+     * @exception OgnlException if there is an error setting the property in the given object
      */
-    void setProperty(Map context, Object target, Object name, Object value)
+    void setProperty( Map context, Object target, Object name, Object value )
         throws OgnlException;
 
     /**
-     * Returns a java string representing the textual method that should be called to access a
-     * particular element. (ie "get")
-     *
-     * @param context
-     *          The current execution context.
-     * @param target
-     *          The current object target on the expression tree being evaluated.
-     * @param index
-     *            The index object that will be placed inside the string to access the value.
+     * Returns a java string representing the textual method that should be called to access a particular element. (ie
+     * "get")
      * 
+     * @param context The current execution context.
+     * @param target The current object target on the expression tree being evaluated.
+     * @param index The index object that will be placed inside the string to access the value.
      * @return The source accessor method to call.
      */
-    String getSourceAccessor(OgnlContext context, Object target, Object index);
+    String getSourceAccessor( OgnlContext context, Object target, Object index );
 
     /**
-     * Returns a java string representing the textual method that should be called to set a
-     * particular element. (ie "set")
-     *
-     * @param context
-     *          The current execution context.
-     * @param target
-     *          The current object target on the expression tree being evaluated.
-     * @param index
-     *            The index object that will be placed inside the string to set the value.
+     * Returns a java string representing the textual method that should be called to set a particular element. (ie
+     * "set")
+     * 
+     * @param context The current execution context.
+     * @param target The current object target on the expression tree being evaluated.
+     * @param index The index object that will be placed inside the string to set the value.
      * @return The source setter method to call.
      */
-    String getSourceSetter(OgnlContext context, Object target, Object index);
+    String getSourceSetter( OgnlContext context, Object target, Object index );
 }

Modified: incubator/ognl/trunk/src/main/java/org/apache/commons/ognl/SetPropertyAccessor.java
URL: http://svn.apache.org/viewvc/incubator/ognl/trunk/src/main/java/org/apache/commons/ognl/SetPropertyAccessor.java?rev=1103095&r1=1103094&r2=1103095&view=diff
==============================================================================
--- incubator/ognl/trunk/src/main/java/org/apache/commons/ognl/SetPropertyAccessor.java (original)
+++ incubator/ognl/trunk/src/main/java/org/apache/commons/ognl/SetPropertyAccessor.java Sat May 14 13:18:29 2011
@@ -23,30 +23,42 @@ import java.util.Map;
 import java.util.Set;
 
 /**
- * Implementation of PropertyAccessor that uses numbers and dynamic subscripts as
- * properties to index into Lists.
+ * Implementation of PropertyAccessor that uses numbers and dynamic subscripts as properties to index into Lists.
+ * 
  * @author Luke Blanshard (blanshlu@netscape.net)
  * @author Drew Davidson (drew@ognl.org)
  */
-public class SetPropertyAccessor extends ObjectPropertyAccessor
+public class SetPropertyAccessor
+    extends ObjectPropertyAccessor
     implements PropertyAccessor // This is here to make javadoc show this class as an implementor
 {
-    public Object getProperty( Map context, Object target, Object name ) throws OgnlException
+    public Object getProperty( Map context, Object target, Object name )
+        throws OgnlException
     {
-        Set     set = (Set)target;
+        Set set = (Set) target;
 
-        if ( name instanceof String ) {
-            Object      result;
-            
-            if (name.equals("size")) {
-                result = new Integer(set.size());
-            } else {
-                if (name.equals("iterator")) {
+        if ( name instanceof String )
+        {
+            Object result;
+
+            if ( name.equals( "size" ) )
+            {
+                result = new Integer( set.size() );
+            }
+            else
+            {
+                if ( name.equals( "iterator" ) )
+                {
                     result = set.iterator();
-                } else {
-                    if (name.equals("isEmpty")) {
+                }
+                else
+                {
+                    if ( name.equals( "isEmpty" ) )
+                    {
                         result = set.isEmpty() ? Boolean.TRUE : Boolean.FALSE;
-                    } else {
+                    }
+                    else
+                    {
                         result = super.getProperty( context, target, name );
                     }
                 }
@@ -56,6 +68,5 @@ public class SetPropertyAccessor extends
 
         throw new NoSuchPropertyException( target, name );
     }
-    
-    
+
 }

Modified: incubator/ognl/trunk/src/main/java/org/apache/commons/ognl/SimpleNode.java
URL: http://svn.apache.org/viewvc/incubator/ognl/trunk/src/main/java/org/apache/commons/ognl/SimpleNode.java?rev=1103095&r1=1103094&r2=1103095&view=diff
==============================================================================
--- incubator/ognl/trunk/src/main/java/org/apache/commons/ognl/SimpleNode.java (original)
+++ incubator/ognl/trunk/src/main/java/org/apache/commons/ognl/SimpleNode.java Sat May 14 13:18:29 2011
@@ -28,27 +28,34 @@ import java.io.Serializable;
  * @author Luke Blanshard (blanshlu@netscape.net)
  * @author Drew Davidson (drew@ognl.org)
  */
-public abstract class SimpleNode implements Node, Serializable {
+public abstract class SimpleNode
+    implements Node, Serializable
+{
 
     protected Node _parent;
+
     protected Node[] _children;
+
     protected int _id;
+
     protected OgnlParser _parser;
 
     private boolean _constantValueCalculated;
+
     private volatile boolean _hasConstantValue;
+
     private Object _constantValue;
 
     private ExpressionAccessor _accessor;
 
-    public SimpleNode(int i)
+    public SimpleNode( int i )
     {
         _id = i;
     }
 
-    public SimpleNode(OgnlParser p, int i)
+    public SimpleNode( OgnlParser p, int i )
     {
-        this(i);
+        this( i );
         _parser = p;
     }
 
@@ -60,7 +67,7 @@ public abstract class SimpleNode impleme
     {
     }
 
-    public void jjtSetParent(Node n)
+    public void jjtSetParent( Node n )
     {
         _parent = n;
     }
@@ -70,32 +77,35 @@ public abstract class SimpleNode impleme
         return _parent;
     }
 
-    public void jjtAddChild(Node n, int i)
+    public void jjtAddChild( Node n, int i )
     {
-        if (_children == null) {
+        if ( _children == null )
+        {
             _children = new Node[i + 1];
-        } else if (i >= _children.length) {
+        }
+        else if ( i >= _children.length )
+        {
             Node c[] = new Node[i + 1];
-            System.arraycopy(_children, 0, c, 0, _children.length);
+            System.arraycopy( _children, 0, c, 0, _children.length );
             _children = c;
         }
         _children[i] = n;
     }
 
-    public Node jjtGetChild(int i)
+    public Node jjtGetChild( int i )
     {
         return _children[i];
     }
 
     public int jjtGetNumChildren()
     {
-        return (_children == null) ? 0 : _children.length;
+        return ( _children == null ) ? 0 : _children.length;
     }
 
     /*
-     * You can override these two methods in subclasses of SimpleNode to customize the way the node
-     * appears when the tree is dumped. If your output uses more than one line you should override
-     * toString(String), otherwise overriding toString() is probably all you need to do.
+     * You can override these two methods in subclasses of SimpleNode to customize the way the node appears when the
+     * tree is dumped. If your output uses more than one line you should override toString(String), otherwise overriding
+     * toString() is probably all you need to do.
      */
 
     public String toString()
@@ -105,37 +115,37 @@ public abstract class SimpleNode impleme
 
     // OGNL additions
 
-    public String toString(String prefix)
+    public String toString( String prefix )
     {
         return prefix + OgnlParserTreeConstants.jjtNodeName[_id] + " " + toString();
     }
 
-    public String toGetSourceString(OgnlContext context, Object target)
+    public String toGetSourceString( OgnlContext context, Object target )
     {
         return toString();
     }
 
-    public String toSetSourceString(OgnlContext context, Object target)
+    public String toSetSourceString( OgnlContext context, Object target )
     {
         return toString();
     }
 
     /*
-    * Override this method if you want to customize how the node dumps out its children.
-    */
+     * Override this method if you want to customize how the node dumps out its children.
+     */
 
-    public void dump(PrintWriter writer, String prefix)
+    public void dump( PrintWriter writer, String prefix )
     {
-        writer.println(toString(prefix));
+        writer.println( toString( prefix ) );
 
-        if (_children != null)
+        if ( _children != null )
         {
-            for (int i = 0; i < _children.length; ++i)
+            for ( int i = 0; i < _children.length; ++i )
             {
                 SimpleNode n = (SimpleNode) _children[i];
-                if (n != null)
+                if ( n != null )
                 {
-                    n.dump(writer, prefix + "  ");
+                    n.dump( writer, prefix + "  " );
                 }
             }
         }
@@ -145,20 +155,20 @@ public abstract class SimpleNode impleme
     {
         int result = -1;
 
-        if (_parent != null)
+        if ( _parent != null )
         {
             int icount = _parent.jjtGetNumChildren();
 
-            for (int i = 0; i < icount; i++)
+            for ( int i = 0; i < icount; i++ )
             {
-                if (_parent.jjtGetChild(i) == this)
+                if ( _parent.jjtGetChild( i ) == this )
                 {
                     result = i;
                     break;
                 }
             }
         }
-        
+
         return result;
     }
 
@@ -167,212 +177,237 @@ public abstract class SimpleNode impleme
         Node result = null;
         int i = getIndexInParent();
 
-        if (i >= 0)
+        if ( i >= 0 )
         {
             int icount = _parent.jjtGetNumChildren();
 
-            if (i < icount)
+            if ( i < icount )
             {
-                result = _parent.jjtGetChild(i + 1);
+                result = _parent.jjtGetChild( i + 1 );
             }
         }
         return result;
     }
 
-    protected Object evaluateGetValueBody(OgnlContext context, Object source)
-            throws OgnlException
+    protected Object evaluateGetValueBody( OgnlContext context, Object source )
+        throws OgnlException
     {
-        context.setCurrentObject(source);
-        context.setCurrentNode(this);
+        context.setCurrentObject( source );
+        context.setCurrentNode( this );
 
-        if (!_constantValueCalculated)
+        if ( !_constantValueCalculated )
         {
             _constantValueCalculated = true;
-            boolean constant = isConstant(context);
+            boolean constant = isConstant( context );
 
-            if (constant)
+            if ( constant )
             {
-                _constantValue = getValueBody(context, source);
+                _constantValue = getValueBody( context, source );
             }
 
             _hasConstantValue = constant;
         }
 
-        return _hasConstantValue ? _constantValue : getValueBody(context, source);
+        return _hasConstantValue ? _constantValue : getValueBody( context, source );
     }
 
-    protected void evaluateSetValueBody(OgnlContext context, Object target, Object value)
-            throws OgnlException
+    protected void evaluateSetValueBody( OgnlContext context, Object target, Object value )
+        throws OgnlException
     {
-        context.setCurrentObject(target);
-        context.setCurrentNode(this);
-        setValueBody(context, target, value);
+        context.setCurrentObject( target );
+        context.setCurrentNode( this );
+        setValueBody( context, target, value );
     }
 
-    public final Object getValue(OgnlContext context, Object source)
-            throws OgnlException
+    public final Object getValue( OgnlContext context, Object source )
+        throws OgnlException
     {
         Object result = null;
 
-        if (context.getTraceEvaluations()) {
+        if ( context.getTraceEvaluations() )
+        {
 
             EvaluationPool pool = OgnlRuntime.getEvaluationPool();
             Throwable evalException = null;
-            Evaluation evaluation = pool.create(this, source);
+            Evaluation evaluation = pool.create( this, source );
 
-            context.pushEvaluation(evaluation);
-            try {
-                result = evaluateGetValueBody(context, source);
+            context.pushEvaluation( evaluation );
+            try
+            {
+                result = evaluateGetValueBody( context, source );
             }
-            catch (OgnlException ex) {
+            catch ( OgnlException ex )
+            {
                 evalException = ex;
                 throw ex;
             }
-            catch (RuntimeException ex) {
+            catch ( RuntimeException ex )
+            {
                 evalException = ex;
                 throw ex;
-            } finally {
+            }
+            finally
+            {
                 Evaluation eval = context.popEvaluation();
 
-                eval.setResult(result);
-                if (evalException != null) {
-                    eval.setException(evalException);
+                eval.setResult( result );
+                if ( evalException != null )
+                {
+                    eval.setException( evalException );
                 }
-                if ((evalException == null) && (context.getRootEvaluation() == null)
-                    && !context.getKeepLastEvaluation()) {
-                    pool.recycleAll(eval);
+                if ( ( evalException == null ) && ( context.getRootEvaluation() == null )
+                    && !context.getKeepLastEvaluation() )
+                {
+                    pool.recycleAll( eval );
                 }
             }
-        } else {
-            result = evaluateGetValueBody(context, source);
+        }
+        else
+        {
+            result = evaluateGetValueBody( context, source );
         }
 
         return result;
     }
 
-    /** Subclasses implement this method to do the actual work of extracting the appropriate value from the source object. */
-    protected abstract Object getValueBody(OgnlContext context, Object source)
-            throws OgnlException;
+    /**
+     * Subclasses implement this method to do the actual work of extracting the appropriate value from the source
+     * object.
+     */
+    protected abstract Object getValueBody( OgnlContext context, Object source )
+        throws OgnlException;
 
-    public final void setValue(OgnlContext context, Object target, Object value)
-            throws OgnlException
+    public final void setValue( OgnlContext context, Object target, Object value )
+        throws OgnlException
     {
-        if (context.getTraceEvaluations())
+        if ( context.getTraceEvaluations() )
         {
             EvaluationPool pool = OgnlRuntime.getEvaluationPool();
             Throwable evalException = null;
-            Evaluation evaluation = pool.create(this, target, true);
+            Evaluation evaluation = pool.create( this, target, true );
 
-            context.pushEvaluation(evaluation);
-            try {
-                evaluateSetValueBody(context, target, value);
+            context.pushEvaluation( evaluation );
+            try
+            {
+                evaluateSetValueBody( context, target, value );
             }
-            catch (OgnlException ex) {
+            catch ( OgnlException ex )
+            {
                 evalException = ex;
-                ex.setEvaluation(evaluation);
+                ex.setEvaluation( evaluation );
                 throw ex;
             }
-            catch (RuntimeException ex) {
+            catch ( RuntimeException ex )
+            {
                 evalException = ex;
                 throw ex;
-            } finally {
+            }
+            finally
+            {
                 Evaluation eval = context.popEvaluation();
 
-                if (evalException != null) {
-                    eval.setException(evalException);
+                if ( evalException != null )
+                {
+                    eval.setException( evalException );
                 }
-                if ((evalException == null) && (context.getRootEvaluation() == null)
-                    && !context.getKeepLastEvaluation()) {
-                    pool.recycleAll(eval);
+                if ( ( evalException == null ) && ( context.getRootEvaluation() == null )
+                    && !context.getKeepLastEvaluation() )
+                {
+                    pool.recycleAll( eval );
                 }
             }
-        } else {
-            evaluateSetValueBody(context, target, value);
+        }
+        else
+        {
+            evaluateSetValueBody( context, target, value );
         }
     }
 
     /**
-     * Subclasses implement this method to do the actual work of setting the appropriate value in the target object. The default implementation throws an
-     * <code>InappropriateExpressionException</code>, meaning that it cannot be a set expression.
+     * Subclasses implement this method to do the actual work of setting the appropriate value in the target object. The
+     * default implementation throws an <code>InappropriateExpressionException</code>, meaning that it cannot be a set
+     * expression.
      */
-    protected void setValueBody(OgnlContext context, Object target, Object value)
-            throws OgnlException
+    protected void setValueBody( OgnlContext context, Object target, Object value )
+        throws OgnlException
     {
-        throw new InappropriateExpressionException(this);
+        throw new InappropriateExpressionException( this );
     }
 
     /** Returns true iff this node is constant without respect to the children. */
-    public boolean isNodeConstant(OgnlContext context)
-            throws OgnlException
+    public boolean isNodeConstant( OgnlContext context )
+        throws OgnlException
     {
         return false;
     }
 
-    public boolean isConstant(OgnlContext context)
-            throws OgnlException
+    public boolean isConstant( OgnlContext context )
+        throws OgnlException
     {
-        return isNodeConstant(context);
+        return isNodeConstant( context );
     }
 
-    public boolean isNodeSimpleProperty(OgnlContext context)
-            throws OgnlException
+    public boolean isNodeSimpleProperty( OgnlContext context )
+        throws OgnlException
     {
         return false;
     }
 
-    public boolean isSimpleProperty(OgnlContext context)
-            throws OgnlException
+    public boolean isSimpleProperty( OgnlContext context )
+        throws OgnlException
     {
-        return isNodeSimpleProperty(context);
+        return isNodeSimpleProperty( context );
     }
 
-    public boolean isSimpleNavigationChain(OgnlContext context)
-            throws OgnlException
+    public boolean isSimpleNavigationChain( OgnlContext context )
+        throws OgnlException
     {
-        return isSimpleProperty(context);
+        return isSimpleProperty( context );
     }
 
-    protected boolean lastChild(OgnlContext context)
+    protected boolean lastChild( OgnlContext context )
     {
-        return _parent == null || context.get("_lastChild") !=  null;
+        return _parent == null || context.get( "_lastChild" ) != null;
     }
 
     /**
-     * This method may be called from subclasses' jjtClose methods. It flattens the tree under this node by eliminating any children that are of the same class as this
-     * node and copying their children to this node.
+     * This method may be called from subclasses' jjtClose methods. It flattens the tree under this node by eliminating
+     * any children that are of the same class as this node and copying their children to this node.
      */
     protected void flattenTree()
     {
         boolean shouldFlatten = false;
         int newSize = 0;
 
-        for (int i = 0; i < _children.length; ++i)
-            if (_children[i].getClass() == getClass())
+        for ( int i = 0; i < _children.length; ++i )
+            if ( _children[i].getClass() == getClass() )
             {
                 shouldFlatten = true;
                 newSize += _children[i].jjtGetNumChildren();
-            } else
+            }
+            else
                 ++newSize;
 
-        if (shouldFlatten)
+        if ( shouldFlatten )
         {
             Node[] newChildren = new Node[newSize];
             int j = 0;
 
-            for (int i = 0; i < _children.length; ++i)
+            for ( int i = 0; i < _children.length; ++i )
             {
                 Node c = _children[i];
-                if (c.getClass() == getClass())
+                if ( c.getClass() == getClass() )
                 {
-                    for (int k = 0; k < c.jjtGetNumChildren(); ++k)
-                        newChildren[j++] = c.jjtGetChild(k);
+                    for ( int k = 0; k < c.jjtGetNumChildren(); ++k )
+                        newChildren[j++] = c.jjtGetChild( k );
 
-                } else
+                }
+                else
                     newChildren[j++] = c;
             }
 
-            if (j != newSize)
-                throw new Error("Assertion error: " + j + " != " + newSize);
+            if ( j != newSize )
+                throw new Error( "Assertion error: " + j + " != " + newSize );
 
             _children = newChildren;
         }
@@ -383,7 +418,7 @@ public abstract class SimpleNode impleme
         return _accessor;
     }
 
-    public void setAccessor(ExpressionAccessor accessor)
+    public void setAccessor( ExpressionAccessor accessor )
     {
         _accessor = accessor;
     }

Modified: incubator/ognl/trunk/src/main/java/org/apache/commons/ognl/Token.java
URL: http://svn.apache.org/viewvc/incubator/ognl/trunk/src/main/java/org/apache/commons/ognl/Token.java?rev=1103095&r1=1103094&r2=1103095&view=diff
==============================================================================
--- incubator/ognl/trunk/src/main/java/org/apache/commons/ognl/Token.java (original)
+++ incubator/ognl/trunk/src/main/java/org/apache/commons/ognl/Token.java Sat May 14 13:18:29 2011
@@ -25,119 +25,113 @@ package org.apache.commons.ognl;
  * Describes the input token stream.
  */
 
-public class Token {
+public class Token
+{
 
-  /**
-   * An integer that describes the kind of this token.  This numbering
-   * system is determined by JavaCCParser, and a table of these numbers is
-   * stored in the file ...Constants.java.
-   */
-  public int kind;
-
-  /** The line number of the first character of this Token. */
-  public int beginLine;
-  /** The column number of the first character of this Token. */
-  public int beginColumn;
-  /** The line number of the last character of this Token. */
-  public int endLine;
-  /** The column number of the last character of this Token. */
-  public int endColumn;
-
-  /**
-   * The string image of the token.
-   */
-  public String image;
-
-  /**
-   * A reference to the next regular (non-special) token from the input
-   * stream.  If this is the last token from the input stream, or if the
-   * token manager has not read tokens beyond this one, this field is
-   * set to null.  This is true only if this token is also a regular
-   * token.  Otherwise, see below for a description of the contents of
-   * this field.
-   */
-  public Token next;
-
-  /**
-   * This field is used to access special tokens that occur prior to this
-   * token, but after the immediately preceding regular (non-special) token.
-   * If there are no such special tokens, this field is set to null.
-   * When there are more than one such special token, this field refers
-   * to the last of these special tokens, which in turn refers to the next
-   * previous special token through its specialToken field, and so on
-   * until the first special token (whose specialToken field is null).
-   * The next fields of special tokens refer to other special tokens that
-   * immediately follow it (without an intervening regular token).  If there
-   * is no such token, this field is null.
-   */
-  public Token specialToken;
-
-  /**
-   * An optional attribute value of the Token.
-   * Tokens which are not used as syntactic sugar will often contain
-   * meaningful values that will be used later on by the compiler or
-   * interpreter. This attribute value is often different from the image.
-   * Any subclass of Token that actually wants to return a non-null value can
-   * override this method as appropriate.
-   */
-  public Object getValue() {
-    return null;
-  }
-
-  /**
-   * No-argument contructor
-   */
-  public Token() {}
-
-  /**
-   * Constructs a new token for the specified Image.
-   */
-  public Token(int kind)
-  {
-     this(kind, null);
-  }
-
-  /**
-   * Constructs a new token for the specified Image and Kind.
-   */
-  public Token(int kind, String image)
-  {
-     this.kind = kind;
-     this.image = image;
-  }
-
-  /**
-   * Returns the image.
-   */
-  public String toString()
-  {
-     return image;
-  }
-
-  /**
-   * Returns a new Token object, by default. However, if you want, you
-   * can create and return subclass objects based on the value of ofKind.
-   * Simply add the cases to the switch for all those special cases.
-   * For example, if you have a subclass of Token called IDToken that
-   * you want to create if ofKind is ID, simply add something like :
-   *
-   *    case MyParserConstants.ID : return new IDToken(ofKind, image);
-   *
-   * to the following switch statement. Then you can cast matchedToken
-   * variable to the appropriate type and use sit in your lexical actions.
-   */
-  public static Token newToken(int ofKind, String image)
-  {
-     switch(ofKind)
-     {
-       default : return new Token(ofKind, image);
-     }
-  }
-
-  public static Token newToken(int ofKind)
-  {
-     return newToken(ofKind, null);
-  }
+    /**
+     * An integer that describes the kind of this token. This numbering system is determined by JavaCCParser, and a
+     * table of these numbers is stored in the file ...Constants.java.
+     */
+    public int kind;
+
+    /** The line number of the first character of this Token. */
+    public int beginLine;
+
+    /** The column number of the first character of this Token. */
+    public int beginColumn;
+
+    /** The line number of the last character of this Token. */
+    public int endLine;
+
+    /** The column number of the last character of this Token. */
+    public int endColumn;
+
+    /**
+     * The string image of the token.
+     */
+    public String image;
+
+    /**
+     * A reference to the next regular (non-special) token from the input stream. If this is the last token from the
+     * input stream, or if the token manager has not read tokens beyond this one, this field is set to null. This is
+     * true only if this token is also a regular token. Otherwise, see below for a description of the contents of this
+     * field.
+     */
+    public Token next;
+
+    /**
+     * This field is used to access special tokens that occur prior to this token, but after the immediately preceding
+     * regular (non-special) token. If there are no such special tokens, this field is set to null. When there are more
+     * than one such special token, this field refers to the last of these special tokens, which in turn refers to the
+     * next previous special token through its specialToken field, and so on until the first special token (whose
+     * specialToken field is null). The next fields of special tokens refer to other special tokens that immediately
+     * follow it (without an intervening regular token). If there is no such token, this field is null.
+     */
+    public Token specialToken;
+
+    /**
+     * An optional attribute value of the Token. Tokens which are not used as syntactic sugar will often contain
+     * meaningful values that will be used later on by the compiler or interpreter. This attribute value is often
+     * different from the image. Any subclass of Token that actually wants to return a non-null value can override this
+     * method as appropriate.
+     */
+    public Object getValue()
+    {
+        return null;
+    }
+
+    /**
+     * No-argument contructor
+     */
+    public Token()
+    {
+    }
+
+    /**
+     * Constructs a new token for the specified Image.
+     */
+    public Token( int kind )
+    {
+        this( kind, null );
+    }
+
+    /**
+     * Constructs a new token for the specified Image and Kind.
+     */
+    public Token( int kind, String image )
+    {
+        this.kind = kind;
+        this.image = image;
+    }
+
+    /**
+     * Returns the image.
+     */
+    public String toString()
+    {
+        return image;
+    }
+
+    /**
+     * Returns a new Token object, by default. However, if you want, you can create and return subclass objects based on
+     * the value of ofKind. Simply add the cases to the switch for all those special cases. For example, if you have a
+     * subclass of Token called IDToken that you want to create if ofKind is ID, simply add something like : case
+     * MyParserConstants.ID : return new IDToken(ofKind, image); to the following switch statement. Then you can cast
+     * matchedToken variable to the appropriate type and use sit in your lexical actions.
+     */
+    public static Token newToken( int ofKind, String image )
+    {
+        switch ( ofKind )
+        {
+            default:
+                return new Token( ofKind, image );
+        }
+    }
+
+    public static Token newToken( int ofKind )
+    {
+        return newToken( ofKind, null );
+    }
 
 }
 /* JavaCC - OriginalChecksum=771cf4338e4d91b53163152263c004d8 (do not edit this line) */

Modified: incubator/ognl/trunk/src/main/java/org/apache/commons/ognl/TokenMgrError.java
URL: http://svn.apache.org/viewvc/incubator/ognl/trunk/src/main/java/org/apache/commons/ognl/TokenMgrError.java?rev=1103095&r1=1103094&r2=1103095&view=diff
==============================================================================
--- incubator/ognl/trunk/src/main/java/org/apache/commons/ognl/TokenMgrError.java (original)
+++ incubator/ognl/trunk/src/main/java/org/apache/commons/ognl/TokenMgrError.java Sat May 14 13:18:29 2011
@@ -22,138 +22,143 @@
 package org.apache.commons.ognl;
 
 /** Token Manager Error. */
-public class TokenMgrError extends Error
+public class TokenMgrError
+    extends Error
 {
 
-   /*
-    * Ordinals for various reasons why an Error of this type can be thrown.
-    */
-
-   /**
-    * Lexical error occurred.
-    */
-   static final int LEXICAL_ERROR = 0;
-
-   /**
-    * An attempt was made to create a second instance of a static token manager.
-    */
-   static final int STATIC_LEXER_ERROR = 1;
-
-   /**
-    * Tried to change to an invalid lexical state.
-    */
-   static final int INVALID_LEXICAL_STATE = 2;
-
-   /**
-    * Detected (and bailed out of) an infinite loop in the token manager.
-    */
-   static final int LOOP_DETECTED = 3;
-
-   /**
-    * Indicates the reason why the exception is thrown. It will have
-    * one of the above 4 values.
-    */
-   int errorCode;
-
-   /**
-    * Replaces unprintable characters by their escaped (or unicode escaped)
-    * equivalents in the given string
-    */
-   protected static final String addEscapes(String str) {
-      StringBuffer retval = new StringBuffer();
-      char ch;
-      for (int i = 0; i < str.length(); i++) {
-        switch (str.charAt(i))
+    /*
+     * Ordinals for various reasons why an Error of this type can be thrown.
+     */
+
+    /**
+     * Lexical error occurred.
+     */
+    static final int LEXICAL_ERROR = 0;
+
+    /**
+     * An attempt was made to create a second instance of a static token manager.
+     */
+    static final int STATIC_LEXER_ERROR = 1;
+
+    /**
+     * Tried to change to an invalid lexical state.
+     */
+    static final int INVALID_LEXICAL_STATE = 2;
+
+    /**
+     * Detected (and bailed out of) an infinite loop in the token manager.
+     */
+    static final int LOOP_DETECTED = 3;
+
+    /**
+     * Indicates the reason why the exception is thrown. It will have one of the above 4 values.
+     */
+    int errorCode;
+
+    /**
+     * Replaces unprintable characters by their escaped (or unicode escaped) equivalents in the given string
+     */
+    protected static final String addEscapes( String str )
+    {
+        StringBuffer retval = new StringBuffer();
+        char ch;
+        for ( int i = 0; i < str.length(); i++ )
         {
-           case 0 :
-              continue;
-           case '\b':
-              retval.append("\\b");
-              continue;
-           case '\t':
-              retval.append("\\t");
-              continue;
-           case '\n':
-              retval.append("\\n");
-              continue;
-           case '\f':
-              retval.append("\\f");
-              continue;
-           case '\r':
-              retval.append("\\r");
-              continue;
-           case '\"':
-              retval.append("\\\"");
-              continue;
-           case '\'':
-              retval.append("\\\'");
-              continue;
-           case '\\':
-              retval.append("\\\\");
-              continue;
-           default:
-              if ((ch = str.charAt(i)) < 0x20 || ch > 0x7e) {
-                 String s = "0000" + Integer.toString(ch, 16);
-                 retval.append("\\u" + s.substring(s.length() - 4, s.length()));
-              } else {
-                 retval.append(ch);
-              }
-              continue;
+            switch ( str.charAt( i ) )
+            {
+                case 0:
+                    continue;
+                case '\b':
+                    retval.append( "\\b" );
+                    continue;
+                case '\t':
+                    retval.append( "\\t" );
+                    continue;
+                case '\n':
+                    retval.append( "\\n" );
+                    continue;
+                case '\f':
+                    retval.append( "\\f" );
+                    continue;
+                case '\r':
+                    retval.append( "\\r" );
+                    continue;
+                case '\"':
+                    retval.append( "\\\"" );
+                    continue;
+                case '\'':
+                    retval.append( "\\\'" );
+                    continue;
+                case '\\':
+                    retval.append( "\\\\" );
+                    continue;
+                default:
+                    if ( ( ch = str.charAt( i ) ) < 0x20 || ch > 0x7e )
+                    {
+                        String s = "0000" + Integer.toString( ch, 16 );
+                        retval.append( "\\u" + s.substring( s.length() - 4, s.length() ) );
+                    }
+                    else
+                    {
+                        retval.append( ch );
+                    }
+                    continue;
+            }
         }
-      }
-      return retval.toString();
-   }
-
-   /**
-    * Returns a detailed message for the Error when it is thrown by the
-    * token manager to indicate a lexical error.
-    * Parameters : 
-    *    EOFSeen     : indicates if EOF caused the lexical error
-    *    curLexState : lexical state in which this error occurred
-    *    errorLine   : line number when the error occurred
-    *    errorColumn : column number when the error occurred
-    *    errorAfter  : prefix that was seen before this error occurred
-    *    curchar     : the offending character
-    * Note: You can customize the lexical error message by modifying this method.
-    */
-   protected static String LexicalError(boolean EOFSeen, int lexState, int errorLine, int errorColumn, String errorAfter, char curChar) {
-      return("Lexical error at line " +
-           errorLine + ", column " +
-           errorColumn + ".  Encountered: " +
-           (EOFSeen ? "<EOF> " : ("\"" + addEscapes(String.valueOf(curChar)) + "\"") + " (" + (int)curChar + "), ") +
-           "after : \"" + addEscapes(errorAfter) + "\"");
-   }
-
-   /**
-    * You can also modify the body of this method to customize your error messages.
-    * For example, cases like LOOP_DETECTED and INVALID_LEXICAL_STATE are not
-    * of end-users concern, so you can return something like : 
-    *
-    *     "Internal Error : Please file a bug report .... "
-    *
-    * from this method for such cases in the release version of your parser.
-    */
-   public String getMessage() {
-      return super.getMessage();
-   }
-
-   /*
-    * Constructors of various flavors follow.
-    */
-
-   /** No arg constructor. */
-   public TokenMgrError() {
-   }
-
-   /** Constructor with message and reason. */
-   public TokenMgrError(String message, int reason) {
-      super(message);
-      errorCode = reason;
-   }
-
-   /** Full Constructor. */
-   public TokenMgrError(boolean EOFSeen, int lexState, int errorLine, int errorColumn, String errorAfter, char curChar, int reason) {
-      this(LexicalError(EOFSeen, lexState, errorLine, errorColumn, errorAfter, curChar), reason);
-   }
+        return retval.toString();
+    }
+
+    /**
+     * Returns a detailed message for the Error when it is thrown by the token manager to indicate a lexical error.
+     * Parameters : EOFSeen : indicates if EOF caused the lexical error curLexState : lexical state in which this error
+     * occurred errorLine : line number when the error occurred errorColumn : column number when the error occurred
+     * errorAfter : prefix that was seen before this error occurred curchar : the offending character Note: You can
+     * customize the lexical error message by modifying this method.
+     */
+    protected static String LexicalError( boolean EOFSeen, int lexState, int errorLine, int errorColumn,
+                                          String errorAfter, char curChar )
+    {
+        return ( "Lexical error at line "
+            + errorLine
+            + ", column "
+            + errorColumn
+            + ".  Encountered: "
+            + ( EOFSeen ? "<EOF> " : ( "\"" + addEscapes( String.valueOf( curChar ) ) + "\"" ) + " (" + (int) curChar
+                + "), " ) + "after : \"" + addEscapes( errorAfter ) + "\"" );
+    }
+
+    /**
+     * You can also modify the body of this method to customize your error messages. For example, cases like
+     * LOOP_DETECTED and INVALID_LEXICAL_STATE are not of end-users concern, so you can return something like :
+     * "Internal Error : Please file a bug report .... " from this method for such cases in the release version of your
+     * parser.
+     */
+    public String getMessage()
+    {
+        return super.getMessage();
+    }
+
+    /*
+     * Constructors of various flavors follow.
+     */
+
+    /** No arg constructor. */
+    public TokenMgrError()
+    {
+    }
+
+    /** Constructor with message and reason. */
+    public TokenMgrError( String message, int reason )
+    {
+        super( message );
+        errorCode = reason;
+    }
+
+    /** Full Constructor. */
+    public TokenMgrError( boolean EOFSeen, int lexState, int errorLine, int errorColumn, String errorAfter,
+                          char curChar, int reason )
+    {
+        this( LexicalError( EOFSeen, lexState, errorLine, errorColumn, errorAfter, curChar ), reason );
+    }
 }
 /* JavaCC - OriginalChecksum=fc24e4c222ec3f01f7c4dd2c636977da (do not edit this line) */

Modified: incubator/ognl/trunk/src/main/java/org/apache/commons/ognl/TypeConverter.java
URL: http://svn.apache.org/viewvc/incubator/ognl/trunk/src/main/java/org/apache/commons/ognl/TypeConverter.java?rev=1103095&r1=1103094&r2=1103095&view=diff
==============================================================================
--- incubator/ognl/trunk/src/main/java/org/apache/commons/ognl/TypeConverter.java (original)
+++ incubator/ognl/trunk/src/main/java/org/apache/commons/ognl/TypeConverter.java Sat May 14 13:18:29 2011
@@ -24,7 +24,7 @@ import java.util.Map;
 
 /**
  * Interface for accessing the type conversion facilities within a context.
- *
+ * 
  * @author Luke Blanshard (blanshlu@netscape.net)
  * @author Drew Davidson (drew@ognl.org)
  */
@@ -32,17 +32,18 @@ public interface TypeConverter
 {
 
     /**
-     * Converts the given value to a given type.  The OGNL context, target, member and
-     * name of property being set are given.  This method should be able to handle
-     * conversion in general without any context, target, member or property name specified.
+     * Converts the given value to a given type. The OGNL context, target, member and name of property being set are
+     * given. This method should be able to handle conversion in general without any context, target, member or property
+     * name specified.
+     * 
      * @param context OGNL context under which the conversion is being done
      * @param target target object in which the property is being set
      * @param member member (Constructor, Method or Field) being set
      * @param propertyName property name being set
      * @param value value to be converted
      * @param toType type to which value is converted
-     * @return Converted value of type toType or TypeConverter.NoConversionPossible to indicate that the
-     *         conversion was not possible.
+     * @return Converted value of type toType or TypeConverter.NoConversionPossible to indicate that the conversion was
+     *         not possible.
      */
     Object convertValue( Map context, Object target, Member member, String propertyName, Object value, Class toType );
 

Modified: incubator/ognl/trunk/src/main/java/org/apache/commons/ognl/enhance/ContextClassLoader.java
URL: http://svn.apache.org/viewvc/incubator/ognl/trunk/src/main/java/org/apache/commons/ognl/enhance/ContextClassLoader.java?rev=1103095&r1=1103094&r2=1103095&view=diff
==============================================================================
--- incubator/ognl/trunk/src/main/java/org/apache/commons/ognl/enhance/ContextClassLoader.java (original)
+++ incubator/ognl/trunk/src/main/java/org/apache/commons/ognl/enhance/ContextClassLoader.java Sat May 14 13:18:29 2011
@@ -21,28 +21,33 @@ package org.apache.commons.ognl.enhance;
 
 import org.apache.commons.ognl.OgnlContext;
 
-public class ContextClassLoader extends ClassLoader
+public class ContextClassLoader
+    extends ClassLoader
 {
-    private OgnlContext         context;
+    private OgnlContext context;
 
-    /*===================================================================
-        Constructors
-      ===================================================================*/
-    public ContextClassLoader(ClassLoader parentClassLoader, OgnlContext context)
+    /*
+     * =================================================================== Constructors
+     * ===================================================================
+     */
+    public ContextClassLoader( ClassLoader parentClassLoader, OgnlContext context )
     {
-        super(parentClassLoader);
+        super( parentClassLoader );
         this.context = context;
     }
 
-    /*===================================================================
-        Overridden methods
-      ===================================================================*/
-    protected Class findClass(String name) throws ClassNotFoundException
+    /*
+     * =================================================================== Overridden methods
+     * ===================================================================
+     */
+    protected Class findClass( String name )
+        throws ClassNotFoundException
     {
-        if ((context != null) && (context.getClassResolver() != null)) {
-            return context.getClassResolver().classForName(name, context);
+        if ( ( context != null ) && ( context.getClassResolver() != null ) )
+        {
+            return context.getClassResolver().classForName( name, context );
         }
-        return super.findClass(name);
+        return super.findClass( name );
     }
 
 }

Modified: incubator/ognl/trunk/src/main/java/org/apache/commons/ognl/enhance/EnhancedClassLoader.java
URL: http://svn.apache.org/viewvc/incubator/ognl/trunk/src/main/java/org/apache/commons/ognl/enhance/EnhancedClassLoader.java?rev=1103095&r1=1103094&r2=1103095&view=diff
==============================================================================
--- incubator/ognl/trunk/src/main/java/org/apache/commons/ognl/enhance/EnhancedClassLoader.java (original)
+++ incubator/ognl/trunk/src/main/java/org/apache/commons/ognl/enhance/EnhancedClassLoader.java Sat May 14 13:18:29 2011
@@ -19,21 +19,24 @@
  */
 package org.apache.commons.ognl.enhance;
 
-public class EnhancedClassLoader extends ClassLoader
+public class EnhancedClassLoader
+    extends ClassLoader
 {
-	/*===================================================================
-		Constructors
-	  ===================================================================*/
-    public EnhancedClassLoader(ClassLoader parentClassLoader)
+    /*
+     * =================================================================== Constructors
+     * ===================================================================
+     */
+    public EnhancedClassLoader( ClassLoader parentClassLoader )
     {
-        super(parentClassLoader);
+        super( parentClassLoader );
     }
 
-	/*===================================================================
-		Overridden methods
-	  ===================================================================*/
-    public Class defineClass(String enhancedClassName, byte[] byteCode)
+    /*
+     * =================================================================== Overridden methods
+     * ===================================================================
+     */
+    public Class defineClass( String enhancedClassName, byte[] byteCode )
     {
-        return defineClass(enhancedClassName, byteCode, 0, byteCode.length);
+        return defineClass( enhancedClassName, byteCode, 0, byteCode.length );
     }
 }

Modified: incubator/ognl/trunk/src/main/java/org/apache/commons/ognl/enhance/ExpressionAccessor.java
URL: http://svn.apache.org/viewvc/incubator/ognl/trunk/src/main/java/org/apache/commons/ognl/enhance/ExpressionAccessor.java?rev=1103095&r1=1103094&r2=1103095&view=diff
==============================================================================
--- incubator/ognl/trunk/src/main/java/org/apache/commons/ognl/enhance/ExpressionAccessor.java (original)
+++ incubator/ognl/trunk/src/main/java/org/apache/commons/ognl/enhance/ExpressionAccessor.java Sat May 14 13:18:29 2011
@@ -25,45 +25,37 @@ package org.apache.commons.ognl.enhance;
 import org.apache.commons.ognl.Node;
 import org.apache.commons.ognl.OgnlContext;
 
-
 /**
- * Provides pure java expression paths to get/set values from an ognl expression. This
- * is achieved by taking an existing {@link Node} parsed expression and using bytecode
- * enhancements to do the same work using pure java vs the ognl interpreter.
+ * Provides pure java expression paths to get/set values from an ognl expression. This is achieved by taking an existing
+ * {@link Node} parsed expression and using bytecode enhancements to do the same work using pure java vs the ognl
+ * interpreter.
  */
 public interface ExpressionAccessor
 {
-    
+
     /**
      * Gets the value represented by this expression path, if any.
      * 
-     * @param context 
-     *          The standard ognl context used for variable substitution/etc.
-     * @param target
-     *          The root object this expression is meant for.
-     * @return
-     *          The evaluated value, if any.
+     * @param context The standard ognl context used for variable substitution/etc.
+     * @param target The root object this expression is meant for.
+     * @return The evaluated value, if any.
      */
-    Object get(OgnlContext context, Object target);
-    
+    Object get( OgnlContext context, Object target );
+
     /**
      * Sets the value represented by this expression path, if possible.
      * 
-     * @param context 
-     *          The standard ognl context used for variable substitution/etc.
-     * @param target
-     *          The root object this expression is meant for.
-     * @param value
-     *          The new value to set if this expression references a settable property.
+     * @param context The standard ognl context used for variable substitution/etc.
+     * @param target The root object this expression is meant for.
+     * @param value The new value to set if this expression references a settable property.
      */
-    void set(OgnlContext context, Object target, Object value);
+    void set( OgnlContext context, Object target, Object value );
 
     /**
-     * Used to set the original root expression node on instances where the compiled version
-     * has to fall back to interpreted syntax because of compilation failures.
-     *
-     * @param expression
-     *          The root expression node used to generate this accessor.
+     * Used to set the original root expression node on instances where the compiled version has to fall back to
+     * interpreted syntax because of compilation failures.
+     * 
+     * @param expression The root expression node used to generate this accessor.
      */
-    void setExpression(Node expression);
+    void setExpression( Node expression );
 }



Mime
View raw message