< prev index next >
src/java.base/share/classes/java/lang/String.java
Print this page
rev 52199 : 8212694: Using Raw String Literals with align() and Integer.MIN_VALUE causes out of memory error
Reviewed-by: smarks
*** 2966,2976 ****
}
int outdent = lines().filter(not(String::isBlank))
.mapToInt(String::indexOfNonWhitespace)
.min()
.orElse(0);
! return indent(n - outdent, true);
}
/**
* This object (which is already a string!) is itself returned.
*
--- 2966,2978 ----
}
int outdent = lines().filter(not(String::isBlank))
.mapToInt(String::indexOfNonWhitespace)
.min()
.orElse(0);
! // overflow-conscious code
! int indent = n - outdent;
! return indent(indent > n ? Integer.MIN_VALUE : indent, true);
}
/**
* This object (which is already a string!) is itself returned.
*
< prev index next >