Skip to content

Commit

Permalink
#1092 parent up
Browse files Browse the repository at this point in the history
  • Loading branch information
yegor256 committed Jul 13, 2022
1 parent bae564a commit 277d04d
Show file tree
Hide file tree
Showing 6 changed files with 57 additions and 20 deletions.
16 changes: 9 additions & 7 deletions pom.xml
Expand Up @@ -104,7 +104,7 @@ OF THE POSSIBILITY OF SUCH DAMAGE.
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<version>1.18.20</version>
<version>1.18.24</version>
<scope>provided</scope>
</dependency>
<dependency>
Expand All @@ -115,17 +115,17 @@ OF THE POSSIBILITY OF SUCH DAMAGE.
<dependency>
<groupId>com.jcabi</groupId>
<artifactId>jcabi-xml</artifactId>
<version>0.23.1</version>
<version>0.23.2</version>
</dependency>
<dependency>
<groupId>com.jcabi</groupId>
<artifactId>jcabi-log</artifactId>
<version>0.20.0</version>
<version>0.20.1</version>
</dependency>
<dependency>
<groupId>com.jcabi</groupId>
<artifactId>jcabi-aspects</artifactId>
<version>0.23.2</version>
<version>0.24.1</version>
<scope>provided</scope>
</dependency>
<dependency>
Expand All @@ -147,7 +147,7 @@ OF THE POSSIBILITY OF SUCH DAMAGE.
<dependency>
<groupId>org.cactoos</groupId>
<artifactId>cactoos</artifactId>
<version>0.41</version>
<version>0.51.0</version>
</dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>
Expand All @@ -170,12 +170,14 @@ OF THE POSSIBILITY OF SUCH DAMAGE.
<dependency>
<groupId>org.hamcrest</groupId>
<artifactId>hamcrest-core</artifactId>
<version>1.3</version>
<version>2.2</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.hamcrest</groupId>
<artifactId>hamcrest-library</artifactId>
<version>1.3</version>
<version>2.2</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
Expand Down
Expand Up @@ -49,9 +49,11 @@
import java.util.List;
import java.util.Properties;
import org.apache.commons.lang3.StringUtils;
import org.cactoos.text.IoCheckedText;
import org.cactoos.text.Replaced;
import org.cactoos.text.TextOf;
import org.cactoos.text.Trimmed;
import org.cactoos.text.UncheckedText;
import org.xml.sax.InputSource;

/**
Expand Down Expand Up @@ -192,14 +194,16 @@ private String header() {
final URL url = this.toUrl(name);
final String content;
try {
content = new Replaced(
new Trimmed(
new TextOf(
url.openStream()
)
),
"[\\r\\n]+$",
""
content = new IoCheckedText(
new Replaced(
new Trimmed(
new TextOf(
url.openStream()
)
),
"[\\r\\n]+$",
""
)
).asString();
} catch (final IOException ex) {
throw new IllegalStateException("Failed to read license", ex);
Expand Down
Expand Up @@ -39,6 +39,7 @@
import org.cactoos.io.ResourceOf;
import org.cactoos.list.ListOf;
import org.cactoos.text.FormattedText;
import org.cactoos.text.IoCheckedText;
import org.cactoos.text.Joined;
import org.cactoos.text.TextOf;
import org.hamcrest.Description;
Expand Down Expand Up @@ -792,9 +793,11 @@ private Collection<Violation> runValidation(final String file,
)
.withFile(
String.format("src/main/java/foo/%s", file),
new TextOf(
new ResourceOf(
new FormattedText("com/qulice/checkstyle/%s", file)
new IoCheckedText(
new TextOf(
new ResourceOf(
new FormattedText("com/qulice/checkstyle/%s", file)
)
)
).asString()
);
Expand Down
Expand Up @@ -34,6 +34,7 @@
import java.io.IOException;
import java.nio.charset.StandardCharsets;
import org.apache.commons.io.FileUtils;
import org.cactoos.text.IoCheckedText;
import org.cactoos.text.Joined;

/**
Expand Down Expand Up @@ -113,7 +114,7 @@ public File file() throws IOException {
FileUtils.forceDeleteOnExit(license);
FileUtils.writeStringToFile(
license,
new Joined(this.eol, this.lines).asString(),
new IoCheckedText(new Joined(this.eol, this.lines)).asString(),
StandardCharsets.UTF_8
);
if (this.directory != null) {
Expand Down
27 changes: 27 additions & 0 deletions qulice-maven-plugin/src/test/resources/LICENSE.txt
@@ -0,0 +1,27 @@
Copyright (c) 2011-2022 Qulice.com
All rights reserved.

Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met: 1) Redistributions of source code must retain the above
copyright notice, this list of conditions and the following
disclaimer. 2) Redistributions in binary form must reproduce the above
copyright notice, this list of conditions and the following
disclaimer in the documentation and/or other materials provided
with the distribution. 3) Neither the name of the Qulice.com nor
the names of its contributors may be used to endorse or promote
products derived from this software without specific prior written
permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT
NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
OF THE POSSIBILITY OF SUCH DAMAGE.
Expand Up @@ -84,7 +84,7 @@ public void notDetectOnArrayOfStrings() throws Exception {
new PmdAssert(
"ArrayOfStringsLengthGreaterThanZero.java",
new IsEqual<>(true),
new IsEmptyString()
IsEmptyString.emptyString()
).validate();
}

Expand Down

0 comments on commit 277d04d

Please sign in to comment.