Skip to content

Commit 2c9a15e

Browse files
committed
better error messge
1 parent af8a4bd commit 2c9a15e

File tree

88 files changed

+305
-308
lines changed

Some content is hidden

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

88 files changed

+305
-308
lines changed

src/main/java/org/cactoos/Fallback.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ public int support(final Throwable exception) {
118118
}
119119

120120
@Override
121-
public X apply(final Throwable input) throws Exception {
121+
public X apply(final Throwable input) {
122122
throw new IllegalStateException(input);
123123
}
124124
}

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ public int read(final byte[] buffer, final int offset,
6868
}
6969

7070
@Override
71-
public void close() throws IOException {
71+
public void close() {
7272
this.inner.set(new DeadInputStream());
7373
}
7474

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ public void flush() throws IOException {
7373
}
7474

7575
@Override
76-
public void close() throws IOException {
76+
public void close() {
7777
this.inner.set(new DeadOutputStream());
7878
}
7979

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ public final class HeadInputStream extends InputStream {
5858
public HeadInputStream(final InputStream orig, final int len) {
5959
super();
6060
this.origin = orig;
61-
this.length = len;
61+
this.length = (long) len;
6262
}
6363

6464
@Override
@@ -67,7 +67,7 @@ public int read() throws IOException {
6767
if (this.processed >= this.length) {
6868
adjusted = -1;
6969
} else {
70-
this.processed += 1;
70+
this.processed += 1L;
7171
adjusted = this.origin.read();
7272
}
7373
return adjusted;
@@ -96,7 +96,7 @@ public void reset() throws IOException {
9696
public int available() throws IOException {
9797
final int available = this.origin.available();
9898
final int adjusted;
99-
if (this.processed + available > this.length) {
99+
if (this.processed + (long) available > this.length) {
100100
adjusted = (int) (this.length - this.processed);
101101
} else {
102102
adjusted = available;

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,7 @@ public int read(final byte[] buf, final int offset, final int len)
142142
final int byts = this.origin.read(buf, offset, len);
143143
final Instant end = Instant.now();
144144
if (byts > 0) {
145-
this.bytes.getAndAdd(byts);
145+
this.bytes.getAndAdd((long) byts);
146146
final long millis = Duration.between(start, end).toMillis();
147147
this.time.getAndAdd(millis);
148148
}

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ public void write(final byte[] buf, final int offset,
118118
final Instant start = Instant.now();
119119
this.origin.write(buf, offset, len);
120120
final Instant end = Instant.now();
121-
this.bytes.getAndAdd(len);
121+
this.bytes.getAndAdd((long) len);
122122
final long millis = Duration.between(start, end).toMillis();
123123
this.time.getAndAdd(millis);
124124
final Level level = this.logger.getLevel();

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

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -160,9 +160,10 @@ public ResourceOf(final Text res, final ClassLoader ldr) {
160160
input -> {
161161
throw new IOException(
162162
new FormattedText(
163-
"The resource \"%s\" was not found in %s",
163+
"The resource \"%s\" was not found in %s (%s)",
164164
input,
165-
ldr
165+
ldr,
166+
ldr.getClass().getCanonicalName()
166167
).asString()
167168
);
168169
},

src/main/java/org/cactoos/number/AvgOf.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -72,9 +72,9 @@ public AvgOf(final Iterable<? extends Number> src) {
7272
(Iterator<? extends Number> it) -> it.hasNext(),
7373
it -> {
7474
BigDecimal total = BigDecimal.ZERO;
75-
long qty = 0;
75+
long qty = 0L;
7676
for (final Number value: new IterableOf<>(it)) {
77-
qty += 1;
77+
qty += 1L;
7878
total = total.add(
7979
new BigDecimal(value.toString())
8080
);

src/main/java/org/cactoos/scalar/Equality.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ public Integer value() throws Exception {
7070
() -> {
7171
int result = 0;
7272
for (int idx = rght.length - 1; idx >= 0; --idx) {
73-
result = lft[idx] - rght[idx];
73+
result = (int) lft[idx] - (int) rght[idx];
7474
if (result != 0) {
7575
break;
7676
}

src/main/java/org/cactoos/scalar/LengthOf.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ public final class LengthOf extends ScalarEnvelope<Long> {
4747
public LengthOf(final Iterable<?> items) {
4848
this(() -> {
4949
final Iterator<?> iterator = items.iterator();
50-
long size = 0;
50+
long size = 0L;
5151
while (iterator.hasNext()) {
5252
iterator.next();
5353
++size;

0 commit comments

Comments
 (0)