Skip to content

Fix GF Embedded runtime detection and unify the working approaches to detect runtime #25393

Open
@OndroMih

Description

@OndroMih

What doesn't work:

In SecurityLifecycle class, Util.isEmbeddedServer() method is used to detect whether the runtime is GF Embedded. But the method always returns false, hence system properties for login.conf and server.policy are not set.

The Util.isEmbeddedServer() method uses the Server class and weird logic that mode is embedded if there are some Server instances. It seems to me that the Server class and related classes that implement EmbeddedContainer are dead code. The only way to create Server instances is using the Builder class, which is used only in tests, which probably test this unused container functionality: https://github.com/search?q=repo%3Aeclipse-ee4j%2Fglassfish++Server.Builder&type=code

Fix

Change the Util.isEmbeddedServer() method to rely on one of the two ways that work:

Additional refactor

Check whether it makes sense to

  • Unify the above 2 working approaches to detecting the runtime and replace them with a single approach
  • Remove the dead code of Server and related classes

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions