Discussion:
Fix for GRAILS-11333: Handle already absolute URLs
candrews
2014-04-17 17:17:04 UTC
Permalink
I just submitted a pull request for
http://jira.grails.org/browse/GRAILS-11333 at
https://github.com/grails/grails-core/pull/488

The test at
https://github.com/grails/grails-core/blob/2.2.x/grails-web/src/test/groovy/org/codehaus/groovy/grails/web/mapping/LinkGeneratorSpec.groovy
should probably also be updated - but I don't quite understand how to do so.

The test case is:
link([uri:'http://www.grails.org/', absolute: true])
should return
http://www.grails.org/

Can someone help me update that test?

Thanks!



--
View this message in context: http://grails.1312388.n4.nabble.com/Fix-for-GRAILS-11333-Handle-already-absolute-URLs-tp4656125.html
Sent from the Grails - dev mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

http://xircles.codehaus.org/manage_email
Graeme Rocher
2014-04-22 10:45:48 UTC
Permalink
The usage of try/catch is not great as it impacts performance
Post by candrews
I just submitted a pull request for
http://jira.grails.org/browse/GRAILS-11333 at
https://github.com/grails/grails-core/pull/488
The test at
https://github.com/grails/grails-core/blob/2.2.x/grails-web/src/test/groovy/org/codehaus/groovy/grails/web/mapping/LinkGeneratorSpec.groovy
should probably also be updated - but I don't quite understand how to do so.
link([uri:'http://www.grails.org/', absolute: true])
should return
http://www.grails.org/
Can someone help me update that test?
Thanks!
--
View this message in context: http://grails.1312388.n4.nabble.com/Fix-for-GRAILS-11333-Handle-already-absolute-URLs-tp4656125.html
Sent from the Grails - dev mailing list archive at Nabble.com.
---------------------------------------------------------------------
http://xircles.codehaus.org/manage_email
--
Graeme Rocher
Grails Project Lead
SpringSource

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

http://xircles.codehaus.org/manage_email
candrews
2014-04-22 18:29:52 UTC
Permalink
Post by Graeme Rocher
The usage of try/catch is not great as it impacts performance
I believe the exception should be thrown rarely; I think that almost 100% of
the time, there would be no exception. The only time the exception should be
thrown is if the given string is invalid according to Java's rules for URI
validation, which are given here:
http://docs.oracle.com/javase/7/docs/api/java/net/URI.html#URI%28java.lang.String%29
For example, "http://http://" would cause the exception to be thrown, but
that kind of thing should be really rare.
Does that sound acceptable? If not, I'll see if I can come up with some
other way to determine if a URI is absolute.

Thanks!



--
View this message in context: http://grails.1312388.n4.nabble.com/Fix-for-GRAILS-11333-Handle-already-absolute-URLs-tp4656125p4656229.html
Sent from the Grails - dev mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

http://xircles.codehaus.org/manage_email

Loading...