Opened 16 years ago
Closed 12 years ago
#649 closed defect (fixed)
FeatureService.UpdateFeatures doesn't log errors and reports them as succesful
Reported by: | zspitzer | Owned by: | |
---|---|---|---|
Priority: | high | Milestone: | 2.4 |
Component: | Feature Service | Version: | 2.2.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 (1)
Change History (11)
comment:1 by , 16 years ago
Severity: | major → critical |
---|---|
Summary: | FeatureService.UpdateFeatures doesn't log errors correctly → FeatureService.UpdateFeatures doesn't log or throw errors |
comment:2 by , 16 years ago
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
by , 16 years ago
Attachment: | test-case-649-update-feature-errors-not-thrown.php added |
---|
comment:3 by , 16 years ago
Summary: | FeatureService.UpdateFeatures doesn't log or throw errors → FeatureService.UpdateFeatures doesn't log errors and reports them as succesful |
---|---|
Version: | 2.0.1 → 2.0.2 |
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 comment:4 by , 16 years ago
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);
comment:5 by , 16 years ago
Priority: | medium → high |
---|
comment:6 by , 16 years ago
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\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);
Hello,
I wolud like fill up my report. Thanks to Zac i have solved my problem. The reason was read only feature source.
comment:7 by , 15 years ago
Milestone: | → 2.1 |
---|---|
Version: | 2.0.2 → 2.1.0 |
comment:8 by , 14 years ago
Version: | 2.1.0 → 2.2.0 |
---|
comment:9 by , 13 years ago
Milestone: | → 2.4 |
---|
comment:10 by , 12 years ago
Resolution: | → fixed |
---|---|
Status: | new → closed |
Fixed in 2.4 (r6846) and trunk (r6847)
Please note that the behaviour is still the same (ie. If MgPropertyCollection contains MgStringProperty instances, it means that particular command had an exception thrown).
The above changeset now properly logs such failures and documents this method behaviour in the API documentation.
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