Details
-
Bug
-
Status: Resolved
-
Major
-
Resolution: Fixed
-
2.1.0-core
-
None
-
None
Description
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:22 Uhr MEZ> <Error>
<org.apache.myfaces.trinidad.context.RenderingContext> <BEA-000000>
<Ressourcenschlüssel af_document.LABEL_SPLASH_SCREEN konnte nicht aus Skin
gsr40518e9c_5b59_459a_8d71_85d8a9d30676.desktop abgerufen werden>
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[]
);
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.