You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@myfaces.apache.org by "Mike Youngstrom (JIRA)" <my...@incubator.apache.org> on 2005/07/19 17:32:45 UTC

[jira] Created: (MYFACES-338) MessageUtils should force Thread.currentThread().getContextClassLoader() on ResourceBundle

MessageUtils should force Thread.currentThread().getContextClassLoader() on ResourceBundle
------------------------------------------------------------------------------------------

         Key: MYFACES-338
         URL: http://issues.apache.org/jira/browse/MYFACES-338
     Project: MyFaces
        Type: Bug
    Versions: 1.0.9 beta    
    Reporter: Mike Youngstrom


MessageUtils should use the thread's getContextClassLoader() when loading a ResrouceBundle instead of MessageUtil's classloader.

Mike

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


Re: [jira] Resolved: (MYFACES-338) MessageUtils should force Thread.currentThread().getContextClassLoader() on ResourceBundle

Posted by Sean Schofield <se...@gmail.com>.
That's ok.  I do it myself sometimes.  Just wanted to remind everyone.

sean

On 8/18/05, Sylvain Vieujot <sv...@apache.org> wrote:
>  Ok, sorry for that.
>  
>  Sylvain.
> 
>  
>  On Thu, 2005-08-18 at 22:35 -0400, Sean Schofield wrote: 
>  Sylvain,
> 
> We should be closing these out instead of marking as resolved. If we
> mark resolve there will be a giant list of them that we have to mark
> closed (manually) when its time for the release. (I know b/c I had to
> close them all last time.)
> 
> sean
> 
> On 8/18/05, Sylvain Vieujot (JIRA)
> <my...@incubator.apache.org> wrote:
> > [
> http://issues.apache.org/jira/browse/MYFACES-338?page=all ]
> > 
> > Sylvain Vieujot resolved MYFACES-338:
> > -------------------------------------
> > 
> > Fix Version: Nightly Build
> > Resolution: Fixed
> > 
> > Patch committed.
> > Thanks Mike.
> > 
> > > MessageUtils should force Thread.currentThread().getContextClassLoader()
> on ResourceBundle
> > >
> ------------------------------------------------------------------------------------------
> > >
> > > Key: MYFACES-338
> > > URL: http://issues.apache.org/jira/browse/MYFACES-338
> > > Project: MyFaces
> > > Type: Bug
> > > Components: JSF 1.1
> > > Versions: 1.0.9 beta
> > > Reporter: Mike Youngstrom
> > > Fix For: Nightly Build
> > 
> > >
> > > MessageUtils should use the thread's getContextClassLoader() when
> loading a ResrouceBundle instead of MessageUtil's classloader.
> > > Mike
> > 
> > --
> > This message is automatically generated by JIRA.
> > -
> > If you think it was sent incorrectly contact one of the administrators:
> > http://issues.apache.org/jira/secure/Administrators.jspa
> > -
> > For more information on JIRA, see:
> > http://www.atlassian.com/software/jira
> > 
> >
> 
>

Re: [jira] Resolved: (MYFACES-338) MessageUtils should force Thread.currentThread().getContextClassLoader() on ResourceBundle

Posted by Sylvain Vieujot <sv...@apache.org>.
Ok, sorry for that.

Sylvain.

On Thu, 2005-08-18 at 22:35 -0400, Sean Schofield wrote:

> Sylvain,
> 
> We should be closing these out instead of marking as resolved.  If we
> mark resolve there will be a giant list of them that we have to mark
> closed (manually) when its time for the release.  (I know b/c I had to
> close them all last time.)
> 
> sean
> 
> On 8/18/05, Sylvain Vieujot (JIRA) <my...@incubator.apache.org> wrote:
> >      [ http://issues.apache.org/jira/browse/MYFACES-338?page=all ]
> > 
> > Sylvain Vieujot resolved MYFACES-338:
> > -------------------------------------
> > 
> >     Fix Version: Nightly Build
> >      Resolution: Fixed
> > 
> > Patch committed.
> > Thanks Mike.
> > 
> > > MessageUtils should force Thread.currentThread().getContextClassLoader() on ResourceBundle
> > > ------------------------------------------------------------------------------------------
> > >
> > >          Key: MYFACES-338
> > >          URL: http://issues.apache.org/jira/browse/MYFACES-338
> > >      Project: MyFaces
> > >         Type: Bug
> > >   Components: JSF 1.1
> > >     Versions: 1.0.9 beta
> > >     Reporter: Mike Youngstrom
> > >      Fix For: Nightly Build
> > 
> > >
> > > MessageUtils should use the thread's getContextClassLoader() when loading a ResrouceBundle instead of MessageUtil's classloader.
> > > Mike
> > 
> > --
> > This message is automatically generated by JIRA.
> > -
> > If you think it was sent incorrectly contact one of the administrators:
> >    http://issues.apache.org/jira/secure/Administrators.jspa
> > -
> > For more information on JIRA, see:
> >    http://www.atlassian.com/software/jira
> > 
> >

Re: [jira] Resolved: (MYFACES-338) MessageUtils should force Thread.currentThread().getContextClassLoader() on ResourceBundle

Posted by Martin Marinschek <ma...@gmail.com>.
To keep in mind for the next time - I have been starting closing out
the resolved ones right now, so this one is done.

regards,

Martin

On 8/19/05, Sean Schofield <se...@gmail.com> wrote:
> Sylvain,
> 
> We should be closing these out instead of marking as resolved.  If we
> mark resolve there will be a giant list of them that we have to mark
> closed (manually) when its time for the release.  (I know b/c I had to
> close them all last time.)
> 
> sean
> 
> On 8/18/05, Sylvain Vieujot (JIRA) <my...@incubator.apache.org> wrote:
> >      [ http://issues.apache.org/jira/browse/MYFACES-338?page=all ]
> >
> > Sylvain Vieujot resolved MYFACES-338:
> > -------------------------------------
> >
> >     Fix Version: Nightly Build
> >      Resolution: Fixed
> >
> > Patch committed.
> > Thanks Mike.
> >
> > > MessageUtils should force Thread.currentThread().getContextClassLoader() on ResourceBundle
> > > ------------------------------------------------------------------------------------------
> > >
> > >          Key: MYFACES-338
> > >          URL: http://issues.apache.org/jira/browse/MYFACES-338
> > >      Project: MyFaces
> > >         Type: Bug
> > >   Components: JSF 1.1
> > >     Versions: 1.0.9 beta
> > >     Reporter: Mike Youngstrom
> > >      Fix For: Nightly Build
> >
> > >
> > > MessageUtils should use the thread's getContextClassLoader() when loading a ResrouceBundle instead of MessageUtil's classloader.
> > > Mike
> >
> > --
> > This message is automatically generated by JIRA.
> > -
> > If you think it was sent incorrectly contact one of the administrators:
> >    http://issues.apache.org/jira/secure/Administrators.jspa
> > -
> > For more information on JIRA, see:
> >    http://www.atlassian.com/software/jira
> >
> >
> 


-- 

http://www.irian.at
Your JSF powerhouse - 
JSF Trainings in English and German

Re: [jira] Resolved: (MYFACES-338) MessageUtils should force Thread.currentThread().getContextClassLoader() on ResourceBundle

Posted by Sean Schofield <se...@gmail.com>.
Sylvain,

We should be closing these out instead of marking as resolved.  If we
mark resolve there will be a giant list of them that we have to mark
closed (manually) when its time for the release.  (I know b/c I had to
close them all last time.)

sean

On 8/18/05, Sylvain Vieujot (JIRA) <my...@incubator.apache.org> wrote:
>      [ http://issues.apache.org/jira/browse/MYFACES-338?page=all ]
> 
> Sylvain Vieujot resolved MYFACES-338:
> -------------------------------------
> 
>     Fix Version: Nightly Build
>      Resolution: Fixed
> 
> Patch committed.
> Thanks Mike.
> 
> > MessageUtils should force Thread.currentThread().getContextClassLoader() on ResourceBundle
> > ------------------------------------------------------------------------------------------
> >
> >          Key: MYFACES-338
> >          URL: http://issues.apache.org/jira/browse/MYFACES-338
> >      Project: MyFaces
> >         Type: Bug
> >   Components: JSF 1.1
> >     Versions: 1.0.9 beta
> >     Reporter: Mike Youngstrom
> >      Fix For: Nightly Build
> 
> >
> > MessageUtils should use the thread's getContextClassLoader() when loading a ResrouceBundle instead of MessageUtil's classloader.
> > Mike
> 
> --
> This message is automatically generated by JIRA.
> -
> If you think it was sent incorrectly contact one of the administrators:
>    http://issues.apache.org/jira/secure/Administrators.jspa
> -
> For more information on JIRA, see:
>    http://www.atlassian.com/software/jira
> 
>

[jira] Resolved: (MYFACES-338) MessageUtils should force Thread.currentThread().getContextClassLoader() on ResourceBundle

Posted by "Sylvain Vieujot (JIRA)" <my...@incubator.apache.org>.
     [ http://issues.apache.org/jira/browse/MYFACES-338?page=all ]
     
Sylvain Vieujot resolved MYFACES-338:
-------------------------------------

    Fix Version: Nightly Build
     Resolution: Fixed

Patch committed.
Thanks Mike.

> MessageUtils should force Thread.currentThread().getContextClassLoader() on ResourceBundle
> ------------------------------------------------------------------------------------------
>
>          Key: MYFACES-338
>          URL: http://issues.apache.org/jira/browse/MYFACES-338
>      Project: MyFaces
>         Type: Bug
>   Components: JSF 1.1
>     Versions: 1.0.9 beta
>     Reporter: Mike Youngstrom
>      Fix For: Nightly Build

>
> MessageUtils should use the thread's getContextClassLoader() when loading a ResrouceBundle instead of MessageUtil's classloader.
> Mike

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


[jira] Commented: (MYFACES-338) MessageUtils should force Thread.currentThread().getContextClassLoader() on ResourceBundle

Posted by "Mike Youngstrom (JIRA)" <my...@incubator.apache.org>.
    [ http://issues.apache.org/jira/browse/MYFACES-338?page=comments#action_12319247 ] 

Mike Youngstrom commented on MYFACES-338:
-----------------------------------------

Below is a patch that fixes several problems with MessageUtils.getMessage()

1.  ResourceBundle.getBundle() throws a MissingResourceException when the resource bundle cannot be found.  It doesn't return null.
2.  Added ClassUtils.getCurrentLoader(bundleName) to the bundleName.  To fix the bug this issue was originally submitted for.
3.  set summary to the messageId if the message was not found instead of returning null.  This was causing a NullPointerException for me when the message was not found.  I think it would be better to either return the messageId like I have it hear or throw some other message not found exception.

Mike

/current/share/src/java/org/apache/myfaces/util/MessageUtils.java
===================================================================
--- /current/share/src/java/org/apache/myfaces/util/MessageUtils.java	(revision 230382)
+++ /current/share/src/java/org/apache/myfaces/util/MessageUtils.java	(working copy)
@@ -160,9 +160,9 @@
 
         if (bundleName != null)
         {
-            bundle = ResourceBundle.getBundle(bundleName, locale);
             try
             {
+                bundle = ResourceBundle.getBundle(bundleName, locale, ClassUtils.getCurrentLoader(bundleName));
                 summary = bundle.getString(messageId);
             }
             catch (MissingResourceException e) {}
@@ -170,14 +170,14 @@
 
         if (summary == null)
         {
-            bundle = ResourceBundle.getBundle(DEFAULT_BUNDLE, locale, ClassUtils.getCurrentLoader(bundleName));
-            if(bundle == null)
-            {
-                throw new NullPointerException();
-            }
-
             try
             {
+	        	bundle = ResourceBundle.getBundle(DEFAULT_BUNDLE, locale, ClassUtils.getCurrentLoader(DEFAULT_BUNDLE));
+	            if(bundle == null)
+	            {
+	                throw new NullPointerException();
+	            }
+	
                 summary = bundle.getString(messageId);
             }
             catch(MissingResourceException e) { }
@@ -185,7 +185,7 @@
 
         if(summary == null)
         {
-            return null;
+            summary = messageId;
         }
 
         if (bundle == null)


> MessageUtils should force Thread.currentThread().getContextClassLoader() on ResourceBundle
> ------------------------------------------------------------------------------------------
>
>          Key: MYFACES-338
>          URL: http://issues.apache.org/jira/browse/MYFACES-338
>      Project: MyFaces
>         Type: Bug
>   Components: JSF 1.1
>     Versions: 1.0.9 beta
>     Reporter: Mike Youngstrom

>
> MessageUtils should use the thread's getContextClassLoader() when loading a ResrouceBundle instead of MessageUtil's classloader.
> Mike

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


[jira] Updated: (MYFACES-338) MessageUtils should force Thread.currentThread().getContextClassLoader() on ResourceBundle

Posted by "Bruno Aranda (JIRA)" <my...@incubator.apache.org>.
     [ http://issues.apache.org/jira/browse/MYFACES-338?page=all ]

Bruno Aranda updated MYFACES-338:
---------------------------------

    Component: JSF 1.1

> MessageUtils should force Thread.currentThread().getContextClassLoader() on ResourceBundle
> ------------------------------------------------------------------------------------------
>
>          Key: MYFACES-338
>          URL: http://issues.apache.org/jira/browse/MYFACES-338
>      Project: MyFaces
>         Type: Bug
>   Components: JSF 1.1
>     Versions: 1.0.9 beta
>     Reporter: Mike Youngstrom

>
> MessageUtils should use the thread's getContextClassLoader() when loading a ResrouceBundle instead of MessageUtil's classloader.
> Mike

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


[jira] Closed: (MYFACES-338) MessageUtils should force Thread.currentThread().getContextClassLoader() on ResourceBundle

Posted by "Sylvain Vieujot (JIRA)" <my...@incubator.apache.org>.
     [ http://issues.apache.org/jira/browse/MYFACES-338?page=all ]
     
Sylvain Vieujot closed MYFACES-338:
-----------------------------------


> MessageUtils should force Thread.currentThread().getContextClassLoader() on ResourceBundle
> ------------------------------------------------------------------------------------------
>
>          Key: MYFACES-338
>          URL: http://issues.apache.org/jira/browse/MYFACES-338
>      Project: MyFaces
>         Type: Bug
>   Components: JSF 1.1
>     Versions: 1.0.9 beta
>     Reporter: Mike Youngstrom
>      Fix For: Nightly Build

>
> MessageUtils should use the thread's getContextClassLoader() when loading a ResrouceBundle instead of MessageUtil's classloader.
> Mike

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira