streams-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From steveblackmon <...@git.apache.org>
Subject [GitHub] incubator-streams pull request: found and fixed a bug with GraphHt...
Date Thu, 30 Jul 2015 20:57:10 GMT
Github user steveblackmon commented on a diff in the pull request:

    https://github.com/apache/incubator-streams/pull/240#discussion_r35919668
  
    --- Diff: streams-contrib/streams-persist-graph/src/main/java/org/apache/streams/graph/GraphHttpPersistWriter.java
---
    @@ -84,54 +86,79 @@ else if( configuration.getType().equals(GraphHttpConfiguration.Type.REXSTER))
{
         protected ObjectNode preparePayload(StreamsDatum entry) {
     
             Activity activity = null;
    +        ActivityObject activityObject = null;
     
             if (entry.getDocument() instanceof Activity) {
                 activity = (Activity) entry.getDocument();
    -        } else if (entry.getDocument() instanceof ObjectNode) {
    -            activity = mapper.convertValue(entry.getDocument(), Activity.class);
    -        } else if (entry.getDocument() instanceof String) {
    -            try {
    -                activity = mapper.readValue((String) entry.getDocument(), Activity.class);
    -            } catch (Throwable e) {
    -                LOGGER.warn(e.getMessage());
    +        } else if (entry.getDocument() instanceof ActivityObject) {
    +            activityObject = (ActivityObject) entry.getDocument();
    +        } else {
    +            ObjectNode objectNode;
    +            if (entry.getDocument() instanceof ObjectNode) {
    +                objectNode = (ObjectNode) entry.getDocument();
    +            } else if( entry.getDocument() instanceof String) {
    +                try {
    +                    objectNode = mapper.readValue((String) entry.getDocument(), ObjectNode.class);
    +                } catch (IOException e) {
    +                    LOGGER.error("Can't handle input: ", entry);
    +                    return mapper.createObjectNode();
    +                }
    +            } else {
    +                LOGGER.error("Can't handle input: ", entry);
    +                return mapper.createObjectNode();
    --- End diff --
    
    I can see your point.  I'll change the interface to allow exceptions to be thrown, with
the default response in the parent class being to use a blank payload.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

Mime
View raw message