Running WindowLicker tests in Cruise Control.

37 views
Skip to first unread message

Yuri Sokolovski

unread,
Aug 24, 2012, 10:58:21 AM8/24/12
to windowlic...@googlegroups.com
Hi, all.

We've written a couple of WindowLicker  unit tests which ran fine from command line locally. However, when we committed them into source repository the Cruise Control wasn't able to run them and was throwing an error:


java.lang.NullPointerException 
at com.objogate.wl.keyboard.KeyboardLayout.defaultKeyboardLayoutName(KeyboardLayout.java:75) 
at com.objogate.wl.keyboard.KeyboardLayout.getDefaultKeyboardLayout(KeyboardLayout.java:71) 
at com.objogate.wl.robot.RoboticAutomaton.<init>(RoboticAutomaton.java:27) 
at com.objogate.wl.swing.gesture.GesturePerformer.<init>(GesturePerformer.java:13) 
... our code

By looking at the source code I found that the place it fails tries to obtain the current country of the current InputContext. I suspect that because Cruise Control runs as a service it has limited ability to obtain Java InputContext due to security or some other reasons.
So I added a few null checks to make sure it doesn't fail:

I suspect it has to do with the fact that Cruise Control runs as a service and thus has limited ability to obtain Java InputContext due to security or some other reasons.

src\core\main\com\objogate\wl\keyboard\Keyboard.java

private static String defaultKeyboardLayoutName() {
        String country="US";
    InputContext context = InputContext.getInstance();
    if(context!=null) {
    java.util.Locale locale=context.getLocale();
    if(locale!=null)
    country=locale.getCountry();
    }
        return Platform.is(Platform.Mac) ? "Mac-" + country : country;
    }

I think it's pretty safe fix. Could somebody add this fix to main repository so it's not lost. I am sure others will run into it sooner or later.

Thanks.

-Yuri

Nat Pryce

unread,
Aug 27, 2012, 10:02:42 AM8/27/12
to windowlic...@googlegroups.com
Thanks.  I've turned this into an issue in the issue tracker.

Cheers,
--Nat


-Yuri

--
You received this message because you are subscribed to the Google Groups "windowlicker-users" group.
To view this discussion on the web visit https://groups.google.com/d/msg/windowlicker-users/-/lD4Hk05D9_IJ.
To post to this group, send email to windowlic...@googlegroups.com.
To unsubscribe from this group, send email to windowlicker-us...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/windowlicker-users?hl=en.



--
http://www.natpryce.com
Reply all
Reply to author
Forward
0 new messages