Skip to content

Commit

Permalink
Fix 2 issues reported by SpotBugs in new code for this release. Fix two
Browse files Browse the repository at this point in the history
@returns that were missing the @. Exclude one dependency of a dependency
to avoid a conflict. Prepare 1.6.6 for release.
  • Loading branch information
davewichers committed Apr 2, 2022
1 parent 5bf2038 commit 5d58ffa
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 10 deletions.
11 changes: 9 additions & 2 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<groupId>org.owasp.antisamy</groupId>
<artifactId>antisamy</artifactId>
<packaging>jar</packaging>
<version>1.6.6-dev</version>
<version>1.6.6</version>
<distributionManagement>
<snapshotRepository>
<id>ossrh</id>
Expand Down Expand Up @@ -42,7 +42,7 @@

<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.build.outputTimestamp>2022-01-31T23:13:00Z</project.build.outputTimestamp>
<project.build.outputTimestamp>2022-04-21T21:46:00Z</project.build.outputTimestamp>
<gpg.skip>true</gpg.skip><!-- by default skip gpg -->
<version.io>2.11.0</version.io>
<version.slf4j>1.7.36</version.slf4j>
Expand All @@ -69,6 +69,13 @@
<groupId>org.apache.httpcomponents.client5</groupId>
<artifactId>httpclient5</artifactId>
<version>5.1.3</version>
<exclusions>
<!-- exclude this old version of slf4j-api as newer can be used -->
<exclusion>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.apache.httpcomponents.core5</groupId>
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/org/owasp/validator/css/CssScanner.java
Original file line number Diff line number Diff line change
Expand Up @@ -333,7 +333,7 @@ public String handleResponse(
try {
String responseBody = httpClient.execute(new HttpGet(stylesheetUri), responseHandler);
// pull down stylesheet, observing size limit
stylesheet = responseBody.getBytes();
stylesheet = responseBody.getBytes(Charset.forName("UTF8"));
if (stylesheet != null && stylesheet.length > sizeLimit) {
errorMessages.add(ErrorMessageUtil.getMessage(
messages,
Expand Down
3 changes: 2 additions & 1 deletion src/main/java/org/owasp/validator/html/CleanResults.java
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,8 @@ public CleanResults(long startOfScan, Callable<String> cleanHTML,

/**
* Return the DOM version of the clean HTML.
* return The XML Document fragment version of the clean HTML produced during the sanitization process.
*
* @return The XML Document fragment version of the clean HTML produced during the sanitization process.
* This may be null, even if the clean HTML String is not null.
*/
public DocumentFragment getCleanXMLDocumentFragment() {
Expand Down
6 changes: 5 additions & 1 deletion src/main/java/org/owasp/validator/html/InternalPolicy.java
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,11 @@ public boolean isOmitXmlDeclaration() {
return omitXmlDeclaration;
}

/** @deprecated XHTML usage will go away in AntiSamy 1.7+ */
/**
* @deprecated XHTML usage will go away in AntiSamy 1.7+
*
* @return true if useXhtml is set for this policy. False otherwise.
*/
@Deprecated
public boolean isUseXhtml() {
return useXhtml;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -408,17 +408,17 @@ private boolean processStyleTag(Element ele, Node parentNode) {

try {
if (ele.getChildNodes().getLength() > 0) {
String toScan = "";
StringBuffer toScan = new StringBuffer();

for (int i = 0; i < ele.getChildNodes().getLength(); i++) {
Node childNode = ele.getChildNodes().item(i);
if (!toScan.isEmpty()){
toScan += "\n";
if (toScan.length() > 0) {
toScan.append("\n");
}
toScan += childNode.getTextContent();
toScan.append(childNode.getTextContent());
}

CleanResults cr = styleScanner.scanStyleSheet(toScan, policy.getMaxInputSize());
CleanResults cr = styleScanner.scanStyleSheet(toScan.toString(), policy.getMaxInputSize());
errorMessages.addAll(cr.getErrorMessages());

/*
Expand Down

0 comments on commit 5d58ffa

Please sign in to comment.