Prakash Udupa created TRINIDAD-2473:
---------------------------------------
Summary: Improve diagnostic support for resource bundle feature in
skinning framework
Key: TRINIDAD-2473
URL: https://issues.apache.org/jira/browse/TRINIDAD-2473
Project: MyFaces Trinidad
Issue Type: Bug
Components: Skinning
Affects Versions: 2.1.0-core
Reporter: Prakash Udupa
We had difficulty diagnosing a skinning issue where the server logs reported
some translated keys not being able to be resolved to its value in the resource
bundle attached to the skins.
There are messages like these two in the logs:
1.
<17.02.2014 21:23 Uhr MEZ> <Error> <HTTP> <BEA-101020>
<[ServletContext@797966157[app:de_arbeitsagentur_portal module:apps
path:/apps spec-version:2.5 version:1.0.0.5.159]] Servlet failed with
Exception
java.util.MissingResourceException: Can't find resource for bundle
at
org.apache.myfaces.trinidadinternal.skin.SkinImpl.getTranslatedValue(SkinImpl.
java:183)
2.
<17.02.2014 21:23 Uhr MEZ> <Error> <HTTP> <BEA-101020>
<[ServletContext@797966157[app:de_arbeitsagentur_portal module:apps
path:/apps spec-version:2.5 version:1.0.0.5.159]] Servlet failed with
Exception
java.util.MissingResourceException: Can't find resource for bundle
at
org.apache.myfaces.trinidadinternal.skin.SkinImpl.getTranslatedValue(SkinImpl.
java:183)
=======
These are not as useful because they do not give the details of skin or the
bundle class that is expected to resolve it, or how in the skin hierarchy this
was resolved (or lack of). Relevant code is here:
=======
In RenderingContext.getTranslatedString():
try
{
return getSkin().getTranslatedString(getLocaleContext(), key);
}
catch (MissingResourceException mre)
{
// Instead of halting execution, return "???<key>???",
// just like JSF and JSTL will do, and log a severe error
_LOG.severe("CANNOT_GET_RESOURCE_KEY", new String[]{key, getSkin().getId()});
return "???" + key + "???";
}
This would not tell if the bundle was read properly in the first place.
The issue is more evident in this code in SkinImpl.getTranslatedValue():
if (translatedValue == null)
{
throw new MissingResourceException("Can't find resource for bundle",
getBundleName(),
key);
}
Although the bundle name and key is passed to the exception, it does not get
included in the message in the log, this information should be included in the
first parameter.
========
This issue is to track the needed improvement in logging here to improve
debug-ability. Will provide a patch soon.
--
This message was sent by Atlassian JIRA
(v6.2#6252)