chenggwang commented on PR #671:
URL: https://github.com/apache/tomcat/pull/671#issuecomment-1755896980
```java
protected boolean setSocketOptions(SocketChannel socket) {
NioSocketWrapper socketWrapper = null;
try {
// Allocate channel and wrapper
NioChannel channel = null;
if (nioChannels != null) {
channel = nioChannels.pop();
}
if (channel == null) {
SocketBufferHandler bufhandler = new SocketBufferHandler(
socketProperties.getAppReadBufSize(),
socketProperties.getAppWriteBufSize(),
socketProperties.getDirectBuffer());
channel = createChannel(bufhandler);
}
NioSocketWrapper newWrapper = new NioSocketWrapper(channel,
this);
channel.reset(socket, newWrapper);
connections.put(socket, newWrapper);
socketWrapper = newWrapper;
```
Only `channel.reset(socket, newWrapper)` is executed. The sc, newWrapper
attributes in channel are only assigned values.And chanel's toString method
looks like this `super.toString() + ":" + sc.toString()` .sc.toString() then
raises the null pointer during IDEA debugging.
<img width="824" alt="fixbug 2023-10-10 231457"
src="https://github.com/apache/tomcat/assets/90715678/40714216-66fb-41be-9c73-d839dca70119">
@markt-asf
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]