// This is testing a work-around for a Xerces bug
// http://nagoya.apache.org/bugzilla/show_bug.cgi?id=27583
// that reports this as an IOException rather than a SAXException
public void testBuildMalformedDocumentWithUnpairedSurrogate() 
      throws IOException {
        String doc = "<doc>A\uD800A</doc>";
        try {
            builder.build(doc, "http://www.example.com");   
            fail("Allowed malformed doc");
        }
        catch (ParsingException success) {
            assertNotNull(success.getMessage());
            assertEquals("http://www.example.com/", success.getURI());
        }
    }
public void testBuildMalformedDocumentWithUnpairedSurrogate()
throws IOException {
String doc = "<doc>A\uD800A</doc>";
try {
builder.build(doc, "http://www.example.com");
fail("Allowed malformed doc");
}
catch (ParsingException success) {
assertNotNull(success.getMessage());
assertEquals("http://www.example.com/", success.getURI());
}
}
public void testBuildMalformedDocumentWithUnpairedSurrogate()
throws IOException {
String doc = "<doc>A\uD800A</doc>";
try {
builder.build(doc, "http://www.example.com");
fail("Allowed malformed doc");
}
catch (ParsingException success) {
assertNotNull(success.getMessage());
assertEquals("http://www.example.com/", success.getURI());
}
}
public void testBuildMalformedDocumentWithUnpairedSurrogate()
throws IOException {
String doc = "<doc>A\uD800A</doc>";
try {
builder.build(doc, "http://www.example.com");
fail("Allowed malformed doc");
}
catch (ParsingException success) {
assertNotNull(success.getMessage());
assertEquals("http://www.example.com/", success.getURI());
}
}