Skip to content

Commit

Permalink
Merge pull request #32197 from vespa-engine/balder/avoid-java21-this-…
Browse files Browse the repository at this point in the history
…escape-warning-8

Avoid this escape.
  • Loading branch information
bjorncs authored Aug 20, 2024
2 parents 49ad9c0 + 1676bee commit cc9be55
Show file tree
Hide file tree
Showing 10 changed files with 17 additions and 19 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import com.yahoo.messagebus.Message;

import java.net.URI;
import java.util.Objects;

/**
* @author Simon Thoresen Hult
Expand All @@ -18,24 +19,21 @@ public MbusRequest(CurrentContainer current, URI uri, Message msg) {
this(current, uri, msg, true);
}
public MbusRequest(CurrentContainer current, URI uri, Message msg, boolean isServerRequest) {
super(current, uri, isServerRequest);
this.message = validateMessage(msg);
super(current, validateParams(msg, uri), isServerRequest);
this.message = msg;
}

public MbusRequest(Request parent, URI uri, Message msg) {
super(parent, uri);
this.message = validateMessage(msg);
super(parent, validateParams(msg, uri));
this.message = msg;
}

public Message getMessage() {
return message;
}

private Message validateMessage(Message msg) {
if (msg != null) {
return msg;
}
release();
throw new NullPointerException();
private static URI validateParams(Message msg, URI uri) {
Objects.requireNonNull(msg, "msg cannot be null");
return uri;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
/**
* @author Simon Thoresen Hult
*/
public class SharedIntermediateSession extends AbstractResource
public final class SharedIntermediateSession extends AbstractResource
implements ClientSession, ServerSession, MessageHandler, ReplyHandler
{

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
/**
* @author Simon Thoresen Hult
*/
public class SharedSourceSession extends AbstractResource implements ClientSession, ReplyHandler {
public final class SharedSourceSession extends AbstractResource implements ClientSession, ReplyHandler {

private static final Logger log = Logger.getLogger(SharedSourceSession.class.getName());
private final SourceSession session;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
*
* @author gjoranv
*/
public class ApplicationMetricsRetriever extends AbstractComponent implements Runnable {
public final class ApplicationMetricsRetriever extends AbstractComponent implements Runnable {

private static final Logger log = Logger.getLogger(ApplicationMetricsRetriever.class.getName());

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
*
* @author gjoranv
*/
public class RpcConnector extends AbstractComponent {
public final class RpcConnector extends AbstractComponent {
private static final Logger log = Logger.getLogger(RpcConnector.class.getName());

private final Supervisor supervisor;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
*
* @author gjoranv
*/
public class RpcServer {
public final class RpcServer {

private static final Logger log = Logger.getLogger(RpcServer.class.getName());

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
/**
* @author jobergum
*/
public class MockHttpServer {
public final class MockHttpServer {

private String response;
private final HttpServer server;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
* @author oyving
* @author mpolden
*/
public class RoutingGenerator extends AbstractComponent {
public final class RoutingGenerator extends AbstractComponent {

private static final Logger log = Logger.getLogger(RoutingGenerator.class.getName());
private static final Duration configTimeout = Duration.ofSeconds(10);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
* @author mortent
* @author mpolden
*/
public class NginxMetricsReporter extends AbstractComponent implements Runnable {
public final class NginxMetricsReporter extends AbstractComponent implements Runnable {

private static final Duration interval = Duration.ofSeconds(20);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ private static String requestKey(String method, String url) {
return method.toUpperCase(Locale.ENGLISH) + " " + url;
}

public static class JsonResponse extends BasicHttpResponse implements CloseableHttpResponse {
public static final class JsonResponse extends BasicHttpResponse implements CloseableHttpResponse {

public JsonResponse(Path jsonFile, int code) {
this(Exceptions.uncheck(() -> Files.readString(jsonFile)), code);
Expand Down

0 comments on commit cc9be55

Please sign in to comment.