Skip to content

Curious locale issue with bus names #185

Closed
@brett-smith

Description

@brett-smith

A user has reported that our software is failing to start on Windows 11 running in a Turkish locale. We are using an embedded DBus daemon here, and use the following code to get a bus address.

var busAddress = TransportBuilder.createDynamicSession("unix", true);

This returns null on this Turkish installation, but will correctly return a valid address everywhere else.

It turns out that it's the _busType.toUpperCase() in createDynamicSession(). This actually results in UN¦X (the 'I' is actually U+00A6) and so the provider is never found.

"unix".toUpperCase().equals("UN¦X");
"UNIX".toUpperCase().equals("UNIX");
"unix".toUpperCase(Locale.ENGLISH).equals("UNIX");

In TransportBuilder, the providers are registered by upper casing the the already upper case names provided by the ITransportProvider implementations, so the upper casing here is effectively a noop,. and the providers are registered with the correct name.

So client code can work around this by making sure the already upper-cased "UNIX" is always passed when string bus names are used.

But it does seem that a better solution is needed inside dbus-java. I suppose using enum is probably out because of the pluggable nature of transport providers.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions