pivot-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Greg Brown <gkbr...@mac.com>
Subject Re: some small things before Pivot 2.0
Date Fri, 12 Nov 2010 01:17:49 GMT
> - substrings without check before (detail follows):
> in some classes I've found some calls to substring(1) because for
> example it's implicit that the input string has to start with a slash
> or other "control" char, but in many cases the existence of that char
> is not tested before the substring ... so, to avoid little "strange
> and confusing" small behaviors, what do you think if I'd fix them ?
> For example, a good behavior is in TerraTheme, while a "not-so-good"
> sample is in ScriptApplication. This is a sample line:
>            if (location.startsWith("/")) {
>                locationURL = classLoader.getResource(location.substring(1));

I think it would be preferable to throw an IllegalArgumentException if the string does not
start with "/". I'll take a look at the other issues in more detail when I get a chance.


View raw message