Skip to content

Commit

Permalink
Remove apache commons direct dependencies (#536)
Browse files Browse the repository at this point in the history
Removed because security alerts with commons-io:2.5 and
that the actual versions are out of our control because
they are provided by Maven runtime.
  • Loading branch information
abelsromero committed Jul 8, 2021
1 parent a321dff commit 9e77416
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 16 deletions.
11 changes: 0 additions & 11 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,6 @@
<plexus.utils.version>3.0.23</plexus.utils.version>
<plexus.component.metadata.version>1.7</plexus.component.metadata.version>
<netty.version>4.1.59.Final</netty.version>
<commons.io.version>2.5</commons.io.version>
<doxia.version>1.8</doxia.version>
</properties>

Expand Down Expand Up @@ -129,11 +128,6 @@
<artifactId>asciidoctorj</artifactId>
<version>${asciidoctorj.version}</version>
</dependency>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-lang3</artifactId>
<version>3.8.1</version>
</dependency>
<dependency>
<groupId>io.netty</groupId>
<artifactId>netty-codec-http</artifactId>
Expand All @@ -144,11 +138,6 @@
<artifactId>doxia-core</artifactId>
<version>${doxia.version}</version>
</dependency>
<dependency>
<groupId>commons-io</groupId>
<artifactId>commons-io</artifactId>
<version>${commons.io.version}</version>
</dependency>
<dependency>
<groupId>org.apache.maven.doxia</groupId>
<artifactId>doxia-module-xhtml</artifactId>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
package org.asciidoctor.maven.site;

import org.apache.commons.lang3.StringUtils;
import org.apache.maven.project.MavenProject;
import org.asciidoctor.AttributesBuilder;
import org.asciidoctor.OptionsBuilder;
import org.asciidoctor.maven.process.AsciidoctorHelper;
import org.codehaus.plexus.util.xml.Xpp3Dom;

import java.io.File;
import java.util.*;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import java.util.stream.Collectors;
import java.util.stream.Stream;

import static org.apache.commons.lang3.StringUtils.isNotBlank;

public class SiteConversionConfigurationParser {

private final MavenProject project;
Expand Down Expand Up @@ -51,7 +51,7 @@ SiteConversionConfiguration processAsciiDocConfig(Xpp3Dom siteConfig,
// <requires>time, base64</requires>
Stream.of(requireNode.getValue().split(","))
.map(String::trim)
.filter(StringUtils::isNotBlank)
.filter(this::isNotBlank)
.forEach(value -> gemsToRequire.add(value));
} else {
// <requires>
Expand Down Expand Up @@ -83,6 +83,12 @@ SiteConversionConfiguration processAsciiDocConfig(Xpp3Dom siteConfig,
return new SiteConversionConfiguration(presetOptions.attributes(presetAttributes).get(), gemsToRequire);
}

public boolean isNotBlank(String value) {
return value != null
&& !value.isEmpty()
&& value.chars().anyMatch(c -> !Character.isWhitespace(c));
}

private File resolveProjectDir(MavenProject project, String path) {
File filePath = new File(path);
if (!filePath.isAbsolute()) {
Expand Down

0 comments on commit 9e77416

Please sign in to comment.