Skip to content

Commit

Permalink
[FLINK-7742] [java api] [runtime] Fix array index out of bounds excep…
Browse files Browse the repository at this point in the history
…tions

This closes apache#4754
  • Loading branch information
yew1eb authored and StephanEwen committed Oct 6, 2017
1 parent 3581a33 commit edc53a7
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ public static String getCallLocationName() {
public static String getCallLocationName(int depth) {
StackTraceElement[] stackTrace = Thread.currentThread().getStackTrace();

if (stackTrace.length < depth) {
if (stackTrace.length <= depth) {
return "<unknown>";
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -224,7 +224,7 @@ public static KvStateRequestType deserializeHeader(ByteBuf buf) {
// Get the message type
int msgType = buf.readInt();
KvStateRequestType[] values = KvStateRequestType.values();
if (msgType >= 0 && msgType <= values.length) {
if (msgType >= 0 && msgType < values.length) {
return values[msgType];
} else {
throw new IllegalArgumentException("Illegal message type with index " + msgType);
Expand Down

0 comments on commit edc53a7

Please sign in to comment.