geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sa...@apache.org
Subject svn commit: r1637646 - in /geronimo/specs/trunk/geronimo-javamail_1.4_spec/src: main/java/javax/mail/internet/ParameterList.java test/java/javax/mail/internet/ContentTypeTest.java
Date Sun, 09 Nov 2014 10:30:07 GMT
Author: salyh
Date: Sun Nov  9 10:30:06 2014
New Revision: 1637646

URL: http://svn.apache.org/r1637646
Log:
fixed parameter list iteration order (again) to work with java 8

Modified:
    geronimo/specs/trunk/geronimo-javamail_1.4_spec/src/main/java/javax/mail/internet/ParameterList.java
    geronimo/specs/trunk/geronimo-javamail_1.4_spec/src/test/java/javax/mail/internet/ContentTypeTest.java

Modified: geronimo/specs/trunk/geronimo-javamail_1.4_spec/src/main/java/javax/mail/internet/ParameterList.java
URL: http://svn.apache.org/viewvc/geronimo/specs/trunk/geronimo-javamail_1.4_spec/src/main/java/javax/mail/internet/ParameterList.java?rev=1637646&r1=1637645&r2=1637646&view=diff
==============================================================================
--- geronimo/specs/trunk/geronimo-javamail_1.4_spec/src/main/java/javax/mail/internet/ParameterList.java
(original)
+++ geronimo/specs/trunk/geronimo-javamail_1.4_spec/src/main/java/javax/mail/internet/ParameterList.java
Sun Nov  9 10:30:06 2014
@@ -49,7 +49,7 @@ public class ParameterList {
 
     private static final int HEADER_SIZE_LIMIT = 76;
 
-    private Map _parameters = new LinkedHashMap(); //predictable iteration order, see toString()
+    private final Map _parameters = new LinkedHashMap(); //predictable iteration order, see
toString()
 
     private boolean encodeParameters = false;
     private boolean decodeParameters = false;
@@ -213,10 +213,11 @@ public class ParameterList {
     public String toString(int used) {
         StringBuffer stringValue = new StringBuffer();
 
-        Iterator values = _parameters.values().iterator();
+        Iterator entries = _parameters.entrySet().iterator();
 
-        while (values.hasNext()) {
-            ParameterValue parm = (ParameterValue)values.next();
+        while (entries.hasNext()) {
+            Map.Entry entry = (Map.Entry) entries.next();
+            ParameterValue parm = (ParameterValue) entry.getValue();
             // get the values we're going to encode in here.
             String name = parm.getEncodedName();
             String value = parm.toString();

Modified: geronimo/specs/trunk/geronimo-javamail_1.4_spec/src/test/java/javax/mail/internet/ContentTypeTest.java
URL: http://svn.apache.org/viewvc/geronimo/specs/trunk/geronimo-javamail_1.4_spec/src/test/java/javax/mail/internet/ContentTypeTest.java?rev=1637646&r1=1637645&r2=1637646&view=diff
==============================================================================
--- geronimo/specs/trunk/geronimo-javamail_1.4_spec/src/test/java/javax/mail/internet/ContentTypeTest.java
(original)
+++ geronimo/specs/trunk/geronimo-javamail_1.4_spec/src/test/java/javax/mail/internet/ContentTypeTest.java
Sun Nov  9 10:30:06 2014
@@ -99,6 +99,12 @@ public class ContentTypeTest extends Tes
         assertEquals("text/plain; foo=bar", type.toString());
         type.setParameter("bar", "me@apache.org");
         assertEquals("text/plain; foo=bar; bar=\"me@apache.org\"", type.toString());
+        type.setParameter("x", "y");
+        assertEquals("text/plain; foo=bar; bar=\"me@apache.org\"; x=y", type.toString());
+        type.setParameter("x", "z");
+        assertEquals("text/plain; foo=bar; bar=\"me@apache.org\"; x=z", type.toString());
+        type.setParameter("foo", "bar2");
+        assertEquals("text/plain; foo=bar2; bar=\"me@apache.org\"; x=z", type.toString());
     }
     public void testMatchContentType() throws ParseException {
         ContentType type = new ContentType("text/plain");



Mime
View raw message