Skip to content

Commit ae012d2

Browse files
committed
improve exception messages
1 parent c590c63 commit ae012d2

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

jme3-core/src/plugins/java/com/jme3/export/binary/ByteUtils.java

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,8 @@ public static void readFully(InputStream in, byte[] b) throws IOException {
6060
bytesRead += read;
6161
}
6262
if (bytesRead < b.length) {
63-
throw new IOException("End of stream reached before reading fully.");
63+
throw new IOException(
64+
"End of stream reached prematurely after " + bytesRead + " of " + b.length + " bytes.");
6465
}
6566
}
6667

@@ -80,7 +81,8 @@ public static void skipFully(InputStream in, long n) throws IOException {
8081
n--;
8182
}
8283
} else {
83-
throw new IOException("Unable to skip exactly " + n + " bytes, actually skipped " + skipped + " bytes." );
84+
throw new IOException(
85+
"Unable to skip exactly " + n + " bytes. Only " + skipped + " bytes were skipped.");
8486
}
8587
}
8688
}
@@ -95,7 +97,8 @@ public static void skipFully(DataInput in, int n) throws IOException {
9597
in.readByte();
9698
n--;
9799
} else {
98-
throw new IOException("Unable to skip exactly " + n + " bytes, actually skipped " + skipped + " bytes." );
100+
throw new IOException(
101+
"Unable to skip exactly " + n + " bytes. Only " + skipped + " bytes were skipped.");
99102
}
100103
}
101104
}

0 commit comments

Comments
 (0)