This is an automated email from the ASF dual-hosted git repository.
clebertsuconic pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/artemis.git
The following commit(s) were added to refs/heads/main by this push:
new a9ee1c770f ARTEMIS-5863 invalid acceptor URI shouldn't break
configuration.exportAsProperties with NPE
a9ee1c770f is described below
commit a9ee1c770fb9d9b57efce4d47b97fd605918afc2
Author: Clebert Suconic <[email protected]>
AuthorDate: Tue Jan 27 16:58:38 2026 -0500
ARTEMIS-5863 invalid acceptor URI shouldn't break
configuration.exportAsProperties with NPE
---
.../activemq/artemis/core/config/impl/ConfigurationImpl.java | 12 +++++++-----
.../artemis/core/config/impl/ConfigurationImplTest.java | 11 +++++++++++
2 files changed, 18 insertions(+), 5 deletions(-)
diff --git
a/artemis-server/src/main/java/org/apache/activemq/artemis/core/config/impl/ConfigurationImpl.java
b/artemis-server/src/main/java/org/apache/activemq/artemis/core/config/impl/ConfigurationImpl.java
index f8a71e017f..667b252ae6 100644
---
a/artemis-server/src/main/java/org/apache/activemq/artemis/core/config/impl/ConfigurationImpl.java
+++
b/artemis-server/src/main/java/org/apache/activemq/artemis/core/config/impl/ConfigurationImpl.java
@@ -1105,10 +1105,12 @@ public class ConfigurationImpl extends
javax.security.auth.login.Configuration i
stream = stream.filter((Map.Entry<?, ?> entry)->
filterOn.isAssignableFrom(entry.getClass()));
}
stream.forEach(entry -> {
- // nested by name
- nested.push(entry.getKey().toString());
- export(beanUtils, nested, bufferedWriter, entry.getValue());
- nested.pop();
+ if (entry.getValue() != null) {
+ // nested by name
+ nested.push(entry.getKey().toString());
+ export(beanUtils, nested, bufferedWriter, entry.getValue());
+ nested.pop();
+ }
});
}
} else if (isComplexConfigObject(value)) {
@@ -1168,7 +1170,7 @@ public class ConfigurationImpl extends
javax.security.auth.login.Configuration i
});
} else {
// string form works ok otherwise
- exportKeyValue(nested, bufferedWriter, value.toString());
+ exportKeyValue(nested, bufferedWriter, String.valueOf(value));
}
}
diff --git
a/artemis-server/src/test/java/org/apache/activemq/artemis/core/config/impl/ConfigurationImplTest.java
b/artemis-server/src/test/java/org/apache/activemq/artemis/core/config/impl/ConfigurationImplTest.java
index eec20a5cad..8987868d02 100644
---
a/artemis-server/src/test/java/org/apache/activemq/artemis/core/config/impl/ConfigurationImplTest.java
+++
b/artemis-server/src/test/java/org/apache/activemq/artemis/core/config/impl/ConfigurationImplTest.java
@@ -17,6 +17,7 @@
package org.apache.activemq.artemis.core.config.impl;
import static
org.apache.activemq.artemis.core.config.impl.ConfigurationImpl.REDACTED;
+import static org.junit.jupiter.api.Assertions.assertDoesNotThrow;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertFalse;
import static org.junit.jupiter.api.Assertions.assertInstanceOf;
@@ -3033,6 +3034,16 @@ public class ConfigurationImplTest extends
AbstractConfigurationTestBase {
assertTrue(configuration.getStatus().contains("initialContextFactory"));
}
+ @Test
+ public void testExportInvalidPropertyOnAcceptor() throws Exception {
+ ConfigurationImpl configuration = new ConfigurationImpl();
+
+ // useKQueue here would generate a hashMap Value null, what would break
the exportAsProperties.
+ configuration.addAcceptorConfiguration("test",
"tcp://0.0.0.0:61616?useKQueue");
+ File fileOutput = new File(getTestDirfile(), "broker.properties");
+ assertDoesNotThrow(() -> configuration.exportAsProperties(fileOutput));
+ }
+
/**
* To test ARTEMIS-926
*/
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]