RFR: 8362598: [macos] Add tests for custom info plist files

Alexey Semenyuk asemenyuk at openjdk.org
Tue Sep 30 01:15:49 UTC 2025


On Mon, 29 Sep 2025 23:49:38 GMT, Alexander Matveev <almatvee at openjdk.org> 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


More information about the core-libs-dev mailing list