locale retrieval from PortletRequestImpl throws NoSuchElement Exception
-----------------------------------------------------------------------

                 Key: PLUTO-541
                 URL: https://issues.apache.org/jira/browse/PLUTO-541
             Project: Pluto
          Issue Type: Bug
    Affects Versions: 2.0.0-M1, 2.0.0
            Reporter: Ussama Baggili
             Fix For: 2.0.0-M1, 2.0.0


when a portlet is trying to retrieve the locales and compare them with 
prefferedLocale and/or add them, the Enumeration that is used to retrieve the 
elements checks for "hasNextElement" but then retrieves "nextElement" twice.

I'm attaching a patch for th simple fix:

Index: 
pluto-container/src/main/java/org/apache/pluto/container/impl/PortletRequestImpl.java
===================================================================
--- 
pluto-container/src/main/java/org/apache/pluto/container/impl/PortletRequestImpl.java
       (revision 757432)
+++ 
pluto-container/src/main/java/org/apache/pluto/container/impl/PortletRequestImpl.java
       (working copy)
@@ -349,7 +349,7 @@
             Locale locale = (Locale)e.nextElement();
             if (!locale.equals(preferredLocale))
             {
-                locales.add((Locale)e.nextElement());
+                locales.add(locale);
             }
         }
         return Collections.enumeration(locales);
@@ -518,7 +518,7 @@
                 Locale locale = (Locale)e.nextElement();
                 if (!locale.equals(preferredLocale))
                 {
-                    locales.add(e.nextElement().toString());
+                    locales.add(locale.toString());
                 }
             }
             return Collections.enumeration(locales);


-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to