streams-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From eponvert <...@git.apache.org>
Subject [GitHub] incubator-streams pull request: found and fixed a bug with GraphHt...
Date Mon, 06 Jul 2015 15:59:38 GMT
Github user eponvert commented on a diff in the pull request:

    https://github.com/apache/incubator-streams/pull/240#discussion_r33950035
  
    --- 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();
    --- End diff --
    
    Is eating the exception and returning a default object node the right strategy here? Shouldn't
the IOE be thrown up to the caller?


---
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