<commit_before>/*
 * Copyright 2000-2013 Vaadin Ltd.
 *
 * 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.
 */
package org.vaadin.netbeans.maven.directory;

import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.InputStream;

import org.openide.filesystems.FileUtil;

/**
 * @author denis
 */
public enum KnownLicense {

    APACHE_2_0("Apache License 2.0", "resources/apache-2.0.txt"), // NOI18N
    CVAL_2_0("CVAL 2.0", "resources/cval-2.0.txt"), // NOI18N
    CVAL_3_0("CVAL 3.0", "resources/cval-3.0.txt"), // NOI18N
    GPL_3_0("GPL 3.0 ", "resources/gpl-3.0.txt"), // NOI18N
    AGPL_3_0("AGPL 3.0 ", "resources/agpl-3.0.txt"), // NOI18N
    EPL_1_0("EPL 1.0", "resources/epl-1.0.txt"), ; // NOI18N

    private static final String UTF_8 = "UTF-8"; // NOI18N

    private KnownLicense( String name, String file ) {
        myName = name;
        myFileName = file;
    }

    String getName() {
        return myName;
    }

    String getText() {
        InputStream stream = KnownLicense.class.getResourceAsStream(myFileName);
        ByteArrayOutputStream bytes = new ByteArrayOutputStream();
        try {
            FileUtil.copy(stream, bytes);
            return bytes.toString(UTF_8);
        }
        catch (IOException e) {
            return null;
        }
    }

    static KnownLicense forString( String name ) {
        for (KnownLicense license : values()) {
            if (license.getName().equalsIgnoreCase(name)) {
                return license;
            }
        }
        return null;
    }

    private String myName;

    private String myFileName;
}
<commit_msg>Known licenses names and search logic is corrected (#13212).<commit_after>/*
 * Copyright 2000-2013 Vaadin Ltd.
 *
 * 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.
 */
package org.vaadin.netbeans.maven.directory;

import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.InputStream;

import org.openide.filesystems.FileUtil;

/**
 * @author denis
 */
public enum KnownLicense {

    APACHE_2_0("Apache License 2.0", "resources/apache-2.0.txt"), // NOI18N
    CVAL_2_0("CVAL 2.0", "resources/cval-2.0.txt"), // NOI18N
    CVAL_3_0("CVAL 3.0", "resources/cval-3.0.txt"), // NOI18N
    GPL_3_0("GPL 3.0", "resources/gpl-3.0.txt"), // NOI18N
    AGPL_3_0("AGPL 3.0", "resources/agpl-3.0.txt"), // NOI18N
    EPL_1_0("EPL 1.0", "resources/epl-1.0.txt"), ; // NOI18N

    private static final String UTF_8 = "UTF-8"; // NOI18N

    private KnownLicense( String name, String file ) {
        myName = name;
        myFileName = file;
    }

    String getName() {
        return myName;
    }

    String getText() {
        InputStream stream = KnownLicense.class.getResourceAsStream(myFileName);
        ByteArrayOutputStream bytes = new ByteArrayOutputStream();
        try {
            FileUtil.copy(stream, bytes);
            return bytes.toString(UTF_8);
        }
        catch (IOException e) {
            return null;
        }
    }

    static KnownLicense forString( String name ) {
        if (name == null) {
            return null;
        }
        for (KnownLicense license : values()) {
            if (license.getName().equalsIgnoreCase(name.trim())) {
                return license;
            }
        }
        return null;
    }

    private String myName;

    private String myFileName;
}

{'fraction_non_alphanumeric': 0.11312113579116098, 'fraction_numerical': 0.030913670712159377, 'mean_word_length': 2.589153656532457, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, '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': '3831710', 'n_tokens_mistral': 1398, 'n_tokens_neox': 1310, 'n_words': 381}