I get this message “Integer literal out of range Decimal nt must be in the range -2147483648 to 2147483648” when I compare the size of a database with a value
getSize is supposed to return a double
I’ve tried to cast it to a long but I still get the error
example…
dbsize=(long) db.getSize();
if ( dbsize<4000000000)…
I have made a java test agent which prints out the size of the databases, with and without casting to a long.
Subject: java problems with db.getSize() …any help?
Jesper Kiaer wrote:dbsize=(long) db.getSize();
if ( dbsize<4000000000)…
Your problem is here. You have specified a literal value that is too large for any of the built in integral values in Java. double is used as the return for getSize() because long does not allow a large enough range. To fix this, simply stay with the double as the type and compare like values, like this:
double dbsize = db.getSize();
if (dbsize < 4000000000.0)
{
// ...
}
I think this gives you what you are looking for. Good luck