luehe       2003/08/01 14:12:33

  Modified:    el/src/java/org/apache/commons/el ArraySuffix.java
                        BinaryOperatorExpression.java Coercions.java
                        DivideOperator.java ExpressionEvaluatorImpl.java
                        FunctionInvocation.java IntegerDivideOperator.java
                        ModulusOperator.java UnaryMinusOperator.java
                        UnaryOperatorExpression.java
               el/src/java/org/apache/commons/el/parser ELParser.java
                        ParseException.java TokenMgrError.java
  Log:
  Minor cleanup. Patch provided by Ryan Lubke
  
  Revision  Changes    Path
  1.4       +61 -31    
jakarta-commons/el/src/java/org/apache/commons/el/ArraySuffix.java
  
  Index: ArraySuffix.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-commons/el/src/java/org/apache/commons/el/ArraySuffix.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- ArraySuffix.java  31 Jul 2003 02:01:07 -0000      1.3
  +++ ArraySuffix.java  1 Aug 2003 21:12:32 -0000       1.4
  @@ -224,33 +224,64 @@
               Integer indexObj = Coercions.coerceToInteger(indexVal);
               if (indexObj == null) {
                   if (log.isErrorEnabled()) {
  -                    log.error(
  -                        MessageUtil.getMessageWithArgs(
  -                            Constants.BAD_INDEX_VALUE,
  -                            getOperatorSymbol(), indexVal.getClass().getName()));
  +                    String message = MessageUtil.getMessageWithArgs(
  +                        Constants.BAD_INDEX_VALUE,
  +                        getOperatorSymbol(), indexVal.getClass().getName());
  +                    log.error(message);
  +                    throw new ELException(message);
                   }
                   return null;
               } else if (pValue instanceof List) {
                   try {
                       return ((List) pValue).get(indexObj.intValue());
  -                } catch (Throwable t) {
  +                } catch (ArrayIndexOutOfBoundsException aob) {
  +                    if (log.isWarnEnabled()) {
  +                        log.warn(
  +                            MessageUtil.getMessageWithArgs(
  +                                Constants.EXCEPTION_ACCESSING_LIST, indexObj), aob);
  +                    }   
  +                    return null;
  +                } catch (IndexOutOfBoundsException iob) {
                       if (log.isWarnEnabled()) {
                           log.warn(
                               MessageUtil.getMessageWithArgs(
  -                                Constants.EXCEPTION_ACCESSING_LIST,
  -                                indexObj), t);
  +                                Constants.EXCEPTION_ACCESSING_LIST, indexObj), 
iob);                        
  +                    }   
  +                    return null;
  +                } catch (Throwable t) {
  +                    if (log.isErrorEnabled()) {
  +                        String message = MessageUtil.getMessageWithArgs(
  +                            Constants.EXCEPTION_ACCESSING_LIST,
  +                            indexObj);
  +                        log.error(message, t);
  +                        throw new ELException(message, t);
                       }
                       return null;
                   }
  -
               } else {
                   try {
                       return Array.get(pValue, indexObj.intValue());
  -                } catch (Throwable t) {
  +                } catch (ArrayIndexOutOfBoundsException aob) {
                       if (log.isWarnEnabled()) {
                           log.warn(
                               MessageUtil.getMessageWithArgs(
  -                                Constants.EXCEPTION_ACCESSING_ARRAY, indexObj), t);
  +                                Constants.EXCEPTION_ACCESSING_ARRAY, indexObj), 
aob);
  +                    }
  +                    return null;
  +                } catch (IndexOutOfBoundsException iob) {
  +                    if (log.isWarnEnabled()) {
  +                        log.warn(
  +                            MessageUtil.getMessageWithArgs(
  +                                Constants.EXCEPTION_ACCESSING_ARRAY, indexObj), 
iob);
  +                    }
  +                    return null;
  +                } catch (Throwable t) {
  +                    if (log.isErrorEnabled()) {
  +                        String message = MessageUtil.getMessageWithArgs(
  +                            Constants.EXCEPTION_ACCESSING_ARRAY,
  +                            indexObj);
  +                        log.error(message, t);
  +                        throw new ELException(message, t);
                       }
                       return null;
                   }
  @@ -271,33 +302,32 @@
               try {
                   return property.getReadMethod().invoke(pValue, sNoArgs);
               } catch (InvocationTargetException exc) {
  -                if (log.isWarnEnabled()) {
  -                    log.warn(
  -                        MessageUtil.getMessageWithArgs(
  -                            Constants.ERROR_GETTING_PROPERTY, indexStr, 
pValue.getClass().getName()),
  -                        exc.getTargetException()
  -                    );
  +                if (log.isErrorEnabled()) {
  +                    String message = MessageUtil.getMessageWithArgs(
  +                        Constants.ERROR_GETTING_PROPERTY, indexStr, 
pValue.getClass().getName());
  +                    Throwable t = exc.getTargetException();
  +                    log.warn(message, t);
  +                    throw new ELException(message, t);
                   }
                   return null;
  -            } catch (Exception exc) {
  -                if (log.isWarnEnabled()) {
  -                    log.warn(
  -                        MessageUtil.getMessageWithArgs(
  -                            Constants.ERROR_GETTING_PROPERTY, indexStr, 
pValue.getClass().getName()),
  -                        exc
  -                    );
  +            } catch (Throwable t) {
  +                if (log.isErrorEnabled()) {
  +                    String message = MessageUtil.getMessageWithArgs(
  +                        Constants.ERROR_GETTING_PROPERTY, indexStr, 
pValue.getClass().getName());                    
  +                    log.warn(message, t);
  +                    throw new ELException(message, t);
                   }
                   return null;
               }
           } else {
  -            if (log.isWarnEnabled()) {
  -                log.warn(
  -                    MessageUtil.getMessageWithArgs(
  -                        Constants.CANT_FIND_INDEX, 
  -                        indexVal, 
  -                        pValue.getClass().getName(), 
  -                        getOperatorSymbol())
  -                    );
  +            if (log.isErrorEnabled()) {
  +                String message = MessageUtil.getMessageWithArgs(
  +                    Constants.CANT_FIND_INDEX,
  +                    indexVal,
  +                    pValue.getClass().getName(),
  +                    getOperatorSymbol());
  +                log.error(message);
  +                throw new ELException(message);                    
               }
               return null;          
           }
  
  
  
  1.4       +2 -2      
jakarta-commons/el/src/java/org/apache/commons/el/BinaryOperatorExpression.java
  
  Index: BinaryOperatorExpression.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-commons/el/src/java/org/apache/commons/el/BinaryOperatorExpression.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- BinaryOperatorExpression.java     31 Jul 2003 02:01:07 -0000      1.3
  +++ BinaryOperatorExpression.java     1 Aug 2003 21:12:32 -0000       1.4
  @@ -128,7 +128,7 @@
       StringBuffer buf = new StringBuffer ();
       buf.append ("(");
       buf.append (mExpression.getExpressionString ());
  -    for (int i = 0; i < mOperators.size (); i++) {
  +    for (int i = 0, size = mOperators.size(); i < size; i++) {
         BinaryOperator operator = (BinaryOperator) mOperators.get (i);
         Expression expression = (Expression) mExpressions.get (i);
         buf.append (" ");
  @@ -151,7 +151,7 @@
       throws ELException
     {
       Object value = mExpression.evaluate (pResolver, functions);
  -    for (int i = 0; i < mOperators.size (); i++) {
  +    for (int i = 0, size = mOperators.size(); i < size; i++) {
         BinaryOperator operator = (BinaryOperator) mOperators.get (i);
   
         // For the And/Or operators, we need to coerce to a boolean
  
  
  
  1.5       +88 -72    jakarta-commons/el/src/java/org/apache/commons/el/Coercions.java
  
  Index: Coercions.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-commons/el/src/java/org/apache/commons/el/Coercions.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- Coercions.java    31 Jul 2003 02:01:07 -0000      1.4
  +++ Coercions.java    1 Aug 2003 21:12:32 -0000       1.5
  @@ -394,11 +394,13 @@
         try {
        return pValue.toString ();
         }
  -      catch (Exception exc) {
  +      catch (Exception exc) {          
             if (log.isErrorEnabled()) {
  -              log.error(
  -                  MessageUtil.getMessageWithArgs(Constants.TOSTRING_EXCEPTION, 
  -                                                 pValue.getClass().getName()), exc);
  +              String message = MessageUtil.getMessageWithArgs(
  +                  Constants.TOSTRING_EXCEPTION,
  +                  pValue.getClass().getName());
  +              log.error(message, exc);
  +              throw new ELException(exc);
             }
             return ""; 
         }
  @@ -424,9 +426,10 @@
       }
       else if (pValue instanceof Boolean) {
           if (log.isErrorEnabled()) {
  -            log.error(
  -                MessageUtil.getMessageWithArgs(
  -                    Constants.BOOLEAN_TO_NUMBER, pValue, pClass.getName()));
  +            String message = MessageUtil.getMessageWithArgs(
  +                Constants.BOOLEAN_TO_NUMBER, pValue, pClass.getName());
  +            log.error(message);
  +            throw new ELException(message);
           }
           return coerceToPrimitiveNumber(ZERO, pClass);     
       }
  @@ -442,21 +445,23 @@
         }
         catch (Exception exc) {
             if (log.isErrorEnabled()) {
  -              log.error(
  -                  MessageUtil.getMessageWithArgs(
  -                      Constants.STRING_TO_NUMBER_EXCEPTION, 
  -                      (String) pValue, pClass.getName()));
  +              String message = MessageUtil.getMessageWithArgs(
  +                  Constants.STRING_TO_NUMBER_EXCEPTION,
  +                  (String) pValue, pClass.getName());
  +              log.error(message);
  +              throw new ELException(message);
             }  
            return coerceToPrimitiveNumber (ZERO, pClass);
         }
       }
       else {
           if (log.isErrorEnabled()) {
  -            log.error(
  -                MessageUtil.getMessageWithArgs(
  -                    Constants.COERCE_TO_NUMBER,
  -                    pValue.getClass().getName(),
  -                    pClass.getName()));
  +            String message = MessageUtil.getMessageWithArgs(
  +                Constants.COERCE_TO_NUMBER,
  +                pValue.getClass().getName(),
  +                pClass.getName());
  +            log.error(message);
  +            throw new ELException(message);
           }      
         return coerceToPrimitiveNumber (0, pClass);
       }
  @@ -479,8 +484,8 @@
        ((int) (((Character) pValue).charValue ()));
       }
       else if (pValue instanceof Boolean) {
  -        if (log.isErrorEnabled()) {
  -            log.error(
  +        if (log.isWarnEnabled()) {
  +            log.warn(
                   MessageUtil.getMessageWithArgs(
                       Constants.BOOLEAN_TO_NUMBER, pValue, Integer.class.getName())); 
           
           }     
  @@ -498,8 +503,8 @@
        return Integer.valueOf ((String) pValue);
         }
         catch (Exception exc) {
  -          if (log.isErrorEnabled()) {
  -              log.error(
  +          if (log.isWarnEnabled()) {
  +              log.warn(
                     MessageUtil.getMessageWithArgs(
                         Constants.STRING_TO_NUMBER_EXCEPTION,
                         (String) pValue,
  @@ -681,9 +686,10 @@
       }
       else if (pValue instanceof Boolean) {
           if (log.isErrorEnabled()) {
  -            log.error(
  -                MessageUtil.getMessageWithArgs(
  -                    Constants.BOOLEAN_TO_CHARACTER, pValue));
  +            String message = MessageUtil.getMessageWithArgs(
  +                Constants.BOOLEAN_TO_CHARACTER, pValue);
  +            log.error(message);
  +            throw new ELException(message);
           }     
         return PrimitiveObjects.getCharacter ((char) 0);
       }
  @@ -697,10 +703,11 @@
       }
       else {
           if (log.isErrorEnabled()) {
  -            log.error(
  -                MessageUtil.getMessageWithArgs(
  -                    Constants.COERCE_TO_CHARACTER,
  -                    pValue.getClass().getName()));
  +            String message = MessageUtil.getMessageWithArgs(
  +                Constants.COERCE_TO_CHARACTER,
  +                pValue.getClass().getName());
  +            log.error(message);
  +            throw new ELException(message);
           }     
         return PrimitiveObjects.getCharacter ((char) 0);
       }
  @@ -728,19 +735,21 @@
         }
         catch (Exception exc) {
             if (log.isErrorEnabled()) {
  -              log.error(
  -                  MessageUtil.getMessageWithArgs(
  -                      Constants.STRING_TO_BOOLEAN, (String) pValue), exc);
  +              String message = MessageUtil.getMessageWithArgs(
  +                  Constants.STRING_TO_BOOLEAN, (String) pValue);
  +              log.error(message, exc);
  +              throw new ELException(message, exc);
             }  
        return Boolean.FALSE;
         }
       }
       else {
           if (log.isErrorEnabled()) {
  -            log.error(
  -                MessageUtil.getMessageWithArgs(
  -                    Constants.COERCE_TO_BOOLEAN,
  -                    pValue.getClass().getName()));
  +            String message = MessageUtil.getMessageWithArgs(
  +                Constants.COERCE_TO_BOOLEAN,
  +                pValue.getClass().getName());
  +            log.error(message);
  +            throw new ELException(message);
           }     
         return Boolean.TRUE;
       }
  @@ -770,10 +779,11 @@
        }
        else {
           if (log.isErrorEnabled()) {
  -            log.error(
  -                MessageUtil.getMessageWithArgs(
  -                    Constants.NO_PROPERTY_EDITOR,
  -                    str, pClass.getName()));            
  +            String message = MessageUtil.getMessageWithArgs(
  +                Constants.NO_PROPERTY_EDITOR,
  +                str, pClass.getName());
  +            log.error(message);
  +            throw new ELException(message);
           }      
          return null;
        }
  @@ -788,11 +798,12 @@
        }
        else {
           if (log.isErrorEnabled()) {
  -            log.error(
  -                MessageUtil.getMessageWithArgs(
  -                    Constants.PROPERTY_EDITOR_ERROR,
  -                    pValue,
  -                    pClass.getName()), exc);
  +            String message = MessageUtil.getMessageWithArgs(
  +                Constants.PROPERTY_EDITOR_ERROR,
  +                pValue,
  +                pClass.getName());
  +            log.error(message, exc);
  +            throw new ELException(message, exc);
           }      
          return null;
        }
  @@ -800,11 +811,12 @@
       }
       else {
           if (log.isErrorEnabled()) {
  -            log.error(
  -                MessageUtil.getMessageWithArgs(
  -                    Constants.COERCE_TO_OBJECT,
  -                    pValue.getClass().getName(),
  -                    pClass.getName()));
  +            String message = MessageUtil.getMessageWithArgs(
  +                Constants.COERCE_TO_OBJECT,
  +                pValue.getClass().getName(),
  +                pClass.getName());
  +            log.error(message);
  +            throw new ELException(message);
           }     
         return null;
       }
  @@ -954,12 +966,13 @@
         }
         catch (Exception exc) {
             if (log.isErrorEnabled()) {
  -              log.error(
  -                  MessageUtil.getMessageWithArgs(
  -                      Constants.COMPARABLE_ERROR,
  -                      pLeft.getClass().getName(),
  -                      (pRight == null) ? "null" : pRight.getClass().getName(),
  -                      pOperator.getOperatorSymbol()), exc);
  +              String message = MessageUtil.getMessageWithArgs(
  +                  Constants.COMPARABLE_ERROR,
  +                  pLeft.getClass().getName(),
  +                  (pRight == null) ? "null" : pRight.getClass().getName(),
  +                  pOperator.getOperatorSymbol());
  +              log.error(message, exc);
  +              throw new ELException(message, exc);
             }  
        return Boolean.FALSE;
         }
  @@ -974,12 +987,13 @@
         }
         catch (Exception exc) {
             if (log.isErrorEnabled()) {
  -              log.error(
  -                  MessageUtil.getMessageWithArgs(
  -                      Constants.COMPARABLE_ERROR,
  -                      pRight.getClass().getName(),
  -                      (pLeft == null) ? "null" : pLeft.getClass().getName(),
  -                      pOperator.getOperatorSymbol()), exc);
  +              String message = MessageUtil.getMessageWithArgs(
  +                  Constants.COMPARABLE_ERROR,
  +                  pRight.getClass().getName(),
  +                  (pLeft == null) ? "null" : pLeft.getClass().getName(),
  +                  pOperator.getOperatorSymbol());
  +              log.error(message, exc);
  +              throw new ELException(message, exc);
             }          
        return Boolean.FALSE;
         }
  @@ -987,12 +1001,13 @@
   
       else {
           if (log.isErrorEnabled()) {
  -            log.error(
  -                MessageUtil.getMessageWithArgs(
  -                    Constants.ARITH_OP_BAD_TYPE,
  -                    pOperator.getOperatorSymbol(),
  -                    pLeft.getClass().getName(),
  -                    pRight.getClass().getName()));
  +            String message = MessageUtil.getMessageWithArgs(
  +                Constants.ARITH_OP_BAD_TYPE,
  +                pOperator.getOperatorSymbol(),
  +                pLeft.getClass().getName(),
  +                pRight.getClass().getName());
  +            log.error(message);
  +            throw new ELException(message);
           }     
         return Boolean.FALSE;
       }
  @@ -1087,12 +1102,13 @@
         }
         catch (Exception exc) {
             if (log.isErrorEnabled()) {
  -              log.error(
  -                  MessageUtil.getMessageWithArgs(
  -                      Constants.ERROR_IN_EQUALS,
  -                      pLeft.getClass().getName(),
  -                      pRight.getClass().getName(),
  -                      pOperator.getOperatorSymbol()), exc);
  +              String message = MessageUtil.getMessageWithArgs(
  +                  Constants.ERROR_IN_EQUALS,
  +                  pLeft.getClass().getName(),
  +                  pRight.getClass().getName(),
  +                  pOperator.getOperatorSymbol());
  +              log.error(message, exc);
  +              throw new ELException(message, exc);
             }  
        return Boolean.FALSE;
         }
  
  
  
  1.4       +14 -12    
jakarta-commons/el/src/java/org/apache/commons/el/DivideOperator.java
  
  Index: DivideOperator.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-commons/el/src/java/org/apache/commons/el/DivideOperator.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- DivideOperator.java       31 Jul 2003 02:01:07 -0000      1.3
  +++ DivideOperator.java       1 Aug 2003 21:12:32 -0000       1.4
  @@ -139,12 +139,13 @@
               return left.divide(right, BigDecimal.ROUND_HALF_UP);
           } catch (Exception exc) {
               if (log.isErrorEnabled()) {
  -                log.error(
  -                    MessageUtil.getMessageWithArgs(
  -                        Constants.ARITH_ERROR,
  -                        getOperatorSymbol(),
  -                        "" + left,
  -                        "" + right));
  +                String message = MessageUtil.getMessageWithArgs(
  +                    Constants.ARITH_ERROR,
  +                    getOperatorSymbol(),
  +                    "" + left,
  +                    "" + right); 
  +                log.error(message);
  +                throw new ELException(message);
               }            
               return PrimitiveObjects.getInteger(0);
           }
  @@ -161,12 +162,13 @@
               return PrimitiveObjects.getDouble(left / right);
           } catch (Exception exc) {
               if (log.isErrorEnabled()) {
  -                log.error(
  -                    MessageUtil.getMessageWithArgs(
  -                        Constants.ARITH_ERROR,
  -                        getOperatorSymbol(),
  -                        "" + left,
  -                        "" + right));
  +                String message = MessageUtil.getMessageWithArgs(
  +                    Constants.ARITH_ERROR,
  +                    getOperatorSymbol(),
  +                    "" + left,
  +                    "" + right);
  +                log.error(message);
  +                throw new ELException(message);
               }         
               return PrimitiveObjects.getInteger(0);
           }
  
  
  
  1.4       +1 -1      
