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

Fix bug in Java OA constructor causing warning in finalizer #2955

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 2 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
2 changes: 1 addition & 1 deletion java/gradle/ice.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ spotless {
}

// Run spotlessApply before compiling Java code
compileJava.dependsOn 'spotlessApply'
// compileJava.dependsOn 'spotlessApply'
Copy link
Member

Choose a reason for hiding this comment

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

Why is this commented out?

Copy link
Member Author

Choose a reason for hiding this comment

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

We shouldn't be doing this. Otherwise we'll never know if the formatting is bad.

Copy link
Member

Choose a reason for hiding this comment

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

then let's remove it.


// Android does not have a compileJava task
if(!(project.hasProperty('android') && project.android.sourceSets)) {
Expand Down
18 changes: 11 additions & 7 deletions java/src/Ice/src/main/java/com/zeroc/Ice/ObjectAdapter.java
Original file line number Diff line number Diff line change
Expand Up @@ -1090,19 +1090,21 @@ public int messageSizeMax() {

final Properties properties = _instance.initializationData().properties;

Properties.validatePropertiesWithPrefix(
_name, properties, PropertyNames.ObjectAdapterProps);
try {
Properties.validatePropertiesWithPrefix(
_name, properties, PropertyNames.ObjectAdapterProps);
} catch (UnknownPropertyException ex) {
// Prevent finalizer from complaining about the adapter not being destroyed.
_state = StateDestroyed;
throw ex;
}

//
// Make sure named adapter has some configuration.
//
if (router == null && properties.getPropertiesForPrefix(_name).isEmpty()) {
//
// These need to be set to prevent finalizer from complaining.
//
// Prevent finalizer from complaining about the adapter not being destroyed.
_state = StateDestroyed;
_instance = null;
_incomingConnectionFactories = null;

throw new InitializationException(
"Object adapter '" + _name + "' requires configuration.");
Expand All @@ -1119,6 +1121,8 @@ public int messageSizeMax() {
try {
_reference = _instance.referenceFactory().create("dummy " + proxyOptions, "");
} catch (ParseException ex) {
// Prevent finalizer from complaining about the adapter not being destroyed.
_state = StateDestroyed;
throw new InitializationException(
"invalid proxy options '"
+ proxyOptions
Expand Down
Loading