Skip to content

Commit

Permalink
Fixes #4
Browse files Browse the repository at this point in the history
  • Loading branch information
dmitrygusev committed Nov 2, 2013
1 parent 547edb0 commit d6cd62a
Showing 1 changed file with 20 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import org.eclipse.core.resources.IContainer;
import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IResource;

public class ContextAssetResolver implements AssetResolver
{
Expand All @@ -10,19 +11,27 @@ public IFile resolve(String path, IFile relativeTo) throws AssetException
{
IContainer webapp = TapestryUtils.findWebapp(relativeTo.getProject());

if (webapp != null)
if (webapp == null)
{
IFile file = (IFile) webapp.findMember(path);

if (file == null)
{
throw new AssetException("File not found '"
+ webapp.getProjectRelativePath().toPortableString() + "/" + path + "'");
}

return file;
throw new AssetException("Couldn't find context folder ('src/main/webapp')");
}

throw new AssetException("Couldn't find context folder ('src/main/webapp')");
IResource resource = webapp.findMember(path);

if (resource == null)
{
throw new AssetException("File not found '"
+ webapp.getProjectRelativePath().toPortableString() + "/" + path + "'");
}

if (!(resource instanceof IFile))
{
throw new AssetException(
"'" + webapp.getProjectRelativePath().toPortableString() + "/" + path + "' is not a file");
}

IFile file = (IFile) resource;

return file;
}
}

0 comments on commit d6cd62a

Please sign in to comment.