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

External method to set rootTypeParsers in DocumentMapperParser incorrect #4113

Closed
karol-gwaj opened this issue Nov 6, 2013 · 2 comments
Closed

Comments

@karol-gwaj
Copy link

looks like there is small bug in putRootTypeParser method in DocumentMapperParser class:

method:

    public void putRootTypeParser(String type, Mapper.TypeParser typeParser) {
        synchronized (typeParsersMutex) {
            rootTypeParsers = new MapBuilder<String, Mapper.TypeParser>()
                    .putAll(typeParsers)
                    .put(type, typeParser)
                    .immutableMap();
        }
    }

should look more like this:

    public void putRootTypeParser(String type, Mapper.TypeParser typeParser) {
        synchronized (typeParsersMutex) {
            rootTypeParsers = new MapBuilder<String, Mapper.TypeParser>(rootTypeParsers)
                    .put(type, typeParser)
                    .immutableMap();
        }
    }

current version when called will override root type parsers with type parsers

@kimchy
Copy link
Member

kimchy commented Nov 6, 2013

indeed, its a bug. this method is mainly aimed at external plugins using it, is that what you are trying to use it for?

@karol-gwaj
Copy link
Author

kinda, im planning to use putTypeParser method in my plugin
simply i accidentally eyeballed this method too (as they are close to each other in the class)

mute pushed a commit to mute/elasticsearch that referenced this issue Jul 29, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants