Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » SWTBot » SWTBot typeText is getting a java.lang.ExceptionInitializerError
SWTBot typeText is getting a java.lang.ExceptionInitializerError [message #528194] Mon, 19 April 2010 16:25 Go to next message
Jeff Johnston is currently offline Jeff JohnstonFriend
Messages: 215
Registered: July 2009
Senior Member
I am trying to use SWTBot on my laptop which has F-12 installed. I am running a test which runs fine on my F-12 desktop with SWTBot, but it fails in trying to do the SWTBotText.typeText() method with the exception above in org.eclipse.swtbot.swt.finder.keyboard.Keyboard.typeText.

Why is this happening? The release of SWTBot on my laptop is later than the one on the desktop (2.0.0.536-dev-e35 vs 2.0.0.512-dev-e35). Both are x86 platforms.
Re: SWTBot typeText is getting a java.lang.ExceptionInitializerError [message #528201 is a reply to message #528194] Mon, 19 April 2010 16:39 Go to previous messageGo to next message
Ketan Padegaonkar is currently offline Ketan PadegaonkarFriend
Messages: 873
Registered: July 2009
Senior Member
Hi Jeff,

Could you provide a stack trace so we can figure out where and why it is
happening ?

– Ketan

On 4/19/10 9:25 AM, Jeff Johnston wrote:
> I am trying to use SWTBot on my laptop which has F-12 installed. I am
> running a test which runs fine on my F-12 desktop with SWTBot, but it
> fails in trying to do the SWTBotText.typeText() method with the
> exception above in
> org.eclipse.swtbot.swt.finder.keyboard.Keyboard.typeText.
>
> Why is this happening? The release of SWTBot on my laptop is later than
> the one on the desktop (2.0.0.536-dev-e35 vs 2.0.0.512-dev-e35). Both
> are x86 platforms.
Re: SWTBot typeText is getting a java.lang.ExceptionInitializerError [message #528224 is a reply to message #528201] Mon, 19 April 2010 18:08 Go to previous messageGo to next message
Jeff Johnston is currently offline Jeff JohnstonFriend
Messages: 215
Registered: July 2009
Senior Member
Appears not to like EN_CA keyboard layout. My keyboard preferences show USA and I also did a setxkbmap us which doesn't help.

java.lang.ExceptionInInitializerError
at org.eclipse.swtbot.swt.finder.keyboard.Keyboard.typeCharacte r(Keyboard.java:100)
at org.eclipse.swtbot.swt.finder.keyboard.Keyboard.typeText(Key board.java:89)
at org.eclipse.swtbot.swt.finder.widgets.SWTBotText.typeText(SW TBotText.java:92)
at org.eclipse.swtbot.swt.finder.widgets.SWTBotText.typeText(SW TBotText.java:78)
at org.eclipse.linuxtools.cdt.autotools.ui.tests.SetConfigurati onParameter.canSetConfigParm(SetConfigurationParameter.java: 105)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAcce ssorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMe thodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:616)
at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall( FrameworkMethod.java:44)
at org.junit.internal.runners.model.ReflectiveCallable.run(Refl ectiveCallable.java:15)
at org.junit.runners.model.FrameworkMethod.invokeExplosively(Fr ameworkMethod.java:41)
at org.junit.internal.runners.statements.InvokeMethod.evaluate( InvokeMethod.java:20)
at org.junit.internal.runners.statements.RunBefores.evaluate(Ru nBefores.java:28)
at org.junit.internal.runners.statements.RunAfters.evaluate(Run Afters.java:31)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit 4ClassRunner.java:73)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit 4ClassRunner.java:46)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java :180)
at org.junit.runners.ParentRunner.access$000(ParentRunner.java: 41)
at org.junit.runners.ParentRunner$1.evaluate(ParentRunner.java: 173)
at org.junit.internal.runners.statements.RunBefores.evaluate(Ru nBefores.java:28)
at org.junit.internal.runners.statements.RunAfters.evaluate(Run Afters.java:31)
at org.junit.runners.ParentRunner.run(ParentRunner.java:220)
at org.eclipse.swtbot.swt.finder.junit.SWTBotJunit4ClassRunner. run(SWTBotJunit4ClassRunner.java:54)
at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.r un(JUnit4TestReference.java:46)
at org.eclipse.jdt.internal.junit.runner.TestExecution.run(Test Execution.java:38)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTe sts(RemoteTestRunner.java:467)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTe sts(RemoteTestRunner.java:683)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(R emoteTestRunner.java:390)
at org.eclipse.swtbot.eclipse.core.RemotePluginTestRunner.main( RemotePluginTestRunner.java:64)
at org.eclipse.swtbot.eclipse.core.UITestApplication.runTests(U ITestApplication.java:117)
at org.eclipse.ui.internal.testing.WorkbenchTestable$1.run(Work benchTestable.java:71)
at java.lang.Thread.run(Thread.java:636)
Caused by: java.lang.IllegalArgumentException: keyboard layout EN_CA not available.
at org.eclipse.swtbot.swt.finder.keyboard.KeyboardLayout.getKey boardLayout(KeyboardLayout.java:89)
at org.eclipse.swtbot.swt.finder.keyboard.KeyboardLayout.getDef aultKeyboardLayout(KeyboardLayout.java:75)
at org.eclipse.swtbot.swt.finder.keyboard.Keystrokes.<clinit>(Keystrokes.java:110)
... 33 more

