Skip to content

Commit

Permalink
Change all imports to org.htmlunit and org.htmlunit.cyberneko as needed.
Browse files Browse the repository at this point in the history
Change uses of new AugmentationImpl() to just null. It now compiles, but
fails horribly during testing.
  • Loading branch information
davewichers committed Apr 10, 2023
1 parent ce7e4f0 commit 7ab57ef
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 19 deletions.
8 changes: 4 additions & 4 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@
<version.findsecbugs>1.12.0</version.findsecbugs>
<version.io>2.11.0</version.io>
<version.slf4j>2.0.7</version.slf4j>
<version.spotbugs.maven>4.7.3.3</version.spotbugs.maven>
<version.spotbugs.maven>4.7.3.4</version.spotbugs.maven>
<version.spotbugs>4.7.3</version.spotbugs>
</properties>

Expand All @@ -72,9 +72,9 @@

<dependencies>
<dependency>
<groupId>net.sourceforge.htmlunit</groupId>
<groupId>org.htmlunit</groupId>
<artifactId>neko-htmlunit</artifactId>
<version>2.70.0</version>
<version>3.0.0</version>
</dependency>
<dependency>
<groupId>org.apache.httpcomponents.client5</groupId>
Expand Down Expand Up @@ -263,7 +263,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-enforcer-plugin</artifactId>
<version>3.2.1</version>
<version>3.3.0</version>
<dependencies>
<dependency>
<groupId>org.codehaus.mojo</groupId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,9 @@
import java.util.concurrent.ConcurrentLinkedQueue;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import net.sourceforge.htmlunit.cyberneko.parsers.DOMFragmentParser;
import net.sourceforge.htmlunit.xerces.dom.DocumentImpl;
import org.apache.batik.css.parser.ParseException;
import org.htmlunit.cyberneko.parsers.DOMFragmentParser;
import org.htmlunit.cyberneko.xerces.dom.DocumentImpl;
import org.owasp.validator.css.CssScanner;
import org.owasp.validator.html.CleanResults;
import org.owasp.validator.html.Policy;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
import javax.xml.transform.TransformerFactory;
import javax.xml.transform.sax.SAXResult;
import javax.xml.transform.sax.SAXSource;
import net.sourceforge.htmlunit.cyberneko.parsers.SAXParser;
import org.htmlunit.cyberneko.parsers.SAXParser;
import org.owasp.validator.html.CleanResults;
import org.owasp.validator.html.Policy;
import org.owasp.validator.html.ScanException;
Expand Down
26 changes: 14 additions & 12 deletions src/main/java/org/owasp/validator/html/scan/MagicSAXFilter.java
Original file line number Diff line number Diff line change
Expand Up @@ -26,16 +26,15 @@

import java.util.*;
import java.util.regex.Pattern;
import net.sourceforge.htmlunit.cyberneko.filters.DefaultFilter;
import net.sourceforge.htmlunit.xerces.util.AugmentationsImpl;
import net.sourceforge.htmlunit.xerces.util.XMLAttributesImpl;
import net.sourceforge.htmlunit.xerces.util.XMLStringBuffer;
import net.sourceforge.htmlunit.xerces.xni.Augmentations;
import net.sourceforge.htmlunit.xerces.xni.QName;
import net.sourceforge.htmlunit.xerces.xni.XMLAttributes;
import net.sourceforge.htmlunit.xerces.xni.XMLString;
import net.sourceforge.htmlunit.xerces.xni.XNIException;
import net.sourceforge.htmlunit.xerces.xni.parser.XMLDocumentFilter;
import org.htmlunit.cyberneko.filters.DefaultFilter;
import org.htmlunit.cyberneko.xerces.util.XMLAttributesImpl;
import org.htmlunit.cyberneko.xerces.util.XMLStringBuffer;
import org.htmlunit.cyberneko.xerces.xni.Augmentations;
import org.htmlunit.cyberneko.xerces.xni.QName;
import org.htmlunit.cyberneko.xerces.xni.XMLAttributes;
import org.htmlunit.cyberneko.xerces.xni.XMLString;
import org.htmlunit.cyberneko.xerces.xni.XNIException;
import org.htmlunit.cyberneko.xerces.xni.parser.XMLDocumentFilter;
import org.owasp.validator.css.CssScanner;
import org.owasp.validator.html.CleanResults;
import org.owasp.validator.html.InternalPolicy;
Expand Down Expand Up @@ -191,9 +190,12 @@ public void endElement(QName element, Augmentations augs) throws XNIException {
// "text/css");
// start the CSS element

super.startElement(element, cssAttributes, new AugmentationsImpl());
// super.startElement(element, cssAttributes, new AugmentationsImpl());
super.startElement(element, cssAttributes, null);
// send the cleaned content
super.characters(new XMLStringBuffer(results.getCleanHTML()), new AugmentationsImpl());
// super.characters(new XMLStringBuffer(results.getCleanHTML()), new
// AugmentationsImpl());
super.characters(new XMLStringBuffer(results.getCleanHTML()), null);
// end the CSS element
super.endElement(element, augs);
}
Expand Down

0 comments on commit 7ab57ef

Please sign in to comment.