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

Aki Sukegawa commented on THRIFT-3902:
--------------------------------------

{code}
    if (host_.length() == 0) {
{code}
This means that host_ is null.
Maybe you're passing null sometimes ?

But the code is admittedly strange in that it checks the length field without 
null check.
Also as the next thing it does is to throw exception right away, it could have 
checked the host argument in constructor since it's completely unusable with 
null or empty host.

> TFramedTransport.open throws NullPointerException
> -------------------------------------------------
>
>                 Key: THRIFT-3902
>                 URL: https://issues.apache.org/jira/browse/THRIFT-3902
>             Project: Thrift
>          Issue Type: Bug
>          Components: Java - Library
>    Affects Versions: 0.9.3
>         Environment: CentOS Linux release 7.1.1503 (Core), JVM 1.7.0_67
>            Reporter: Zeynep Arikoglu
>            Priority: Critical
>
> The following java code sometimes throws NPE:
> final TFramedTransport transport = new TFramedTransport(new TSocket(host, 
> port));
> transport.open();
> Stacktrace is as follows:
> [junit] Exception in thread "Thread-620" java.lang.NullPointerException
> [junit]       at org.apache.thrift.transport.TSocket.open(TSocket.java:209)
> [junit]       at 
> org.apache.thrift.transport.TFramedTransport.open(TFramedTransport.java:81)
> There is no other information related to the problem.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to