[mapguide-internals] Exception thrown on null values?

Bruce Dechant bruce.dechant at autodesk.com
Thu Feb 28 17:04:36 EST 2008


Jason,

This is the expected behavior as Traian pointed out. This was changed from what it was before because now we do the IsNull() check internally in the server on all GetXXX() APIs just in case the user "forgot" to call it. This was also done to prevent memory access violations when trying to call for example GetString() from a reader that has a NULL property value and the underlying provider tries to do the read string and then crashes, by adding this check we have added some server stability.

Not all providers are created equally. :)

Thanks,
Bruce


-----Original Message-----
From: mapguide-internals-bounces at lists.osgeo.org [mailto:mapguide-internals-bounces at lists.osgeo.org] On Behalf Of Jason Birch
Sent: Thursday, February 28, 2008 2:48 PM
To: MapGuide Internals Mail List
Subject: RE: [mapguide-internals] Exception thrown on null values?

Am I allowed to say "lame"?  :)  NULL is a perfectly valid value for
most data types, and throwing an exception in this case adds a lot of
additional processing that should not be required.

I personally feel that this is a case where MapGuide could make
application developers lives a lot easier and improve (slightly?) the
performance of web-level apps by swallowing the exception and returning
NULL.

Jason

-----Original Message-----
From: mapguide-internals-bounces at lists.osgeo.org
[mailto:mapguide-internals-bounces at lists.osgeo.org] On Behalf Of Traian
Stanev
Sent: Thursday, February 28, 2008 13:31
To: 'MapGuide Internals Mail List'
Subject: RE: [mapguide-internals] Exception thrown on null values?

I think this complies with the FDO spec, which requires an exception to
be thrown when the value is null and you try to get it anyway. The two
solutions are to check for IsNull() before getting it, or to catch the
exception. The code *could* in theory return NULL in this case, but...

Traian

> -----Original Message-----
> From: mapguide-internals-bounces at lists.osgeo.org [mailto:mapguide-
> internals-bounces at lists.osgeo.org] On Behalf Of Jason Birch
> Sent: Thursday, February 28, 2008 4:29 PM
> To: MapGuide Internals Mail List
> Subject: [mapguide-internals] Exception thrown on null values?
>
> Hi,
>
> I'm seeing a case in MGOS 2.0 where MgFeatureReader->GetString() is
> throwing an exception when the value of the string is null.
>
> Is this expected behaviour?  Has it changed since 1.2?  I believe that
> I've seen a similar error in geometry, but don't have a test case for
> that yet.
>
> This is relatively easy to work around with a try/catch and
suppressing
> the error output if the message includes "null", but it's a bit
> annoying.  Is there a better way of dealing with this?
>
> Jason
> _______________________________________________
> mapguide-internals mailing list
> mapguide-internals at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/mapguide-internals
_______________________________________________
mapguide-internals mailing list
mapguide-internals at lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/mapguide-internals
_______________________________________________
mapguide-internals mailing list
mapguide-internals at lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/mapguide-internals


More information about the mapguide-internals mailing list