Skip to content

Commit 44ca448

Browse files
committed
Merge branch '__rultor'
2 parents 715a2d9 + 92964cd commit 44ca448

File tree

73 files changed

+425
-358
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

73 files changed

+425
-358
lines changed

pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -217,7 +217,7 @@ SOFTWARE.
217217
<plugin>
218218
<groupId>com.qulice</groupId>
219219
<artifactId>qulice-maven-plugin</artifactId>
220-
<version>0.22.0</version>
220+
<version>0.22.2</version>
221221
<configuration>
222222
<excludes combine.children="append">
223223
<exclude>checkstyle:/src/site/resources/.*</exclude>

src/main/java/org/cactoos/bytes/BytesOf.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@
4949
*
5050
* @since 0.12
5151
*/
52+
@SuppressWarnings("PMD.OnlyOneConstructorShouldDoInitialization")
5253
public final class BytesOf implements Bytes {
5354

5455
/**
@@ -263,6 +264,7 @@ public BytesOf(final Throwable error, final Charset charset) {
263264
* @param error The exception to serialize
264265
* @param charset Charset
265266
*/
267+
@SuppressWarnings("PMD.ConstructorOnlyInitializesOrCallOtherConstructors")
266268
public BytesOf(final Throwable error, final CharSequence charset) {
267269
this(
268270
() -> {
@@ -304,6 +306,7 @@ public BytesOf(final StackTraceElement[] strace, final Charset charset) {
304306
* @param charset Charset
305307
* @since 0.29
306308
*/
309+
@SuppressWarnings("PMD.ConstructorOnlyInitializesOrCallOtherConstructors")
307310
public BytesOf(final StackTraceElement[] strace,
308311
final CharSequence charset) {
309312
this(

src/main/java/org/cactoos/collection/CollectionEnvelope.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@
3333
* @param <X> Element type
3434
* @since 0.23
3535
*/
36+
@SuppressWarnings("PMD.TooManyMethods")
3637
public abstract class CollectionEnvelope<X>
3738
extends IterableEnvelope<X> implements Collection<X> {
3839

src/main/java/org/cactoos/io/InputOf.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@ public final class InputOf implements Input {
5959
*
6060
* @param file The file
6161
*/
62+
@SuppressWarnings("PMD.AvoidFileStream")
6263
public InputOf(final File file) {
6364
this(
6465
() -> new FileInputStream(
@@ -72,6 +73,7 @@ public InputOf(final File file) {
7273
*
7374
* @param path The path
7475
*/
76+
@SuppressWarnings("PMD.AvoidFileStream")
7577
public InputOf(final Path path) {
7678
this(() -> new FileInputStream(path.toFile()));
7779
}

src/main/java/org/cactoos/io/OutputTo.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@ public OutputTo(final File file) {
6060
* @param mkdirs Should we do mkdirs beforehand?
6161
* @since 0.15
6262
*/
63+
@SuppressWarnings("PMD.AvoidFileStream")
6364
public OutputTo(final File file, final boolean mkdirs) {
6465
this(
6566
() -> {
@@ -85,6 +86,7 @@ public OutputTo(final Path path) {
8586
* @param mkdirs Should we do mkdirs beforehand?
8687
* @since 0.15
8788
*/
89+
@SuppressWarnings("PMD.AvoidFileStream")
8890
public OutputTo(final Path path, final boolean mkdirs) {
8991
this(
9092
() -> {

src/main/java/org/cactoos/io/ResourceOf.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,7 @@ public ResourceOf(final CharSequence res) {
7575
* @param cls Resource class loader
7676
* @since 0.49
7777
*/
78+
@SuppressWarnings("PMD.UseProperClassLoader")
7879
public ResourceOf(final CharSequence res, final Class<?> cls) {
7980
this(res, cls.getClassLoader());
8081
}
@@ -95,6 +96,7 @@ public ResourceOf(final CharSequence res, final ClassLoader ldr) {
9596
* @param cls Resource class loader
9697
* @since 0.49
9798
*/
99+
@SuppressWarnings("PMD.UseProperClassLoader")
98100
public ResourceOf(final CharSequence res,
99101
final Func<CharSequence, Input> fbk, final Class<?> cls) {
100102
this(res, fbk, cls.getClassLoader());
@@ -210,6 +212,7 @@ public ResourceOf(final Text res,
210212
}
211213

212214
@Override
215+
@SuppressWarnings("PMD.CloseResource")
213216
public InputStream stream() throws Exception {
214217
InputStream input = this.loader.getResourceAsStream(
215218
this.path.asString()

src/main/java/org/cactoos/io/TailOf.java

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ public final class TailOf implements Input {
5959
* @param bytes Number of last bytes to show from input
6060
*/
6161
public TailOf(final Input inpt, final int bytes) {
62-
this(inpt, bytes, 16384);
62+
this(inpt, bytes, 16_384);
6363
}
6464

6565
/**
@@ -87,12 +87,13 @@ public InputStream stream() throws Exception {
8787
final byte[] buffer = new byte[this.max];
8888
final byte[] response = new byte[this.count];
8989
int num = 0;
90-
final InputStream strm = this.input.stream();
91-
for (int read = strm.read(buffer); read > 0; read = strm.read(buffer)) {
92-
if (read < this.max && read < this.count) {
93-
num = this.copyPartial(buffer, response, num, read);
94-
} else {
95-
num = this.copy(buffer, response, read);
90+
try (InputStream strm = this.input.stream()) {
91+
for (int read = strm.read(buffer); read > 0; read = strm.read(buffer)) {
92+
if (read < this.max && read < this.count) {
93+
num = this.copyPartial(buffer, response, num, read);
94+
} else {
95+
num = this.copy(buffer, response, read);
96+
}
9697
}
9798
}
9899
return new ByteArrayInputStream(response, 0, num);

src/main/java/org/cactoos/io/TempFolder.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -72,9 +72,9 @@ public TempFolder() {
7272
new Randomized(
7373
new org.cactoos.iterable.Joined<>(
7474
new IterableOf<>(
75-
new RangeOf<>('0', '9', ch -> ++ch),
76-
new RangeOf<>('A', 'Z', ch -> ++ch),
77-
new RangeOf<>('a', 'z', ch -> ++ch)
75+
new RangeOf<>('0', '9', ch -> (char) (ch + 1)),
76+
new RangeOf<>('A', 'Z', ch -> (char) (ch + 1)),
77+
new RangeOf<>('a', 'z', ch -> (char) (ch + 1))
7878
)
7979
),
8080
() -> 5

src/main/java/org/cactoos/io/Zip.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,7 @@ public Zip(final Iterable<? extends Path> origin) {
6767
}
6868

6969
@Override
70+
@SuppressWarnings("PMD.AvoidFileStream")
7071
public InputStream stream() throws Exception {
7172
final ByteArrayOutputStream out = new ByteArrayOutputStream();
7273
try (ZipOutputStream zip = new ZipOutputStream(out)) {

src/main/java/org/cactoos/iterable/IterableOf.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ public Iterator<X> iterator() {
8585

8686
@Override
8787
@SuppressFBWarnings("EQ_UNUSUAL")
88-
@SuppressWarnings (value = "unchecked")
88+
@SuppressWarnings("unchecked")
8989
public boolean equals(final Object other) {
9090
return new Unchecked<>(
9191
new Or(

0 commit comments

Comments
 (0)