Opened 15 years ago

Closed 15 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

  1. Launch Site Administrator->Configure Services->Set Library data file folder as C:/Program Files/Autodesk/MapGuideEnterprise2010/Server/Repositories/Library/DataFiles/Test/NonExistFolder->Save
  2. Restart the Mapguide service.
  3. Launch Studio.
  4. 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)

Ticket890.patch (7.8 KB ) - added by stevenxu 15 years ago.
Ticket890_V2.patch (8.2 KB ) - added by stevenxu 15 years ago.
Update of patch
Ticket890_V3rd.patch (8.9 KB ) - added by stevenxu 15 years ago.
Ticket890_V4th.patch (9.1 KB ) - added by stevenxu 15 years ago.
Ticket890_V5th.patch (9.1 KB ) - added by StevenXu 15 years ago.

Download all attachments as: .zip

Change History (17)

comment:1 by stevenxu, 15 years ago

Owner: changed from StevenXu to stevenxu
Status: newassigned

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)

by stevenxu, 15 years ago

Attachment: Ticket890.patch added

comment:2 by stevenxu, 15 years ago

Resolution: fixed
Status: assignedclosed

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 stevenxu, 15 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 stevenxu, 15 years ago

Resolution: fixed
Status: closedreopened

comment:5 by stevedang, 15 years ago

Nice work Steven! Just a few comments:

Common/Foundation/System/FileUtil.h:

  • 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 tomfukushima, 15 years ago

Owner: changed from stevenxu to stevedang
Status: reopenednew

Assigning to Steve Dang as he is reviewing and will submit. Thanks Steve.

comment:7 by tomfukushima, 15 years ago

Owner: changed from stevedang to tomfukushima
Status: newassigned

comment:8 by tomfukushima, 15 years ago

Owner: changed from tomfukushima to stevedang
Status: assignednew

Arghh. Trying again to assign to Steve.

by stevenxu, 15 years ago

Attachment: Ticket890_V2.patch added

Update of patch

comment:9 by stevenxu, 15 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 stevenxu, 15 years ago

Attachment: Ticket890_V3rd.patch added

comment:10 by stevenxu, 15 years ago

Owner: changed from stevedang to stevenxu
Status: newassigned

The latest patch Ticket890_V3rd.patch included:

  1. 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.
  1. Make the new add code in the method CreateDirectory more readable.

by stevenxu, 15 years ago

Attachment: Ticket890_V4th.patch added

by StevenXu, 15 years ago

Attachment: Ticket890_V5th.patch added

comment:11 by StevenXu, 15 years ago

The latest patch V5th made some changes on the code style in order to follow the coding fuidelines consistently.

comment:12 by stevenxu, 15 years ago

Resolution: fixed
Status: assignedclosed
Note: See TracTickets for help on using tickets.