private JavaResource getJavaResource(final DirectoryResource sourceDir, final String relativePath)
{
if (Strings.isNullOrEmpty(relativePath))
{
throw new ResourceException("Empty relative path");
}
String path = relativePath.trim().endsWith(".java")
? relativePath.substring(0, relativePath.lastIndexOf(".java")) : relativePath;
path = Packages.toFileSyntax(path) + ".java";