apex-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tweise <...@git.apache.org>
Subject [GitHub] incubator-apex-core pull request: APEXCORE-10 #resolve Changes for...
Date Fri, 08 Apr 2016 03:59:37 GMT
Github user tweise commented on a diff in the pull request:

    https://github.com/apache/incubator-apex-core/pull/250#discussion_r58977816
  
    --- Diff: api/src/main/java/com/datatorrent/api/StringCodec.java ---
    @@ -377,4 +384,43 @@ public String toString(Class<? extends T> clazz)
         private static final long serialVersionUID = 201312082053L;
       }
     
    +  public class JsonStringCodec<T> implements StringCodec<T>, Serializable
    +  {
    +    private static final long serialVersionUID = 2513932518264776006L;
    +    Class<?> clazz;
    +
    +    public JsonStringCodec(Class<T> clazz)
    +    {
    +      this.clazz = clazz;
    +    }
    +
    +    @Override
    +    public T fromString(String string)
    +    {
    +      try {
    +        ObjectMapper mapper = new ObjectMapper();
    +        mapper.configure(DeserializationConfig.Feature.FAIL_ON_UNKNOWN_PROPERTIES, false);
    +        ObjectReader reader = mapper.reader(clazz);
    +        return reader.readValue(string);
    +      } catch (IOException e) {
    +        Throwables.propagate(e);
    --- End diff --
    
    Would be nice to fix the other occurrences in this file also and remove usage of DTThrowable.


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