summaryrefslogtreecommitdiffstats
path: root/luni/src/main/java
diff options
context:
space:
mode:
Diffstat (limited to 'luni/src/main/java')
-rw-r--r--luni/src/main/java/org/apache/harmony/xml/parsers/DocumentBuilderImpl.java10
1 files changed, 6 insertions, 4 deletions
diff --git a/luni/src/main/java/org/apache/harmony/xml/parsers/DocumentBuilderImpl.java b/luni/src/main/java/org/apache/harmony/xml/parsers/DocumentBuilderImpl.java
index d1079c8..040a012 100644
--- a/luni/src/main/java/org/apache/harmony/xml/parsers/DocumentBuilderImpl.java
+++ b/luni/src/main/java/org/apache/harmony/xml/parsers/DocumentBuilderImpl.java
@@ -416,11 +416,13 @@ class DocumentBuilderImpl extends DocumentBuilder {
private String resolveCharacterReference(String value, int base) {
try {
- int ch = Integer.parseInt(value, base);
- if (ch < 0 || ch > Character.MAX_VALUE) {
- return null;
+ int codePoint = Integer.parseInt(value, base);
+ if (Character.isBmpCodePoint(codePoint)) {
+ return String.valueOf((char) codePoint);
+ } else {
+ char[] surrogatePair = Character.toChars(codePoint);
+ return new String(surrogatePair);
}
- return String.valueOf((char) ch);
} catch (NumberFormatException ex) {
return null;
}