incubator-sling-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From fmesc...@apache.org
Subject svn commit: r577676 - in /incubator/sling/trunk/webmanager/src/main/java/org/apache/sling/console/web/internal: AjaxConfigManagerAction.java ConfigManager.java ConfigManagerBase.java
Date Thu, 20 Sep 2007 10:40:22 GMT
Author: fmeschbe
Date: Thu Sep 20 03:40:18 2007
New Revision: 577676

URL: http://svn.apache.org/viewvc?rev=577676&view=rev
Log:
Catch NoSuchMethodError when trying to get the Locale in a Servlet 2.1 environment

Modified:
    incubator/sling/trunk/webmanager/src/main/java/org/apache/sling/console/web/internal/AjaxConfigManagerAction.java
    incubator/sling/trunk/webmanager/src/main/java/org/apache/sling/console/web/internal/ConfigManager.java
    incubator/sling/trunk/webmanager/src/main/java/org/apache/sling/console/web/internal/ConfigManagerBase.java

Modified: incubator/sling/trunk/webmanager/src/main/java/org/apache/sling/console/web/internal/AjaxConfigManagerAction.java
URL: http://svn.apache.org/viewvc/incubator/sling/trunk/webmanager/src/main/java/org/apache/sling/console/web/internal/AjaxConfigManagerAction.java?rev=577676&r1=577675&r2=577676&view=diff
==============================================================================
--- incubator/sling/trunk/webmanager/src/main/java/org/apache/sling/console/web/internal/AjaxConfigManagerAction.java
(original)
+++ incubator/sling/trunk/webmanager/src/main/java/org/apache/sling/console/web/internal/AjaxConfigManagerAction.java
Thu Sep 20 03:40:18 2007
@@ -91,7 +91,7 @@
 
         if (pid != null) {
             try {
-                this.configForm(result, pid, isFactory, request.getLocale());
+                this.configForm(result, pid, isFactory, getLocale(request));
             } catch (Exception e) {
                 // add message
             }

Modified: incubator/sling/trunk/webmanager/src/main/java/org/apache/sling/console/web/internal/ConfigManager.java
URL: http://svn.apache.org/viewvc/incubator/sling/trunk/webmanager/src/main/java/org/apache/sling/console/web/internal/ConfigManager.java?rev=577676&r1=577675&r2=577676&view=diff
==============================================================================
--- incubator/sling/trunk/webmanager/src/main/java/org/apache/sling/console/web/internal/ConfigManager.java
(original)
+++ incubator/sling/trunk/webmanager/src/main/java/org/apache/sling/console/web/internal/ConfigManager.java
Thu Sep 20 03:40:18 2007
@@ -76,7 +76,7 @@
         pw.println("<tr class='content' id='configField'>");
         pw.println("<td class='content'>Configurations</th>");
         pw.println("<td class='content'>");
-        this.listConfigurations(pw, optionalMetaType, request.getLocale());
+        this.listConfigurations(pw, optionalMetaType, getLocale(request));
         pw.println("</td>");
         pw.println("</tr>");
 

Modified: incubator/sling/trunk/webmanager/src/main/java/org/apache/sling/console/web/internal/ConfigManagerBase.java
URL: http://svn.apache.org/viewvc/incubator/sling/trunk/webmanager/src/main/java/org/apache/sling/console/web/internal/ConfigManagerBase.java?rev=577676&r1=577675&r2=577676&view=diff
==============================================================================
--- incubator/sling/trunk/webmanager/src/main/java/org/apache/sling/console/web/internal/ConfigManagerBase.java
(original)
+++ incubator/sling/trunk/webmanager/src/main/java/org/apache/sling/console/web/internal/ConfigManagerBase.java
Thu Sep 20 03:40:18 2007
@@ -17,8 +17,11 @@
 package org.apache.sling.console.web.internal;
 
 import java.util.HashMap;
+import java.util.Locale;
 import java.util.Map;
 
+import javax.servlet.http.HttpServletRequest;
+
 import org.osgi.framework.Bundle;
 import org.osgi.framework.BundleContext;
 import org.osgi.service.cm.Configuration;
@@ -173,6 +176,16 @@
         }
 
         return null;
+    }
+    
+    protected Locale getLocale(HttpServletRequest request) {
+        try {
+            return request.getLocale();
+        } catch (Throwable t) {
+            // expected in standard OSGi Servlet 2.1 environments
+            // fallback to using the default locale
+            return Locale.getDefault();
+        }
     }
 
     //--------- SCR Integration -----------------------------------------------



Mime
View raw message