You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@xalan.apache.org by mi...@apache.org on 2003/10/23 17:56:07 UTC
cvs commit: xml-xalan/java/src/org/apache/xml/res XMLErrorResources.java
minchau 2003/10/23 08:56:06
Modified: java/src/org/apache/xml/serializer Encodings.properties
ToTextStream.java
java/src/org/apache/xml/res XMLErrorResources.java
Log:
patch to emit emit error message for method="text"
when output character not valid in the output encoding.
PR: bug 795
Submitted by: Richard Cao
Reviewed by: Brian Minchau
Revision Changes Path
1.3 +3 -3 xml-xalan/java/src/org/apache/xml/serializer/Encodings.properties
Index: Encodings.properties
===================================================================
RCS file: /home/cvs/xml-xalan/java/src/org/apache/xml/serializer/Encodings.properties,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- Encodings.properties 13 Aug 2003 16:30:52 -0000 1.2
+++ Encodings.properties 23 Oct 2003 15:56:06 -0000 1.3
@@ -4,7 +4,7 @@
# Patch attributed to havardw@underdusken.no (H�vard Wigtil)
Cp1251 WINDOWS-1251 0x00FF
Cp1252 WINDOWS-1252 0x00FF
-ISO8859_1 US-ASCII,ISO-8859-1 0x007F
+ISO8859_1 ISO-8859-1 0x00FF
# Patch attributed to havardw@underdusken.no (H�vard Wigtil)
ISO8859-1 ISO-8859-1 0x00FF
ISO8859_2 ISO-8859-2 0x00FF
@@ -25,7 +25,7 @@
ISO8859_9 ISO-8859-9 0x00FF
ISO8859-9 ISO-8859-9 0x00FF
# # ?
-8859_1 US-ASCII,ISO-8859-1 0x00FF
+8859_1 ISO-8859-1 0x00FF
8859_2 ISO-8859-2 0x00FF
8859_3 ISO-8859-3 0x00FF
8859_4 ISO-8859-4 0x00FF
@@ -76,7 +76,7 @@
Cp918 EBCDIC-CP-AR2 0x00FF
Cp1047 IBM1047,IBM-1047 0x00FF
MacTEC MacRoman 0x00FF
-ASCII ASCII,ISO-Latin-1 0x007F
+ASCII ASCII,US-ASCII 0x007F
Unicode UNICODE,UTF-16 0xFFFF
UTF8 UTF-8 0xFFFF
# patch attributed to Jinsung Lee
1.13 +12 -3 xml-xalan/java/src/org/apache/xml/serializer/ToTextStream.java
Index: ToTextStream.java
===================================================================
RCS file: /home/cvs/xml-xalan/java/src/org/apache/xml/serializer/ToTextStream.java,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -r1.12 -r1.13
--- ToTextStream.java 6 Oct 2003 14:33:07 -0000 1.12
+++ ToTextStream.java 23 Oct 2003 15:56:06 -0000 1.13
@@ -61,7 +61,8 @@
import java.io.IOException;
-import org.apache.xml.serializer.CharInfo;
+import org.apache.xml.res.XMLErrorResources;
+import org.apache.xml.res.XMLMessages;
import org.xml.sax.Attributes;
import org.xml.sax.SAXException;
@@ -356,7 +357,11 @@
}
else
{
- writer.write(c);
+ String encoding = getEncoding();
+ String integralValue = Integer.toString(c);
+ throw new SAXException(XMLMessages.createXMLMessage(
+ XMLErrorResources.ER_ILLEGAL_CHARACTER,
+ new Object[]{ integralValue, encoding}));
}
}
}
@@ -383,7 +388,11 @@
}
else
{
- writer.write(c);
+ String encoding = getEncoding();
+ String integralValue = Integer.toString(c);
+ throw new SAXException(XMLMessages.createXMLMessage(
+ XMLErrorResources.ER_ILLEGAL_CHARACTER,
+ new Object[]{ integralValue, encoding}));
}
}
}
1.5 +4 -0 xml-xalan/java/src/org/apache/xml/res/XMLErrorResources.java
Index: XMLErrorResources.java
===================================================================
RCS file: /home/cvs/xml-xalan/java/src/org/apache/xml/res/XMLErrorResources.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- XMLErrorResources.java 1 Apr 2003 19:18:23 -0000 1.4
+++ XMLErrorResources.java 23 Oct 2003 15:56:06 -0000 1.5
@@ -204,6 +204,7 @@
public static final String ER_COULD_NOT_LOAD_METHOD_PROPERTY = "ER_COULD_NOT_LOAD_METHOD_PROPERTY";
public static final String ER_SERIALIZER_NOT_CONTENTHANDLER = "ER_SERIALIZER_NOT_CONTENTHANDLER";
public static final String ER_ILLEGAL_ATTRIBUTE_POSITION = "ER_ILLEGAL_ATTRIBUTE_POSITION";
+ public static final String ER_ILLEGAL_CHARACTER = "ER_ILLEGAL_CHARACTER";
/*
* Now fill in the message text.
@@ -462,6 +463,9 @@
{ER_COULD_NOT_LOAD_RESOURCE,
"Could not load ''{0}'' (check CLASSPATH), now using just the defaults"},
+
+ { ER_ILLEGAL_CHARACTER,
+ "Attempt to output character of integral value {0} that is not represented in specified output encoding of {1}."},
{ER_COULD_NOT_LOAD_METHOD_PROPERTY,
"Could not load the propery file ''{0}'' for output method ''{1}'' (check CLASSPATH)" }
---------------------------------------------------------------------
To unsubscribe, e-mail: xalan-cvs-unsubscribe@xml.apache.org
For additional commands, e-mail: xalan-cvs-help@xml.apache.org