8143967: The stream state check should handle unsigned anchor value
authormchung
Tue, 24 Nov 2015 15:30:58 -0800
changeset 34373 a551d53250dd
parent 34372 ccdd9223ab7a
child 34374 b45db1cff661
8143967: The stream state check should handle unsigned anchor value Reviewed-by: dfuchs, dcubed, coleenp, sspitsyn
jdk/src/java.base/share/classes/java/lang/StackStreamFactory.java
--- 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.");
                     }
             }