Skip to content

Commit

Permalink
Grails GSP: Make logger protected in DefaultGroovyPageLocator
Browse files Browse the repository at this point in the history
  • Loading branch information
rainboyan committed Jul 13, 2023
1 parent cb4bc76 commit 4bedc24
Showing 1 changed file with 15 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -60,20 +60,20 @@
*/
public class DefaultGroovyPageLocator implements GroovyPageLocator, ResourceLoaderAware, ApplicationContextAware, PluginManagerAware {

private static final Logger LOG = LoggerFactory.getLogger(DefaultGroovyPageLocator.class);

public static final String PATH_TO_WEB_INF_VIEWS = "/WEB-INF/grails-app/views";

private static final String SLASHED_VIEWS_DIR_PATH = "/" + GrailsResourceUtils.VIEWS_DIR_PATH;

private static final String PLUGINS_PATH = "/plugins/";

private static final String BLANK = "";
protected final Logger logger = LoggerFactory.getLogger(getClass());

protected Collection<ResourceLoader> resourceLoaders = new ConcurrentLinkedQueue<>();

protected GrailsPluginManager pluginManager;

private static final String BLANK = "";

private ConcurrentMap<String, String> precompiledGspMap;

protected boolean warDeployed = Environment.isWarDeployed();
Expand Down Expand Up @@ -252,13 +252,13 @@ protected GroovyPageScriptSource findBinaryScriptSource(String uri) {
}

BinaryGrailsPlugin binaryPlugin = (BinaryGrailsPlugin) plugin;
if (LOG.isDebugEnabled()) {
LOG.debug("Searching plugin [{}] for GSP view [{}]", plugin.getName(), uri);
if (logger.isDebugEnabled()) {
logger.debug("Searching plugin [{}] for GSP view [{}]", plugin.getName(), uri);
}
GroovyPageScriptSource scriptSource = resolveViewInBinaryPlugin(binaryPlugin, uri);
if (scriptSource != null) {
if (LOG.isDebugEnabled()) {
LOG.debug("Found GSP view [{}] in plugin [{}]", uri, plugin.getName());
if (logger.isDebugEnabled()) {
logger.debug("Found GSP view [{}] in plugin [{}]", uri, plugin.getName());
}
return scriptSource;
}
Expand Down Expand Up @@ -370,7 +370,7 @@ protected List<String> resolveSearchPaths(String uri) {
}
else {
searchPaths = CollectionUtils.newList(
GrailsResourceUtils.appendPiecesForUri(BuildSettings.GRAILS_APP_PATH + "/views", uri),
GrailsResourceUtils.appendPiecesForUri(BuildSettings.GRAILS_APP_PATH + File.separator + "views", uri),
GrailsResourceUtils.appendPiecesForUri(PATH_TO_WEB_INF_VIEWS, uri),
uri);
}
Expand All @@ -383,24 +383,24 @@ protected GroovyPageScriptSource findResourceScriptPathForSearchPaths(String uri
for (String searchPath : searchPaths) {
String gspClassName = this.precompiledGspMap.get(searchPath);
if (gspClassName != null && !this.reloadedPrecompiledGspClassNames.contains(gspClassName)) {
if (LOG.isDebugEnabled()) {
LOG.debug("Found pre-compiled GSP template [{}] for path [{}]", gspClassName, searchPath);
if (logger.isDebugEnabled()) {
logger.debug("Found pre-compiled GSP template [{}] for path [{}]", gspClassName, searchPath);
}
Class<GroovyPage> gspClass = null;
try {
if (LOG.isDebugEnabled()) {
LOG.debug("Loading GSP template [{}]", gspClassName);
if (logger.isDebugEnabled()) {
logger.debug("Loading GSP template [{}]", gspClassName);
}
gspClass = (Class<GroovyPage>) Class.forName(gspClassName, true, Thread.currentThread().getContextClassLoader());
}
catch (ClassNotFoundException e) {
LOG.warn("Cannot load class " + gspClassName + ". Resuming on non-precompiled implementation.", e);
logger.warn("Cannot load class " + gspClassName + ". Resuming on non-precompiled implementation.", e);
}
if (gspClass != null) {
GroovyPageCompiledScriptSource groovyPageCompiledScriptSource =
createGroovyPageCompiledScriptSource(uri, searchPath, gspClass);
if (LOG.isDebugEnabled()) {
LOG.debug("Returning new GSP script source for class [{}]", gspClassName);
if (logger.isDebugEnabled()) {
logger.debug("Returning new GSP script source for class [{}]", gspClassName);
}
return groovyPageCompiledScriptSource;
}
Expand Down

0 comments on commit 4bedc24

Please sign in to comment.