Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Avoid this escape. #32197

Merged
merged 1 commit into from
Aug 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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