File tree Expand file tree Collapse file tree 1 file changed +10
-8
lines changed
src/main/java/org/apache/commons/net/telnet Expand file tree Collapse file tree 1 file changed +10
-8
lines changed Original file line number Diff line number Diff line change @@ -125,7 +125,7 @@ class Telnet extends SocketClient
125
125
/***
126
126
* The stream on which to spy
127
127
***/
128
- private OutputStream spyStream = null ;
128
+ private volatile OutputStream spyStream = null ;
129
129
130
130
/***
131
131
* The notification handler
@@ -1248,18 +1248,19 @@ void _stopSpyStream()
1248
1248
***/
1249
1249
void _spyRead (int ch )
1250
1250
{
1251
- if (spyStream != null )
1251
+ OutputStream spy = spyStream ;
1252
+ if (spy != null )
1252
1253
{
1253
1254
try
1254
1255
{
1255
1256
if (ch != '\r' )
1256
1257
{
1257
- spyStream .write (ch );
1258
+ spy .write (ch );
1258
1259
if (ch == '\n' )
1259
1260
{
1260
- spyStream .write ('\r' );
1261
+ spy .write ('\r' );
1261
1262
}
1262
- spyStream .flush ();
1263
+ spy .flush ();
1263
1264
}
1264
1265
}
1265
1266
catch (IOException e )
@@ -1279,12 +1280,13 @@ void _spyWrite(int ch)
1279
1280
if (!(_stateIsDo (TelnetOption .ECHO )
1280
1281
&& _requestedDo (TelnetOption .ECHO )))
1281
1282
{
1282
- if (spyStream != null )
1283
+ OutputStream spy = spyStream ;
1284
+ if (spy != null )
1283
1285
{
1284
1286
try
1285
1287
{
1286
- spyStream .write (ch );
1287
- spyStream .flush ();
1288
+ spy .write (ch );
1289
+ spy .flush ();
1288
1290
}
1289
1291
catch (IOException e )
1290
1292
{
You can’t perform that action at this time.
0 commit comments