jakarta-commons/el/src/java/org/apache/commons/el/ExpressionEvaluatorImpl.java
  
  Index: ExpressionEvaluatorImpl.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-commons/el/src/java/org/apache/commons/el/ExpressionEvaluatorImpl.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- ExpressionEvaluatorImpl.java      31 Jul 2003 02:01:07 -0000      1.3
  +++ ExpressionEvaluatorImpl.java      1 Aug 2003 21:12:32 -0000       1.4
  @@ -433,7 +433,7 @@
     {
       StringBuffer retval = new StringBuffer ();
       char ch;
  -    for (int i = 0; i < str.length (); i++) {
  +    for (int i = 0, length = str.length(); i < length; i++) {
         switch (str.charAt (i)) {
        case 0 :
          continue;
  
  
  
  1.5       +26 -20    
jakarta-commons/el/src/java/org/apache/commons/el/FunctionInvocation.java
  
  Index: FunctionInvocation.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-commons/el/src/java/org/apache/commons/el/FunctionInvocation.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- FunctionInvocation.java   31 Jul 2003 02:01:07 -0000      1.4
  +++ FunctionInvocation.java   1 Aug 2003 21:12:32 -0000       1.5
  @@ -138,9 +138,10 @@
       // if the Map is null, then the function is invalid
       if (functions == null) {
           if (log.isErrorEnabled()) {
  -            log.error(
  -                MessageUtil.getMessageWithArgs(
  -                    Constants.UNKNOWN_FUNCTION, functionName));
  +            String message = MessageUtil.getMessageWithArgs(
  +                Constants.UNKNOWN_FUNCTION, functionName);
  +            log.error(message);
  +            throw new ELException(message);
           }
       }            
   
  @@ -160,9 +161,10 @@
       Method target = (Method) functions.resolveFunction(prefix, localName);
       if (target == null) {
           if (log.isErrorEnabled()) {
  -            log.error(
  -                MessageUtil.getMessageWithArgs(
  -                    Constants.UNKNOWN_FUNCTION, functionName));
  +            String message = MessageUtil.getMessageWithArgs(
  +                Constants.UNKNOWN_FUNCTION, functionName);
  +            log.error(message);
  +            throw new ELException(message);
           }
       }      
   
  @@ -170,11 +172,12 @@
       Class[] params = target.getParameterTypes();
       if (params.length != argumentList.size()) {
           if (log.isErrorEnabled()) {
  -            log.error(
  -                MessageUtil.getMessageWithArgs(
  -                    Constants.INAPPROPRIATE_FUNCTION_ARG_COUNT,
  -                    functionName, new Integer(params.length),
  -                    new Integer(argumentList.size())));
  +            String message = MessageUtil.getMessageWithArgs(
  +                Constants.INAPPROPRIATE_FUNCTION_ARG_COUNT,
  +                functionName, new Integer(params.length),
  +                new Integer(argumentList.size()));
  +            log.error(message);
  +            throw new ELException(message);
           }      
       }
   
  @@ -193,18 +196,21 @@
         return (target.invoke(null, arguments));
       } catch (InvocationTargetException ex) {
           if (log.isErrorEnabled()) {
  -            log.error(
  -                MessageUtil.getMessageWithArgs(
  -                    Constants.FUNCTION_INVOCATION_ERROR,
  -                    functionName), ex.getTargetException());
  +            String message = MessageUtil.getMessageWithArgs(
  +                Constants.FUNCTION_INVOCATION_ERROR,
  +                functionName);
  +            Throwable t = ex.getTargetException();
  +            log.error(message, t);
  +            throw new ELException(message, t);
           }      
         return null;
  -    } catch (Exception ex) {
  +    } catch (Throwable t) {
           if (log.isErrorEnabled()) {
  -            log.error(
  -                MessageUtil.getMessageWithArgs(
  -                    Constants.FUNCTION_INVOCATION_ERROR,
  -                    functionName), ex);    
  +            String message = MessageUtil.getMessageWithArgs(
  +                Constants.FUNCTION_INVOCATION_ERROR,
  +                functionName);            
  +            log.error(message, t);
  +            throw new ELException(message, t); 
           }      
         return null;
       }
  
  
  
  1.3       +6 -6      
jakarta-commons/el/src/java/org/apache/commons/el/IntegerDivideOperator.java
  
  Index: IntegerDivideOperator.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-commons/el/src/java/org/apache/commons/el/IntegerDivideOperator.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- IntegerDivideOperator.java        31 Jul 2003 02:01:07 -0000      1.2
  +++ IntegerDivideOperator.java        1 Aug 2003 21:12:32 -0000       1.3
  @@ -135,12 +135,12 @@
       }
       catch (Exception exc) {
           if (log.isErrorEnabled()) {
  -            log.error(
  -                MessageUtil.getMessageWithArgs(
  -                    Constants.ARITH_ERROR,
  -                    getOperatorSymbol(),
  -                    "" + left,
  -                    "" + right));
  +            String message = MessageUtil.getMessageWithArgs(
  +                Constants.ARITH_ERROR,
  +                getOperatorSymbol(),
  +                "" + left,
  +                "" + right);
  +            log.error(message);
           }    
         return PrimitiveObjects.getInteger (0);
       }
  
  
  
  1.4       +21 -18    
jakarta-commons/el/src/java/org/apache/commons/el/ModulusOperator.java
  
  Index: ModulusOperator.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-commons/el/src/java/org/apache/commons/el/ModulusOperator.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- ModulusOperator.java      31 Jul 2003 02:01:07 -0000      1.3
  +++ ModulusOperator.java      1 Aug 2003 21:12:32 -0000       1.4
  @@ -144,12 +144,13 @@
         }
         catch (Exception exc) {
             if (log.isErrorEnabled()) {
  -              log.error(
  -                  MessageUtil.getMessageWithArgs(
  -                      Constants.ARITH_ERROR,
  -                      getOperatorSymbol(),
  -                      "" + left,
  -                      "" + right));
  +              String message = MessageUtil.getMessageWithArgs(
  +                  Constants.ARITH_ERROR,
  +                  getOperatorSymbol(),
  +                  "" + left,
  +                  "" + right);
  +              log.error(message);
  +              throw new ELException(message);
             }  
        return PrimitiveObjects.getInteger (0);
         }
  @@ -164,12 +165,13 @@
               return left.remainder(right);
           } catch (Exception exc) {
               if (log.isErrorEnabled()) {
  -                log.error(
  -                    MessageUtil.getMessageWithArgs(
  -                        Constants.ARITH_ERROR,
  -                        getOperatorSymbol(),
  -                        "" + left,
  -                        "" + right));
  +                String message = MessageUtil.getMessageWithArgs(
  +                    Constants.ARITH_ERROR,
  +                    getOperatorSymbol(),
  +                    "" + left,
  +                    "" + right);
  +                log.error(message);
  +                throw new ELException(message);
               }                   
               return PrimitiveObjects.getInteger(0);
           }
  @@ -187,12 +189,13 @@
         }
         catch (Exception exc) {
             if (log.isErrorEnabled()) {
  -              log.error(
  -                  MessageUtil.getMessageWithArgs(
  -                      Constants.ARITH_ERROR,
  -                      getOperatorSymbol(),
  -                      "" + left,
  -                      "" + right));
  +              String message = MessageUtil.getMessageWithArgs(
  +                  Constants.ARITH_ERROR,
  +                  getOperatorSymbol(),
  +                  "" + left,
  +                  "" + right);
  +              log.error(message);
  +              throw new ELException(message);
             }          
        return PrimitiveObjects.getInteger (0);
         }
  
  
  
  1.4       +6 -5      
