Skip to content

Commit

Permalink
another Xerces detection fix for JDK 17 (issue #541)
Browse files Browse the repository at this point in the history
  • Loading branch information
rbri committed Jan 21, 2023
1 parent 62a2386 commit 343aa84
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 2 deletions.
3 changes: 3 additions & 0 deletions src/changes/changes.xml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@

<body>
<release version="2.70.0" date="xx, 2023" description="Chrome/Edge 109, Firefox 108, Bugfixes">
<action type="fix" dev="rbri" issue="541">"
Another Xerces detection fix for JDK 17.
</action>
<action type="add" dev="rbri">
Missing properties addedNodes, removedNodes, previousSibling, and nextSibling added to MutationRecord.
</action>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ public final class Platform {
HelperSunXerces_ = (XmlUtilsHelperAPI)
Class.forName("com.gargoylesoftware.htmlunit.platform.util.XmlUtilsSunXercesHelper").newInstance();
}
catch (final Exception e) {
catch (final Exception | LinkageError e) {
// ignore
}

Expand All @@ -60,7 +60,7 @@ public final class Platform {
HelperXerces_ = (XmlUtilsHelperAPI)
Class.forName("com.gargoylesoftware.htmlunit.platform.util.XmlUtilsXercesHelper").newInstance();
}
catch (final Exception e2) {
catch (final Exception | LinkageError e2) {
// ignore
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Objects;

import org.w3c.dom.Document;
import org.w3c.dom.NamedNodeMap;
Expand All @@ -38,6 +39,11 @@ public final class XmlUtilsSunXercesHelper implements XmlUtilsHelperAPI {

// private static final Log LOG = LogFactory.getLog(XmlUtilsXerces.class);

public XmlUtilsSunXercesHelper() {
// Force eager loading of classes in order to flush out any linkage errors early
Objects.hash(DeferredDocumentImpl.class, DeferredNode.class);
}

/**
* {@inheritDoc}
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Objects;

import org.apache.xerces.dom.DeferredDocumentImpl;
import org.apache.xerces.dom.DeferredNode;
Expand All @@ -38,6 +39,11 @@ public final class XmlUtilsXercesHelper implements XmlUtilsHelperAPI {

// private static final Log LOG = LogFactory.getLog(XmlUtilsXerces.class);

public XmlUtilsXercesHelper() {
// Force eager loading of classes in order to flush out any linkage errors early
Objects.hash(DeferredDocumentImpl.class, DeferredNode.class);
}

/**
* {@inheritDoc}
*/
Expand Down

0 comments on commit 343aa84

Please sign in to comment.