Author: nbelaevski
Date: 2009-03-18 18:27:47 -0400 (Wed, 18 Mar 2009)
New Revision: 13017
Modified:
trunk/ui/tree/src/main/java/org/richfaces/converter/BaseTreeConverter.java
trunk/ui/tree/src/test/java/org/richfaces/converter/BaseTreeConverterTest.java
Log:
https://jira.jboss.org/jira/browse/RF-4351
Modified: trunk/ui/tree/src/main/java/org/richfaces/converter/BaseTreeConverter.java
===================================================================
--- trunk/ui/tree/src/main/java/org/richfaces/converter/BaseTreeConverter.java 2009-03-18
20:13:06 UTC (rev 13016)
+++ trunk/ui/tree/src/main/java/org/richfaces/converter/BaseTreeConverter.java 2009-03-18
22:27:47 UTC (rev 13017)
@@ -16,7 +16,7 @@
public abstract class BaseTreeConverter implements Converter {
- private static final Pattern unescapePattern =
Pattern.compile("_(:|_)|_(x[0-9A-Fa-f]{2}|[0-9A-Fa-f]{4})?|(:)");
+ private static final Pattern unescapePattern =
Pattern.compile("_(:|_)|_(x[0-9A-Fa-f]{2}|u[0-9A-Fa-f]{4})?|(:)");
//private static final Pattern htmlEscapePattern =
Pattern.compile(":|_|[^0-9a-zA-Z]");
@@ -47,11 +47,10 @@
sb.append("x"); // _xef
break;
case 3:
- sb.append("0"); // _0fed
+ sb.append("u0"); // _u0fed
break;
case 4:
- //no padding required
- // _fcda
+ sb.append("u"); // _ufcda
break;
default:
@@ -91,9 +90,7 @@
matcher.appendReplacement(sb, "");
String hex = matcher.group(2);
if (hex != null) {
- if (hex.charAt(0) == 'x') {
- hex = hex.substring(1);
- }
+ hex = hex.substring(1);
int h = Integer.parseInt(hex, 16);
sb.append((char) h);
Modified: trunk/ui/tree/src/test/java/org/richfaces/converter/BaseTreeConverterTest.java
===================================================================
---
trunk/ui/tree/src/test/java/org/richfaces/converter/BaseTreeConverterTest.java 2009-03-18
20:13:06 UTC (rev 13016)
+++
trunk/ui/tree/src/test/java/org/richfaces/converter/BaseTreeConverterTest.java 2009-03-18
22:27:47 UTC (rev 13017)
@@ -79,11 +79,11 @@
sb.setLength(0);
converter.appendToKeyString(sb, "a\u037ec");
- assertEquals("a_037ec:", sb.toString());
+ assertEquals("a_u037ec:", sb.toString());
sb.setLength(0);
converter.appendToKeyString(sb, "a\ue1acd");
- assertEquals("a_e1acd:", sb.toString());
+ assertEquals("a_ue1acd:", sb.toString());
sb.setLength(0);
}
@@ -126,22 +126,22 @@
assertEquals("\u00a9", split.get(0));
assertEquals("c\u0098ab", split.get(1));
- split = converter.splitKeyString("_0008:a_0009bcd");
+ split = converter.splitKeyString("_u0008:a_u0009bcd");
assertEquals(2, split.size());
assertEquals("\u0008", split.get(0));
assertEquals("a\u0009bcd", split.get(1));
- split = converter.splitKeyString("_0028:a_00a9bcd");
+ split = converter.splitKeyString("_u0028:a_u00a9bcd");
assertEquals(2, split.size());
assertEquals("\u0028", split.get(0));
assertEquals("a\u00a9bcd", split.get(1));
- split = converter.splitKeyString("_0a28:a_0ea9bcd");
+ split = converter.splitKeyString("_u0a28:a_u0ea9bcd");
assertEquals(2, split.size());
assertEquals("\u0a28", split.get(0));
assertEquals("a\u0ea9bcd", split.get(1));
- split = converter.splitKeyString("_9e28:a_f3a9bcd");
+ split = converter.splitKeyString("_u9e28:a_uf3a9bcd");
assertEquals(2, split.size());
assertEquals("\u9e28", split.get(0));
assertEquals("a\uf3a9bcd", split.get(1));