Re: SWTBot typeText is getting a java.lang.ExceptionInitializerError [message #528258 is a reply to message #528224] Mon, 19 April 2010 20:21 Go to previous messageGo to next message
Pascal G is currently offline Pascal GFriend
Messages: 157
Registered: July 2009
Senior Member
Jeff Johnston wrote:
> Appears not to like EN_CA keyboard layout. My keyboard preferences show
> USA and I also did a setxkbmap us which doesn't help.
>
> Caused by: java.lang.IllegalArgumentException: keyboard layout EN_CA not
> available.
> at org.eclipse.swtbot.swt.finder.keyboard.KeyboardLayout.getKey
> boardLayout(KeyboardLayout.java:89)
> at org.eclipse.swtbot.swt.finder.keyboard.KeyboardLayout.getDef
> aultKeyboardLayout(KeyboardLayout.java:75)
> at
> org.eclipse.swtbot.swt.finder.keyboard.Keystrokes.<clinit>(Keystrokes.java:110)
>
> ... 33 more
>
>

Are you sure that SWTBotPreferences#KEYBOARD_LAYOUT is set to EN_US?

--
Pascal Gélinas | Software Developer
*Nu Echo Inc.*
http://www.nuecho.com/ | http://blog.nuecho.com/

*Because performance matters.*
Re: SWTBot typeText is getting a java.lang.ExceptionInitializerError [message #528262 is a reply to message #528258] Mon, 19 April 2010 20:55 Go to previous messageGo to next message
Jeff Johnston is currently offline Jeff JohnstonFriend
Messages: 215
Registered: July 2009
Senior Member
Pascal G wrote on Mon, 19 April 2010 16:21
Jeff Johnston wrote:
> Appears not to like EN_CA keyboard layout. My keyboard preferences show
> USA and I also did a setxkbmap us which doesn't help.
>
> Caused by: java.lang.IllegalArgumentException: keyboard layout EN_CA not
> available.
> at org.eclipse.swtbot.swt.finder.keyboard.KeyboardLayout.getKey
> boardLayout(KeyboardLayout.java:89)
> at org.eclipse.swtbot.swt.finder.keyboard.KeyboardLayout.getDef
> aultKeyboardLayout(KeyboardLayout.java:75)
> at
> org.eclipse.swtbot.swt.finder.keyboard.Keystrokes.<clinit>(Keystrokes.java:110)
>
> ... 33 more
>
>

Are you sure that SWTBotPreferences#KEYBOARD_LAYOUT is set to EN_US?




It is not . The value of SWTBotPreferences.KEYBOARD_LAYOUT gets set to EN_CA which matches I guess my LANG env variable setting??. Manually setting the field to :"EN_US" in my @BeforeClass method fixes the problem but this seems rather hokey.

Is there a better way to set this up and why doesn't the code simply default to "EN_US" if such an error occurs?
Re: SWTBot typeText is getting a java.lang.ExceptionInitializerError [message #528274 is a reply to message #528262] Mon, 19 April 2010 21:25 Go to previous messageGo to next message
Pascal G is currently offline Pascal GFriend
Messages: 157
Registered: July 2009
Senior Member
Jeff Johnston wrote:
> It is not . The value of SWTBotPreferences.KEYBOARD_LAYOUT gets set to
> EN_CA which matches I guess my LANG env variable setting??. Manually
> setting the field to :"EN_US" in my @BeforeClass method fixes the
> problem but this seems rather hokey.
> Is there a better way to set this up and why doesn't the code simply
> default to "EN_US" if such an error occurs?
>

SWTBot tries to guess your keyboard layout based on your env language.
This would work really well if it wasn't for bug 280562 and bug 280824.
I have to do the same fix in a @BeforeClass method. You could also
define the java property (you know, -Dname=value)
org.eclipse.swtbot.keyboard.layout to EN_US to remove the need of a
@BeforeClass, but I prefer the @BeforeClass because it's a workaround
for those two bugs.

Defaulting to EN_US might sound like a good idea, except that you'll get
weird behavior while you type text if your native keyboard layout isn't
EN_US. And this would be way more complicated to debug than to fail
early with an exception.

Hope this helps.
--
Pascal Gélinas | Software Developer
*Nu Echo Inc.*
http://www.nuecho.com/ | http://blog.nuecho.com/

*Because performance matters.*
Re: SWTBot typeText is getting a java.lang.ExceptionInitializerError [message #528275 is a reply to message #528262] Mon, 19 April 2010 21:26 Go to previous message
Ralf Ebert is currently offline Ralf EbertFriend
Messages: 168
Registered: July 2009
Senior Member
Hi Jeff,
> Is there a better way to set this up and why doesn't the code simply
> default to "EN_US" if such an error occurs?

http://wiki.eclipse.org/SWTBot/Keyboard_Layouts might be helpful.

Greetings,

Ralf


--
Learn how to contribute to Eclipse here: http://eclipse.org/contribute/
Read my Blog here: http://www.ralfebert.de/blog/
Follow me on Twitter here: http://twitter.com/ralfebert/
Previous Topic:New SWTBot builds
Next Topic:SWTBot - Ant issue
Goto Forum:
  


Current Time: Fri Apr 19 16:19:17 GMT 2024

Powered by FUDForum. Page generated in 0.02358 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top