Issue Details (XML | Word | Printable)

Key: VALIDATOR-209
Type: Improvement Improvement
Status: Closed Closed
Resolution: Fixed
Priority: Minor Minor
Assignee: Niall Pemberton
Reporter: Craig McClanahan
Votes: 0
Watchers: 0
Operations

If you were logged in you would be able to see more operations.
Commons Validator

Additional constructor for ValidatorResources that takes URL[] instead of String[]

Created: 23/Nov/06 03:15 AM   Updated: 12/Nov/07 07:25 PM
Return to search
Component/s: Framework
Affects Version/s: 1.3.0 Release
Fix Version/s: 1.3.1 Release

Time Tracking:
Not Specified

File Attachments:
  Size
Text File Licensed for inclusion in ASF works validator-209-ValidatorResources.patch 2006-11-23 04:09 AM Niall Pemberton 3 kB
Issue Links:
Blocker
 

Resolution Date: 23/Nov/06 05:46 AM


 Description  « Hide
Currently, the constructor for ValidatorResources takes an InputStream, and array of InputStream, a single String, or an array of Strings (in the latter two cases, the strings are assumed to be URIs of either webapp resources or classpath resources to be parsed). In a web application environment, a framework or application using Commons Validator will typically use either ServletContext.getResource() or Class.getResource() to find URLs of the set of resources to be configured.

However, the CommonsValidator constructor cannot take URLs correctly. Therefore, the caller will need to convert these URLs to external (String) form in order to pass them in. However, these Strings will ultimately need to be turned back into URLs anyway (inside the Digester instance being used), in order for relative references to work.

Thus, the current implementation assumes that there is a lossless conversion from a URL returned by ServletContext.getResource() or Class.getResource(), to a String, and then back to a URL. That assumption is not necessarily guaranteed for the servlet context resources (although it is generally the case in practice for most containers). It is legal for the container to embed information (such as a custom URLStreamHandler implementation) inside the URLs it returns for webapp resources.

It would be better defensive coding for ValidatorResources to accept an array of URLs of the resources to be loaded (and pass them directly in to Digester unchanged), in addition to the other constructors that are currently supported.



 All   Comments   Work Log   Change History   Subversion Commits      Sort Order: Ascending order - Click to sort in descending order
Craig McClanahan made changes - 23/Nov/06 04:04 AM
Field Original Value New Value
Link This issue is blocked by DIGESTER-110 [ DIGESTER-110 ]
Niall Pemberton made changes - 23/Nov/06 04:09 AM
Attachment validator-209-ValidatorResources.patch [ 12345522 ]
Niall Pemberton made changes - 23/Nov/06 05:46 AM
Resolution Fixed [ 1 ]
Assignee Niall Pemberton [ niallp ]
Fix Version/s 1.3.1 [ 12311934 ]
Status Open [ 1 ] Resolved [ 5 ]
Henri Yandell made changes - 12/Nov/07 07:25 PM
Status Resolved [ 5 ] Closed [ 6 ]