MapGuide Open Source:  Home |  Download |  Internals

Ticket #649 (new defect)

Opened 2 years ago

Last modified 3 months ago

FeatureService.UpdateFeatures doesn't log errors and reports them as succesful

Reported by: zspitzer Assigned to:
Priority: high Milestone:
Component: Feature Service Version: 2.1.0
Severity: critical Keywords:
Cc: External ID:

Description

When doing an insert with FeatureService?.UpdateFeatures? it returne if there's a problem, it's returns as string GetPropertyType?(9) or on success as a featureReader GetPropertyType?(12).

When an error occurs, the access.log still logs it as successful rather than failed and the error is not logged to error.log

I triggered it by attempting to insert features into a non existent class

An exception occurred in FDO component. Item 'Rail3' not found in collection
  Exception occurred in method  MgServerUpdateFeatures.UpdateFeatures at line 97 in
 file  d:\buildforgeprojects\mapguide_open_source_v2.0\build_27.13\mgdev\server
\src\services\feature\ServerUpdateFeatures.cpp 

Using Mg 2.0.1 on XP

Attachments

test-case-649-update-feature-errors-not-thrown.php (1.6 kB) - added by zspitzer on 12/03/2008 06:35:30 PM.

Change History

12/02/2008 08:15:29 AM changed by zspitzer

  • severity changed from major to critical.
  • summary changed from FeatureService.UpdateFeatures doesn't log errors correctly to FeatureService.UpdateFeatures doesn't log or throw errors.

I am bumping this to critical, only because this is a potential dataloss bug

Most code (including samples which many users follow) will assume if an update/insert completes without throwing an error, it was successful, which is not true

12/02/2008 11:24:48 AM changed by tomfukushima

Please add step-by-step instructions to recreate the problem; and it seems that a package and sample PHP script would also be required. Thanks, Tom

12/03/2008 06:35:30 PM changed by zspitzer

  • attachment test-case-649-update-feature-errors-not-thrown.php added.

12/03/2008 06:44:07 PM changed by zspitzer

  • version changed from 2.0.1 to 2.0.2.
  • summary changed from FeatureService.UpdateFeatures doesn't log or throw errors to FeatureService.UpdateFeatures doesn't log errors and reports them as succesful.

Ok, test case attached, it uses the a feature source from the Sheboygan Samples. It will fail to make any changes, due to the SDF being marked as READ ONLY and the FeatureClass? name is wrong ( should be Rail, is Rail3)

Simply run the script, tweaking the user/pass if required.

Current Behaviour: An error is returned in the result which must be manually inspected and the access.log reports the UpdateFeatures? operation as being Successful.

UpdateFeatures.1.0.0:3(Library://Samples/Sheboygan/Data/Rail.FeatureSource,MgFeatureCommandCollection,false,) Success

Expected Behaviour: An error should be thrown (to be caught), the UpdateFeatures? accesslog entry should be marked as Failure

UpdateFeatures.1.0.0:3(Library://Samples/Sheboygan/Data/Rail.FeatureSource,MgFeatureCommandCollection,false,) Failure

In addition the error message should be logged to error.log

An exception occurred in FDO component. Item 'Rail3' not found in collection
Exception occurred in method MgServerUpdateFeatures.UpdateFeatures at line 97 in 
file d:\buildforgeprojects\mapguide_open_source_v2.0\build_27.13\mgdev\server
\src\services\feature\ServerUpdateFeatures.cpp 

(follow-up: ↓ 6 ) 03/01/2009 01:40:10 PM changed by milicevic

Hello,

i wolud like to report the same behaviour on deleting features. In fact, I don't get it, the code looks and works well, class name is just fine, filter condition also but no errors or exceptions has been thrown.

        string TIMgisUser = System.Configuration.ConfigurationManager.AppSettings["TIMgisUser"];
        MapGuideApi.MgInitializeWebTier(@"C:\program files\MapguideOpenSource2.0\WebServerExtensions\www\webconfig.ini");
        MgUserInformation userInfo = new MgUserInformation("Administrator", "" + System.Configuration.ConfigurationManager.AppSettings["mgP"] + "");
        MgSite site = new MgSite();
        site.Open(userInfo);
        String mgSessionId = site.CreateSession();

        MgUserInformation userInfoNew = new MgUserInformation(mgSessionId);
        MgSiteConnection siteConnection = new MgSiteConnection();
        siteConnection.Open(userInfoNew);

        MgResourceService resourceService = siteConnection.CreateService(MgServiceType.ResourceService) as MgResourceService;
        MgFeatureService featureService = siteConnection.CreateService(MgServiceType.FeatureService) as MgFeatureService;

        MgResourceIdentifier resId = new MgResourceIdentifier("Library://PROJEKTI/ZLZ/PODACI/DIONICE.FeatureSource");
        MgFeatureCommandCollection commands = new MgFeatureCommandCollection();

        string layerClassName = "DIONICE";
        
        MgDeleteFeatures deleteCmd = new MgDeleteFeatures(layerClassName , "(FeatId=1)");
        commands.Add(deleteCmd);

        featureService.UpdateFeatures(resId, commands, false);

03/02/2009 05:53:19 AM changed by zspitzer

  • priority changed from medium to high.

(in reply to: ↑ 4 ) 03/03/2009 03:44:49 AM changed by milicevic

Replying to milicevic:

Hello, i wolud like to report the same behaviour on deleting features. In fact, I don't get it, the code looks and works well, class name is just fine, filter condition also but no errors or exceptions has been thrown. {{{ string TIMgisUser = System.Configuration.ConfigurationManager?.AppSettings?TIMgisUser?; MapGuideApi?.MgInitializeWebTier?(@"C:\program files\MapguideOpenSource?2.0\WebServerExtensions?\www\webconfig.ini"); MgUserInformation? userInfo = new MgUserInformation?("Administrator", "" + System.Configuration.ConfigurationManager?.AppSettings?mgP? + ""); MgSite? site = new MgSite?(); site.Open(userInfo); String mgSessionId = site.CreateSession?(); MgUserInformation? userInfoNew = new MgUserInformation?(mgSessionId); MgSiteConnection? siteConnection = new MgSiteConnection?(); siteConnection.Open(userInfoNew); MgResourceService? resourceService = siteConnection.CreateService?(MgServiceType?.ResourceService?) as MgResourceService?; MgFeatureService? featureService = siteConnection.CreateService?(MgServiceType?.FeatureService?) as MgFeatureService?; MgResourceIdentifier? resId = new MgResourceIdentifier?("Library://PROJEKTI/ZLZ/PODACI/DIONICE.FeatureSource"); MgFeatureCommandCollection? commands = new MgFeatureCommandCollection?(); string layerClassName = "DIONICE"; MgDeleteFeatures? deleteCmd = new MgDeleteFeatures?(layerClassName , "(FeatId?=1)"); commands.Add(deleteCmd); featureService.UpdateFeatures?(resId, commands, false); }}}

Hello,

I wolud like fill up my report. Thanks to Zac i have solved my problem. The reason was read only feature source.

11/05/2009 06:40:53 PM changed by zspitzer

  • version changed from 2.0.2 to 2.1.0.
  • milestone set to 2.1.