SourceForge.net Logo
Main Overview Wiki Issues Forum Build Fisheye
Issue Details (XML | Word | Printable)

Key: CMP-419
Type: New Feature New Feature
Status: Closed Closed
Resolution: Fixed
Priority: Minor Minor
Assignee: Shay Banon
Reporter: Ismael Juma
Votes: 0
Watchers: 0
Operations

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

Add URIConverter.

Created: 19/Jun/07 10:27 PM   Updated: 21/Jun/07 02:44 AM
Component/s: Compass::Core
Affects Version/s: 1.2 M1
Fix Version/s: 1.2 M2


 Description  « Hide
Hi,

It would be nice for Compass to provide an URIConverter out of the box. There is already a URLConverter, so the addition of a URIConverter makes sense to me. It's a trivial class:

public class URIConverter extends AbstractBasicConverter {

public Object fromString(String str, ResourcePropertyMapping resourcePropertyMapping) {
try { return new URI(str); } catch (URISyntaxException e) { throw new ConversionException("Failed to conver uri", e); }
}
}

Given some of the problems of the URL class (a horrible equals implementation that can cause nasty performance issues), it would be nice to make it as easy to use the alternative.



 All   Comments   Change History      Sort Order: Ascending order - Click to sort in descending order
Ismael Juma added a comment - 19/Jun/07 10:34 PM
I used the URLConverter as a template and I now noticed that there's a typo in the exception message. "convert" is missing the "t". Should probably be fixed in the original class too.

Ismael Juma added a comment - 20/Jun/07 07:48 AM
Thanks for the quick fix. One minor nitpick, in the message "Failed to convert url", "url" should probably be replaced by "uri" in the URIConverter.

Shay Banon added a comment - 21/Jun/07 02:44 AM
Yea, thanks for keeping an eye on this, I will fix it promptly.