in src/main/java/org/apache/bsf/util/StringUtils.java [245:291]
private static URL getURL(final URL contextURL, final String spec, final int recursiveDepth)
throws MalformedURLException
{
URL url = null;
try
{
url = new URL(contextURL, spec);
try
{
url.openStream();
}
catch (final IOException ioe1)
{
throw new MalformedURLException("This file was not found: " + url);
}
}
catch (final MalformedURLException e1)
{
url = new URL("file", "", spec);
try
{
url.openStream();
}
catch (final IOException ioe2)
{
if (contextURL != null)
{
final String contextFileName = contextURL.getFile();
final String parentName = new File(contextFileName).getParent();
if (parentName != null && recursiveDepth < 3)
{
return getURL(new URL("file", "", parentName + '/'),
spec,
recursiveDepth + 1);
}
}
throw new MalformedURLException("This file was not found: " + url);
}
}
return url;
}