getItemValueString and Domino 6.5.5 and 7.0 (Show’n Tell Thursday)
August 31st, 2006The return value of the Java method getItemValueString has been changed in Lotus Domino 6.5.5, Lotus Domino 7.0 and later releases. Before 6.5.5 the method getItemValueString returns null if the item is empty or if the item does not exist. In 6.5.5, 7.0 and later releases getItemValueString returns the empty string ("") instead.
I upgraded three servers from 6.5.4 to 6.5.5 and found out the hard way when the application didn't work as expected. Conditions checking getItemValueString for null values were never met so lots of logic was skipped.
So if you plan to upgrade to 6.5.5 og 7.0 or later then check your Java code for the use of getItemValueString.
Update: I have added this post to the Lotus Notes and Domino Blogging Community Show'n Tell Thursday series.
Tags: Java, Lotus Domino, Show-n-Tell Thursday
September 1st, 2006 at 05:33
Aaarrrgghhh.... Breaking API's is something that you really shouldn't do and IBM is doing it.
Consider how many applications will start to fail in new, inconsistant and "interesting" ways because of this change. The only good thing is that I have found that the return of null for empty items has been very inconsistant. This has causes me at always test for null and for the length of the returned string so I guess most of my code will be okay.
It's a real bummer though.
September 1st, 2006 at 05:50
Forgot to mention that this is even more the reason to leverage that Java evaluates if-statements by stopping once the first predicate matches. This means you can do the following test on a null string without getting a NPE:
String my_string = null;
if (null == my_string || 0 == my_string.length()) {
// do somthing about empty item
}
October 28th, 2006 at 08:20
Please post some of the other probles you faced while upgrading.
October 29th, 2006 at 08:03
Hi Thirukkovalur Ravi, the issue with the getItemValuString was the only problem I experienced with the upgrade.