[ https://issues.apache.org/jira/browse/JOHNZON-408?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17875520#comment-17875520 ]
Niclas Hedhman edited comment on JOHNZON-408 at 8/21/24 2:44 PM: ----------------------------------------------------------------- I end up with depending on {{javax:json:javax.json-api:1.1}} and in its {{{}javax.json.JsonValue{}}}, there is; {{public interface JsonValue {}} /** The empty JSON object. @since 1.1 */ {{static final JsonObject EMPTY_JSON_OBJECT = Json.createObjectBuilder().build();}} was (Author: niclas): I end up with depending on {{javax:json:javax.json-api:1.1}} and in its {{{}javax.json.JsonValue{}}}, there is; {{public interface JsonValue {}} {{/** }}{{ The empty JSON object. }} @since 1.1 {{{}*/ {}}}{{{}static final JsonObject EMPTY_JSON_OBJECT = Json.createObjectBuilder().build();{}}} > JsonValue.EMPTY_JSON_OBJECT is null > ----------------------------------- > > Key: JOHNZON-408 > URL: https://issues.apache.org/jira/browse/JOHNZON-408 > Project: Johnzon > Issue Type: Bug > Components: Core > Reporter: Niclas Hedhman > Assignee: Markus Jung > Priority: Major > > JsonValue.EMPTY_JSON_OBJECT is set to null, because the initialization of > that instance is calling the JsonObjectBuilderImpl.build() which returns > itself if it is an empty `attributeMap`. > See comment > https://github.com/apache/johnzon/commit/50a64d59a81384fe400570e36fc93ce7e2347746#r145601781 > for the exact time when this was broken, and the ultra-simple test for it. > And the previous code worked, but someone thought to be "clever" and no tests > capturing it. -- This message was sent by Atlassian Jira (v8.20.10#820010)