rombert commented on code in PR #72:
URL:
https://github.com/apache/sling-org-apache-sling-xss/pull/72#discussion_r4747220554
##########
pom.xml:
##########
@@ -283,49 +255,12 @@
<!-- B U I L D
-->
<!--
======================================================================= -->
<build>
- <pluginManagement>
- <plugins>
- <plugin>
- <!-- Extend RAT configuration from parent pom -->
- <groupId>org.apache.rat</groupId>
- <artifactId>apache-rat-plugin</artifactId>
- <configuration>
- <excludes combine.children="append">
-
<exclude>src/main/resources/ESAPI.properties</exclude>
-
<exclude>src/main/resources/validation.properties</exclude>
- </excludes>
- </configuration>
- </plugin>
- </plugins>
- </pluginManagement>
-
<plugins>
<plugin>
<groupId>org.apache.sling</groupId>
<artifactId>sling-maven-plugin</artifactId>
</plugin>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-dependency-plugin</artifactId>
- <executions>
- <execution>
- <id>unpack</id>
- <goals>
- <goal>unpack</goal>
- </goals>
- <phase>prepare-package</phase>
- <configuration>
-
<outputDirectory>${project.build.directory}/dependencies-classes</outputDirectory>
- <artifactItems>
- <artifactItem>
- <groupId>org.owasp.esapi</groupId>
- <artifactId>esapi</artifactId>
- </artifactItem>
- </artifactItems>
- </configuration>
- </execution>
- </executions>
- </plugin>
+
<plugin>
<artifactId>maven-resources-plugin</artifactId>
Review Comment:
Please remove the now-unneeded `copy-resources` execution. It can copy stale
ESAPI files from an earlier build back into the bundle.
##########
src/main/java/org/apache/sling/xss/impl/XSSAPIImpl.java:
##########
@@ -150,7 +149,10 @@ public Long getValidLong(String source, long defaultValue)
{
public Double getValidDouble(String source, double defaultValue) {
if (source != null && source.length() > 0) {
try {
- return validator.getValidDouble("XSS", source, 0d,
Double.MAX_VALUE, false);
+ double d = Double.parseDouble(source.trim());
+ if (d >= 0d && d <= Double.MAX_VALUE && !Double.isNaN(d) &&
!Double.isInfinite(d)) {
+ return d;
+ }
} catch (Exception e) {
LOGGER.warn("Unable to get a valid double from the input.", e);
Review Comment:
Please keep the previous behavior of logging the rejected value only at
DEBUG. `Double.parseDouble` includes the value in its exception message, so
passing the exception to `LOGGER.warn` now logs it at WARN.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]