commons-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Gary Gregory (JIRA)" <j...@apache.org>
Subject [jira] [Updated] (NET-643) NPE when closing tellnet stream
Date Fri, 25 Aug 2017 15:16:00 GMT

     [ https://issues.apache.org/jira/browse/NET-643?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]

Gary Gregory updated NET-643:
-----------------------------
    Description: 
our code:
{code:java}
try {
            TelnetClient telnetClient = new TelnetClient();
            telnetClient.connect(address, port);
            mInput = new BufferedInputStream(telnetClient.getInputStream());
            mOutput = new PrintStream(telnetClient.getOutputStream());
            BufferedReader br = new BufferedReader(new InputStreamReader(this.mInput));
            ... some IO on streams ...
} catch (IOException e) {
            if (Dbg.DEBUG) {
                Dbg.d(TAG, "telnet exception " + Dbg.getStackTraceString(e));
            }
            return false;
} finally {
            try {
                  if (mInput != null) mInput.close();
                  if (mOutput != null) mOutput.close();
            } catch (IOException ignored) {}
}
{code}

  was:
our code:
try {
            TelnetClient telnetClient = new TelnetClient();
            telnetClient.connect(address, port);
            mInput = new BufferedInputStream(telnetClient.getInputStream());
            mOutput = new PrintStream(telnetClient.getOutputStream());
            BufferedReader br = new BufferedReader(new InputStreamReader(this.mInput));
            ... some IO on streams ...
} catch (IOException e) {
            if (Dbg.DEBUG) {
                Dbg.d(TAG, "telnet exception " + Dbg.getStackTraceString(e));
            }
            return false;
} finally {
            try {
                  if (mInput != null) mInput.close();
                  if (mOutput != null) mOutput.close();
            } catch (IOException ignored) {}
}


> NPE when closing tellnet stream
> -------------------------------
>
>                 Key: NET-643
>                 URL: https://issues.apache.org/jira/browse/NET-643
>             Project: Commons Net
>          Issue Type: Bug
>          Components: Telnet
>    Affects Versions: 3.6
>         Environment: Observed in Android application. Some people encountered similar
NPE on desktop years ago:
> https://bugs.eclipse.org/bugs/show_bug.cgi?id=395149
>            Reporter: Vasily
>
> our code:
> {code:java}
> try {
>             TelnetClient telnetClient = new TelnetClient();
>             telnetClient.connect(address, port);
>             mInput = new BufferedInputStream(telnetClient.getInputStream());
>             mOutput = new PrintStream(telnetClient.getOutputStream());
>             BufferedReader br = new BufferedReader(new InputStreamReader(this.mInput));
>             ... some IO on streams ...
> } catch (IOException e) {
>             if (Dbg.DEBUG) {
>                 Dbg.d(TAG, "telnet exception " + Dbg.getStackTraceString(e));
>             }
>             return false;
> } finally {
>             try {
>                   if (mInput != null) mInput.close();
>                   if (mOutput != null) mOutput.close();
>             } catch (IOException ignored) {}
> }
> {code}



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)

Mime
View raw message