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

Common: fix PathNotFoundException in PII enrichment #339

Closed
chuwy opened this issue Sep 8, 2020 · 1 comment
Closed

Common: fix PathNotFoundException in PII enrichment #339

chuwy opened this issue Sep 8, 2020 · 1 comment
Labels
bug Something isn't working
Milestone

Comments

@chuwy
Copy link
Contributor

chuwy commented Sep 8, 2020

This line:

val documentContext2 = documentContext.map(
jsonPath,
new ScrambleMapFunction(strategy, modifiedFields, fieldMutator.fieldName, jsonPath, schema)
)
can throw following exception:

com.jayway.jsonpath.PathNotFoundException: Expected to find an object with property ['a','b','c','d','e'] in path $['properties']['foo'] but found 'null'. This is not a json object according to the JsonProvider: 'com.jayway.jsonpath.spi.json.JacksonJsonNodeJsonProvider'.
    at com.jayway.jsonpath.internal.path.PropertyPathToken.evaluate(PropertyPathToken.java:71)
    at com.jayway.jsonpath.internal.path.PathToken.handleObjectProperty(PathToken.java:81)
    at com.jayway.jsonpath.internal.path.PropertyPathToken.evaluate(PropertyPathToken.java:79)
    at com.jayway.jsonpath.internal.path.PathToken.handleObjectProperty(PathToken.java:81)
    at com.jayway.jsonpath.internal.path.PropertyPathToken.evaluate(PropertyPathToken.java:79)
    at com.jayway.jsonpath.internal.path.RootPathToken.evaluate(RootPathToken.java:62)
    at com.jayway.jsonpath.internal.path.CompiledPath.evaluate(CompiledPath.java:53)
    at com.jayway.jsonpath.JsonPath.map(JsonPath.java:244)
    at com.jayway.jsonpath.internal.JsonContext.map(JsonContext.java:161)
    at com.jayway.jsonpath.internal.JsonContext.map(JsonContext.java:155)
    at com.snowplowanalytics.snowplow.enrich.common.enrichments.registry.pii.PiiJson.jsonPathReplace(PiiPseudonymizerEnrichment.scala:275)
    at com.snowplowanalytics.snowplow.enrich.common.enrichments.registry.pii.PiiJson.$anonfun$modifyObjectIfSchemaMatches$6(PiiPseudonymizerEnrichment.scala:255)
    at scala.Option.map(Option.scala:230)
@chuwy chuwy added the bug Something isn't working label Sep 8, 2020
@chuwy chuwy added this to the 1.4.0 milestone Sep 8, 2020
@benjben
Copy link
Contributor

benjben commented Sep 9, 2020

To add more details, this is happening when we want to hash foo.a, but foo (whose type is ["object", "null"]) is null

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants