You are viewing a plain text version of this content. The canonical link for it is here.
Posted to pr@jena.apache.org by GitBox <gi...@apache.org> on 2020/08/17 20:58:23 UTC

[GitHub] [jena] afs commented on a change in pull request #783: JENA-1944: RDF Thrift tidy-up

afs commented on a change in pull request #783:
URL: https://github.com/apache/jena/pull/783#discussion_r471771274



##########
File path: jena-arq/src/main/java/org/apache/jena/riot/RDFParserRegistry.java
##########
@@ -206,14 +206,24 @@ public ReaderRIOT create(Lang language, ParserProfile profile) {
     private static class ReaderRIOTFactoryThrift implements ReaderRIOTFactory {
         @Override
         public ReaderRIOT create(Lang language, ParserProfile profile) {
-            return new ReaderRDFThrift() ;
+            return new ReaderRDFThrift(profile) ;
         }
     }
 
     private static class ReaderRDFThrift implements ReaderRIOT {
+        private final ParserProfile profile; 
+        public ReaderRDFThrift(ParserProfile profile) { this.profile = profile; }
+
         @Override
         public void read(InputStream in, String baseURI, ContentType ct, StreamRDF output, Context context) {
-            BinRDF.inputStreamToStream(in, output) ;
+            try {
+                BinRDF.inputStreamToStream(in, output);
+            } catch (RiotException ex) {
+                if ( profile != null && profile.getErrorHandler() != null )
+                    profile.getErrorHandler().error(ex.getMessage(), -1, -1);
+                else
+                    System.err.println(ex.getMessage());

Review comment:
       Thanks for seeing that. `Logger` in some way would be better
   
   RDFThrift is a bit different because the parser does not signal errors or warnings like the other text-syntax parsers. Such raw binary is supposed to be "right" and errors are actually low level encoding problems that Thrift will catch and complain about. But each case must throw an exception regardless of the errorhandler.
   




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: pr-unsubscribe@jena.apache.org
For additional commands, e-mail: pr-help@jena.apache.org