jakarta-commons/el/src/java/org/apache/commons/el/UnaryMinusOperator.java
  
  Index: UnaryMinusOperator.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-commons/el/src/java/org/apache/commons/el/UnaryMinusOperator.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- UnaryMinusOperator.java   31 Jul 2003 02:01:07 -0000      1.3
  +++ UnaryMinusOperator.java   1 Aug 2003 21:12:32 -0000       1.4
  @@ -174,11 +174,12 @@
   
       else {
           if (log.isErrorEnabled()) {
  -            log.error(
  -                MessageUtil.getMessageWithArgs(
  -                    Constants.UNARY_OP_BAD_TYPE,
  -                    getOperatorSymbol(),
  -                    pValue.getClass().getName()));
  +            String message = MessageUtil.getMessageWithArgs(
  +                Constants.UNARY_OP_BAD_TYPE,
  +                getOperatorSymbol(),
  +                pValue.getClass().getName());
  +            log.error(message);
  +            throw new ELException(message);
           }     
         return PrimitiveObjects.getInteger (0);
       }
  
  
  
  1.4       +1 -1      
jakarta-commons/el/src/java/org/apache/commons/el/UnaryOperatorExpression.java
  
  Index: UnaryOperatorExpression.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-commons/el/src/java/org/apache/commons/el/UnaryOperatorExpression.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- UnaryOperatorExpression.java      31 Jul 2003 02:01:07 -0000      1.3
  +++ UnaryOperatorExpression.java      1 Aug 2003 21:12:32 -0000       1.4
  @@ -132,7 +132,7 @@
         buf.append (" ");
       }
       else {
  -      for (int i = 0; i < mOperators.size (); i++) {
  +      for (int i = 0, size = mOperators.size(); i < size; i++) {
        UnaryOperator operator = (UnaryOperator) mOperators.get (i);
        buf.append (operator.getOperatorSymbol ());
        buf.append (" ");
  
  
  
  1.3       +1 -1      
jakarta-commons/el/src/java/org/apache/commons/el/parser/ELParser.java
  
  Index: ELParser.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-commons/el/src/java/org/apache/commons/el/parser/ELParser.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- ELParser.java     31 Mar 2003 01:17:07 -0000      1.2
  +++ ELParser.java     1 Aug 2003 21:12:32 -0000       1.3
  @@ -1889,7 +1889,7 @@
       jj_rescan_token();
       jj_add_error_token(0, 0);
       int[][] exptokseq = new int[jj_expentries.size()][];
  -    for (int i = 0; i < jj_expentries.size(); i++) {
  +    for (int i = 0, size = jj_expentries.size(); i < size; i++) {
         exptokseq[i] = (int[])jj_expentries.elementAt(i);
       }
       return new ParseException(token, exptokseq, tokenImage);
  
  
  
  1.2       +1 -1      
jakarta-commons/el/src/java/org/apache/commons/el/parser/ParseException.java
  
  Index: ParseException.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-commons/el/src/java/org/apache/commons/el/parser/ParseException.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- ParseException.java       4 Feb 2003 00:22:25 -0000       1.1
  +++ ParseException.java       1 Aug 2003 21:12:32 -0000       1.2
  @@ -147,7 +147,7 @@
     protected String add_escapes(String str) {
         StringBuffer retval = new StringBuffer();
         char ch;
  -      for (int i = 0; i < str.length(); i++) {
  +      for (int i = 0, length = str.length(); i < length; i++) {
           switch (str.charAt(i))
           {
              case 0 :
  
  
  
  1.2       +1 -1      
jakarta-commons/el/src/java/org/apache/commons/el/parser/TokenMgrError.java
  
  Index: TokenMgrError.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-commons/el/src/java/org/apache/commons/el/parser/TokenMgrError.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- TokenMgrError.java        4 Feb 2003 00:22:25 -0000       1.1
  +++ TokenMgrError.java        1 Aug 2003 21:12:32 -0000       1.2
  @@ -40,7 +40,7 @@
      protected static final String addEscapes(String str) {
         StringBuffer retval = new StringBuffer();
         char ch;
  -      for (int i = 0; i < str.length(); i++) {
  +      for (int i = 0, length = str.length(); i < length; i++) {
           switch (str.charAt(i))
           {
              case 0 :
  
  
  

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

Reply via email to