jena-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From a...@apache.org
Subject svn commit: r1304618 - /incubator/jena/Jena2/TDB/trunk/src/test/java/com/hp/hpl/jena/tdb/nodetable/TestCodec.java
Date Fri, 23 Mar 2012 21:41:38 GMT
Author: andy
Date: Fri Mar 23 21:41:38 2012
New Revision: 1304618

URL: http://svn.apache.org/viewvc?rev=1304618&view=rev
Log:
Tests for safe handling of bad unicode.  JENA-225.

Modified:
    incubator/jena/Jena2/TDB/trunk/src/test/java/com/hp/hpl/jena/tdb/nodetable/TestCodec.java

Modified: incubator/jena/Jena2/TDB/trunk/src/test/java/com/hp/hpl/jena/tdb/nodetable/TestCodec.java
URL: http://svn.apache.org/viewvc/incubator/jena/Jena2/TDB/trunk/src/test/java/com/hp/hpl/jena/tdb/nodetable/TestCodec.java?rev=1304618&r1=1304617&r2=1304618&view=diff
==============================================================================
--- incubator/jena/Jena2/TDB/trunk/src/test/java/com/hp/hpl/jena/tdb/nodetable/TestCodec.java
(original)
+++ incubator/jena/Jena2/TDB/trunk/src/test/java/com/hp/hpl/jena/tdb/nodetable/TestCodec.java
Fri Mar 23 21:41:38 2012
@@ -83,6 +83,16 @@ public class TestCodec extends BaseTest 
     @Test public void nodec_lit_20()    { test ("1") ; }
     @Test public void nodec_lit_21()    { test ("12.3") ; }
     @Test public void nodec_lit_22()    { test ("''^^<>") ; }
+
+    // Bad Unicode.
+    static private final String binaryStr1            = "abc\uD800xyz" ;    // A single surrogate,
without it's pair. 
+    static private final String binaryStr2            = "\uD800" ;          // A single surrogate,
without it's pair. 
+    static private final String binaryStr3            = "\u0000" ;          // A zero character
 
+
+    @Test public void nodec_lit_30()    { test ("'"+binaryStr1+"'") ; }
+    @Test public void nodec_lit_31()    { test ("'"+binaryStr2+"'") ; }
+    @Test public void nodec_lit_32()    { test ("'"+binaryStr3+"'") ; }
+
     
     @Test public void nodec_uri_01()    { test ("<>") ; }
     @Test public void nodec_uri_02()    { test ("<http://example/>") ; }



Mime
View raw message