dependency-check-core/src/main/java/org/owasp/dependencycheck/analyzer/NspAnalyzer.java
/**
     * Adds information to an evidence collection from the node json
     * configuration.
     *
     * @param json information from node.js
     * @param collection a set of evidence about a dependency
     * @param key the key to obtain the data from the json information
     */
Adds information to an evidence collection from the node json
configuration.

@param json information from node.js
@param collection a set of evidence about a dependency
@param key the key to obtain the data from the json information
Adds information to an evidence collection from the node json configuration . @param json information from node . js @param collection a set of evidence about a dependency @param key the key to obtain the data from the json information
private void addToEvidence(JsonObject json, EvidenceCollection collection, String key) {
        if (json.containsKey(key)) {
            final JsonValue value = json.get(key);
            if (value instanceof JsonString) {
                collection.addEvidence(PACKAGE_JSON, key, ((JsonString) value).getString(), Confidence.HIGHEST);
            } else if (value instanceof JsonObject) {
                final JsonObject jsonObject = (JsonObject) value;
                for (final Map.Entry<String, JsonValue> entry : jsonObject.entrySet()) {
                    final String property = entry.getKey();
                    final JsonValue subValue = entry.getValue();
                    if (subValue instanceof JsonString) {
                        collection.addEvidence(PACKAGE_JSON,
                                String.format("%s.%s", key, property),
                                ((JsonString) subValue).getString(),
                                Confidence.HIGHEST);
                    } else {
                        LOGGER.warn("JSON sub-value not string as expected: {}", subValue);
                    }
                }
            } else {
                LOGGER.warn("JSON value not string or JSON object as expected: {}", value);
            }
        }
    }
private void addToEvidence ( JsonObject json , EvidenceCollection collection , String key ) { if ( json . containsKey ( key ) ) { final JsonValue value = json . get ( key ) ; if ( value instanceof JsonString ) { collection . addEvidence ( PACKAGE_JSON , key , ( ( JsonString ) value ) . getString ( ) , Confidence . HIGHEST ) ; } else if ( value instanceof JsonObject ) { final JsonObject jsonObject = ( JsonObject ) value ; for ( final Map . Entry < String , JsonValue > entry : jsonObject . entrySet ( ) ) { final String property = entry . getKey ( ) ; final JsonValue subValue = entry . getValue ( ) ; if ( subValue instanceof JsonString ) { collection . addEvidence ( PACKAGE_JSON , String . format ( "%s.%s" , key , property ) , ( ( JsonString ) subValue ) . getString ( ) , Confidence . HIGHEST ) ; } else { LOGGER . warn ( "JSON sub-value not string as expected: {}" , subValue ) ; } } } else { LOGGER . warn ( "JSON value not string or JSON object as expected: {}" , value ) ; } } }
Adds information to an evidence collection from the node json
 configuration.
Adds information to an evidence collection from the node json configuration .