raphael     2002/11/10 02:08:37

  Modified:    src/java/org/apache/jetspeed/services/profiler
                        JetspeedProfilerService.java
  Log:
  Fix bug 14035: Incorrect edition of language keyed PSML files
  
  Revision  Changes    Path
  1.42      +42 -19    
jakarta-jetspeed/src/java/org/apache/jetspeed/services/profiler/JetspeedProfilerService.java
  
  Index: JetspeedProfilerService.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-jetspeed/src/java/org/apache/jetspeed/services/profiler/JetspeedProfilerService.java,v
  retrieving revision 1.41
  retrieving revision 1.42
  diff -u -r1.41 -r1.42
  --- JetspeedProfilerService.java      8 Nov 2002 23:21:51 -0000       1.41
  +++ JetspeedProfilerService.java      10 Nov 2002 10:08:37 -0000      1.42
  @@ -477,6 +477,7 @@
               //  Is it a group, role, or user resource?
               //  It can only be one
               String param = rundata.getParameters().getString( Profiler.PARAM_GROUP 
);
  +
               if (null != param)
               {
                   // GROUP Resource
  @@ -524,7 +525,8 @@
               // get resource name
               StringBuffer resource = new StringBuffer();
               param = rundata.getParameters().getString( Profiler.PARAM_PAGE );
  -            if (null == param) {
  +            if (null == param)
  +            {
                  // the default resource
                   resource.append( resourceDefault );
                   resource.append( resourceExt );
  @@ -538,8 +540,7 @@
               profile.setName( resource.toString() );
   
               // LANGUAGE
  -            if ((useFallbackLanguage || useFallbackCountry) && (rundata != null))
  -                getLanguageSettings(profile, rundata);
  +            getLanguageSettings(profile, rundata);
   
               PSMLDocument doc = fallback( profile );
               if (null != doc)
  @@ -620,6 +621,7 @@
       protected void getLanguageSettings( Profile profile, RunData rundata )
       {
           String language = 
rundata.getParameters().getString(Profiler.PARAM_LANGUAGE);
  +
           if (language != null)
           {
               // dont use locale based fall back
  @@ -627,31 +629,38 @@
               {
                   return;
               }
  +            else
  +            {
  +                profile.setLanguage(language);
  +            }
  +
               String country = 
rundata.getParameters().getString(Profiler.PARAM_COUNTRY);
               if (country != null)
               {
                   profile.setCountry(country);
               }
  -            profile.setLanguage(language);
           }
  -        Locale locale = (Locale)rundata.getUser().getTemp("locale");
  -        if (locale == null)
  +        else
           {
  -            // Get the locale store it in the user object
  -            locale = LocaleDetector.getLocale(rundata);
  +            Locale locale = (Locale)rundata.getUser().getTemp("locale");
               if (locale == null)
               {
  -                locale = new Locale(
  -                                
TurbineResources.getString("locale.default.language", "en"),
  -                                
TurbineResources.getString("locale.default.country", "US"));
  +                // Get the locale store it in the user object
  +                locale = LocaleDetector.getLocale(rundata);
  +                if (locale == null)
  +                {
  +                    locale = new Locale(
  +                                    
TurbineResources.getString("locale.default.language", "en"),
  +                                    
TurbineResources.getString("locale.default.country", "US"));
  +                }
  +                rundata.getUser().setTemp("locale", locale);
               }
  -            rundata.getUser().setTemp("locale", locale);
  -        }
  -        language = locale.getLanguage();
  -        String country = locale.getCountry();
  -        if (useFallbackLanguage)
  -        {
  -            profile.setLanguage( locale.getLanguage() );
  +
  +            if (useFallbackLanguage)
  +            {
  +                profile.setLanguage( locale.getLanguage() );
  +            }
  +
               if (useFallbackCountry)
               {
                   profile.setCountry( locale.getCountry() );
  @@ -908,6 +917,20 @@
           if (null != mtype)
           {
               uri.addPathInfo(Profiler.PARAM_MEDIA_TYPE, mtype);
  +        }
  +
  +       // check language to add to the uri
  +        String language = locator.getLanguage();
  +        if (null != language)
  +        {
  +            uri.addPathInfo(Profiler.PARAM_LANGUAGE, language);
  +        }
  +
  +       // check language to add to the uri
  +        String country = locator.getCountry();
  +        if (null != country)
  +        {
  +            uri.addPathInfo(Profiler.PARAM_COUNTRY, country);
           }
   
           // check User, Group or Role to add to the uri
  
  
  

--
To unsubscribe, e-mail:   <mailto:jetspeed-dev-unsubscribe@;jakarta.apache.org>
For additional commands, e-mail: <mailto:jetspeed-dev-help@;jakarta.apache.org>

Reply via email to