in src/main/java/org/apache/maven/plugins/resource/loader/ProjectResourceLoader.java [85:143]
public synchronized InputStream getResourceStream( String templateName )
throws ResourceNotFoundException
{
/*
* Make sure we have a valid templateName.
*/
if ( templateName == null || templateName.length() == 0 )
{
/*
* If we don't get a properly formed templateName then there's not much we can do. So we'll forget about
* trying to search any more paths for the template.
*/
throw new ResourceNotFoundException( "Need to specify a file name or file path!" );
}
String template = StringUtils.normalizePath( templateName );
if ( template == null || template.length() == 0 )
{
String msg = "Project Resource loader error : argument " + template
+ " contains .. and may be trying to access " + "content outside of template root. Rejected.";
rsvc.getLog().error( "ProjectResourceLoader : " + msg );
throw new ResourceNotFoundException( msg );
}
/*
* if a / leads off, then just nip that :)
*/
if ( template.startsWith( "/" ) )
{
template = template.substring( 1 );
}
// MCHANGES-118 adding the basedir path
paths.add( (String) rsvc.getApplicationAttribute( "baseDirectory" ) );
for ( String path : paths )
{
InputStream inputStream = findTemplate( path, template );
if ( inputStream != null )
{
/*
* Store the path that this template came from so that we can check its modification time.
*/
templatePaths.put( templateName, path );
return inputStream;
}
}
/*
* We have now searched all the paths for templates and we didn't find anything so throw an exception.
*/
String msg = "ProjectResourceLoader Error: cannot find resource " + template;
throw new ResourceNotFoundException( msg );
}