Skip to content

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

Open
@SlavikCA

Description

@SlavikCA

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)
...

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions