Opened 16 years ago
Closed 16 years ago
#890 closed defect (fixed)
One exception happened with load procedure when Library data file folder doesn't exist.
Reported by: | stevenxu | Owned by: | stevenxu |
---|---|---|---|
Priority: | medium | Milestone: | 2.2 |
Component: | Site Service | Version: | 2.0.1 |
Severity: | major | Keywords: | |
Cc: | External ID: | 1200756 |
Description
Steps
- Launch Site Administrator->Configure Services->Set Library data file folder as C:/Program Files/Autodesk/MapGuideEnterprise2010/Server/Repositories/Library/DataFiles/Test/NonExistFolder->Save
- Restart the Mapguide service.
- Launch Studio.
- New -> Load Procedure->Select any type file->Click Load Resources
Results: One exception happened.
Expected results: One new folder should be created automatically if setting a non-existed folder in the configure web.
Attachments (5)
Change History (17)
comment:1 by , 16 years ago
Owner: | changed from | to
---|---|
Status: | new → assigned |
by , 16 years ago
Attachment: | Ticket890.patch added |
---|
comment:2 by , 16 years ago
Resolution: | → fixed |
---|---|
Status: | assigned → closed |
Ticket890.patch is my fix.
In my fix I verified the following folers:
Library data file folder: Repositories/Library/DataFiles/ Library repository folder: Repositories/Library/ Session data file folder: Repositories/Session/DataFiles/ Session repository folder: Repositories/Session/ Site repository folder: Repositories/Site/ Tile cache path: Repositories/TileCache/
comment:3 by , 16 years ago
Library data file folder: Repositories/Library/DataFiles/
Library repository folder: Repositories/Library/
Session data file folder: Repositories/Session/DataFiles/
Session repository folder: Repositories/Session/
Site repository folder: Repositories/Site/
Tile cache path: Repositories/TileCache/
comment:4 by , 16 years ago
Resolution: | fixed |
---|---|
Status: | closed → reopened |
comment:5 by , 16 years ago
Nice work Steven! Just a few comments:
- It's nice that you added a new comprehensive/internal method, MakeDirectory.
- Consider renaming it to CreateDirectories for consistency with the other overloaded method.
Common\Foundation\System\FileUtil.cpp:
Lines 439, 449:
- Please use 4-space tab/indentation.
Line 443 - if( path.find_first_of(sm_slash)==0)
- I'm not sure what this check is for.
- To make this method complete, it should also handle UCN pathnames (though not supported for repositories' locations), and of course work on Linux. Otherwise, you will need to document this limitation.
- To optimize this method, we should check if the path already exists before walking through it.
Line 450:
- Not needed.
Line 458-460:
- Please use size_t's instead of int's.
Line 467 - if( PathnameExists(subPath))
- Not needed because for consistency in both CreateDirectory and CreateDirectories methods, the "strict" flag should be only used to determine if the method should throw an exception when the path already exists.
Server/src/Services/Tile/TileCache.cpp:
Line 55 - if (!MgFileUtil::PathnameExists(sm_path))
- Not needed.
comment:6 by , 16 years ago
Owner: | changed from | to
---|---|
Status: | reopened → new |
Assigning to Steve Dang as he is reviewing and will submit. Thanks Steve.
comment:7 by , 16 years ago
Owner: | changed from | to
---|---|
Status: | new → assigned |
comment:8 by , 16 years ago
Owner: | changed from | to
---|---|
Status: | assigned → new |
Arghh. Trying again to assign to Steve.
comment:9 by , 16 years ago
The latest patch of Ticket890_V2.patch made the all changes of steve dang's comments, expect that, I changed the function name as 'CreateDirectoryEx' in Common/Foundation/System/FileUtil.h, instead of 'CreateDirectory'.
As following:
static void CreateDirectory(CREFSTRING path, bool strict = false);
static void CreateDirectoryEx(CREFSTRING path, bool recursive = true, bool strict = false);
For the default value of the parameter, the same function names would result in ambiguous overloaded functions.
by , 16 years ago
Attachment: | Ticket890_V3rd.patch added |
---|
comment:10 by , 16 years ago
Owner: | changed from | to
---|---|
Status: | new → assigned |
The latest patch Ticket890_V3rd.patch included:
- Expand the existing function: CreateDirectory(CREFSTRING path, bool strict = false) as CreateDirectory(CREFSTRING path, bool strict = false, bool recursive=false), so that it can create parent directories recursively.
- Make the new add code in the method CreateDirectory more readable.
by , 16 years ago
Attachment: | Ticket890_V4th.patch added |
---|
by , 16 years ago
Attachment: | Ticket890_V5th.patch added |
---|
comment:11 by , 16 years ago
The latest patch V5th made some changes on the code style in order to follow the coding fuidelines consistently.
comment:12 by , 16 years ago
Resolution: | → fixed |
---|---|
Status: | assigned → closed |
It was fixed in trunk: http://trac.osgeo.org/mapguide/changeset/3749
According to what Steve Dang said:
By default, the Server will create fresh repositories at startup if they do not exist. Let’s make things simple, i.e. Create the repository/resource data file paths if they do not exist and throw an exception when this fails in:
MgLibraryRepository::VerifyAccess(CREFSTRING repositoryPath) MgSessionRepository::VerifyAccess(CREFSTRING repositoryPath) MgSiteRepository::VerifyAccess(CREFSTRING repositoryPath)