Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

can't catch LocalException: tried to access class com.browserstack.local.LocalException #46

Open
SlavikCA opened this issue Nov 16, 2019 · 1 comment

Comments

@SlavikCA
Copy link

Using version 1.0.3

I have this Groovy code:

import com.browserstack.local.LocalException

class AcsTestBase {
...
        log.info 'Starting BrowserStack Local binary ...'
        try {
            bsLocal = new Local()
            HashMap<String, String> bsLocalArgs = new HashMap<String, String>()
            bsLocalArgs.put('key', key)
            bsLocal.start(bsLocalArgs)
            log.info 'bsLocal.isRunning(): ' + bsLocal.isRunning()
        } catch (LocalException e) {
            log.error e.message
            throw e
        }

This results in this:

java.lang.IllegalAccessError: tried to access class com.browserstack.local.LocalException from class tests.AcsTestBase

But if I use catch (Exception e) instead, then everything is working ok: I'm getting message in the log, as expected.

The point of this issue is not fact, that I'm getting Exception, but the issue is that I can't catch the exception by using LocalException class

By the way, the cause of exception was this (I know how to handle it):

com.browserstack.local.LocalException: Either another browserstack local client is running on your machine or some server is listening on port 45691
	at com.browserstack.local.Local.start(Local.java:80)
	at com.browserstack.local.Local$start.call(Unknown Source)
	at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:47)
	at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:115)
	at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:127)
...
@stevenmchaves
Copy link

I also opened up basically the same:

#67

The class should be public.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants