{"action":"created","issue":{"url":"https://api.github.com/repos/hekailiang/squirrel/issues/38","labels_url":"https://api.github.com/repos/hekailiang/squirrel/issues/38/labels{/name}","comments_url":"https://api.github.com/repos/hekailiang/squirrel/issues/38/comments","events_url":"https://api.github.com/repos/hekailiang/squirrel/issues/38/events","html_url":"https://github.com/hekailiang/squirrel/issues/38","id":55915894,"number":38,"title":"setDebugEnabled(true) makes machine fail","user":{"login":"jgabrielygalan","id":247560,"avatar_url":"https://avatars.githubusercontent.com/u/247560?v=3","gravatar_id":"","url":"https://api.github.com/users/jgabrielygalan","html_url":"https://github.com/jgabrielygalan","followers_url":"https://api.github.com/users/jgabrielygalan/followers","following_url":"https://api.github.com/users/jgabrielygalan/following{/other_user}","gists_url":"https://api.github.com/users/jgabrielygalan/gists{/gist_id}","starred_url":"https://api.github.com/users/jgabrielygalan/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jgabrielygalan/subscriptions","organizations_url":"https://api.github.com/users/jgabrielygalan/orgs","repos_url":"https://api.github.com/users/jgabrielygalan/repos","events_url":"https://api.github.com/users/jgabrielygalan/events{/privacy}","received_events_url":"https://api.github.com/users/jgabrielygalan/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":2,"created_at":"2015-01-29T15:48:52Z","updated_at":"2015-01-30T07:47:11Z","closed_at":null,"body":"I was trying to debug the execution of a state machine, so I enabled the debug mode with setDebugEnabled(true) in the StateMachineConfiguration. The result is an exception when entering the initial state:\r\n\r\n16:41:24.186 [main] DEBUG o.s.foundation.fsm.impl.StateImpl - State \"initial\" entry.\r\n16:41:24.190 [main] DEBUG o.s.f.f.i.AbstractExecutionService - Actions within 'STATE_ENTRY__initial' invoked.\r\n16:41:24.281 [main] ERROR o.s.f.fsm.StateMachineLogger - AuthFlowStateMachine(VQuJQUv3nf): Transition from \"initial\" to \"initial\" on \"Start\" caused exception.\r\norg.squirrelframework.foundation.exception.SquirrelRuntimeException: 00010012 : couldn't invoke 'public abstract void org.squirrelframework.foundation.fsm.StateMachine$TransitionBeginListener.transitionBegin(org.squirrelframework.foundation.fsm.StateMachine$TransitionBeginEvent)' with [org.squirrelframework.foundation.fsm.impl.AbstractStateMachine$TransitionBeginEventImpl@604a550e] on org.squirrelframework.foundation.fsm.impl.AbstractStateMachine$5@19afdb9: null.\r\n\tat org.squirrelframework.foundation.util.ReflectUtils.invoke(ReflectUtils.java:337) ~[squirrel-foundation-0.3.0.jar:na]\r\n\tat org.squirrelframework.foundation.event.ListenerMethod.invokeMethod(ListenerMethod.java:63) ~[squirrel-foundation-0.3.0.jar:na]\r\n\tat org.squirrelframework.foundation.event.PolymEventDispatcher.fireEvent(PolymEventDispatcher.java:68) ~[squirrel-foundation-0.3.0.jar:na]\r\n\tat org.squirrelframework.foundation.component.impl.AbstractSubject.fireEvent(AbstractSubject.java:84) ~[squirrel-foundation-0.3.0.jar:na]\r\n\tat org.squirrelframework.foundation.fsm.impl.AbstractStateMachine.processEvent(AbstractStateMachine.java:174) ~[squirrel-foundation-0.3.0.jar:na]\r\n\tat org.squirrelframework.foundation.fsm.impl.AbstractStateMachine.processEvents(AbstractStateMachine.java:236) ~[squirrel-foundation-0.3.0.jar:na]\r\n\tat org.squirrelframework.foundation.fsm.impl.AbstractStateMachine.internalFire(AbstractStateMachine.java:261) ~[squirrel-foundation-0.3.0.jar:na]\r\n\tat org.squirrelframework.foundation.fsm.impl.AbstractStateMachine.fire(AbstractStateMachine.java:287) ~[squirrel-foundation-0.3.0.jar:na]\r\n\r\nThis is the code (it's in a junit test):\r\n\r\n\t\tStateMachineBuilder<AuthFlowStateMachine, String, Object, Context> builder = StateMachineBuilderFactory.create(AuthFlowStateMachine.class, String.class, Object.class, Context.class);\r\n\t\tEvaluateAction action = new EvaluateAction();\r\n\t\taction.setArguments(\"'correct'\");\r\n\t\tbuilder.externalTransition().from(\"initial\").to(\"second\").on(Event.Start).perform(action);\r\n\t\tbuilder.externalTransition().from(\"second\").to(\"ok\").on(\"correct\");\r\n\t\tAuthFlowStateMachine stateMachine = builder.newStateMachine(\"initial\", StateMachineConfiguration.create().setDebugEnabled(true));\r\n\t\tTokenTransaction transaction = new TokenTransaction();\t\t\r\n\t\tstateMachine.fire(Event.Start, new Context(transaction));\r\n\t\tassertEquals(\"ok\", stateMachine.getCurrentState());\r\n\r\n(EvaluateAction evaluates the arguments as an MVEL expression and fires and event of the result as a string, but anyway, it's not even reaching that point).\r\n\r\nIf I change the above code to setDebugEnabled(false), everything works as expected, and the assertEquals passes."},"comment":{"url":"https://api.github.com/repos/hekailiang/squirrel/issues/comments/72165555","html_url":"https://github.com/hekailiang/squirrel/issues/38#issuecomment-72165555","issue_url":"https://api.github.com/repos/hekailiang/squirrel/issues/38","id":72165555,"user":{"login":"jgabrielygalan","id":247560,"avatar_url":"https://avatars.githubusercontent.com/u/247560?v=3","gravatar_id":"","url":"https://api.github.com/users/jgabrielygalan","html_url":"https://github.com/jgabrielygalan","followers_url":"https://api.github.com/users/jgabrielygalan/followers","following_url":"https://api.github.com/users/jgabrielygalan/following{/other_user}","gists_url":"https://api.github.com/users/jgabrielygalan/gists{/gist_id}","starred_url":"https://api.github.com/users/jgabrielygalan/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jgabrielygalan/subscriptions","organizations_url":"https://api.github.com/users/jgabrielygalan/orgs","repos_url":"https://api.github.com/users/jgabrielygalan/repos","events_url":"https://api.github.com/users/jgabrielygalan/events{/privacy}","received_events_url":"https://api.github.com/users/jgabrielygalan/received_events","type":"User","site_admin":false},"created_at":"2015-01-30T07:47:11Z","updated_at":"2015-01-30T07:47:11Z","body":"Yes, sorry, as my state machine, action and context don't do anything relevant, I thought the above was enough. But I have stripped it down to this:\r\n\r\nimport static org.junit.Assert.assertEquals;\r\nimport org.junit.Test;\r\nimport org.squirrelframework.foundation.fsm.StateMachineBuilder;\r\nimport org.squirrelframework.foundation.fsm.StateMachineBuilderFactory;\r\nimport org.squirrelframework.foundation.fsm.StateMachineConfiguration;\r\nimport org.squirrelframework.foundation.fsm.impl.AbstractStateMachine;\r\n\r\npublic class TestSetDebugEnabled {\r\n\t@Test\r\n\tpublic void testSetDebugEnabledDoesntBreak() {\r\n\t\tStateMachineBuilder<AuthFlowStateMachine, String, Object, Context> builder = StateMachineBuilderFactory.create(AuthFlowStateMachine.class, String.class, Object.class, Context.class);\r\n\t\tbuilder.externalTransition().from(\"initial\").to(\"second\").on(\"Start\");\r\n\t\tAuthFlowStateMachine stateMachine = builder.newStateMachine(\"initial\", StateMachineConfiguration.create().setDebugEnabled(true));\r\n\t\tstateMachine.fire(\"Start\", new Context());\r\n\t\tassertEquals(\"second\", stateMachine.getCurrentState());\r\n\t}\r\n}\r\nclass Context {\t\r\n}\r\nclass AuthFlowStateMachine extends AbstractStateMachine<AuthFlowStateMachine, String, Object, Context> {\t\r\n}\r\n\r\nThis test fails with the above exception. If I change the true in setDebugEnabled to false, it works.\r\nWe are using this dependency configuration:\r\n\r\n\t\t<dependency>\r\n\t\t\t<groupId>org.squirrelframework</groupId>\r\n\t\t\t<artifactId>squirrel-foundation</artifactId>\r\n\t\t\t<version>0.3.0</version>\r\n\t\t\t<exclusions>\r\n\t\t\t\t<exclusion>\r\n\t\t\t\t\t<groupId>org.slf4j</groupId>\r\n\t\t\t\t\t<artifactId>slf4j-log4j12</artifactId>\r\n\t\t\t\t</exclusion>\r\n\t\t\t</exclusions>\r\n\t\t</dependency>\r\n\r\nWe needed to strip out he slf4j, since it was interferring with our own logging setup."}}