8143967: The stream state check should handle unsigned anchor value
Reviewed-by: dfuchs, dcubed, coleenp, sspitsyn
--- a/jdk/src/java.base/share/classes/java/lang/StackStreamFactory.java Tue Nov 24 15:05:58 2015 -0800
+++ b/jdk/src/java.base/share/classes/java/lang/StackStreamFactory.java Tue Nov 24 15:30:58 2015 -0800
@@ -225,17 +225,17 @@
}
switch (state) {
case NEW:
- if (this.anchor != 0) {
+ if (anchor != 0) {
throw new IllegalStateException("This stack stream is being reused.");
}
break;
case OPEN:
- if (this.anchor <= 0) {
- throw new IllegalStateException("This stack stream is not valid for walking");
+ if (anchor == 0 || anchor == -1L) {
+ throw new IllegalStateException("This stack stream is not valid for walking.");
}
break;
case CLOSED:
- if (this.anchor != -1L) {
+ if (anchor != -1L) {
throw new IllegalStateException("This stack stream is not closed.");
}
}