Bug 45569 - Eliminate need for user.dir grant when not using relative-catalogs
Summary: Eliminate need for user.dir grant when not using relative-catalogs
Status: NEW
Alias: None
Product: XmlCommons - Now in JIRA
Classification: Unclassified
Component: Resolver (show other bugs)
Version: 1.x
Hardware: PC All
: P3 normal (vote)
Target Milestone: ---
Assignee: Commons Developers Mailing List
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2008-08-05 15:02 UTC by Eddy Chan
Modified: 2008-08-05 15:02 UTC (History)
0 users



Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Eddy Chan 2008-08-05 15:02:55 UTC
When the CatalogManager configuration of relative-catalogs is false, the catalog paths will be absolute.  When parsing the catalogs in Catalog.parseCatalogFile, the first thing that occurs is creating a URL of the current working directory, which requires a grant to the "user.dir" PropertyPermission.  Creating this URL is unnecessary when an absolute path to the catalog is passed in and the grant would also be unnecessary.

To alleviate this condition, a URL can be attempted to be made from the fileName first and if a MalformedURLException occurs, treat it as a relative path.  In essence:

try {
  base = new URL(fixSlashes(fileName));
} catch (MalformedURLException mue) {
 ...
}

Alternatively, there can be a mode set or passed in to treat the fileName appropriately.