Probably a stupid issue

I have what I am sure is a stupid programming issue. Can someone take a quick look:

logDebug "--${releaseNotesToDisplay}"
// The above prints [https://raw.githubusercontent.com/dcmeglio/hubitat-packagemanager/master/packageManifest.json:Fixed install by URL., https://raw.githubusercontent.com/SANdood/Ecobee-Suite/master/packageManifest.json:null]
logDebug "--${pkg}"
// The above prints https://raw.githubusercontent.com/dcmeglio/hubitat-packagemanager/master/packageManifest.json
logDebug "--${releaseNotesToDisplay[pkg]}"

// The above prints null

How can that last like be null when the first two clearly indicate it exists in the map?

Perhaps try putting pkg in its own ${} rather than inside the got variable reference?

Oh, hang on, I see your not wanting to print them both, but see the position of pkg, or perhaps if it exists? Not sure if this is the case.

You may want to try "contains".

Strange... works for me. Had to create a simple test environment.

All I could think of is
ensure that releaseNotesToDisplay is a map and not a string and that pkg is a string
or is it something in your logDebug routine not translating it properly

When I run this,

def releaseNotesToDisplay = ["https://raw.githubusercontent.com/dcmeglio/hubitat-packagemanager/master/packageManifest.json":"Fixed install by URL.", "https://raw.githubusercontent.com/SANdood/Ecobee-Suite/master/packageManifest.json":null]
def pkg = "https://raw.githubusercontent.com/dcmeglio/hubitat-packagemanager/master/packageManifest.json"
log.debug "--${releaseNotesToDisplay}"
log.debug "--${pkg}"
log.debug "--${releaseNotesToDisplay[pkg]}"

I get this output,

[debug](http://hubitat.localdomain/installedapp/configure/3680)--Fixed install by URL.
[debug](http://hubitat.localdomain/installedapp/configure/3680)--https://raw.githubusercontent.com/dcmeglio/hubitat-packagemanager/master/packageManifest.json
[debug](http://hubitat.localdomain/installedapp/configure/3680)--[https://raw.githubusercontent.com/dcmeglio/hubitat-packagemanager/master/packageManifest.json:Fixed install by URL., https://raw.githubusercontent.com/SANdood/Ecobee-Suite/master/packageManifest.json:null]

Its always something stupid. I've spent hours on an issue to only find a space I missed.

Bingo! It wasn't a string. This was a classic case of "I don't know how this ever worked" but it did at some point. Thanks!

1 Like