tinkerpop-dev 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] (TINKERPOP-1251) NPE in ObjectWritable.toString
Date Wed, 06 Apr 2016 21:55:25 GMT

    [ https://issues.apache.org/jira/browse/TINKERPOP-1251?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15229214#comment-15229214

ASF GitHub Bot commented on TINKERPOP-1251:

Github user dalaro commented on the pull request:

    Thanks, Marko.  I think the compareTo change that accompanied the toString fix in fa2d626951f799a0a50191f9653a17b5c18cdc20
is a regression, but the discussion about it is ongoing in https://issues.apache.org/jira/browse/TINKERPOP-1251
anyway, so I'll kill this PR.

> NPE in ObjectWritable.toString
> ------------------------------
>                 Key: TINKERPOP-1251
>                 URL: https://issues.apache.org/jira/browse/TINKERPOP-1251
>             Project: TinkerPop
>          Issue Type: Bug
>          Components: io
>    Affects Versions: 3.1.1-incubating
>            Reporter: Dan LaRocque
>            Assignee: Marko A. Rodriguez
>             Fix For: 3.2.0-incubating, 3.1.2-incubating
> ObjectWritable is a fancy wrapper around single reference named {{t}}.
> ObjectWritable is internally inconsistent about whether {{t==null}} is allowed.
> {{toString}} suggests that {{t==null}} is an illegal state, since it throws NPE:
> {code}
>     public String toString() {
>         return this.t.toString();
>     }
> {code}
> Compare with {{isEmpty}}, which suggests that {{t==null}} is a legal state:
> {code}
>     public boolean isEmpty() {
>         return null == this.t;
>     }
> {code}
> IMO toString should just tolerate null.
> Why does this matter?  One case where this {{toString}} gets invoked is Java serialization
with debugging info turned on ("sun.io.serialization.extendedDebugInfo" sys prop).  When so
configured, Java serialization code (ObjectOutputStream) invokes {{toString}} on the objects
it processes.  If {{toString}} throws this NPE, serialization fails.  This is frustrating,
since serialization of null ObjectWritables works fine with debugging info suppressed, but
breaks with debugging info enabled.

This message was sent by Atlassian JIRA

View raw message