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
XContentBuilder.writeValue causes StackOverflowError given Path #11771
Comments
This is correct, since one segment of the path is still a path, which is its own first segment, etc. Weird API, that. Still, @pickypg, I'm curious where you stumbled upon this, e.g. if you could post the stack trace (until it starts calling itself recursively). Because I don't see much value serializing a Path object like this, it would not be useful as an array of path elements even if there was not this issue of endless recursion. Calling toString() on it and storing it as a string could be more useful. Not sure XContentBuilder needs explicit support of Path, or rather whatever is calling should decide how they want to serialize paths, especially if the value is expected to be read back as a Path eventually. |
Hi @szroland, I agree that it's a slightly odd usage, but I came across it while integration testing against Elasticearch 1.6. As the Groovy client author, I had to update a bunch of my tests to include support for the new // Create the repository
PutRepositoryResponse putResponse = clusterAdminClient.putRepository {
name repoName
type "fs"
settings {
location = randomRepoPath()
}
} where This can be easily worked around by calling
We do have a bunch of |
I added a pull request with a possible implementation to have something concrete to review / discuss. |
…ontentBuilder, using toString() to create String representation. This addresses elastic#11771
…ontentBuilder, using toString() to create String representation. This addresses #11771
Fixed. |
If
XContentBuilder
receives aPath
object to write, then it results in aStackOverflowError
because it runs into theIterable
check, whichPath
implements (Path implements Iterable<Path>
).The text was updated successfully, but these errors were encountered: