@@ -307,6 +307,7 @@ public class DSNode extends DSLogger implements DSIObject, Iterable<DSInfo> {
307307 * Adds the info to internal collections, sets parent related fields on child nodes.
308308 */
309309 void add (final DSInfo info ) {
310+ dsInit ();
310311 synchronized (this ) {
311312 if (lastChild != null ) {
312313 lastChild .next = info ;
@@ -360,7 +361,6 @@ public DSInfo add(String name, DSIObject object) {
360361 argAsNode = toNode (object );
361362 argAsNode .validateParent (this );
362363 }
363- dsInit ();
364364 if (argIsNode ) {
365365 if (argAsNode .infoInParent != null ) {
366366 throw new IllegalArgumentException ("Already parented" );
@@ -423,6 +423,7 @@ public int childCount() {
423423 * @return this
424424 */
425425 public DSNode clear () {
426+ dsInit ();
426427 DSInfo info = firstChild ;
427428 while (info != null ) {
428429 if (!info .isPermanent ()) {
@@ -593,6 +594,7 @@ public DSInfo getInfo(String name) {
593594 * The first child, or null.
594595 */
595596 public DSIObject getFirst () {
597+ dsInit ();
596598 DSInfo info = firstChild ;
597599 if (info == null ) {
598600 return null ;
@@ -604,13 +606,15 @@ public DSIObject getFirst() {
604606 * The first child info, or null.
605607 */
606608 public DSInfo getFirstInfo () {
609+ dsInit ();
607610 return firstChild ;
608611 }
609612
610613 /**
611614 * The last child, or null.
612615 */
613616 public DSIObject getLast () {
617+ dsInit ();
614618 DSInfo info = lastChild ;
615619 if (info == null ) {
616620 return null ;
@@ -622,6 +626,7 @@ public DSIObject getLast() {
622626 * The last child info, or null.
623627 */
624628 public DSInfo getLastInfo () {
629+ dsInit ();
625630 return lastChild ;
626631 }
627632
@@ -683,6 +688,7 @@ public String getPath() {
683688
684689 @ Override
685690 public int hashCode () {
691+ dsInit ();
686692 int hc = 1 ;
687693 DSInfo info = firstChild ;
688694 while (info != null ) {
@@ -781,13 +787,15 @@ public Iterator<DSInfo> iterateNodes() {
781787 * Returns an iterator of child DSIValues.
782788 */
783789 public Iterator <DSInfo > iterateValues () {
790+ dsInit ();
784791 return new ValueIterator ();
785792 }
786793
787794 /**
788795 * Returns an iterator of all info children.
789796 */
790797 public Iterator <DSInfo > iterator () {
798+ dsInit ();
791799 return new ChildIterator ();
792800 }
793801
@@ -1119,6 +1127,7 @@ public final void stable() {
11191127 * Sets the state to starting. Calls onStarted once the entire subtree is started.
11201128 */
11211129 public final void start () {
1130+ dsInit ();
11221131 if (isRunning ()) {
11231132 throw new IllegalStateException ("Already running: " + getPath ());
11241133 }
0 commit comments