Java Stored Procedure - if expression [message #544100] |
Mon, 20 February 2012 03:34 |
|
van_culo
Messages: 6 Registered: February 2012 Location: Milano, Italy
|
Junior Member |
|
|
Hi I have written a first stored procedure for my company and immediately we have run in to a problem that seems to be a bug Oracle, but maybe someone could share some light on this if it is not a bug.
At a certain point in a class Java we have a code simple as this:
Integer one = null;
Integer two = null;
if(one!=null&&two.intValue()>0) then....
This extremely simple example throws a NullPointerException in Oracle. But this goes against the Java Language Specification! According to this specification:
"The && operator is like & (ยง15.22.2), but evaluates its right-hand operand only if
the value of its left-hand operand is true."
That is if "one!=null" is true the right hand operand "two.intValue()" should be evaluated, but clearly for us it is ALWAYS being evaluated. Can someone please explain? Discovering this in our first function, makes us worry, a lot, if there are other surprises to expect? Before deploying the class we tested it with JUnit, and we are of course using JDK1.4, the same as on Oracle server.
We are using Oracle 10 with JDK1.4.2_04.
Any help, documentation or information is extremely welcome.
Tim Mickelson
|
|
|
|
Re: Java Stored Procedure - if expression [message #544111 is a reply to message #544105] |
Mon, 20 February 2012 04:01 |
|
van_culo
Messages: 6 Registered: February 2012 Location: Milano, Italy
|
Junior Member |
|
|
I don't understand what you mean? I don't know if this is a bug, that is why I'm asking. The logical expression is not working as it should according to Java Language Specification, but maybe Oracle does not comply 100% with the Java Specification. But if it is so, with a simple thing as this, then I would like to know if there are more surprises? I do know that i can simply do a work around, but then how many workarounds do I have to do, is this still Java? I would like an explanation if possible. An upgrade of Oracle is out of the question, these are servers installed at clients and I can not make a similar decision for them. I just want to know if someone has a deeper knowledge of as why Oracle is not compliant with the Java Language Specification, can someone please explain this? Do you think this is a bug? If not, is there documentation from Oracle that explains why this is not a bug, are there other limitations? I don't want to report a bug to Oracle if it is already known this limitation or if it is already documented as a limitation. So I'm asking here before doing such a thing.
|
|
|
|
|
|
|
|
|
|
|
|