Review request for CR 171917 CachedRowSetImpl.populate does not handle map properly

David Schlosnagle schlosna at gmail.com
Fri May 25 23:35:56 UTC 2012


On Fri, May 25, 2012 at 3:50 PM, Lance Andersen - Oracle
<Lance.Andersen at oracle.com> wrote:
> The populate() method needs to check for a size of 0 for the map in case a webrowset xml file has an empty map tag,  which would result in calling setobject specifying a map and not all databases/drivers support this.
>
> simple 1 line change:
>
> hg diff CachedRowSetImpl.java
> diff -r 4580652d9828 src/share/classes/com/sun/rowset/CachedRowSetImpl.java
> --- a/src/share/classes/com/sun/rowset/CachedRowSetImpl.java    Fri May 04 16:00:47 2012 -0400
> +++ b/src/share/classes/com/sun/rowset/CachedRowSetImpl.java    Fri May 25 15:45:29 2012 -0400
> @@ -659,7 +659,7 @@
>                  * us work with drivers that do not support
>                  * getObject with a map in fairly sensible way
>                  */
> -                if (map == null) {
> +                if (map == null || map.size() == 0) {

Lance,

Is there any reason not to use Map.isEmpty() which would be useful if
the Map has an expensive size() method?

 -                if (map == null) {
 +                if (map == null || map.isEmpty()) {

Thanks,
Dave



More information about the core-libs-dev mailing list