libVersion 0.95 broke something?

24 views
Skip to first unread message

mikko.nu...@gmail.com

unread,
Nov 25, 2015, 9:16:53 AM11/25/15
to CodenameOne Discussions
Hi,

my production application stopped working after library update, no changes made, problem occurs at least with iOS:

This works (at StateMachine.java):

findTxtUsername().getText(); // component txtUsername is found

But this does not work any more (when parsing authentication response of ConnectionRequest)

StateMachine.getStateMachine().findTxtUsername().getText(); // txtUsername is null / not found

Is this intentional, should I handle these cases otherwise?

Shai Almog

unread,
Nov 26, 2015, 1:08:48 AM11/26/15
to CodenameOne Discussions, mikko.nu...@gmail.com
Hi,
we always change a lot of things but its hard to tell.

The code above is a bit problematic since you are relying from outside the state machine that the form parent of txtUsername is there and it might not be there yet...

mikko.nu...@gmail.com

unread,
Nov 26, 2015, 3:24:42 AM11/26/15
to CodenameOne Discussions, mikko.nu...@gmail.com
Yes,

the code above is not the best practise and I've changed it to work, but as said it also worked before... thought you wanted to know. I have a lot of that kind of references because I did not want to put all of the front end code to StateMachine.java. I use that kind of references to retrieve me containers in my controller classes but obviously they are not broken. That gives me clue that it has something to do with ConnectionRequest, even though it is purely synchronous call and the form that we are retrieving the text fields from is already shown and present all the time.

Shai Almog

unread,
Nov 26, 2015, 11:46:41 PM11/26/15
to CodenameOne Discussions, mikko.nu...@gmail.com
I'm afraid that's to abstract.
How are you calling the code from the connection request?
Do you use postRequest?
Call it after the addToQueueAndWait?

If neither of those then it might not work.

mikko.nu...@gmail.com

unread,
Nov 27, 2015, 3:37:10 AM11/27/15
to CodenameOne Discussions, mikko.nu...@gmail.com
I called it in postResponse() naturally after addToQueueAndWait() before I changed it. Next showForm("Home", null) is in StateMachine after this all is done (this thread finished) so the form should still live there? But you don't need to think this longer... I set the field values to my static data structure before the call and nullified them if authorization was failed so the find-methods or references to UI were no longer needed there (and which might have been ugly). Guess my previous thought was just to bind the data from the fields to data structure after everything is confirmed "Ok" rather than changing it before and after the call. Just weird that it suddenly stopped working.


   
@Override
   
protected void postResponse() {

       
super.postResponse();

       
RequestInfoParser.parseAuthorization(getDocument()); <----
       
StorageService.storeAuthentication();
   
}


Reply all
Reply to author
Forward
0 new messages