Problems with lifecycle of a node

Here is my log:

INFO RaAggregationNodeModel *ctor node created
DEBUG WorkflowManager Added new node 0:2
DEBUG NodeContainer agg 0 has new state: IDLE
DEBUG WorkflowEditor Workflow event triggered: WorkflowEvent [type=NODE_ADDED;node=0:2;old=null;new=Aggregation 0:2 (IDLE);timestamp=02/04/2020 12:25:02 PM]
INFO AbstractCreateNewConnectedNodeCommand Autoconnect: Connecting new node 0:2 port 1 with existing node File Reader 0:1 (EXECUTED) port 1
INFO Aggregation 0:2 *config specs=name=S.csv,columns=[S#; SNAME; STATUS; CITY]
DEBUG Aggregation 0:2 *ctor spec=name=S.csv,columns=[S#; SNAME; STATUS; CITY] gcols= acol= rcol=new-total afunc=Sum
ERROR AggManager ASSERT Aggregation column not valid
ERROR Aggregation 0:2 Configure failed (ArrayIndexOutOfBoundsException): -1
DEBUG WorkflowManager Added new connection from node 0:1(1) to node 0:2(1)
DEBUG WorkflowEditor Workflow event triggered: WorkflowEvent [type=CONNECTION_ADDED;node=null;old=null;new=STD[0:1(1) -> 0:2( 1)];timestamp=02/04/2020 12:25:02 PM]
DEBUG WorkflowRootEditPart part: NodeAnnotationEditPart( )
DEBUG WorkflowRootEditPart part: NodeContainerEditPart( Aggregation 0:2 (IDLE) )
DEBUG ConnectionContainerEditPart refreshing visuals for: STD[0:1(1) -> 0:2( 1)]
DEBUG ConnectionContainerEditPart modelling info: bendpoints:
DEBUG ConnectionContainerEditPart refreshing visuals for: STD[0:1(1) -> 0:2( 1)]
DEBUG ConnectionContainerEditPart modelling info: bendpoints:
DEBUG Aggregation 0:2 *aggregation dialog created
DEBUG Aggregation 0:2 *save to settings=model
DEBUG Aggregation 0:2 *load add from model spec=name=S.csv,columns=[S#; SNAME; STATUS; CITY]
ERROR Aggregation 0:2 CODING PROBLEM Wrong exception type thrown while saving dialog settings
WARN Aggregation 0:2 failed to apply settings: java.util.ConcurrentModificationException
DEBUG Aggregation 0:2 *save add to field_ignored
DEBUG Aggregation 0:2 *validate settings=model
WARN Aggregation 0:2 failed to apply settings: no columns available for aggregation

What this says is that

  • config gets called first, while the settings are invalid. My code fails with a bounds error.
  • then the dialog is created
  • then the sequence is: saveSettingsTo (still invalid), loadAdditionalSettingsFrom (still invalid), saveAdditionalSettingsTo (still invalid), validate (which checks the settings and throws the correct exception, but the settings are still invalid).

I can’t make sense of this sequence. I have code to validate the settings and put in reasonable defaults, but I can’t do that until after I know the input spec. The call to validate does the right thing, but although it can find problems it can’t fix them. So two questions really:

  1. How to stop configure getting called while the settings are invalid
  2. Where to put code to fix problems with the settings, before validate says NO.

Incidentally there is a ConcurrentModificationException complicating the issue. That’s in one of the dialog components, not in my code.