Skip to content
This repository has been archived by the owner on Oct 23, 2024. It is now read-only.

[COPS-5211] Fix marathon constraint parser bug #3160

Merged
merged 5 commits into from
Aug 21, 2019

Conversation

takirala
Copy link
Contributor

@takirala takirala commented Aug 21, 2019

COPS-5211 With the current logic around parsing the placement constraint string, there may be a case where only the first few characters in the string are parsed in to json object.
For e.g.:

["a","b"],[["asd"]

would be parsed as

["a","b"]

with the trailing tokens being ignored. This PR upgrades the jackson.core:jackson-databind (along with other jackson libraries) to a newer version which has the provision to specify sth like DeserializationFeature.FAIL_ON_TRAILING_TOKENS in order to make sure the entire string is a valid json array before we try to parse it.

@takirala takirala added the wip label Aug 21, 2019
@takirala takirala self-assigned this Aug 21, 2019
@@ -22,7 +24,8 @@

private final String image;

private final WriteOnceLinkedHashMap<String, RawNetwork> networks;
@JsonSetter(contentNulls = Nulls.AS_EMPTY)
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@@ -2,7 +2,7 @@ name: "invalid-image-null-test"
pods:
server:
count: 1
image:
image: ""
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I feel this is more accurate, meaning:

image: ""

is invalid, but

image:

is valid.

If we want to keep the old behaviour, we can use "" as default value for image in RawPod.java but i like this better. I don't have a strong opinion though.

@takirala takirala removed the wip label Aug 21, 2019
@takirala takirala changed the title Fix marathon constraint parser bug [COPS-5211] Fix marathon constraint parser bug Aug 21, 2019
@takirala takirala merged commit 240a163 into master Aug 21, 2019
@takirala takirala deleted the fix-marathon-constraint-parser-bug branch August 21, 2019 19:04
takirala added a commit that referenced this pull request Aug 21, 2019
* Upgrade jackson to 2.9 to use DeserializationFeature.FAIL_ON_TRAILING_TOKENS
* Add/update unit tests
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants