CVS Update: xmlpull-api-v1/src/java/tests/org/xmlpull/v1/tests
Aleksander Andrzej Slominski <[email protected]> Tue, 20 Jan 2004 18:44:26 -0500 (EST)
| Newsgroups | gmane.text.xml.xmlpull.devel |
|---|---|
| Message-ID | <[email protected]> |
aslom 04/01/20 18:44:26
Modified: src/java/tests/org/xmlpull/v1/tests TestSerialize.java
Log:
updated tests to check for null char in input
Revision Changes Path
1.6 +63 -49 xmlpull-api-v1/src/java/tests/org/xmlpull/v1/tests/TestSerialize.java
Index: TestSerialize.java
===================================================================
RCS file: /l/extreme/cvspub/xmlpull-api-v1/src/java/tests/org/xmlpull/v1/tests/TestSerialize.java,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -b -t -w -r1.5 -r1.6
--- TestSerialize.java 20 Jan 2004 17:49:19 -0000 1.5
+++ TestSerialize.java 20 Jan 2004 23:44:26 -0000 1.6
@@ -227,7 +227,7 @@
//byte[] binput = "<foo>test</foo>".getBytes("UTF8");
byte[] binput = baos.toByteArray();
- System.out.println(getClass()+" binput="+printable(new String(binput)));
+ //System.out.println(getClass()+" binput="+printable(new String(binput)));
xpp.setInput(new ByteArrayInputStream( binput ), "UTF-8" );
assertEquals("UTF-8", xpp.getInputEncoding());
@@ -244,6 +244,20 @@
checkParserState(xpp, 1, xpp.END_TAG, "foo", null, false, -1);
xpp.next();
checkParserState(xpp, 0, xpp.END_DOCUMENT, null, null, false, -1);
+
+ baos = new ByteArrayOutputStream();
+ ser.setOutput(baos, "UTF-8");
+ ser.startDocument("UTF-8", null);
+ ser.startTag("", "foo");
+ s = "test\u0000\t\r\n";
+ try {
+ ser.attribute(null, "att", s);
+ fail("expected to fail as zero chartacter is illegal both in XML 1.0 and 1.1");
+ } catch(Exception e) {}
+ try {
+ ser.text(s);
+ fail("expected to fail as zero chartacter is illegal both in XML 1.0 and 1.1");
+ } catch(Exception e) {}
}
}
------------------------ Yahoo! Groups Sponsor ---------------------~-->
Buy Ink Cartridges or Refill Kits for your HP, Epson, Canon or Lexmark
Printer at MyInks.com. Free s/h on orders $50 or more to the US & Canada.
http://www.c1tracking.com/l.asp?cid=5511
http://us.click.yahoo.com/mOAaAA/3exGAA/qnsNAA/2U_rlB/TM
---------------------------------------------------------------------~->
Yahoo! Groups Links
To visit your group on the web, go to:
http://groups.yahoo.com/group/xmlpull-dev/
To unsubscribe from this group, send an email to:
[email protected]
Your use of Yahoo! Groups is subject to:
http://docs.yahoo.com/info/terms/