> - 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.

G


Reply via email to