diff --git a/spring-statemachine-core/src/main/java/org/springframework/statemachine/support/tree/AbstractIterator.java b/spring-statemachine-core/src/main/java/org/springframework/statemachine/support/tree/AbstractIterator.java index 598e3f7a..31f79e11 100644 --- a/spring-statemachine-core/src/main/java/org/springframework/statemachine/support/tree/AbstractIterator.java +++ b/spring-statemachine-core/src/main/java/org/springframework/statemachine/support/tree/AbstractIterator.java @@ -1,5 +1,5 @@ /* - * Copyright 2015 the original author or authors. + * Copyright 2015-2018 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -39,7 +39,7 @@ public abstract class AbstractIterator implements Iterator { @Override public final boolean hasNext() { - Assert.state(state != State.FAILED); + Assert.state(state != State.FAILED, "state cannot be null"); switch (state) { case DONE: return false; @@ -78,6 +78,7 @@ public abstract class AbstractIterator implements Iterator { return next; } + @Override public final void remove() { throw new UnsupportedOperationException("remove"); } diff --git a/spring-statemachine-core/src/main/java/org/springframework/statemachine/support/tree/TreeTraverser.java b/spring-statemachine-core/src/main/java/org/springframework/statemachine/support/tree/TreeTraverser.java index 77bf9584..d954422f 100644 --- a/spring-statemachine-core/src/main/java/org/springframework/statemachine/support/tree/TreeTraverser.java +++ b/spring-statemachine-core/src/main/java/org/springframework/statemachine/support/tree/TreeTraverser.java @@ -1,5 +1,5 @@ /* - * Copyright 2015 the original author or authors. + * Copyright 2015-2018 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -24,14 +24,14 @@ public abstract class TreeTraverser { /** * Returns the children of the specified node. Must not contain null. - * + * * @param root the node * @return child iterables */ public abstract Iterable children(T root); public final Iterable postOrderTraversal(final T root) { - Assert.notNull(root); + Assert.notNull(root, "root cannot be null"); return new Iterable() { @Override public Iterator iterator() { @@ -49,8 +49,8 @@ public abstract class TreeTraverser { final Iterator childIterator; PostOrderNode(T root, Iterator childIterator) { - Assert.notNull(root); - Assert.notNull(childIterator); + Assert.notNull(root, "root cannot be null"); + Assert.notNull(childIterator, "childIterator cannot be null"); this.root = root; this.childIterator = childIterator; }