cxf-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "ASF GitHub Bot (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (CXF-7462) OutboundSseEventImpl could use some minor tweaks
Date Wed, 02 Aug 2017 16:30:01 GMT

    [ https://issues.apache.org/jira/browse/CXF-7462?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16111223#comment-16111223
] 

ASF GitHub Bot commented on CXF-7462:
-------------------------------------

Github user andymc12 commented on a diff in the pull request:

    https://github.com/apache/cxf/pull/301#discussion_r130927024
  
    --- Diff: rt/rs/sse/src/main/java/org/apache/cxf/jaxrs/sse/OutboundSseEventImpl.java ---
    @@ -92,6 +92,7 @@ public Builder data(GenericType newType, Object newData) {
     
             @Override
             public Builder data(Object newData) {
    +            this.type = newData.getClass();
    --- End diff --
    
    Good catch!  Do you have any thoughts on what we should do if a null is passed in?  The
spec throws an `IllegalArgumentException` if the user passes null to `sse.newEvent(String
data)`.  For `builder.data(null)`, we could either do the same, or take null as the data and
use Object.class as the default type.  I'm leaning toward throwing the exception.  What do
you think?


> OutboundSseEventImpl could use some minor tweaks
> ------------------------------------------------
>
>                 Key: CXF-7462
>                 URL: https://issues.apache.org/jira/browse/CXF-7462
>             Project: CXF
>          Issue Type: Improvement
>          Components: JAX-RS
>    Affects Versions: 3.2.0
>            Reporter: Andy McCright
>            Priority: Minor
>             Fix For: 3.2.0
>
>
> The OutboundSseEventImpl class could use some minor tweaks, including:
> 1) Make the fields final to reflect that the event is immutable.
> 2) Use defaults for the data type (String.class) and media type (SERVER_SENT_EVENT_TYPE).
> 3) Restrict the constructor's visibility.
> I also plan to add some tests for these changes.



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)

Mime
View raw message