Skip to content
This repository has been archived by the owner on May 27, 2022. It is now read-only.

Typo #82

Open
leotu opened this issue Mar 15, 2019 · 1 comment
Open

Typo #82

leotu opened this issue Mar 15, 2019 · 1 comment

Comments

@leotu
Copy link

leotu commented Mar 15, 2019

The error message "Hostname could not be found in context. HostNamePartitioningStrategy will not work." and variable name "hostname" are weird.

ContextNameKeyingStrategy: <-- problem code

@Override
    public void setContext(Context context) {
        super.setContext(context);
        final String hostname = context.getProperty(CoreConstants.CONTEXT_NAME_KEY);
        if (hostname == null) {
            addError("Hostname could not be found in context. HostNamePartitioningStrategy will not work.");
        } else {
            contextNameHash = ByteBuffer.allocate(4).putInt(hostname.hashCode()).array();
        }
    }

HostNameKeyingStrategy:

 @Override
    public void setContext(Context context) {
        super.setContext(context);
        final String hostname = context.getProperty(CoreConstants.HOSTNAME_KEY);
        if (hostname == null) {
            if (!errorWasShown) {
            addError("Hostname could not be found in context. HostNamePartitioningStrategy will not work.");
                errorWasShown = true;
            }
        } else {
            hostnameHash = ByteBuffer.allocate(4).putInt(hostname.hashCode()).array();
        }
    }
@danielwegener
Copy link
Owner

Good catch, thanks! Tribute to the copy & paste error god 😊

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

No branches or pull requests

2 participants