Bug 45569

Summary: Eliminate need for user.dir grant when not using relative-catalogs
Product: XmlCommons - Now in JIRA Reporter: Eddy Chan <ecapachedev>
Component: ResolverAssignee: Commons Developers Mailing List <commons-dev>
Status: NEW ---    
Severity: normal    
Priority: P3    
Version: 1.x   
Target Milestone: ---   
Hardware: PC   
OS: All   

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.