Skip to content

Commit 1c25a4a

Browse files
authored
[#1841] Escaping curly braces in MessageBundle (#1842)
Without escaping `MessageFormatter` is unable to process the message. --------- Co-authored-by: Benjamin Asbach <asbachb@users.noreply.github.com>
1 parent 781ab35 commit 1c25a4a

File tree

2 files changed

+22
-1
lines changed

2 files changed

+22
-1
lines changed

jaxb-ri/xjc/src/main/resources/com/sun/tools/xjc/generator/bean/field/MessageBundle.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ DEFAULT_GETTER_LIST_JAVADOC = \
2727
<p>This accessor method returns a reference to the live list,\n\
2828
not a snapshot. Therefore any modification you make to the\n\
2929
returned list will be present inside the Jakarta XML Binding object.\n\
30-
This is why there is not a {@code set} method for the {0} property.</p>\n\n\
30+
This is why there is not a '{'@code set'}' method for the {0} property.</p>\n\n\
3131
<p>\n\
3232
For example, to add a new item, do as follows:\n\
3333
</p>\n\

jaxb-ri/xjc/src/test/java/com/sun/tools/xjc/XjcDtdPluginTest.java

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
/*
22
* Copyright (c) 2023 Oracle and/or its affiliates. All rights reserved.
3+
* Copyright (c) 2025 Contributors to the Eclipse Foundation. All rights reserved.
34
*
45
* This program and the accompanying materials are made available under the
56
* terms of the Eclipse Distribution License v. 1.0, which is available at
@@ -81,4 +82,24 @@ public void postProcessModel(Model model, ErrorHandler errorHandler) {
8182
wasPostProcessModelHookCalled[0]
8283
);
8384
}
85+
86+
@Test
87+
public void testIssue_cannotRenderJavadocForLists() throws Exception {
88+
final OptionsEx opt = new OptionsEx();
89+
opt.setSchemaLanguage(Language.DTD);
90+
opt.compatibilityMode = Options.EXTENSION;
91+
92+
opt.addGrammar(
93+
new InputSource(
94+
new ByteArrayInputStream("<!ELEMENT AnElement1 (#PCDATA)>\n<!ELEMENT AnElement2 (#PCDATA)>\n<!ELEMENT AnElement (AnElement1 | AnElement2)>".getBytes())
95+
)
96+
);
97+
98+
Model model = ModelLoader.load(
99+
opt,
100+
new JCodeModel(),
101+
null
102+
);
103+
model.generateCode(opt, null);
104+
}
84105
}

0 commit comments

Comments
 (0)