You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@jena.apache.org by afs <gi...@git.apache.org> on 2018/03/06 20:10:06 UTC

[GitHub] jena pull request #373: JENA-1454: Fix to handle text output format.

GitHub user afs opened a pull request:

    https://github.com/apache/jena/pull/373

    JENA-1454: Fix to handle text output format.

    Bug fix to JENA-1454.

You can merge this pull request into a Git repository by running:

    $ git pull https://github.com/afs/jena fuseki-text

Alternatively you can review and apply these changes as the patch at:

    https://github.com/apache/jena/pull/373.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

    This closes #373
    
----
commit b5b4b13ad6bafb08c15a8588cd2ad43ec0f515e2
Author: Andy Seaborne <an...@...>
Date:   2018-03-06T19:50:19Z

    JENA-1454: Fix to handle text output format.

----


---

[GitHub] jena pull request #373: JENA-1454: Fix to handle text output format.

Posted by ajs6f <gi...@git.apache.org>.
Github user ajs6f commented on a diff in the pull request:

    https://github.com/apache/jena/pull/373#discussion_r172649522
  
    --- Diff: jena-fuseki2/jena-fuseki-core/src/main/java/org/apache/jena/fuseki/servlets/ResponseResultSet.java ---
    @@ -131,26 +130,30 @@ public static void doResponseResultSet(HttpAction action, ResultSet resultSet, P
                 contentType = contentTypeTextPlain ;
     
             // Some kind of general dispatch is neater but there are quite a few special cases.
    +        // text/plain is special because there is no ResultSetWriter for it (yet). 
    +        // Text plain is special because of the formatting by prologue.
    +        // text/plain is not a registered result set language. 
             //
             // JSON is special because of ?callback
    -        // 
    +        //
             // XML is special because of
             // (1) charset is a feature of XML, not the response 
             // (2) ?stylesheet=
             //
             // Thrift is special because
             // (1) charset is meaningless
             // (2) there is no boolean result form.
    -        //
    -        // Text plain is special because of the formatting by prologue.
    -        
    +
    +        if ( Objects.equals(serializationType, contentTypeTextPlain) ) {
    --- End diff --
    
    Just out of curiosity-- why `Objects.equals` here instead of `contentTypeTextPlain.equals` or `serializationType.equals`?


---

[GitHub] jena pull request #373: JENA-1454: Fix to handle text output format.

Posted by afs <gi...@git.apache.org>.
Github user afs commented on a diff in the pull request:

    https://github.com/apache/jena/pull/373#discussion_r172680400
  
    --- Diff: jena-fuseki2/jena-fuseki-core/src/main/java/org/apache/jena/fuseki/servlets/ResponseResultSet.java ---
    @@ -131,26 +130,30 @@ public static void doResponseResultSet(HttpAction action, ResultSet resultSet, P
                 contentType = contentTypeTextPlain ;
     
             // Some kind of general dispatch is neater but there are quite a few special cases.
    +        // text/plain is special because there is no ResultSetWriter for it (yet). 
    +        // Text plain is special because of the formatting by prologue.
    +        // text/plain is not a registered result set language. 
             //
             // JSON is special because of ?callback
    -        // 
    +        //
             // XML is special because of
             // (1) charset is a feature of XML, not the response 
             // (2) ?stylesheet=
             //
             // Thrift is special because
             // (1) charset is meaningless
             // (2) there is no boolean result form.
    -        //
    -        // Text plain is special because of the formatting by prologue.
    -        
    +
    +        if ( Objects.equals(serializationType, contentTypeTextPlain) ) {
    --- End diff --
    
    Style, no more :  `Objects.equals` copes with null in the same way the back-to-front `constant.equals(variable)` is also a null-defending idiom. Not that there will be nulls.  It could be a switch on strings. It should be `lang` driven but there is no text result set writer ATM and text is odd because it uses prefixes and no other result set format does.
    
    This is a quick fix to restore what become broken in the JENA-1454 redesign.


---

[GitHub] jena pull request #373: JENA-1454: Fix to handle text output format.

Posted by asfgit <gi...@git.apache.org>.
Github user asfgit closed the pull request at:

    https://github.com/apache/jena/pull/373


---

[GitHub] jena pull request #373: JENA-1454: Fix to handle text output format.

Posted by ajs6f <gi...@git.apache.org>.
Github user ajs6f commented on a diff in the pull request:

    https://github.com/apache/jena/pull/373#discussion_r172649617
  
    --- Diff: jena-fuseki2/jena-fuseki-core/src/main/java/org/apache/jena/fuseki/servlets/ResponseResultSet.java ---
    @@ -131,26 +130,30 @@ public static void doResponseResultSet(HttpAction action, ResultSet resultSet, P
                 contentType = contentTypeTextPlain ;
     
             // Some kind of general dispatch is neater but there are quite a few special cases.
    +        // text/plain is special because there is no ResultSetWriter for it (yet). 
    +        // Text plain is special because of the formatting by prologue.
    +        // text/plain is not a registered result set language. 
             //
             // JSON is special because of ?callback
    -        // 
    +        //
             // XML is special because of
             // (1) charset is a feature of XML, not the response 
             // (2) ?stylesheet=
             //
             // Thrift is special because
             // (1) charset is meaningless
             // (2) there is no boolean result form.
    -        //
    -        // Text plain is special because of the formatting by prologue.
    -        
    +
    +        if ( Objects.equals(serializationType, contentTypeTextPlain) ) {
    --- End diff --
    
    Oh, I see-- this was cut from down below. NM.


---