< prev index next >
src/hotspot/share/oops/typeArrayKlass.cpp
Print this page
*** 140,173 ****
if (src_pos < 0 || dst_pos < 0 || length < 0) {
// Pass specific exception reason.
ResourceMark rm;
stringStream ss;
if (src_pos < 0) {
! ss.print("while trying to copy from index %i of a %s array with length %i",
src_pos, type2name_tab[ArrayKlass::cast(s->klass())->element_type()], s->length());
} else if (dst_pos < 0) {
! ss.print("while trying to copy to index %i of a %s array with length %i",
dst_pos, type2name_tab[ArrayKlass::cast(d->klass())->element_type()], d->length());
} else {
! ss.print("while trying to copy a negative range %i from a %s array with length %i to a %s array with length %i",
! length, type2name_tab[ArrayKlass::cast(s->klass())->element_type()], s->length(),
! type2name_tab[ArrayKlass::cast(d->klass())->element_type()], d->length());
}
THROW_MSG(vmSymbols::java_lang_ArrayIndexOutOfBoundsException(), ss.as_string());
}
// Check if the ranges are valid
! if ( (((unsigned int) length + (unsigned int) src_pos) > (unsigned int) s->length())
! || (((unsigned int) length + (unsigned int) dst_pos) > (unsigned int) d->length()) ) {
// Pass specific exception reason.
ResourceMark rm;
stringStream ss;
if (((unsigned int) length + (unsigned int) src_pos) > (unsigned int) s->length()) {
! ss.print("while trying to copy from index %u of a %s array with length %i",
(unsigned int) length + (unsigned int) src_pos,
type2name_tab[ArrayKlass::cast(s->klass())->element_type()], s->length());
} else {
! ss.print("while trying to copy to index %u of a %s array with length %i",
(unsigned int) length + (unsigned int) dst_pos,
type2name_tab[ArrayKlass::cast(d->klass())->element_type()], d->length());
}
THROW_MSG(vmSymbols::java_lang_ArrayIndexOutOfBoundsException(), ss.as_string());
}
--- 140,171 ----
if (src_pos < 0 || dst_pos < 0 || length < 0) {
// Pass specific exception reason.
ResourceMark rm;
stringStream ss;
if (src_pos < 0) {
! ss.print("arraycopy source index %i out of bounds for %s[%i].",
src_pos, type2name_tab[ArrayKlass::cast(s->klass())->element_type()], s->length());
} else if (dst_pos < 0) {
! ss.print("arraycopy destination index %i out of bounds for %s[%i].",
dst_pos, type2name_tab[ArrayKlass::cast(d->klass())->element_type()], d->length());
} else {
! ss.print("arraycopy length %i is negative.", length);
}
THROW_MSG(vmSymbols::java_lang_ArrayIndexOutOfBoundsException(), ss.as_string());
}
// Check if the ranges are valid
! if ((((unsigned int) length + (unsigned int) src_pos) > (unsigned int) s->length()) ||
! (((unsigned int) length + (unsigned int) dst_pos) > (unsigned int) d->length())) {
// Pass specific exception reason.
ResourceMark rm;
stringStream ss;
if (((unsigned int) length + (unsigned int) src_pos) > (unsigned int) s->length()) {
! ss.print("arraycopy: last source index %u out of bounds for %s[%i].",
(unsigned int) length + (unsigned int) src_pos,
type2name_tab[ArrayKlass::cast(s->klass())->element_type()], s->length());
} else {
! ss.print("arraycopy: last destination index %u out of bounds for %s[%i].",
(unsigned int) length + (unsigned int) dst_pos,
type2name_tab[ArrayKlass::cast(d->klass())->element_type()], d->length());
}
THROW_MSG(vmSymbols::java_lang_ArrayIndexOutOfBoundsException(), ss.as_string());
}
< prev index next >