diff options
author | Eike Stepper | 2012-09-21 07:59:51 +0000 |
---|---|---|
committer | Eike Stepper | 2012-09-21 07:59:51 +0000 |
commit | 24f0afcd08bbf8c05baa750100db3de425a6af24 (patch) | |
tree | 7a1d1cda3504465d061897c2fba08426192c1256 | |
parent | a6e70789ed1c8085fcc13bec3ae2fbf935614e42 (diff) | |
download | cdo-24f0afcd08bbf8c05baa750100db3de425a6af24.tar.gz cdo-24f0afcd08bbf8c05baa750100db3de425a6af24.tar.xz cdo-24f0afcd08bbf8c05baa750100db3de425a6af24.zip |
[369632] [DB] Wrong conversion to Long and Integer
https://bugs.eclipse.org/bugs/show_bug.cgi?id=369632
-rw-r--r-- | plugins/org.eclipse.net4j.db/src/org/eclipse/net4j/db/DBUtil.java | 36 |
1 files changed, 10 insertions, 26 deletions
diff --git a/plugins/org.eclipse.net4j.db/src/org/eclipse/net4j/db/DBUtil.java b/plugins/org.eclipse.net4j.db/src/org/eclipse/net4j/db/DBUtil.java index 4466729a44..8ba5d0ff3a 100644 --- a/plugins/org.eclipse.net4j.db/src/org/eclipse/net4j/db/DBUtil.java +++ b/plugins/org.eclipse.net4j.db/src/org/eclipse/net4j/db/DBUtil.java @@ -419,16 +419,12 @@ public final class DBUtil public static int selectMinimumInt(Connection connection, IDBField field, String... where) throws DBException { Number number = getFunctionResult(connection, field, "MIN", where); //$NON-NLS-1$ - if (number instanceof Integer) - { - return (Integer)number; - } - else if (number == null) + if (number == null) { return 0; } - throw new DBException("Not an integer number: " + number); //$NON-NLS-1$ + return number.intValue(); } /** @@ -437,16 +433,12 @@ public final class DBUtil public static long selectMinimumLong(Connection connection, IDBField field, String... where) throws DBException { Number number = getFunctionResult(connection, field, "MIN", where); //$NON-NLS-1$ - if (number instanceof Long) + if (number == null) { - return (Long)number; - } - else if (number == null) - { - return 0L; + return 0; } - throw new DBException("Not a long number: " + number); //$NON-NLS-1$ + return number.longValue(); } /** @@ -455,16 +447,12 @@ public final class DBUtil public static int selectMaximumInt(Connection connection, IDBField field, String... where) throws DBException { Number number = getFunctionResult(connection, field, "MAX", where); //$NON-NLS-1$ - if (number instanceof Integer) - { - return (Integer)number; - } - else if (number == null) + if (number == null) { return 0; } - throw new DBException("Not an integer number: " + number); //$NON-NLS-1$ + return number.intValue(); } /** @@ -473,16 +461,12 @@ public final class DBUtil public static long selectMaximumLong(Connection connection, IDBField field, String... where) throws DBException { Number number = getFunctionResult(connection, field, "MAX", where); //$NON-NLS-1$ - if (number instanceof Long) + if (number == null) { - return (Long)number; - } - else if (number == null) - { - return 0L; + return 0; } - throw new DBException("Not a long number: " + number); //$NON-NLS-1$ + return number.longValue(); } private static Number getFunctionResult(Connection connection, IDBField field, String function, String... where) |