Skip to content

Commit

Permalink
Make finalizer happy
Browse files Browse the repository at this point in the history
  • Loading branch information
externl committed Oct 22, 2024
1 parent 99080a8 commit 2b42480
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 8 deletions.
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'

// 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

0 comments on commit 2b42480

Please sign in to comment.