|
46 | 46 | import javax.xml.stream.XMLStreamWriter;
|
47 | 47 | import javax.xml.transform.TransformerException;
|
48 | 48 | import javax.xml.transform.TransformerFactory;
|
| 49 | +import javax.xml.transform.dom.DOMSource; |
49 | 50 | import javax.xml.transform.stream.StreamResult;
|
50 | 51 | import javax.xml.transform.stream.StreamSource;
|
51 | 52 | import jdk.internal.util.Architecture;
|
|
59 | 60 | import jdk.jpackage.internal.model.PackagerException;
|
60 | 61 | import jdk.jpackage.internal.resources.ResourceLocator;
|
61 | 62 | import jdk.jpackage.internal.util.XmlUtils;
|
| 63 | +import org.xml.sax.SAXException; |
62 | 64 |
|
63 | 65 | record MacPkgPackager(MacPkgPackage pkg, BuildEnv env, Optional<Services> services, Path outputDir) {
|
64 | 66 |
|
@@ -463,11 +465,12 @@ private void prepareConfigFiles() throws IOException {
|
463 | 465 |
|
464 | 466 | private void patchCPLFile(Path cpl) throws IOException {
|
465 | 467 | try (final var xsltResource = ResourceLocator.class.getResourceAsStream("adjust-component-plist.xsl")) {
|
466 |
| - final var srcXml = new StreamSource(new ByteArrayInputStream(Files.readAllBytes(cpl))); |
| 468 | + final var srcXml = new DOMSource(XmlUtils.initDocumentBuilder().parse( |
| 469 | + new ByteArrayInputStream(Files.readAllBytes(cpl)))); |
467 | 470 | final var dstXml = new StreamResult(cpl.toFile());
|
468 | 471 | final var xslt = TransformerFactory.newInstance().newTransformer(new StreamSource(xsltResource));
|
469 | 472 | xslt.transform(srcXml, dstXml);
|
470 |
| - } catch (TransformerException ex) { |
| 473 | + } catch (TransformerException|SAXException ex) { |
471 | 474 | throw new RuntimeException(ex);
|
472 | 475 | }
|
473 | 476 | }
|
|
0 commit comments