colindembovsky / cols-agent-tasks

Colin's ALM Corner Custom Build Tasks
MIT License
83 stars 67 forks source link

Json Tokenizer - Cannot convert undefined or null to object #90

Closed Bhuard1 closed 6 years ago

Bhuard1 commented 6 years ago

In the json file I wish to tokenzied I have null objects "dataSources": [ { "type": "structured", "name": "xxxx", "connectionDetails": { "protocol": "tds", "address": { "server": "model.dataSources[0].connectionDetails.address.server", "database": "xxxxx" }, "authentication": null, "query": null },

The task was returning error: Cannot convert undefined or null to object when trying to evaluate the line: "authentication": null,

In function replaceProps I added if(obj[prop] != null) {if (obj[prop] instanceof Array) {..........}}

I have never used github nor know how to create my own tasks on a TFS on-premise so I am simply logging as an issue in case if helps someone else. I updated the code directly on the agent machine for the time being

eogas commented 6 years ago

I ran into this today as well. It seems that the tokenizer should just ignore null values, or maybe use a sane default type (probably string).