8270903: sun.net.httpserver.HttpConnection: Improve toString

Reviewed-by: chegar, vtewari
This commit is contained in:
Julia Boes 2021-08-05 09:42:16 +00:00
parent 4abe531140
commit 685fc3c677

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2005, 2021, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -66,11 +66,13 @@ class HttpConnection {
volatile State state;
public String toString() {
String s = null;
final var sb = new StringBuilder(HttpConnection.class.getSimpleName());
if (chan != null) {
s = chan.toString();
sb.append(" (");
sb.append(chan);
sb.append(")");
}
return s;
return sb.toString();
}
HttpConnection () {