Skip to content

Conversation

@pepone
Copy link
Member

@pepone pepone commented Oct 28, 2025

No description provided.

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR modifies the Java Communicator constructor to clone the InitializationData parameter before passing it to the internal initialize method, preventing potential external modifications to the initialization data after communicator creation.

Key Changes:

  • The InitializationData object is now cloned before being passed to _instance.initialize() to ensure immutability of the communicator's configuration.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

public Communicator(InitializationData initData) {
_instance = new Instance();
_instance.initialize(this, initData);
_instance.initialize(this, initData.clone());
Copy link

Copilot AI Oct 28, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Potential NullPointerException if initData is null. Consider adding a null check before calling clone(), or handle the null case explicitly (e.g., passing null or creating a default InitializationData instance).

Suggested change
_instance.initialize(this, initData.clone());
_instance.initialize(this, initData != null ? initData.clone() : new InitializationData());

Copilot uses AI. Check for mistakes.
@pepone pepone merged commit e422cfa into zeroc-ice:main Oct 29, 2025
28 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants