<commit_before>#!/bin/bash

JAVA_KEYSTORE_PASSWORD=${JAVA_KEYSTORE_PASSWORD:-<PASSWORD>}

import_java_cert() {
    echo "Importing CA cert into Java Keystore on $1"
    keytool -noprompt -keystore $2 -storepass $JAVA_KEYSTORE_PASSWORD -importcert -alias caf-ssl-ca-cert -file $3
}

import_java_certs() {
    IFS=',' read -a caFiles <<< "$SSL_CA_CRT"

    for caFile in "${caFiles[@]}"
    do
        if ! [ -e $MESOS_SANDBOX/$caFile ]
        then
            echo "CA Certificate at '$MESOS_SANDBOX/$caFile' not found"
            echo "Aborting further Java CA certificate load attempts."
            exit 1
        fi

        import_java_cert $1 $2 $MESOS_SANDBOX/$caFile
        echo "CA Certificate '$caFile' added to cacerts"
    done
}

if [ -n "$MESOS_SANDBOX" ] && [ -n "$SSL_CA_CRT" ]
then
    # Determine OS version
    if [ -e /usr/lib/ssl/certs/java/cacerts ]; then
        import_java_certs "Debian" /usr/lib/ssl/certs/java/cacerts
    elif [ -e /etc/pki/java/cacerts ]; then
        import_java_certs "CentOS" /etc/pki/java/cacerts
    else
        echo "Not installing CA Certificate for Java. Unsupported OS."
    fi
else
    echo "Not installing CA Certificate for Java"
fi
<commit_msg>Update install-ca-cert-java.sh<commit_after>#!/bin/bash

JAVA_KEYSTORE_PASSWORD=${JAVA_KEYSTORE_PASSWORD:-<PASSWORD>}

import_java_cert() {
    echo "Importing CA cert into Java Keystore on $1"
    keytool -noprompt -keystore $2 -storepass $JAVA_KEYSTORE_PASSWORD -importcert -alias caf-ssl-ca-cert-$4 -file $3
}

import_java_certs() {
    IFS=',' read -a caFiles <<< "$SSL_CA_CRT"

    index=0
    for caFile in "${caFiles[@]}"
    do
        if ! [ -e $MESOS_SANDBOX/$caFile ]
        then
            echo "CA Certificate at '$MESOS_SANDBOX/$caFile' not found"
            echo "Aborting further Java CA certificate load attempts."
            exit 1
        fi

        import_java_cert $1 $2 $MESOS_SANDBOX/$caFile $index
	    (( index++ ))
        echo "CA Certificate '$caFile' added to cacerts"
    done
}

if [ -n "$MESOS_SANDBOX" ] && [ -n "$SSL_CA_CRT" ]
then
    # Determine OS version
    if [ -e /usr/lib/ssl/certs/java/cacerts ]; then
        import_java_certs "Debian" /usr/lib/ssl/certs/java/cacerts
    elif [ -e /etc/pki/java/cacerts ]; then
        import_java_certs "CentOS" /etc/pki/java/cacerts
    else
        echo "Not installing CA Certificate for Java. Unsupported OS."
    fi
else
    echo "Not installing CA Certificate for Java"
fi

{'fraction_non_alphanumeric': 0.1166936790923825, 'fraction_numerical': 0.005672609400324149, 'mean_word_length': 2.6577777777777776, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, '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': '885848', 'n_tokens_mistral': 938, 'n_tokens_neox': 886, 'n_words': 226}