Opened 13 years ago

Closed 13 years ago

#1921 closed defect (fixed)

Maestro - Save Map

Reported by: crispinatime Owned by: jng
Priority: high Milestone: Maestro-5.0
Component: Maestro Version:
Severity: blocker Keywords:
Cc: External ID:

Description

Hi,

An unusual one but a bit of a blocker. I have a test package to a local Oracle database that I have used for a long time.

When I try and save a map using current build of Maestro trunk I get the error below during validation.

My datasources and layers all validate OK and no errors in MG logs. This bug is not in Maestro 4B1 (the other version I have running) when connecting to the same MG server.

Validating resource: Session:5a06c3a8-428b-11e1-8000-00219b03478f_en_7F0000010AFC0AFB0AFA//b9005494-75e7-43ad-9a4c-75ea3b56fd25.MapDefinition Error - OSGeo.MapGuide.ObjectModels.MapDefinition_1_0_0.MapDefinition: Library://XXXX/Oracle.FeatureSource could not be processed for spatial info:

The given key was not present in the dictionary.

Change History (10)

comment:1 by jng, 13 years ago

If you can debug, stick a breakpoint here to get the stack trace of the offending code and post the stack trace here.

We generally don't put the full exception information in validation error messages because exceptions from the mapagent are ridiculously large with several levels of nesting, so we only extract the core messages. But for something like this (the message is due to an invalid use of a Dictionary<TKey, TVal> somewhere) the full information is sorely needed.

comment:2 by jng, 13 years ago

That's line 202 if the source view in that link fails to highlight the line I'm indicating.

comment:3 by crispinatime, 13 years ago

Here you go:

There may not be a pkey on this table (Oracle, just a unique index by dubious design) but the layer validates and I can do a feature selection OK.

   at System.ThrowHelper.ThrowKeyNotFoundException()
   at System.Collections.Generic.Dictionary`2.get_Item(TKey key)
   at OSGeo.MapGuide.MaestroAPI.Feature.RecordBase.get_Item(String name) in e:\Projects\Maestro\OSGeo.MapGuide.MaestroAPI\Feature\RecordBase.cs:line 382
   at OSGeo.MapGuide.MaestroAPI.Feature.ReaderBase.get_Item(String name) in e:\Projects\Maestro\OSGeo.MapGuide.MaestroAPI\Feature\ReaderBase.cs:line 369
   at OSGeo.MapGuide.MaestroAPI.PlatformConnectionBase.GetSpatialExtent(String resourceID, String schema, String geometry, String filter, Boolean allowFallbackToContextInformation) in e:\Projects\Maestro\OSGeo.MapGuide.MaestroAPI\PlatformConnectionBase.cs:line 1640
   at OSGeo.MapGuide.MaestroAPI.PlatformConnectionBase.GetSpatialExtent(String resourceID, String schema, String geometry) in e:\Projects\Maestro\OSGeo.MapGuide.MaestroAPI\PlatformConnectionBase.cs:line 1544
   at OSGeo.MapGuide.ObjectModels.FeatureSource.FeatureSourceExtensions.GetSpatialExtent(IFeatureSource fs, String className, String geomProperty) in e:\Projects\Maestro\OSGeo.MapGuide.MaestroAPI\ObjectModels\FeatureSourceInterfaces.cs:line 532
   at OSGeo.MapGuide.MaestroAPI.Resource.Validation.BaseMapDefinitionValidator.ValidateBase(ResourceValidationContext context, IResource resource, Boolean recurse) in e:\Projects\Maestro\OSGeo.MapGuide.MaestroAPI\Resource\Validation\BaseMapDefinitionValidator.cs:line 193

comment:4 by crispinatime, 13 years ago

It's trying to get an "extent" on save and failing with a throw in here:

protected virtual OSGeo.MapGuide.ObjectModels.Common.IEnvelope GetSpatialExtent(string resourceID, string schema, string geometry, string filter, bool allowFallbackToContextInformation)

comment:5 by crispinatime, 13 years ago

The LayerDefinition (ObjectModels\LayerInterfaceExtensions.cs) makes the same call but catches the throw at line 238

                        catch 
                        {
                            //Which in that case, default to extents of active spatial context
                            if (activeSc != null && activeSc.Extent != null)
                                return activeSc.Extent.Clone();
                            else
                                return null;
                        }

comment:6 by crispinatime, 13 years ago

... but the real issue is that there is some case-sensitivity in the Oracle provider (not sure why as Oracle table SQL is not case sensitive).

Changing line 1596 of PlatformConnectionBase.cs to upper-case "EXTENT" fixed it!

IGeometry geom = fsrEXTENT as IGeometry;

Anyone know why Oracle properties are case-sensitive upper-case (even when the alias is lower-case?)

comment:7 by crispinatime, 13 years ago

:=)

That also fixed previewing of Oracle layers where the initial map extent always used to be massive!

comment:8 by jng, 13 years ago

If upper-case property resolves this issue, I'll put that in as the fix

comment:9 by crispinatime, 13 years ago

Yep, fixed on my local build with that change.

Recommend all aliases for any aggregate query properties are upper to ensure work on Oracle as well as other providers.

comment:10 by jng, 13 years ago

Resolution: fixed
Status: newclosed

Fixed r6447

Note: See TracTickets for help on using tickets.