myfaces-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Prakash Udupa (JIRA)" <...@myfaces.apache.org>
Subject [jira] [Comment Edited] (TRINIDAD-2473) Improve diagnostic support for resource bundle feature in skinning framework
Date Tue, 03 Jun 2014 20:12:04 GMT

    [ https://issues.apache.org/jira/browse/TRINIDAD-2473?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14017060#comment-14017060
] 

Prakash Udupa edited comment on TRINIDAD-2473 at 6/3/14 8:11 PM:
-----------------------------------------------------------------

Attached the improved patch "TRINIDAD-2473-take-2.trunk.patch". One of the Trinidad committers
please check this in.

Note that this patch adds a new utility class "org.apache.myfaces.trinidad.util.ToStringHelper"
in the API package, which means a new API. This utility is added so as to help with the toString()
implementations in the various classes in Trinidad. 

The common requirement in most toString() implementations is to be able to:
1. Add information about the class - class name and identity hash code
2. Add the rudimentary field-value state from the objects of the class
3. Formatting needed to make the string representations uniform.

The new utility class takes care of this, and I believe is generally useful elsewhere in Trinidad
code base.



was (Author: pudupa):
Attached the improved patch "TRINIDAD-2473-take-2.trunk.patch". One of the Trinidad committers
please check this in.

> 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
>         Attachments: TRINIDAD-2473-take-2.trunk.patch, TRINIDAD-2473.trunk.patch
>
>   Original Estimate: 24h
>  Remaining Estimate: 24h
>
> 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[]{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)

Mime
View raw message