|
16 | 16 |
|
17 | 17 | package org.springframework.session.data.mongo;
|
18 | 18 |
|
| 19 | +import org.springframework.lang.Nullable; |
| 20 | +import org.springframework.session.Session; |
| 21 | + |
19 | 22 | import java.time.Duration;
|
20 | 23 | import java.time.Instant;
|
21 |
| -import java.util.Date; |
22 |
| -import java.util.HashMap; |
23 |
| -import java.util.Map; |
24 |
| -import java.util.Objects; |
25 |
| -import java.util.Set; |
26 |
| -import java.util.UUID; |
| 24 | +import java.util.*; |
27 | 25 | import java.util.stream.Collectors;
|
28 | 26 |
|
29 |
| -import org.springframework.lang.Nullable; |
30 |
| -import org.springframework.session.Session; |
31 |
| - |
32 | 27 | /**
|
33 | 28 | * Session object providing additional information about the datetime of expiration.
|
34 | 29 | *
|
|
39 | 34 | public class MongoSession implements Session {
|
40 | 35 |
|
41 | 36 | /**
|
42 |
| - * Mongo doesn't support {@literal dot} in field names. We replace it with a very |
43 |
| - * rarely used character |
| 37 | + * Mongo doesn't support {@literal dot} in field names. We replace it with a unicode character from the Private Use Area. |
| 38 | + * <p> |
| 39 | + * NOTE: This was originally stored in unicode format. Delomboking the code caused it to get converted to another encoding, |
| 40 | + * which isn't supported on all systems, so we migrated back to unicode. The same character is being represented ensuring |
| 41 | + * binary compatibility. |
| 42 | + * |
| 43 | + * @see https://www.compart.com/en/unicode/U+F607 |
44 | 44 | */
|
45 |
| - private static final char DOT_COVER_CHAR = ''; |
| 45 | + private static final char DOT_COVER_CHAR = '\uF607'; |
46 | 46 |
|
47 | 47 | private String id;
|
48 | 48 |
|
@@ -106,8 +106,7 @@ public void setAttribute(String attributeName, Object attributeValue) {
|
106 | 106 |
|
107 | 107 | if (attributeValue == null) {
|
108 | 108 | removeAttribute(coverDot(attributeName));
|
109 |
| - } |
110 |
| - else { |
| 109 | + } else { |
111 | 110 | this.attrs.put(coverDot(attributeName), attributeValue);
|
112 | 111 | }
|
113 | 112 | }
|
|
0 commit comments