On Mon, 29 Sep 2025 23:49:38 GMT, Alexander Matveev <[email protected]> 
wrote:

>> test/jdk/tools/jpackage/macosx/CustomInfoPListTest.java line 70:
>> 
>>> 68: 
>>> 69:     // We do not need full Info.plist for testing
>>> 70:     private static String getInfoPListXML(String bundleName) {
>> 
>> Use jdk.jpackage.internal.util.XmlUtils.createXml() helper to create xml 
>> file. It will format the output xml and will also eliminate the need for the 
>> patch in PListWriter class.
>
> I think using `PListWriter` is more convenient then 
> `jdk.jpackage.internal.util.XmlUtils.createXml()`. I will prefer to use 
> `PListWriter`.

I'm not suggesting replacing `PListWriter`  with `XmlUtils.createXml()`. I'm 
suggesting replacing 
`XMLOutputFactory.newInstance().createXMLStreamWriter(buf)` with 
`XmlUtils.createXml()`:


private static void savePList(String bundleName, Path plistFile) throws 
XMLStreamException, IOException {
    XmlUtils.createXml(plistFile, xml -> { 
        writePList(xml, toXmlConsumer(() -> {
            writeDict(xml, toXmlConsumer(() -> {
                writeString(xml, "CFBundleName", bundleName);
                writeString(xml, "CFBundleIdentifier", "CustomInfoPListTest");
                writeString(xml, "CFBundleVersion", "1.0");
            }));
        }));
    });
}

-------------

PR Review Comment: https://git.openjdk.org/jdk/pull/27509#discussion_r2389607409

Reply via email to