<commit_before>/*
 * This file is part of dependency-check-core.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 *
 * Copyright (c) 2015 <NAME>. All Rights Reserved.
 */
package org.owasp.dependencycheck.data.update.cpe;

import java.io.UnsupportedEncodingException;
import java.util.ArrayList;
import java.util.List;
import javax.annotation.concurrent.NotThreadSafe;
import org.owasp.dependencycheck.data.update.NvdCveUpdater;
import org.owasp.dependencycheck.data.update.exception.InvalidDataException;
import org.owasp.dependencycheck.utils.Settings;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.xml.sax.Attributes;
import org.xml.sax.SAXException;
import org.xml.sax.helpers.DefaultHandler;

/**
 * A SAX Handler that will parse the CPE XML and load it into the database.
 *
 * @author <NAME>
 */
@NotThreadSafe
public class CPEHandler extends DefaultHandler {

    /**
     * The current CPE schema.
     */
    private static final String CURRENT_SCHEMA_VERSION = "2.3";
    /**
     * The Starts with expression to filter CVE entries by CPE.
     */
    private final String cpeStartsWith;
    /**
     * The text content of the node being processed. This can be used during the
     * end element event.
     */
    private StringBuilder nodeText = null;
    /**
     * A reference to the current element.
     */
    private final Element current = new Element();
    /**
     * The logger.
     */
    private static final Logger LOGGER = LoggerFactory.getLogger(NvdCveUpdater.class);
    /**
     * The list of CPE values.
     */
    private final List<Cpe> data = new ArrayList<>();

    /**
     * Constructs a new CPE Handler object with the configured settings.
     *
     * @param settings the configured settings
     */
    public CPEHandler(Settings settings) {
        cpeStartsWith = settings.getString(Settings.KEYS.CVE_CPE_STARTS_WITH_FILTER, "cpe:/a:");
    }

    /**
     * Returns the list of CPE values.
     *
     * @return the list of CPE values
     */
    public List<Cpe> getData() {
        return data;
    }<commit_msg>Update CPEHandler.java<commit_after>/*
 * This file is part of dependency-check-core.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 *
 * Copyright (c) 2015 <NAME>. All Rights Reserved.
 */
package org.owasp.dependencycheck.data.update.cpe;

import java.io.UnsupportedEncodingException;
import java.util.ArrayList;
import java.util.List;
import javax.annotation.concurrent.NotThreadSafe;
import org.owasp.dependencycheck.data.update.exception.InvalidDataException;
import org.owasp.dependencycheck.utils.Settings;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.xml.sax.Attributes;
import org.xml.sax.SAXException;
import org.xml.sax.helpers.DefaultHandler;

/**
 * A SAX Handler that will parse the CPE XML and load it into the database.
 *
 * @author <NAME>
 */
@NotThreadSafe
public class CPEHandler extends DefaultHandler {

    /**
     * The current CPE schema.
     */
    private static final String CURRENT_SCHEMA_VERSION = "2.3";
    /**
     * The Starts with expression to filter CVE entries by CPE.
     */
    private final String cpeStartsWith;
    /**
     * The text content of the node being processed. This can be used during the
     * end element event.
     */
    private StringBuilder nodeText = null;
    /**
     * A reference to the current element.
     */
    private final Element current = new Element();
    /**
     * The logger.
     */
    private static final Logger LOGGER = LoggerFactory.getLogger(CPEHandler.class);
    /**
     * The list of CPE values.
     */
    private final List<Cpe> data = new ArrayList<>();

    /**
     * Constructs a new CPE Handler object with the configured settings.
     *
     * @param settings the configured settings
     */
    public CPEHandler(Settings settings) {
        cpeStartsWith = settings.getString(Settings.KEYS.CVE_CPE_STARTS_WITH_FILTER, "cpe:/a:");
    }

    /**
     * Returns the list of CPE values.
     *
     * @return the list of CPE values
     */
    public List<Cpe> getData() {
        return data;
    }
{'fraction_non_alphanumeric': 0.09220272904483431, 'fraction_numerical': 0.004678362573099415, 'mean_word_length': 3.0593354430379747, 'pattern_counts': {'":': 0, '<': 13, '<?xml version=': 0, '>': 13, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 6}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6722975', 'n_tokens_mistral': 1469, 'n_tokens_neox': 1448, 'n_words': 509}