Bug 8116 - Update EL arithmetic operators to handle Strings
Summary: Update EL arithmetic operators to handle Strings
Status: RESOLVED FIXED
Alias: None
Product: Taglibs
Classification: Unclassified
Component: Standard Taglib (show other bugs)
Version: unspecified
Hardware: All All
: P3 normal (vote)
Target Milestone: ---
Assignee: Tomcat Developers Mailing List
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2002-04-15 18:09 UTC by Nathan Abramson
Modified: 2004-11-16 19:05 UTC (History)
0 users



Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Nathan Abramson 2002-04-15 18:09:10 UTC
Change the EL to implement these new rules for handling Strings in
arithmetic operators:

A.3.5.1 Binary operators - A {+,-,*} B
 if A and B are null, - return 0
 if A or B is Float, Double, or a String containing ".", "e", or "E"
   coerce both A and B to Double and apply operator
 otherwise
   coerce both A and B to Long and apply operator
 if operator results in exception, error

A.3.5.2 Binary operator - A {/} B
 if A and B are null, - return 0
 otherwise coerce both A and B to Double and apply operator
 if operator results in exception (such as divide by 0), error

A.3.5.3 Binary operator - A {%} B
 if A and B are null, return 0
 if A or B is Float, Double, or a String containing ".", "e", or "E"
   coerce both A and B to Double and apply operator
 otherwise
   coerce both A and B to Long and apply operator
 if operator results in exception (such as divide by 0), error

A.3.5.4 Unary minus operator - -A
 if A is null, return 0
 if A is a String
   if A contains ".", "e", or "E"
     coerce to a Double and apply operator
   otherwise
     coerce to a Long and apply operator
 if operator results in exception, error
 if A is Byte,Short,Integer,Long,Float,Double
   retain type, apply operator
 if operator results in exception, error
 otherwise, error
Comment 1 Nathan Abramson 2002-04-15 19:45:48 UTC
All of these changes have been made