jena-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From a...@apache.org
Subject svn commit: r1179733 - /incubator/jena/Jena2/ARQ/trunk/src/test/java/org/openjena/riot/lang/UnitTestTurtleBadSyntax.java
Date Thu, 06 Oct 2011 18:11:56 GMT
Author: andy
Date: Thu Oct  6 18:11:56 2011
New Revision: 1179733

URL: http://svn.apache.org/viewvc?rev=1179733&view=rev
Log:
Don't treat missing file as parse error.

Modified:
    incubator/jena/Jena2/ARQ/trunk/src/test/java/org/openjena/riot/lang/UnitTestTurtleBadSyntax.java

Modified: incubator/jena/Jena2/ARQ/trunk/src/test/java/org/openjena/riot/lang/UnitTestTurtleBadSyntax.java
URL: http://svn.apache.org/viewvc/incubator/jena/Jena2/ARQ/trunk/src/test/java/org/openjena/riot/lang/UnitTestTurtleBadSyntax.java?rev=1179733&r1=1179732&r2=1179733&view=diff
==============================================================================
--- incubator/jena/Jena2/ARQ/trunk/src/test/java/org/openjena/riot/lang/UnitTestTurtleBadSyntax.java
(original)
+++ incubator/jena/Jena2/ARQ/trunk/src/test/java/org/openjena/riot/lang/UnitTestTurtleBadSyntax.java
Thu Oct  6 18:11:56 2011
@@ -18,13 +18,15 @@
 
 package org.openjena.riot.lang;
 
-import junit.framework.TestCase ;
-import org.openjena.riot.system.JenaReaderTurtle2 ;
-
-import com.hp.hpl.jena.rdf.model.Model ;
-import com.hp.hpl.jena.rdf.model.ModelFactory ;
-import com.hp.hpl.jena.rdf.model.RDFReader ;
-import com.hp.hpl.jena.shared.JenaException ;
+import java.io.InputStream ;
+
+import junit.framework.TestCase ;
+import org.openjena.atlas.io.IO ;
+import org.openjena.atlas.lib.SinkNull ;
+import org.openjena.riot.RiotException ;
+import org.openjena.riot.RiotReader ;
+
+import com.hp.hpl.jena.graph.Triple ;
 
 
 public class UnitTestTurtleBadSyntax extends TestCase
@@ -34,16 +36,13 @@ public class UnitTestTurtleBadSyntax ext
     
     @Override
     public void runTest()
-    {
-        Model model = ModelFactory.createDefaultModel() ;
-        RDFReader t = new JenaReaderTurtle2() ;
-        try {
-            t.read(model, uri) ;
-            fail("Bad syntax test succeed in parsing the file") ;
-        } catch (JenaException ex)
-        {
-            return ;    
-        }
-
+    {
+        InputStream in = IO.openFile(uri) ;
+        assertNotNull(in) ;
+        LangRIOT parser = RiotReader.createParserTurtle(in, uri, new SinkNull<Triple>())
;
+        try {
+            parser.parse() ;
+        } catch (RiotException ex) { return ; }
+        fail("Bad syntax RDF/JSON test succeed in parsing the file") ;
     }
 }



Mime
View raw message