| Summary: | [DB] Wrong conversion to Long and Integer | ||
|---|---|---|---|
| Product: | [Modeling] EMF | Reporter: | Ales Dolecek <ales_d> |
| Component: | cdo.net4j.db | Assignee: | Eike Stepper <stepper> |
| Status: | CLOSED FIXED | QA Contact: | Eike Stepper <stepper> |
| Severity: | normal | ||
| Priority: | P3 | CC: | stepper |
| Version: | 4.2 | ||
| Target Milestone: | --- | ||
| Hardware: | PC | ||
| OS: | All | ||
| Whiteboard: | |||
Moving all open issues to 4.2. Open bugs can be ported to 4.1 maintenance after they've been fixed in master. commit 24f0afcd08bbf8c05baa750100db3de425a6af24 Port to 4.1 via bug 393112. Available in R20130613-1157 (4.2) |
Build Identifier: 4.0.0.v20110607-1031 In org.eclipse.net4j.db.DBUtil methods selectMinimumInt selectMinimumLong selectMaximumInt selectMaxmiumLong The Number is converted to appropriate type with cast: Number number = ... if (number instanceof Integer) { return (Integer)number; } else if (number == null) { return 0; } throw new DBException("Not an integer number: " + number); //$NON-NLS-1$ Better way however is: Number number = ... if (number == null) { return 0; } return Integer.valueOf(number.intValue()) --- Although this conversion can lose information if the number is actually "out of range" of Integer or Long it works with other numeric types returned from database - eg. BigDecimal in case of Oracle. Reproducible: Sometimes Steps to Reproduce: Happends if the underlying database use different Number subclass to represent Integer and Long values.