text:
usage()
{
    cat << EOF
Usage: $0 [options]

Test NSS library against NISCC SMIME and TLS testcases.

Options:
 -h, --help           print this help message and exit
 -v, --verbose        enable extra verbose output
     --niscc-home DIR use NISCC testcases from directory DIR (default /niscc)
     --host HOST      use host HOST (default '127.0.0.1')
     --threads X      set thread number to X (max. 10, default 10)
     --out DIR        set DIR as output directory (default '/out')
     --mail ADDRESS   send mail with test result to ADDRESS
     --nss DIR        set NSS directory to DIR (default '~/niscc-hg/nss')
     --nss-hack DIR   set hacked NSS directory to DIR (default '~/niscc-hg/nss_hack')
     --log-store      store all the logs (only summary by default)
     --no-build-test  don't pull and build tested NSS
     --no-build-hack  don't pull and build hacked NSS
     --test-system    test system installed NSS
     --date DATE      use DATE in log archive name and outgoing email
     --libfaketime path.so  use faketime library with LD_PRELOAD=path.so
     --smallset       test only a very small subset

All options are optional.
All options (and possibly more) can be also set through environment variables.
Commandline options have higher priority than environment variables.
For more information please refer to the source code of this script.

For a successfull run the script NEEDS the core file pattern to be 'core.*',
e.g. 'core.%t'. You can check the current pattern in
'/proc/sys/kernel/core_pattern'. Otherwise the test will be unable to detect
any failures and will pass every time.

It is recommended to use hacked and tested binaries in a location, where their
absolute path is max. 80 characters. If their path is longer and a core file is
generated, its properties may be incomplete.

Return value of the script indicates how many failures it experienced.

EOF
    exit $1
}

################################################################################
# Process command-line arguments
################################################################################
process_args()
{
    HELP="false"
    args=`getopt -u -l "niscc-home:,host:,threads:,out:,verbose,mail:,nss:,nss-hack:,log-store,no-build-test,no-build-hack,help,test-system,date:,libfaketime:,smallset" -- "hv" $*`
    [ "$?" != "0" ] && usage 1
    set -- $args
    for i; do
        case "$i" in
            -v|--verbose)
                shift
                VERBOSE="-v"
                ;;
            --niscc-home)
                shift
                NISCC_HOME="$1"
                shift
                ;;
            --host)
                shift
                HOST="$1"
                shift
                ;;
            --threads)
                shift
                THREADS="$1"
                shift
                ;;
            --out)
                shift
                TEST_OUTPUT="$1"
                shift
                ;;
            --mail)
                shift
                USE_MAIL="true"
                QA_LIST="$1"
                shift
                ;;
            --nss)
                shift
                LOCALDIST="$1"
                shift
                ;;
            --nss-hack)
                shift
                NSS_HACK="$1"
                shift
                ;;
            --log-store)
                shift
                LOG_STORE="true"
                ;;
            --no-build-test)
                shift
                NO_BUILD_TEST="true"
                ;;
            --no-build-hack)
                shift
                NO_BUILD_HACK="true"
                ;;
            -h|--help)
                shift
                HELP="true"
                ;;
            --test-system)
                shift
                TEST_SYSTEM="true"
                ;;
            --date)
                shift
                DATE="$1"
                shift
                ;;
            --libfaketime)
                shift
                FAKETIMELIB="$1"
                shift
                ;;
            --smallset)
                shift
                SMALLSET="true"
                ;;
            --)
                ;;
            *)
                ;;
        esac
    done
    [ $HELP = "true" ] && usage 0
}

################################################################################
# Create and set needed and useful environment variables
################################################################################
create_environment()
{
    # Base location of NISCC testcases
    export NISCC_HOME=${NISCC_HOME:-/niscc}

    # Base location of NSS
    export HG=${HG:-"$HOME/niscc-hg"}

    # NSS being tested
    export LOCALDIST=${LOCALDIST:-"${HG}/nss"}

    # Hacked NSS - built with "NISCC_TEST=1"
    export NSS_HACK=${NSS_HACK:-"${HG}/nss_hack"}

    # Hostname of the testmachine
    export HOST=${HOST:-127.0.0.1}

    # Whether to store logfiles
    export LOG_STORE=${LOG_STORE:-"false"}

    # Whether to mail the summary
    export USE_MAIL=${USE_MAIL:-"false"}

    # How to mail summary
    export MAIL_COMMAND=${MAIL_COMMAND:-"mailx -S smtp=smtp://your.smtp.server:25 -r your+niscc@email.address"}

    # List of mail addresses where to send summary
    export QA_LIST=${QA_LIST:-"result@recipient.address"}

    # Whether to use 64b build
    export USE_64=${USE_64:-1}

    # Directory where to write all the output data (around 650MiB for each run)
    export TEST_OUTPUT=${TEST_OUTPUT:-"$HOME/out"}

    # How many threads to use in selfserv and strsclnt (max. 10)
    export THREADS=${THREADS:-10}

    # If true, do not build tthe tested version of NSS
    export NO_BUILD_TEST=${NO_BUILD_TEST:-"false"}

    # If true, do not build the special NSS version for NISCC
    export NO_BUILD_HACK=${NO_BUILD_HACK:-"false"}

    # If true, do not rebuild client and server directories
    export NO_SETUP=${NO_SETUP:-"false"}

    # Location of NISCC SSL/TLS testcases
    export TEST=${TEST:-"${NISCC_HOME}/NISCC_SSL_testcases"}

    # If true, then be extra verbose
    export VERBOSE=${VERBOSE:-""}

    # If true, test the system installed NSS
    export TEST_SYSTEM=${TEST_SYSTEM:-"false"}
    [ "$TEST_SYSTEM" = "true" ] && export NO_BUILD_TEST="true"

    [ ! -z "$VERBOSE" ] && set -xv

    # Real date for naming of archives (system date must be 2002-11-18 .. 2007-11-18 due to certificate validity
    DATE=${DATE:-`date`}
    export DATE=`date -d "$DATE" +%Y%m%d`

    FAKETIMELIB=${FAKETIMELIB:-""}
    export DATE=`date -d "$DATE" +%Y%m%d`

    # Whether to test only a very small subset
    export SMALLSET=${SMALLSET:-"false"}

    # Create output dir if it doesn't exist
    mkdir -p ${TEST_OUTPUT}
}

################################################################################
# Do a HG pull of NSS
################################################################################
hg_pull()
{
    # Tested NSS - by default using HG default tip
    if [ "$NO_BUILD_TEST" = "false" ]; then
        echo "cloning NSS sources to be tested from HG"
        [ ! -d "$LOCALDIST" ] && mkdir -p "$LOCALDIST"
        cd "$LOCALDIST"
        [ ! -d "$LOCALDIST/nspr" ] && hg clone --noupdate https://hg.mozilla.org/projects/nspr
        cd nspr; hg pull; hg update -C -r default; cd ..
        [ ! -d "$LOCALDIST/nss" ] && hg clone --noupdate https://hg.mozilla.org/projects/nss
        cd nss; hg pull; hg update -C -r default; cd ..
        #find . -exec touch {} \;
    fi

    # Hacked NSS - by default using some RTM version.
    # Do not use HEAD for hacked NSS - it needs to be stable and bug-free
    if [ "$NO_BUILD_HACK" = "false" ]; then
        echo "cloning NSS sources for a hacked build from HG"
        [ ! -d "$NSS_HACK" ] && mkdir -p "$NSS_HACK"
        cd "$NSS_HACK"
        NSPR_TAG=`curl --silent http://hg.mozilla.org/releases/mozilla-aurora/raw-file/default/nsprpub/TAG-INFO | head -1 | sed --regexp-extended 's/[[:space:]]//g' | awk '{print $1}'`
        NSS_TAG=`curl --silent http://hg.mozilla.org/releases/mozilla-aurora/raw-file/default/security/nss/TAG-INFO | head -1 | sed --regexp-extended 's/[[:space:]]//g' | awk '{print $1}'`
        [ ! -d "$NSS_HACK/nspr" ] && hg clone --noupdate https://hg.mozilla.org/projects/nspr
        cd nspr; hg pull; hg update -C -r "$NSPR_TAG"; cd ..
        [ ! -d "$NSS_HACK/nss" ] && hg clone --noupdate https://hg.mozilla.org/projects/nss
        cd nss; hg pull; hg update -C -r "$NSS_TAG"; cd ..
        #find . -exec touch {} \;
    fi
}

################################################################################
# Build NSS after setting make variable NISCC_TEST
################################################################################
build_NSS()
{
    # Tested NSS
    if [ "$NO_BUILD_TEST" = "false" ]; then
        echo "building NSS to be tested"
        cd "$LOCALDIST"
        unset NISCC_TEST
        cd nss
        gmake nss_clean_all &>> $TEST_OUTPUT/nisccBuildLog
        gmake nss_build_all &>> $TEST_OUTPUT/nisccBuildLog
    fi

    # Hacked NSS
    if [ "$NO_BUILD_HACK" = "false" ]; then
        echo "building hacked NSS"
        cd "$NSS_HACK"
        export NISCC_TEST=1
        cd nss
        gmake nss_clean_all &>> $TEST_OUTPUT/nisccBuildLogHack
        gmake nss_build_all &>> $TEST_OUTPUT/nisccBuildLogHack
    fi

    unset NISCC_TEST
}

################################################################################
# Set build dir, bin and lib directories
################################################################################
init()
{
    # Enable useful core files to be generated in case of crash
    ulimit -c unlimited

    # Pattern of core files, they should be created in current directory
    echo "core_pattern $(cat /proc/sys/kernel/core_pattern)" > "$TEST_OUTPUT/nisccLog00"

    # gmake is needed in the path for this suite to run
    echo "PATH $PATH" >> "$TEST_OUTPUT/nisccLog00"

    # Find out hacked NSS version
    DISTTYPE=`cd "$NSS_HACK/nss/tests/common"; gmake objdir_name`
    echo "NSS_HACK DISTTYPE $DISTTYPE" >> "$TEST_OUTPUT/nisccLog00"
    export HACKBIN="$NSS_HACK/dist/$DISTTYPE/bin"
    export HACKLIB="$NSS_HACK/dist/$DISTTYPE/lib"

    if [ "$TEST_SYSTEM" = "false" ]; then
        # Find out nss version
        DISTTYPE=`cd "$LOCALDIST/nss/tests/common"; gmake objdir_name`
        echo "NSS DISTTYPE $DISTTYPE" >> "$TEST_OUTPUT/nisccLog00"
        export TESTBIN="$LOCALDIST/dist/$DISTTYPE/bin"
        export TESTLIB="$LOCALDIST/dist/$DISTTYPE/lib"
        export TESTTOOLS="$TESTBIN"
    else
        # Using system installed NSS
        echo "USING SYSTEM NSS" >> "$TEST_OUTPUT/nisccLog00"
        export TESTBIN="/usr/bin"
        if [ `uname -m` = "x86_64" ]; then
            export TESTLIB="/usr/lib64"
            export TESTTOOLS="/usr/lib64/nss/unsupported-tools"
        else
            export TESTLIB="/usr/lib"
            export TESTTOOLS="/usr/lib/nss/unsupported-tools"
        fi
    fi

    # Verify NISCC_TEST was set in the proper library
    if strings "$HACKLIB/libssl3.so" | grep NISCC_TEST > /dev/null 2>&1; then
        echo "$HACKLIB/libssl3.so contains NISCC_TEST" >> "$TEST_OUTPUT/nisccLog00"
    else
        echo "$HACKLIB/libssl3.so does NOT contain NISCC_TEST" >> "$TEST_OUTPUT/nisccLog00"
    fi

    if strings "$TESTLIB/libssl3.so" | grep NISCC_TEST > /dev/null 2>&1; then
        echo "$TESTLIB/libssl3.so contains NISCC_TEST" >> "$TEST_OUTPUT/nisccLog00"
    else
        echo "$TESTLIB/libssl3.so does NOT contain NISCC_TEST" >> "$TEST_OUTPUT/nisccLog00"
    fi
}

################################################################################
# Setup simple client and server directory
################################################################################
ssl_setup_dirs_simple()
{
    [ "$NO_SETUP" = "true" ] && return

    echo "Setting up working directories for SSL simple tests"

    CLIENT="$TEST_OUTPUT/niscc_ssl/simple_client"
    SERVER="$TEST_OUTPUT/niscc_ssl/simple_server"

    # Generate .p12 files
    openssl pkcs12 -export -inkey "$TEST/client_key.pem" -in "$TEST/client_crt.pem" -out "$TEST_OUTPUT/client_crt.p12" -passout pass:testtest1 -name "client_crt"
    openssl pkcs12 -export -inkey "$TEST/server_key.pem" -in "$TEST/server_crt.pem" -out "$TEST_OUTPUT/server_crt.p12" -passout pass:testtest1 -name "server_crt"

    # Setup simple client directory
    rm -rf "$CLIENT"
    mkdir -p "$CLIENT"
    echo test > "$CLIENT/password-is-test.txt"
    export LD_LIBRARY_PATH="$TESTLIB"
    LD_PRELOAD=${FAKETIMELIB} NO_FAKE_STAT=1 FAKETIME="@2004-03-29 14:14:14" \
    "${TESTBIN}/certutil" -N -d "$CLIENT" -f "$CLIENT/password-is-test.txt" >> "$TEST_OUTPUT/nisccLog00" 2>&1
    LD_PRELOAD=${FAKETIMELIB} NO_FAKE_STAT=1 FAKETIME="@2004-03-29 14:14:14" \
    "${TESTBIN}/certutil" -A -d "$CLIENT" -n rootca -i "$TEST/rootca.crt" -t "C,C," >> "$TEST_OUTPUT/nisccLog00" 2>&1
    LD_PRELOAD=${FAKETIMELIB} NO_FAKE_STAT=1 FAKETIME="@2004-03-29 14:14:14" \
    "${TESTBIN}/pk12util" -i "$TEST_OUTPUT/client_crt.p12" -d "$CLIENT" -k "$CLIENT/password-is-test.txt" -W testtest1 >> "$TEST_OUTPUT/nisccLog00" 2>&1
    LD_PRELOAD=${FAKETIMELIB} NO_FAKE_STAT=1 FAKETIME="@2004-03-29 14:14:14" \
    "${TESTBIN}/certutil" -L -d "$CLIENT" >> "$TEST_OUTPUT/nisccLog00" 2>&1

    # File containg message used for terminating the server
    echo "GET /stop HTTP/1.0" > "$CLIENT/stop.txt"
    echo ""                  >> "$CLIENT/stop.txt"

    # Setup simple server directory
    rm -rf "$SERVER"
    mkdir -p "$SERVER"
    echo test > "$SERVER/password-is-test.txt"
    LD_PRELOAD=${FAKETIMELIB} NO_FAKE_STAT=1 FAKETIME="@2004-03-29 14:14:14" \
    "${TESTBIN}/certutil" -N -d "$SERVER" -f "$SERVER/password-is-test.txt" >> "$TEST_OUTPUT/nisccLog00" 2>&1
    LD_PRELOAD=${FAKETIMELIB} NO_FAKE_STAT=1 FAKETIME="@2004-03-29 14:14:14" \
    "${TESTBIN}/certutil" -A -d "$SERVER" -n rootca -i "$TEST/rootca.crt" -t "TC,C," >> "$TEST_OUTPUT/nisccLog00" 2>&1
    LD_PRELOAD=${FAKETIMELIB} NO_FAKE_STAT=1 FAKETIME="@2004-03-29 14:14:14" \
    "${TESTBIN}/pk12util" -i "$TEST_OUTPUT/server_crt.p12" -d "$SERVER" -k "$SERVER/password-is-test.txt" -W testtest1 >> "$TEST_OUTPUT/nisccLog00" 2>&1
    LD_PRELOAD=${FAKETIMELIB} NO_FAKE_STAT=1 FAKETIME="@2004-03-29 14:14:14" \
    "${TESTBIN}/certutil" -L -d "$SERVER" >> "$TEST_OUTPUT/nisccLog00" 2>&1

    unset LD_LIBRARY_PATH
}

################################################################################
# Setup resigned client and server directory
################################################################################
ssl_setup_dirs_resigned()
{
    [ "$NO_SETUP" = "true" ] && return

    echo "Setting up working directories for SSL resigned tests"

    CLIENT="$TEST_OUTPUT/niscc_ssl/resigned_client"
    SERVER="$TEST_OUTPUT/niscc_ssl/resigned_server"

    # Setup resigned client directory
    rm -rf "$CLIENT"
    mkdir -p "$CLIENT"
    echo test > "$CLIENT/password-is-test.txt"
    export LD_LIBRARY_PATH="$TESTLIB"
    LD_PRELOAD=${FAKETIMELIB} NO_FAKE_STAT=1 FAKETIME="@2004-03-29 14:14:14" \
    "${TESTBIN}/certutil" -N -d "$CLIENT" -f "$CLIENT/password-is-test.txt" >> "$TEST_OUTPUT/nisccLog00" 2>&1
    LD_PRELOAD=${FAKETIMELIB} NO_FAKE_STAT=1 FAKETIME="@2004-03-29 14:14:14" \
    "${TESTBIN}/certutil" -A -d "$CLIENT" -n rootca -i "$TEST/rootca.crt" -t "C,C," >> "$TEST_OUTPUT/nisccLog00" 2>&1
    LD_PRELOAD=${FAKETIMELIB} NO_FAKE_STAT=1 FAKETIME="@2004-03-29 14:14:14" \
    "${TESTBIN}/pk12util" -i "$TEST_OUTPUT/client_crt.p12" -d "$CLIENT" -k "$CLIENT/password-is-test.txt" -W testtest1 >> "$TEST_OUTPUT/nisccLog00" 2>&1
    LD_PRELOAD=${FAKETIMELIB} NO_FAKE_STAT=1 FAKETIME="@2004-03-29 14:14:14" \
    "${TESTBIN}/certutil" -L -d "$CLIENT" >> "$TEST_OUTPUT/nisccLog00" 2>&1

    echo "GET /stop HTTP/1.0" > "$CLIENT/stop.txt"
    echo ""                  >> "$CLIENT/stop.txt"

    # Setup resigned server directory
    rm -rf "$SERVER"
    mkdir -p "$SERVER"
    echo test > "$SERVER/password-is-test.txt"
    LD_PRELOAD=${FAKETIMELIB} NO_FAKE_STAT=1 FAKETIME="@2004-03-29 14:14:14" \
    "${TESTBIN}/certutil" -N -d "$SERVER" -f "$SERVER/password-is-test.txt" >> "$TEST_OUTPUT/nisccLog00" 2>&1
    LD_PRELOAD=${FAKETIMELIB} NO_FAKE_STAT=1 FAKETIME="@2004-03-29 14:14:14" \
    "${TESTBIN}/certutil" -A -d "$SERVER" -n rootca -i "$TEST/rootca.crt" -t "TC,C," >> "$TEST_OUTPUT/nisccLog00" 2>&1
    LD_PRELOAD=${FAKETIMELIB} NO_FAKE_STAT=1 FAKETIME="@2004-03-29 14:14:14" \
    "${TESTBIN}/pk12util" -i "$TEST_OUTPUT/server_crt.p12" -d "$SERVER" -k "$SERVER/password-is-test.txt" -W testtest1 >> "$TEST_OUTPUT/nisccLog00" 2>&1
    LD_PRELOAD=${FAKETIMELIB} NO_FAKE_STAT=1 FAKETIME="@2004-03-29 14:14:14" \
    "${TESTBIN}/certutil" -L -d "$SERVER" >> "$TEST_OUTPUT/nisccLog00" 2>&1

    unset LD_LIBRARY_PATH
}

################################################################################
# NISCC SMIME tests
################################################################################
niscc_smime()
{
    cd "$TEST_OUTPUT"
    DATA="$NISCC_HOME/NISCC_SMIME_testcases"

    [ ! -d niscc_smime ] && mkdir -p niscc_smime

    export SMIME_CERT_DB_DIR=envDB
    export NSS_STRICT_SHUTDOWN=1
    export NSS_DISABLE_ARENA_FREE_LIST=1
    export LD_LIBRARY_PATH="$TESTLIB"

    # Generate .p12 files
    openssl pkcs12 -export -inkey "$DATA/Client.key" -in "$DATA/Client.crt" -out Client.p12 -passout pass:testtest1 &>/dev/null
    openssl pkcs12 -export -inkey "$DATA/CA.key" -in "$DATA/CA.crt" -out CA.p12 -passout pass:testtest1 &>/dev/null

    # Generate envDB if needed
    if [ ! -d "$SMIME_CERT_DB_DIR" ]; then
        mkdir -p "$SMIME_CERT_DB_DIR"
        echo testtest1 > password-is-testtest1.txt
        LD_PRELOAD=${FAKETIMELIB} NO_FAKE_STAT=1 FAKETIME="@2004-03-29 14:14:14" \
        "${TESTBIN}/certutil" -N -d "./$SMIME_CERT_DB_DIR" -f password-is-testtest1.txt > /dev/null 2>&1
        LD_PRELOAD=${FAKETIMELIB} NO_FAKE_STAT=1 FAKETIME="@2004-03-29 14:14:14" \
        "${TESTBIN}/certutil" -A -d "$SMIME_CERT_DB_DIR" -f password-is-testtest1.txt -i "$DATA/CA.crt" -n CA -t "TC,C,"
        LD_PRELOAD=${FAKETIMELIB} NO_FAKE_STAT=1 FAKETIME="@2004-03-29 14:14:14" \
        "${TESTBIN}/certutil" -A -d "$SMIME_CERT_DB_DIR" -f password-is-testtest1.txt -i "$DATA/Client.crt" -n Client -t "TC,C,"
        LD_PRELOAD=${FAKETIMELIB} NO_FAKE_STAT=1 FAKETIME="@2004-03-29 14:14:14" \
        "${TESTBIN}/pk12util" -i ./CA.p12 -d "$SMIME_CERT_DB_DIR" -k password-is-testtest1.txt -W testtest1
        LD_PRELOAD=${FAKETIMELIB} NO_FAKE_STAT=1 FAKETIME="@2004-03-29 14:14:14" \
        "${TESTBIN}/pk12util" -i ./Client.p12 -d "$SMIME_CERT_DB_DIR" -k password-is-testtest1.txt -W testtest1
    fi

    # if p7m-ed-m-files.txt does not exist, then generate it.
    [ -f "$DATA/p7m-ed-m-files.txt" ] && sed "s|^|$DATA/|" "$DATA/p7m-ed-m-files.txt" > p7m-ed-m-files.txt
    export P7M_ED_M_FILES=p7m-ed-m-files.txt
    if [ "$SMALLSET" = "true" ]; then
        [ ! -f "$P7M_ED_M_FILES" ] && find "$DATA"/p7m-ed-m-0* -type f -print | head -10 >> "$P7M_ED_M_FILES"
    else
        [ ! -f "$P7M_ED_M_FILES" ] && find "$DATA"/p7m-ed-m-0* -type f -print >> "$P7M_ED_M_FILES"
    fi

    # Test "p7m-ed-m*" testcases
    echo "Testing SMIME enveloped data testcases"
    LD_PRELOAD=${FAKETIMELIB} NO_FAKE_STAT=1 FAKETIME="@2004-03-29 14:14:14" \
    "${TESTBIN}/cmsutil" $VERBOSE -D -d "$SMIME_CERT_DB_DIR" -p testtest1 -b -i "$P7M_ED_M_FILES" > niscc_smime/p7m-ed-m-results.txt 2>&1

    export SMIME_CERT_DB_DIR=sigDB
    # Generate sigDB if needed
    if [ ! -d "$SMIME_CERT_DB_DIR" ]; then
        mkdir -p "$SMIME_CERT_DB_DIR"
        LD_PRELOAD=${FAKETIMELIB} NO_FAKE_STAT=1 FAKETIME="@2004-03-29 14:14:14" \
        "${TESTBIN}/certutil" -N -d "$SMIME_CERT_DB_DIR" -f password-is-testtest1.txt
        LD_PRELOAD=${FAKETIMELIB} NO_FAKE_STAT=1 FAKETIME="@2004-03-29 14:14:14" \
        "${TESTBIN}/certutil" -A -d "$SMIME_CERT_DB_DIR" -i "$DATA/CA.crt" -n CA -t "TC,C,"
        LD_PRELOAD=${FAKETIMELIB} NO_FAKE_STAT=1 FAKETIME="@2004-03-29 14:14:14" \
        "${TESTBIN}/certutil" -A -d "$SMIME_CERT_DB_DIR" -i "$DATA/Client.crt" -n Client -t "TC,C,"
    fi

    # if p7m-sd-dt-files.txt does not exist, then generate it.
    [ -f "$DATA/p7m-sd-dt-files.txt" ] && sed "s|^|$DATA/|" "$DATA/p7m-sd-dt-files.txt" > p7m-sd-dt-files.txt
    export P7M_SD_DT_FILES=p7m-sd-dt-files.txt
    if [ "$SMALLSET" = "true" ]; then
        [ ! -f "$P7M_SD_DT_FILES" ] && find "$DATA"/p7m-sd-dt-[cm]-* -type f -print | head -10 >> "$P7M_SD_DT_FILES"
    else
        [ ! -f "$P7M_SD_DT_FILES" ] && find "$DATA"/p7m-sd-dt-[cm]-* -type f -print >> "$P7M_SD_DT_FILES"
    fi

    [ ! -f detached.txt ] && touch detached.txt

    # Test "p7m-sd-dt*" testcases
    echo "Testing SMIME detached signed data testcases"
    LD_PRELOAD=${FAKETIMELIB} NO_FAKE_STAT=1 FAKETIME="@2004-03-29 14:14:14" \
    "${TESTBIN}/cmsutil" $VERBOSE -D -d "$SMIME_CERT_DB_DIR" -c detached.txt -b -i "$P7M_SD_DT_FILES" > niscc_smime/p7m-sd-dt-results.txt 2>&1

    # if p7m-sd-op-files.txt does not exist, then generate it.
    [ -f "$DATA/p7m-sd-op-files.txt" ] && sed "s|^|$DATA/|" "$DATA/p7m-sd-op-files.txt" > p7m-sd-op-files.txt
    export P7M_SD_OP_FILES=p7m-sd-op-files.txt
    if [ "$SMALLSET" = "true" ]; then
        [ ! -f "$P7M_SD_OP_FILES" ] && find "$DATA"/p7m-sd-op-[cm]-* -type f -print | head -10 >> "$P7M_SD_OP_FILES"
    else
        [ ! -f "$P7M_SD_OP_FILES" ] && find "$DATA"/p7m-sd-op-[cm]-* -type f -print >> "$P7M_SD_OP_FILES"
    fi

    # Test "p7m-sd-op*" testcases
    echo "Testing SMIME opaque signed data testcases"
    LD_PRELOAD=${FAKETIMELIB} NO_FAKE_STAT=1 FAKETIME="@2004-03-29 14:14:14" \
    "${TESTBIN}/cmsutil" $VERBOSE -D -d "$SMIME_CERT_DB_DIR" -b -i "$P7M_SD_OP_FILES" > niscc_smime/p7m-sd-op-results.txt 2>&1

    unset LD_LIBRARY_PATH
}

################################################################################
# Set env variables for NISCC SSL tests
################################################################################
niscc_ssl_init()
{
    export NSS_STRICT_SHUTDOWN=1
    export NSS_DISABLE_ARENA_FREE_LIST=1
    cd "$TEST_OUTPUT"
}

force_crash()
{
    echo "int main(int argc, char *argv[]) { int *i; i = (int*)(void*)1; *i = 1; }" > "$TEST_OUTPUT/crashme.c"
    gcc -g -o "$TEST_OUTPUT/crashme" "$TEST_OUTPUT/crashme.c"
    "$TEST_OUTPUT/crashme"
}

################################################################################
# Do simple client auth tests
# Use an altered client against the server
################################################################################
ssl_simple_client_auth()
{
    echo "Testing SSL simple client auth testcases"
    export CLIENT="$TEST_OUTPUT/niscc_ssl/simple_client"
    export SERVER="$TEST_OUTPUT/niscc_ssl/simple_server"
    export PORT=8443
    export START_AT=1
    if [ "$SMALLSET" = "true" ]; then
        export STOP_AT=10
    else
        export STOP_AT=106160
    fi
    unset NISCC_TEST
    export LD_LIBRARY_PATH="$TESTLIB"
    LD_PRELOAD=${FAKETIMELIB} NO_FAKE_STAT=1 FAKETIME="@2004-03-29 14:14:14" \
    "${TESTTOOLS}/selfserv" $VERBOSE -p $PORT -d "$SERVER" -n server_crt -rr -t $THREADS -w test > "$TEST_OUTPUT/nisccLog01" 2>&1 &

    export NISCC_TEST="$TEST/simple_client"
    export LD_LIBRARY_PATH="$HACKLIB"

    for START in `seq $START_AT $THREADS $STOP_AT`; do
        START_AT=$START \
        STOP_AT=$(($START+$THREADS)) \
        LD_PRELOAD=${FAKETIMELIB} NO_FAKE_STAT=1 FAKETIME="@2004-03-29 14:14:14" \
        "${HACKBIN}/strsclnt" $VERBOSE -d "$CLIENT" -n client_crt -p $PORT -t $THREADS -c $THREADS -o -N -w test $HOST >> "$TEST_OUTPUT/nisccLog02" 2>&1
    done

    unset NISCC_TEST
    echo "starting tstclnt to shutdown simple client selfserv process"
    for i in `seq 5`; do
        LD_PRELOAD=${FAKETIMELIB} NO_FAKE_STAT=1 FAKETIME="@2004-03-29 14:14:14" \
        "${HACKBIN}/tstclnt" -h $HOST -p $PORT -d "$CLIENT" -n client_crt -o -f -w test < "$CLIENT/stop.txt" >> "$TEST_OUTPUT/nisccLog02" 2>&1
    done

    unset LD_LIBRARY_PATH

    sleep 1
}

################################################################################
# Do simple server auth tests
# Use an altered server against the client
################################################################################
ssl_simple_server_auth()
{
    echo "Testing SSL simple server auth testcases"
    export CLIENT="$TEST_OUTPUT/niscc_ssl/simple_client"
    export SERVER="$TEST_OUTPUT/niscc_ssl/simple_server"
    export PORT=8444
    export START_AT=00000001
    if [ "$SMALLSET" = "true" ]; then
        export STOP_AT=00000010
    else
        export STOP_AT=00106167
    fi
    export LD_LIBRARY_PATH="$HACKLIB"
    export NISCC_TEST="$TEST/simple_server"
    LD_PRELOAD=${FAKETIMELIB} NO_FAKE_STAT=1 FAKETIME="@2004-03-29 14:14:14" \
    "${HACKBIN}/selfserv" $VERBOSE -p $PORT -d "$SERVER" -n server_crt -t $THREADS -w test > "$TEST_OUTPUT/nisccLog03" 2>&1 &

    unset NISCC_TEST
    export LD_LIBRARY_PATH="$TESTLIB"
    for START in `seq $START_AT $THREADS $STOP_AT`; do
        LD_PRELOAD=${FAKETIMELIB} NO_FAKE_STAT=1 FAKETIME="@2004-03-29 14:14:14" \
        "${TESTTOOLS}/strsclnt" $VERBOSE -d "$CLIENT" -p $PORT -t $THREADS -c $THREADS -o -N $HOST >> "$TEST_OUTPUT/nisccLog04" 2>&1
    done

    echo "starting tstclnt to shutdown simple server selfserv process"
    for i in `seq 5`; do
        LD_PRELOAD=${FAKETIMELIB} NO_FAKE_STAT=1 FAKETIME="@2004-03-29 14:14:14" \
        "${TESTTOOLS}/tstclnt" -h $HOST -p $PORT -d "$CLIENT" -n client_crt -o -f -w test < "$CLIENT/stop.txt" >> "$TEST_OUTPUT/nisccLog04" 2>&1
    done

    unset LD_LIBRARY_PATH

    sleep 1
}

################################################################################
# Do simple rootCA tests
# Use an altered server against the client
################################################################################
ssl_simple_rootca()
{
    echo "Testing SSL simple rootCA testcases"
    export CLIENT="$TEST_OUTPUT/niscc_ssl/simple_client"
    export SERVER="$TEST_OUTPUT/niscc_ssl/simple_server"
    export PORT=8445
    export START_AT=1
    if [ "$SMALLSET" = "true" ]; then
        export STOP_AT=10
    else
        export STOP_AT=106190
    fi
    export LD_LIBRARY_PATH="$HACKLIB"
    export NISCC_TEST="$TEST/simple_rootca"
    LD_PRELOAD=${FAKETIMELIB} NO_FAKE_STAT=1 FAKETIME="@2004-03-29 14:14:14" \
    "${HACKBIN}/selfserv" $VERBOSE -p $PORT -d "$SERVER" -n server_crt -t $THREADS -w test > "$TEST_OUTPUT/nisccLog05" 2>&1 &

    unset NISCC_TEST
    export LD_LIBRARY_PATH="$TESTLIB"
    for START in `seq $START_AT $THREADS $STOP_AT`; do
        LD_PRELOAD=${FAKETIMELIB} NO_FAKE_STAT=1 FAKETIME="@2004-03-29 14:14:14" \
        "${TESTTOOLS}/strsclnt" $VERBOSE -d "$CLIENT" -p $PORT -t $THREADS -c $THREADS -o -N $HOST >> "$TEST_OUTPUT/nisccLog06" 2>&1
    done

    echo "starting tstclnt to shutdown simple rootca selfserv process"
    for i in `seq 5`; do
        LD_PRELOAD=${FAKETIMELIB} NO_FAKE_STAT=1 FAKETIME="@2004-03-29 14:14:14" \
        "${TESTTOOLS}/tstclnt" -h $HOST -p $PORT -d "$CLIENT" -n client_crt -o -f -w test < "$CLIENT/stop.txt" >> "$TEST_OUTPUT/nisccLog06" 2>&1
    done

    unset LD_LIBRARY_PATH

    sleep 1
}

################################################################################
# Do resigned client auth tests
# Use an altered client against the server
################################################################################
ssl_resigned_client_auth()
{
    echo "Testing SSL resigned client auth testcases"
    export CLIENT="$TEST_OUTPUT/niscc_ssl/resigned_client"
    export SERVER="$TEST_OUTPUT/niscc_ssl/resigned_server"
    export PORT=8446
    export START_AT=0
    if [ "$SMALLSET" = "true" ]; then
        export STOP_AT=9
    else
        export STOP_AT=99981
    fi
    unset NISCC_TEST
    export LD_LIBRARY_PATH="$TESTLIB"
    LD_PRELOAD=${FAKETIMELIB} NO_FAKE_STAT=1 FAKETIME="@2004-03-29 14:14:14" \
    "${TESTTOOLS}/selfserv" $VERBOSE -p $PORT -d "$SERVER" -n server_crt -rr -t $THREADS -w test > "$TEST_OUTPUT/nisccLog07" 2>&1 &

    export NISCC_TEST="$TEST/resigned_client"
    export LD_LIBRARY_PATH="$HACKLIB"

    for START in `seq $START_AT $THREADS $STOP_AT`; do
        START_AT=$START \
        STOP_AT=$(($START+$THREADS)) \
        LD_PRELOAD=${FAKETIMELIB} NO_FAKE_STAT=1 FAKETIME="@2004-03-29 14:14:14" \
        "${HACKBIN}/strsclnt" $VERBOSE -d "$CLIENT" -n client_crt -p $PORT -t $THREADS -c $THREADS -o -N -w test $HOST >> "$TEST_OUTPUT/nisccLog08" 2>&1
    done

    unset NISCC_TEST
    echo "starting tstclnt to shutdown resigned client selfserv process"
    for i in `seq 5`; do
        LD_PRELOAD=${FAKETIMELIB} NO_FAKE_STAT=1 FAKETIME="@2004-03-29 14:14:14" \
        "${HACKBIN}/tstclnt" -h $HOST -p $PORT -d "$CLIENT" -n client_crt -o -f -w test < "$CLIENT/stop.txt" >> "$TEST_OUTPUT/nisccLog08" 2>&1
    done

    unset LD_LIBRARY_PATH

    sleep 1
}

################################################################################
# Do resigned server auth tests
# Use an altered server against the client
################################################################################
ssl_resigned_server_auth()
{
    echo "Testing SSL resigned server auth testcases"
    export CLIENT="$TEST_OUTPUT/niscc_ssl/resigned_client"
    export SERVER="$TEST_OUTPUT/niscc_ssl/resigned_server"
    export PORT=8447
    export START_AT=0
    if [ "$SMALLSET" = "true" ]; then
        export STOP_AT=9
    else
        export STOP_AT=100068
    fi
    export LD_LIBRARY_PATH="$HACKLIB"
    export NISCC_TEST="$TEST/resigned_server"
    LD_PRELOAD=${FAKETIMELIB} NO_FAKE_STAT=1 FAKETIME="@2004-03-29 14:14:14" \
    "${HACKBIN}/selfserv" $VERBOSE -p $PORT -d "$SERVER" -n server_crt -t $THREADS -w test > "$TEST_OUTPUT/nisccLog09" 2>&1 &

    unset NISCC_TEST
    export LD_LIBRARY_PATH="$TESTLIB"
    for START in `seq $START_AT $THREADS $STOP_AT`; do
        LD_PRELOAD=${FAKETIMELIB} NO_FAKE_STAT=1 FAKETIME="@2004-03-29 14:14:14" \
        "${TESTTOOLS}/strsclnt" $VERBOSE -d "$CLIENT" -p $PORT -t $THREADS -c $THREADS -o -N $HOST >> "$TEST_OUTPUT/nisccLog10" 2>&1
    done

    echo "starting tstclnt to shutdown resigned server selfserv process"
    for i in `seq 5`; do
        LD_PRELOAD=${FAKETIMELIB} NO_FAKE_STAT=1 FAKETIME="@2004-03-29 14:14:14" \
        "${TESTTOOLS}/tstclnt" -h $HOST -p $PORT -d "$CLIENT" -n client_crt -o -f -w test < "$CLIENT/stop.txt" >> "$TEST_OUTPUT/nisccLog10" 2>&1
    done

    unset LD_LIBRARY_PATH

    sleep 1
}

################################################################################
# Do resigned rootCA tests
# Use an altered server against the client
################################################################################
ssl_resigned_rootca()
{
    echo "Testing SSL resigned rootCA testcases"
    export CLIENT="$TEST_OUTPUT/niscc_ssl/resigned_client"
    export SERVER="$TEST_OUTPUT/niscc_ssl/resigned_server"
    export PORT=8448
    export START_AT=0
    if [ "$SMALLSET" = "true" ]; then
        export STOP_AT=9
    else
        export STOP_AT=99959
    fi
    export LD_LIBRARY_PATH="$HACKLIB"
    export NISCC_TEST="$TEST/resigned_rootca"
    LD_PRELOAD=${FAKETIMELIB} NO_FAKE_STAT=1 FAKETIME="@2004-03-29 14:14:14" \
    "${HACKBIN}/selfserv" $VERBOSE -p $PORT -d "$SERVER" -n server_crt -t $THREADS -w test > "$TEST_OUTPUT/nisccLog11" 2>&1 &

    unset NISCC_TEST
    export LD_LIBRARY_PATH="$TESTLIB"
    for START in `seq $START_AT $THREADS $STOP_AT`; do
        LD_PRELOAD=${FAKETIMELIB} NO_FAKE_STAT=1 FAKETIME="@2004-03-29 14:14:14" \
        "${TESTTOOLS}/strsclnt" $VERBOSE -d "$CLIENT" -p $PORT -t $THREADS -c $THREADS -o -N $HOST >> "$TEST_OUTPUT/nisccLog12" 2>&1
    done

    echo "starting tstclnt to shutdown resigned rootca selfserv process"
    for i in `seq 5`; do
        LD_PRELOAD=${FAKETIMELIB} NO_FAKE_STAT=1 FAKETIME="@2004-03-29 14:14:14" \
        "${TESTTOOLS}/tstclnt" -h $HOST -p $PORT -d "$CLIENT" -n client_crt -o -f -w test < "$CLIENT/stop.txt" >> "$TEST_OUTPUT/nisccLog12" 2>&1
    done

    unset LD_LIBRARY_PATH

    sleep 1
}

################################################################################
# Email the test logfile, and if core found, notify of failure
################################################################################
mail_testLog()
{
    pushd "$TEST_OUTPUT"

    # remove mozilla nss build false positives and core stored in previous runs
    find . -name "core*" -print | grep -v coreconf | grep -v core_watch | grep -v archive >> crashLog
    export SIZE=`cat crashLog | wc -l`

    [ "$USE_MAIL" = "false" ] && return

    # mail text
    MT=mailText
    rm -f $MT

    if [ "$SIZE" -ne 1 ]; then
        echo "### FAILED ###" >> $MT
        echo "### Exactly one crash is expected." >> $MT
        echo "### Zero means: crash detection is broken, fix the script!" >> $MT
        echo "### > 1 means: robustness test failure, fix the bug! (check the logs)" >> $MT
        cat crashLog >> nisccLogSummary
        SUBJ="FAILED: NISCC TESTS (check file: crashLog)"
    else
        echo ":) PASSED :)" >> $MT
        SUBJ="PASSED: NISCC tests"
    fi

    echo "Date used during test run: $DATE" >> $MT

    echo "Count of lines in files:" >> $MT
    wc -l crashLog nisccBuildLog nisccBuildLogHack nisccLog[0-9]* p7m-* |grep -vw total >> $MT
    NUM=`cat nisccLog0[123456789] nisccLog1[12] | egrep -ic "success/passed"`
    echo "Number of times the SSL tests reported success/passed (low expected): $NUM" >> $MT
    NUM=`cat nisccLog0[123456789] nisccLog1[12] | egrep -ic "problem|failed|error"`
    echo "Number of times the SSL tests reported problem/failed/error (high expected): $NUM" >> $MT
    NUM=`cat niscc_smime/p7m*results.txt | egrep -ic "success/passed"`
    echo "Number of times the S/MIME tests reported success/passed (low expected): $NUM" >> $MT
    NUM=`cat niscc_smime/p7m*results.txt | egrep -ic "problem|failed|error"`
    echo "Number of times the S/MIME tests reported problem/failed/error (high expected): $NUM" >> $MT
    echo "==== tail of nisccBuildLog ====" >> $MT
    tail -20 nisccBuildLog >> $MT
    echo "===============================" >> $MT
    echo "==== tail of nisccBuildLogHack ====" >> $MT
    tail -20 nisccBuildLogHack >> $MT
    echo "===================================" >> $MT

    #NUM=``
    #echo "Number of : $NUM" >> $MT

    cat $MT | $MAIL_COMMAND -s "$SUBJ" $QA_LIST

    popd
}

################################################################################
# Summarize all logs
################################################################################
log_summary()
{
    echo "Summarizing all logs"
    # Move old logs
    [ -f "$TEST_OUTPUT/nisccLogSummary" ] && mv nisccLogSummary nisccLogSummary.old
    [ -f "$TEST_OUTPUT/crashLog" ] && mv crashLog crashLog.old

    for a in $TEST_OUTPUT/nisccLog[0-9]*; do
        echo ================================== "$a"
        grep -v using "$a" | sort | uniq -c | sort -b -n +0 -1
    done > $TEST_OUTPUT/nisccLogSummary

    for a in $TEST_OUTPUT/niscc_smime/p7m-*-results.txt; do
        echo ================================== "$a"
        grep -v using "$a" | sort | uniq -c | sort -b -n +0 -1
    done >> $TEST_OUTPUT/nisccLogSummary
}

################################################################################
# Process core files
################################################################################
core_process()
{
    echo "Processing core files"
    cd "$TEST_OUTPUT"

    for CORE in `cat crashLog`; do
        FILE=`file "$CORE" | sed "s/.* from '//" | sed "s/'.*//"`
        BINARY=`strings "$CORE" | grep "^${FILE}" | tail -1`
        gdb "$BINARY" "$CORE" << EOF_GDB > "$CORE.details"
where
quit
EOF_GDB
    done
}

################################################################################
# Move the old log files to save them, delete extra log files
################################################################################
move_files()
{
    echo "Moving and deleting log files"
    cd "$TEST_OUTPUT"

    rm -rf TRASH
    mkdir TRASH

    if [ "$LOG_STORE" = "true" ]; then
        BRANCH=`echo $LOCALDIST | sed "s:.*/\(security.*\)/builds/.*:\1:"`
        if [ "$BRANCH" = "$LOCALDIST" ]; then
            ARCHIVE="$TEST_OUTPUT/archive"
        else
            ARCHIVE="$TEST_OUTPUT/archive/$BRANCH"
        fi

        # Check for archive directory
        if [ ! -d "$ARCHIVE" ]; then
            mkdir -p "$ARCHIVE"
        fi

        # Determine next log storage point
        slot=`ls -1 "$ARCHIVE" | grep $DATE | wc -l`
        slot=`expr $slot + 1`
        location="$ARCHIVE/$DATE.$slot"
        mkdir -p "$location"

        # Archive the logs
        mv nisccBuildLog "$location" 2> /dev/null
        mv nisccBuildLogHack "$location" 2> /dev/null
        mv nisccLogSummary "$location"
        mv nisccLog* "$location"
        mv niscc_smime/p7m-ed-m-results.txt "$location"
        mv niscc_smime/p7m-sd-dt-results.txt "$location"
        mv niscc_smime/p7m-sd-op-results.txt "$location"

        # Archive any core files produced
        for core in `cat "$TEST_OUTPUT/crashLog"`; do
            mv "$core" "$location"
            mv "$core.details" "$location"
        done
        mv crashLog "$location"
    else
        # Logs not stored => summaries, crashlog and corefiles not moved, other logs deleted
        mv nisccLog00 nisccLog01 nisccLog02 nisccLog03 nisccLog04 nisccLog05 nisccLog06 nisccLog07 nisccLog08 nisccLog09 nisccLog10 nisccLog11 nisccLog12 TRASH/
        mv niscc_smime/p7m-ed-m-results.txt niscc_smime/p7m-sd-dt-results.txt niscc_smime/p7m-sd-op-results.txt TRASH/
    fi
    mv envDB sigDB niscc_smime niscc_ssl TRASH/
    mv CA.p12 Client.p12 client_crt.p12 server_crt.p12 TRASH/
    mv p7m-ed-m-files.txt p7m-sd-dt-files.txt p7m-sd-op-files.txt password-is-testtest1.txt detached.txt TRASH/
    mv crashme.c crashme TRASH/
}

################################################################################
# Main
################################################################################
process_args $*
create_environment
hg_pull
build_NSS
init
niscc_smime
niscc_ssl_init
force_crash
ssl_setup_dirs_simple
    ssl_simple_client_auth
    ssl_simple_server_auth
    ssl_simple_rootca
ssl_setup_dirs_resigned
    ssl_resigned_client_auth
    ssl_resigned_server_auth
    ssl_resigned_rootca
# no idea what these commented-out lines are supposed to be!
#ssl_setup_dirs_update
#    ssl_update_server_auth der
#    ssl_update_client_auth der
#    ssl_update_server_auth resigned-der
#    ssl_update_client_auth resigned-der
log_summary
mail_testLog
core_process
move_files
exit $SIZE


text:
package org.apache.arrow.flight.grpc;

import java.util.concurrent.Executor;
import java.util.function.Consumer;

import org.apache.arrow.flight.CallHeaders;

import io.grpc.CallCredentials;
import io.grpc.Metadata;

/**
 * Adapter class to utilize a CredentialWriter to implement Grpc CallCredentials.
 */
public class CallCredentialAdapter extends CallCredentials {

  private final Consumer<CallHeaders> credentialWriter;

  public CallCredentialAdapter(Consumer<CallHeaders> credentialWriter) {
    this.credentialWriter = credentialWriter;
  }

  @Override
  public void applyRequestMetadata(RequestInfo requestInfo, Executor executor, MetadataApplier metadataApplier) {
    executor.execute(() ->
    {
      final Metadata headers = new Metadata();
      credentialWriter.accept(new MetadataAdapter(headers));
      metadataApplier.apply(headers);
    });
  }

  @Override
  public void thisUsesUnstableApi() {
    // Mandatory to override this to acknowledge that CallCredentials is Experimental.
  }
}

redpajama_set_name: RedPajamaGithub


text:
package Paws::CloudHSMv2::ListTags;
  use Moose;
  has MaxResults => (is => 'ro', isa => 'Int');
  has NextToken => (is => 'ro', isa => 'Str');
  has ResourceId => (is => 'ro', isa => 'Str', required => 1);

  use MooseX::ClassAttribute;

  class_has _api_call => (isa => 'Str', is => 'ro', default => 'ListTags');
  class_has _returns => (isa => 'Str', is => 'ro', default => 'Paws::CloudHSMv2::ListTagsResponse');
  class_has _result_key => (isa => 'Str', is => 'ro');
1;

### main pod documentation begin ###

=head1 NAME

Paws::CloudHSMv2::ListTags - Arguments for method ListTags on Paws::CloudHSMv2

=head1 DESCRIPTION

This class represents the parameters used for calling the method ListTags on the
AWS CloudHSM V2 service. Use the attributes of this class
as arguments to method ListTags.

You shouldn't make instances of this class. Each attribute should be used as a named argument in the call to ListTags.

As an example:

  $service_obj->ListTags(Att1 => $value1, Att2 => $value2, ...);

Values for attributes that are native types (Int, String, Float, etc) can passed as-is (scalar values). Values for complex Types (objects) can be passed as a HashRef. The keys and values of the hashref will be used to instance the underlying object.

=head1 ATTRIBUTES

=head2 MaxResults => Int

The maximum number of tags to return in the response. When there are
more tags than the number you specify, the response contains a
C<NextToken> value.

=head2 NextToken => Str

The C<NextToken> value that you received in the previous response. Use
this value to get more tags.

=head2 B<REQUIRED> ResourceId => Str

The cluster identifier (ID) for the cluster whose tags you are getting.
To find the cluster ID, use DescribeClusters.

=head1 SEE ALSO

This class forms part of L<Paws>, documenting arguments for method ListTags in L<Paws::CloudHSMv2>

=head1 BUGS and CONTRIBUTIONS

The source code is located here: https://github.com/pplu/aws-sdk-perl

Please report bugs to: https://github.com/pplu/aws-sdk-perl/issues

=cut


text:
/* quickFind hack for IE */
if( (! ('addEventListener' in document ) ) && 'attachEvent' in document )document.addEventListener=function(){arguments[0]='onload';this.attachEvent.apply(this,arguments);}

if('addEventListener' in document ) document.addEventListener('DOMContentLoaded', function(){
	var qfi=document.body.insertBefore(document.createElement('input'), document.body.firstChild ), to;
	qfi.id='qfi';
	qfi.onkeyup=function(){ clearTimeout(to); to=setTimeout( quickFind, 100); };
	qfi.style.position='fixed'; qfi.style.top='0'; qfi.style.right='0';
	qfi.placeholder='Quick find';
	qfi.value=qfi.placeholder;
	qfi.style.color='#ccc';
	qfi.onfocus=function(){ if(qfi.value==qfi.placeholder)qfi.value=''; qfi.style.color='#000'; }
	qfi.onblur=function(){ if(qfi.value=='')qfi.value=qfi.placeholder; qfi.style.color='#ccc'; }
	function quickFind(){
		var trs=document.getElementsByTagName('tr');
		for(var i=0, tr;tr=trs[i];i++){
			if(qfi.value==''){
				tr.style.display='';
			}else{
				tr.style.display = ( tr.textContent.indexOf(qfi.value)>-1 ) ? '' : 'none';
			}
		}
	}

}, false)


text:
#include "io_realm_internal_OsSchemaInfo.h"

#include <schema.hpp>
#include <object_schema.hpp>
#include <property.hpp>
#include <util/format.hpp>

#include "java_accessor.hpp"
#include "java_exception_def.hpp"
#include "util.hpp"
#include "jni_util/java_exception_thrower.hpp"

using namespace realm;
using namespace realm::jni_util;
using namespace realm::util;
using namespace realm::_impl;

static void finalize_schema(jlong ptr)
{
    TR_ENTER_PTR(ptr);
    delete reinterpret_cast<Schema*>(ptr);
}

JNIEXPORT jlong JNICALL Java_io_realm_internal_OsSchemaInfo_nativeCreateFromList(JNIEnv* env, jclass,
                                                                                jlongArray objectSchemaPtrs_)
{
    TR_ENTER()
    try {
        std::vector<ObjectSchema> object_schemas;
        JLongArrayAccessor array(env, objectSchemaPtrs_);
        for (jsize i = 0; i < array.size(); ++i) {
            object_schemas.push_back(*reinterpret_cast<ObjectSchema*>(array[i]));
        }
        auto* schema = new Schema(std::move(object_schemas));
        return reinterpret_cast<jlong>(schema);
    }
    CATCH_STD()
    return 0;
}

JNIEXPORT jlong JNICALL Java_io_realm_internal_OsSchemaInfo_nativeGetFinalizerPtr(JNIEnv*, jclass)
{
    TR_ENTER()
    return reinterpret_cast<jlong>(&finalize_schema);
}

JNIEXPORT jlong JNICALL Java_io_realm_internal_OsSchemaInfo_nativeGetObjectSchemaInfo(JNIEnv* env, jclass,
                                                                                jlong native_ptr,
                                                                                jstring j_class_name)
{
    TR_ENTER_PTR(native_ptr)

    try {
        JStringAccessor class_name_accessor(env, j_class_name);
        StringData class_name(class_name_accessor);
        auto& schema = *reinterpret_cast<Schema*>(native_ptr);
        auto it = schema.find(class_name);
        if (it == schema.end()) {
            THROW_JAVA_EXCEPTION(env, JavaExceptionDef::IllegalState,
                                 format("Class '%1' cannot be found in the schema.", class_name.data()));
        } else {
            return reinterpret_cast<jlong>(new ObjectSchema(*it));
        }
    }
    CATCH_STD()

    return reinterpret_cast<jlong>(nullptr);
}


text:
'use strict';

/**
 * The response model for the list source controls operation.
 */
class SourceControlListResult extends Array {
  /**
   * Create a SourceControlListResult.
   * @member {string} [nextLink] The next link.
   */
  constructor() {
    super();
  }

  /**
   * Defines the metadata of SourceControlListResult
   *
   * @returns {object} metadata of SourceControlListResult
   *
   */
  mapper() {
    return {
      required: false,
      serializedName: 'SourceControlListResult',
      type: {
        name: 'Composite',
        className: 'SourceControlListResult',
        modelProperties: {
          value: {
            required: false,
            serializedName: '',
            type: {
              name: 'Sequence',
              element: {
                  required: false,
                  serializedName: 'SourceControlElementType',
                  type: {
                    name: 'Composite',
                    className: 'SourceControl'
                  }
              }
            }
          },
          nextLink: {
            required: false,
            serializedName: 'nextLink',
            type: {
              name: 'String'
            }
          }
        }
      }
    };
  }
}

module.exports = SourceControlListResult;


text:
package main

import "sync"

type gamestate struct {
	Player       *Player
	NextLocation int
	Date         Date
	logLock      sync.Locker
	Log          []LogEntry
	gameLoop     *GameLoop
}

var WorldState *gamestate


text:
package it.smartcommunitylab.riciclo.model;

public class Gestore extends BaseObject {

	private String ragioneSociale;
	private String descrizione;
	private String ufficio;
	private String indirizzo;
	private String orarioUfficio;
	private String sitoWeb;
	private String email;
	private String telefono;
	private String fax;

	public String getRagioneSociale() {
		return ragioneSociale;
	}
	public void setRagioneSociale(String ragioneSociale) {
		this.ragioneSociale = ragioneSociale;
	}
	public String getDescrizione() {
		return descrizione;
	}
	public void setDescrizione(String descrizione) {
		this.descrizione = descrizione;
	}
	public String getUfficio() {
		return ufficio;
	}
	public void setUfficio(String ufficio) {
		this.ufficio = ufficio;
	}
	public String getIndirizzo() {
		return indirizzo;
	}
	public void setIndirizzo(String indirizzo) {
		this.indirizzo = indirizzo;
	}
	public String getOrarioUfficio() {
		return orarioUfficio;
	}
	public void setOrarioUfficio(String orarioUfficio) {
		this.orarioUfficio = orarioUfficio;
	}
	public String getSitoWeb() {
		return sitoWeb;
	}
	public void setSitoWeb(String sitoWeb) {
		this.sitoWeb = sitoWeb;
	}
	public String getEmail() {
		return email;
	}
	public void setEmail(String email) {
		this.email = email;
	}
	public String getTelefono() {
		return telefono;
	}
	public void setTelefono(String telefono) {
		this.telefono = telefono;
	}
	public String getFax() {
		return fax;
	}
	public void setFax(String fax) {
		this.fax = fax;
	}

	@Override
	public String toString() {
		return "Gestore [" + ragioneSociale + "]";
	}

}


text:
package com.intellij.structuralsearch.plugin.ui;

import com.intellij.find.FindManager;
import com.intellij.find.FindProgressIndicator;
import com.intellij.find.FindSettings;
import com.intellij.find.impl.FindManagerImpl;
import com.intellij.notification.NotificationType;
import com.intellij.openapi.progress.ProgressIndicator;
import com.intellij.openapi.progress.ProgressManager;
import com.intellij.openapi.progress.util.AbstractProgressIndicatorExBase;
import com.intellij.openapi.util.Factory;
import com.intellij.openapi.vfs.VirtualFile;
import com.intellij.psi.PsiDocumentManager;
import com.intellij.psi.PsiElement;
import com.intellij.psi.PsiFile;
import com.intellij.structuralsearch.*;
import com.intellij.structuralsearch.plugin.StructuralSearchPlugin;
import com.intellij.usageView.UsageInfo;
import com.intellij.usages.*;
import com.intellij.util.Processor;
import org.jetbrains.annotations.NotNull;

public class SearchCommand {
  protected final SearchContext mySearchContext;
  protected final Configuration myConfiguration;
  private MatchingProcess process;
  private FindUsagesProcessPresentation myProcessPresentation;

  public SearchCommand(Configuration configuration, SearchContext searchContext) {
    myConfiguration = configuration;
    mySearchContext = searchContext;
  }

  protected UsageViewContext createUsageViewContext() {
    final Runnable searchStarter = () -> new SearchCommand(myConfiguration, mySearchContext).startSearching();
    return new UsageViewContext(myConfiguration, mySearchContext, searchStarter);
  }

  public void startSearching() {
    final UsageViewContext context = createUsageViewContext();
    final UsageViewPresentation presentation = new UsageViewPresentation();
    presentation.setOpenInNewTab(FindSettings.getInstance().isShowResultsInSeparateView());
    context.configure(presentation);

    myProcessPresentation = new FindUsagesProcessPresentation(presentation);
    myProcessPresentation.setShowNotFoundMessage(true);
    myProcessPresentation.setShowPanelIfOnlyOneUsage(true);

    myProcessPresentation.setProgressIndicatorFactory(
      new Factory<ProgressIndicator>() {
        @Override
        public ProgressIndicator create() {
          FindProgressIndicator indicator = new FindProgressIndicator(mySearchContext.getProject(), presentation.getScopeText());
          indicator.addStateDelegate(new AbstractProgressIndicatorExBase(){
            @Override
            public void cancel() {
              super.cancel();
              stopAsyncSearch();
            }
          });
          return indicator;
        }
      }
    );

    PsiDocumentManager.getInstance(mySearchContext.getProject()).commitAllDocuments();
    final ConfigurableUsageTarget target = context.getTarget();
    ((FindManagerImpl)FindManager.getInstance(mySearchContext.getProject())).getFindUsagesManager().addToHistory(target);
    UsageViewManager.getInstance(mySearchContext.getProject()).searchAndShowUsages(
      new UsageTarget[]{target},
      () -> new UsageSearcher() {
        @Override
        public void generate(@NotNull final Processor<? super Usage> processor) {
          findUsages(processor);
        }
      },
      myProcessPresentation,
      presentation,
      new UsageViewManager.UsageViewStateListener() {
        @Override
        public void usageViewCreated(@NotNull UsageView usageView) {
          context.setUsageView(usageView);
          context.configureActions();
        }

        @Override
        public void findingUsagesFinished(final UsageView usageView) {}
      }
    );
  }

  public void findUsages(final Processor<? super Usage> processor) {
    final ProgressIndicator progress = ProgressManager.getInstance().getProgressIndicator();
    progress.setIndeterminate(false);

    final MatchResultSink sink = new MatchResultSink() {
      int count;

      @Override
      public void setMatchingProcess(MatchingProcess _process) {
        process = _process;
        findStarted();
      }

      @Override
      public void processFile(PsiFile element) {
        final VirtualFile virtualFile = element.getVirtualFile();
        if (virtualFile != null)
          progress.setText(SSRBundle.message("looking.in.progress.message", virtualFile.getPresentableName()));
      }

      @Override
      public void matchingFinished() {
        if (mySearchContext.getProject().isDisposed()) return;
        findEnded();
        progress.setText(SSRBundle.message("found.progress.message", count));
      }

      @Override
      public ProgressIndicator getProgressIndicator() {
        return progress;
      }

      @Override
      public void newMatch(MatchResult result) {
        UsageInfo info;

        if (MatchResult.MULTI_LINE_MATCH.equals(result.getName())) {
          int start = -1;
          int end = -1;
          PsiElement parent = result.getMatch().getParent();

          for (final MatchResult matchResult : result.getChildren()) {
            PsiElement el = matchResult.getMatch();
            final int elementStart = el.getTextRange().getStartOffset();

            if (start == -1 || start > elementStart) {
              start = elementStart;
            }
            final int newend = elementStart + el.getTextLength();

            if (newend > end) {
              end = newend;
            }
          }

          final int parentStart = parent.getTextRange().getStartOffset();
          int startOffset = start - parentStart;
          info = new UsageInfo(parent, startOffset, end - parentStart);
        }
        else {
          final PsiElement match = result.getMatch();
          if (!match.isPhysical()) {
            // e.g. lambda parameter anonymous type element
            return;
          }
          info = new UsageInfo(match);
        }

        final Usage usage = new UsageInfo2UsageAdapter(info);
        foundUsage(result, usage);
        processor.process(usage);
        ++count;
      }
    };

    try {
      new Matcher(mySearchContext.getProject(), myConfiguration.getMatchOptions()).findMatches(sink);
    }
    catch (StructuralSearchException e) {
      myProcessPresentation.setShowNotFoundMessage(false);
      //noinspection InstanceofCatchParameter
      UIUtil.SSR_NOTIFICATION_GROUP.createNotification(NotificationType.ERROR)
                                   .setContent(e instanceof StructuralSearchScriptException
                                               ? SSRBundle.message("search.script.problem", e.getCause())
                                               : SSRBundle.message("search.template.problem", e.getMessage()))
                                   .setImportant(true)
                                   .notify(mySearchContext.getProject());
    }
  }

  public void stopAsyncSearch() {
    if (process != null) process.stop();
  }

  protected void findStarted() {
    StructuralSearchPlugin.getInstance(mySearchContext.getProject()).setSearchInProgress(true);
  }

  protected void findEnded() {
    StructuralSearchPlugin.getInstance(mySearchContext.getProject()).setSearchInProgress(false);
  }

  protected void foundUsage(MatchResult result, Usage usage) {}
}


text:
package com.maxifier.mxcache.instrumentation;

/**
 * @author Alexander Kochurov (alexander.kochurov@maxifier.com)
 */
public interface ResourceTest {
    void writeIt();

    void writeMultiple();

    void readIt();
}


text:
package org.apache.poi.hssf.usermodel;

import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;

import org.apache.poi.hssf.model.HSSFFormulaParser;
import org.apache.poi.hssf.record.formula.NumberPtg;
import org.apache.poi.hssf.record.formula.Ptg;
import org.apache.poi.hssf.record.formula.StringPtg;
import org.apache.poi.ss.formula.FormulaType;

/**
 *
 * @author Josh Micich
 */
public class DVConstraint {
	/**
	 * ValidationType enum
	 */
	public static final class ValidationType {
		private ValidationType() {
			// no instances of this class
		}
		/** 'Any value' type - value not restricted */
		public static final int ANY         = 0x00;
		/** Integer ('Whole number') type */
		public static final int INTEGER     = 0x01;
		/** Decimal type */
		public static final int DECIMAL     = 0x02;
		/** List type ( combo box type ) */
		public static final int LIST        = 0x03;
		/** Date type */
		public static final int DATE        = 0x04;
		/** Time type */
		public static final int TIME        = 0x05;
		/** String length type */
		public static final int TEXT_LENGTH = 0x06;
		/** Formula ( 'Custom' ) type */
		public static final int FORMULA     = 0x07;
	}
	/**
	 * Condition operator enum
	 */
	public static final class OperatorType {
		private OperatorType() {
			// no instances of this class
		}

		public static final int BETWEEN = 0x00;
		public static final int NOT_BETWEEN = 0x01;
		public static final int EQUAL = 0x02;
		public static final int NOT_EQUAL = 0x03;
		public static final int GREATER_THAN = 0x04;
		public static final int LESS_THAN = 0x05;
		public static final int GREATER_OR_EQUAL = 0x06;
		public static final int LESS_OR_EQUAL = 0x07;
		/** default value to supply when the operator type is not used */
		public static final int IGNORED = BETWEEN;

		/* package */ static void validateSecondArg(int comparisonOperator, String paramValue) {
			switch (comparisonOperator) {
				case BETWEEN:
				case NOT_BETWEEN:
					if (paramValue == null) {
						throw new IllegalArgumentException("expr2 must be supplied for 'between' comparisons");
					}
				// all other operators don't need second arg
			}
		}
	}

	/* package */ static final class FormulaPair {

		private final Ptg[] _formula1;
		private final Ptg[] _formula2;

		public FormulaPair(Ptg[] formula1, Ptg[] formula2) {
			_formula1 = formula1;
			_formula2 = formula2;
		}
		public Ptg[] getFormula1() {
			return _formula1;
		}
		public Ptg[] getFormula2() {
			return _formula2;
		}

	}

	// convenient access to ValidationType namespace
	private static final ValidationType VT = null;

	private final int _validationType;
	private int _operator;
	private String[] _explicitListValues;

	private String _formula1;
	private String _formula2;
	private Double _value1;
	private Double _value2;

	private DVConstraint(int validationType, int comparisonOperator, String formulaA,
			String formulaB, Double value1, Double value2, String[] excplicitListValues) {
		_validationType = validationType;
		_operator = comparisonOperator;
		_formula1 = formulaA;
		_formula2 = formulaB;
		_value1 = value1;
		_value2 = value2;
		_explicitListValues = excplicitListValues;
	}

	/**
	 * Creates a list constraint
	 */
	private DVConstraint(String listFormula, String[] excplicitListValues) {
		this(ValidationType.LIST, OperatorType.IGNORED,
			listFormula, null, null, null, excplicitListValues);
	}

	/**
	 * Creates a number based data validation constraint. The text values entered for expr1 and expr2
	 * can be either standard Excel formulas or formatted number values. If the expression starts
	 * with '=' it is parsed as a formula, otherwise it is parsed as a formatted number.
	 *
	 * @param validationType one of {@link ValidationType#ANY}, {@link ValidationType#DECIMAL},
	 * {@link ValidationType#INTEGER}, {@link ValidationType#TEXT_LENGTH}
	 * @param comparisonOperator any constant from {@link OperatorType} enum
	 * @param expr1 date formula (when first char is '=') or formatted number value
	 * @param expr2 date formula (when first char is '=') or formatted number value
	 */
	public static DVConstraint createNumericConstraint(int validationType, int comparisonOperator,
			String expr1, String expr2) {
		switch (validationType) {
			case ValidationType.ANY:
				if (expr1 != null || expr2 != null) {
					throw new IllegalArgumentException("expr1 and expr2 must be null for validation type 'any'");
				}
				break;
			case ValidationType.DECIMAL:
			case ValidationType.INTEGER:
			case ValidationType.TEXT_LENGTH:
				if (expr1 == null) {
					throw new IllegalArgumentException("expr1 must be supplied");
				}
				OperatorType.validateSecondArg(comparisonOperator, expr2);
				break;
			default:
				throw new IllegalArgumentException("Validation Type ("
						+ validationType + ") not supported with this method");
		}
		// formula1 and value1 are mutually exclusive
		String formula1 = getFormulaFromTextExpression(expr1);
		Double value1 = formula1 == null ? convertNumber(expr1) : null;
		// formula2 and value2 are mutually exclusive
		String formula2 = getFormulaFromTextExpression(expr2);
		Double value2 = formula2 == null ? convertNumber(expr2) : null;
		return new DVConstraint(validationType, comparisonOperator, formula1, formula2, value1, value2, null);
	}

	public static DVConstraint createFormulaListConstraint(String listFormula) {
		return new DVConstraint(listFormula, null);
	}
	public static DVConstraint createExplicitListConstraint(String[] explicitListValues) {
		return new DVConstraint(null, explicitListValues);
	}

	/**
	 * Creates a time based data validation constraint. The text values entered for expr1 and expr2
	 * can be either standard Excel formulas or formatted time values. If the expression starts
	 * with '=' it is parsed as a formula, otherwise it is parsed as a formatted time.  To parse
	 * formatted times, two formats are supported:  "HH:MM" or "HH:MM:SS".  This is contrary to
	 * Excel which uses the default time format from the OS.
	 *
	 * @param comparisonOperator constant from {@link OperatorType} enum
	 * @param expr1 date formula (when first char is '=') or formatted time value
	 * @param expr2 date formula (when first char is '=') or formatted time value
	 */
	public static DVConstraint createTimeConstraint(int comparisonOperator, String expr1, String expr2) {
		if (expr1 == null) {
			throw new IllegalArgumentException("expr1 must be supplied");
		}
		OperatorType.validateSecondArg(comparisonOperator, expr1);

		// formula1 and value1 are mutually exclusive
		String formula1 = getFormulaFromTextExpression(expr1);
		Double value1 = formula1 == null ? convertTime(expr1) : null;
		// formula2 and value2 are mutually exclusive
		String formula2 = getFormulaFromTextExpression(expr2);
		Double value2 = formula2 == null ? convertTime(expr2) : null;
		return new DVConstraint(VT.TIME, comparisonOperator, formula1, formula2, value1, value2, null);

	}
	/**
	 * Creates a date based data validation constraint. The text values entered for expr1 and expr2
	 * can be either standard Excel formulas or formatted date values. If the expression starts
	 * with '=' it is parsed as a formula, otherwise it is parsed as a formatted date (Excel uses
	 * the same convention).  To parse formatted dates, a date format needs to be specified.  This
	 * is contrary to Excel which uses the default short date format from the OS.
	 *
	 * @param comparisonOperator constant from {@link OperatorType} enum
	 * @param expr1 date formula (when first char is '=') or formatted date value
	 * @param expr2 date formula (when first char is '=') or formatted date value
	 * @param dateFormat ignored if both expr1 and expr2 are formulas.  Default value is "YYYY/MM/DD"
	 * otherwise any other valid argument for <tt>SimpleDateFormat</tt> can be used
	 * @see SimpleDateFormat
	 */
	public static DVConstraint createDateConstraint(int comparisonOperator, String expr1, String expr2, String dateFormat) {
		if (expr1 == null) {
			throw new IllegalArgumentException("expr1 must be supplied");
		}
		OperatorType.validateSecondArg(comparisonOperator, expr2);
		SimpleDateFormat df = dateFormat == null ? null : new SimpleDateFormat(dateFormat);

		// formula1 and value1 are mutually exclusive
		String formula1 = getFormulaFromTextExpression(expr1);
		Double value1 = formula1 == null ? convertDate(expr1, df) : null;
		// formula2 and value2 are mutually exclusive
		String formula2 = getFormulaFromTextExpression(expr2);
		Double value2 = formula2 == null ? convertDate(expr2, df) : null;
		return new DVConstraint(VT.DATE, comparisonOperator, formula1, formula2, value1, value2, null);
	}

	/**
	 * Distinguishes formula expressions from simple value expressions.  This logic is only
	 * required by a few factory methods in this class that create data validation constraints
	 * from more or less the same parameters that would have been entered in the Excel UI.  The
	 * data validation dialog box uses the convention that formulas begin with '='.  Other methods
	 * in this class follow the POI convention (formulas and values are distinct), so the '='
	 * convention is not used there.
	 *
	 * @param textExpr a formula or value expression
	 * @return all text after '=' if textExpr begins with '='. Otherwise null if textExpr does not begin with '='
	 */
	private static String getFormulaFromTextExpression(String textExpr) {
		if (textExpr == null) {
			return null;
		}
		if (textExpr.length() < 1) {
			throw new IllegalArgumentException("Empty string is not a valid formula/value expression");
		}
		if (textExpr.charAt(0) == '=') {
			return textExpr.substring(1);
		}
		return null;
	}

	/**
	 * @return null if numberStr is null
	 */
	private static Double convertNumber(String numberStr) {
		if (numberStr == null) {
			return null;
		}
		try {
			return new Double(numberStr);
		} catch (NumberFormatException e) {
			throw new RuntimeException("The supplied text '" + numberStr
					+ "' could not be parsed as a number");
		}
	}

	/**
	 * @return null if timeStr is null
	 */
	private static Double convertTime(String timeStr) {
		if (timeStr == null) {
			return null;
		}
		return new Double(HSSFDateUtil.convertTime(timeStr));
	}
	/**
	 * @param dateFormat pass null for default YYYYMMDD
	 * @return null if timeStr is null
	 */
	private static Double convertDate(String dateStr, SimpleDateFormat dateFormat) {
		if (dateStr == null) {
			return null;
		}
		Date dateVal;
		if (dateFormat == null) {
			dateVal = HSSFDateUtil.parseYYYYMMDDDate(dateStr);
		} else {
			try {
				dateVal = dateFormat.parse(dateStr);
			} catch (ParseException e) {
				throw new RuntimeException("Failed to parse date '" + dateStr
						+ "' using specified format '" + dateFormat + "'", e);
			}
		}
		return new Double(HSSFDateUtil.getExcelDate(dateVal));
	}

	public static DVConstraint createCustomFormulaConstraint(String formula) {
		if (formula == null) {
			throw new IllegalArgumentException("formula must be supplied");
		}
		return new DVConstraint(VT.FORMULA, OperatorType.IGNORED, formula, null, null, null, null);
	}

	/**
	 * @return both parsed formulas (for expression 1 and 2).
	 */
	/* package */ FormulaPair createFormulas(HSSFSheet sheet) {
		Ptg[] formula1;
		Ptg[] formula2;
		if (isListValidationType()) {
			formula1 = createListFormula(sheet);
			formula2 = Ptg.EMPTY_PTG_ARRAY;
		} else {
			formula1 = convertDoubleFormula(_formula1, _value1, sheet);
			formula2 = convertDoubleFormula(_formula2, _value2, sheet);
		}
		return new FormulaPair(formula1, formula2);
	}

	private Ptg[] createListFormula(HSSFSheet sheet) {

		if (_explicitListValues == null) {
            HSSFWorkbook wb = sheet.getWorkbook();
            // formula is parsed with slightly different RVA rules: (root node type must be 'reference')
			return HSSFFormulaParser.parse(_formula1, wb, FormulaType.DATAVALIDATION_LIST, wb.getSheetIndex(sheet));
			// To do: Excel places restrictions on the available operations within a list formula.
			// Some things like union and intersection are not allowed.
		}
		// explicit list was provided
		StringBuffer sb = new StringBuffer(_explicitListValues.length * 16);
		for (int i = 0; i < _explicitListValues.length; i++) {
			if (i > 0) {
				sb.append('\0'); // list delimiter is the nul char
			}
			sb.append(_explicitListValues[i]);

		}
		return new Ptg[] { new StringPtg(sb.toString()), };
	}

	/**
	 * @return The parsed token array representing the formula or value specified.
	 * Empty array if both formula and value are null
	 */
	private static Ptg[] convertDoubleFormula(String formula, Double value, HSSFSheet sheet) {
		if (formula == null) {
			if (value == null) {
				return Ptg.EMPTY_PTG_ARRAY;
			}
			return new Ptg[] { new NumberPtg(value.doubleValue()), };
		}
		if (value != null) {
			throw new IllegalStateException("Both formula and value cannot be present");
		}
        HSSFWorkbook wb = sheet.getWorkbook();
		return HSSFFormulaParser.parse(formula, wb, FormulaType.CELL, wb.getSheetIndex(sheet));
	}

	/**
	 * @return data validation type of this constraint
	 * @see ValidationType
	 */
	public int getValidationType() {
		return _validationType;
	}
	/**
	 * Convenience method
	 * @return true if this constraint is a 'list' validation
	 */
	public boolean isListValidationType() {
		return _validationType == VT.LIST;
	}
	/**
	 * Convenience method
	 * @return true if this constraint is a 'list' validation with explicit values
	 */
	public boolean isExplicitList() {
		return _validationType == VT.LIST && _explicitListValues != null;
	}
	/**
	 * @return the operator used for this constraint
	 * @see OperatorType
	 */
	public int getOperator() {
		return _operator;
	}
	/**
	 * Sets the comparison operator for this constraint
	 * @see OperatorType
	 */
	public void setOperator(int operator) {
		_operator = operator;
	}

	public String[] getExplicitListValues() {
		return _explicitListValues;
	}
	public void setExplicitListValues(String[] explicitListValues) {
		if (_validationType != VT.LIST) {
			throw new RuntimeException("Cannot setExplicitListValues on non-list constraint");
		}
		_formula1 = null;
		_explicitListValues = explicitListValues;
	}

	/**
	 * @return the formula for expression 1. May be null
	 */
	public String getFormula1() {
		return _formula1;
	}
	/**
	 * Sets a formula for expression 1.
	 */
	public void setFormula1(String formula1) {
		_value1 = null;
		_explicitListValues = null;
		_formula1 = formula1;
	}

	/**
	 * @return the formula for expression 2. May be null
	 */
	public String getFormula2() {
		return _formula2;
	}
	/**
	 * Sets a formula for expression 2.
	 */
	public void setFormula2(String formula2) {
		_value2 = null;
		_formula2 = formula2;
	}

	/**
	 * @return the numeric value for expression 1. May be null
	 */
	public Double getValue1() {
		return _value1;
	}
	/**
	 * Sets a numeric value for expression 1.
	 */
	public void setValue1(double value1) {
		_formula1 = null;
		_value1 = new Double(value1);
	}

	/**
	 * @return the numeric value for expression 2. May be null
	 */
	public Double getValue2() {
		return _value2;
	}
	/**
	 * Sets a numeric value for expression 2.
	 */
	public void setValue2(double value2) {
		_formula2 = null;
		_value2 = new Double(value2);
	}
}


text:
<?php

  session_start();

  include '../DBH.php';

  $username = $_POST['username'];
  $email = $_POST['email'];
  $pwd = $_POST['password'];
  $pwd2 = $_POST['password_again'];

  if (empty($username)) {
    header("Location: ../register.php?error=empty");
    exit();
  }

  if (empty($email)) {
    header("Location: ../register.php?error=empty");
    exit();
  }

  if (empty($pwd)) {
    header("Location: ../register.php?error=empty");
    exit();
  }

  if (empty($pwd2)) {
    header("Location: ../register.php?error=empty");
    exit();
  } else {

    $sql = "SELECT username FROM users WHERE username = '$username'";
    $result = $conn->query($sql);
    $username_check = mysqli_num_rows($result);

    if ($username_check > 0) {
      header("Location: ../register.php?error=username");
      exit();
    }

    if ($pwd !== $pwd2) {
      header("Location: ../register.php?error=password_must_be_the_same");
      exit();

    } else {
      $sql = "INSERT INTO users (username, email, password)
      VALUES ('$username', '$email', '$pwd')";

      $result = mysqli_query($conn, $sql);

      // header("Location: ../index.php");
      header("Location: ../index.php?success=registration_ok");
    }

  }

?>


text:
package com.google.appengine.api.datastore;

import com.google.common.base.MoreObjects;
import com.google.common.base.Preconditions;
import com.google.common.collect.Iterables;
import com.google.common.collect.Multimap;
import java.util.Collection;
import java.util.Collections;
import java.util.List;

/**
 * Abstract base class with a common {@link CallbackContext} implementation.
 *
 */
abstract class BaseCallbackContext<T> implements CallbackContext<T> {
  private final CurrentTransactionProvider currentTxnProvider;

  /** All elements provided to the operation that triggered the callback. */
  private final List<T> elements;

  /** The index into {@link #elements} of the "current" element. */
  private int currentIndex;

  /**
   * @param currentTxnProvider Provides the current transaction
   * @param elements All elements involved in the operation that triggered the callback.
   */
  BaseCallbackContext(CurrentTransactionProvider currentTxnProvider, List<T> elements) {
    this.currentTxnProvider = Preconditions.checkNotNull(currentTxnProvider);
    this.elements = Collections.unmodifiableList(Preconditions.checkNotNull(elements));
  }

  @Override
  public List<T> getElements() {
    return elements;
  }

  @Override
  public Transaction getCurrentTransaction() {
    return currentTxnProvider.getCurrentTransaction(null);
  }

  @Override
  public int getCurrentIndex() {
    return currentIndex;
  }

  @Override
  public T getCurrentElement() {
    return elements.get(currentIndex);
  }

  /**
   * Executes all appropriate callbacks for the elements in this context.
   *
   * @param callbacksByKind A Multimap containing lists of callbacks, organized by kind.
   * @param noKindCallbacks Callbacks that apply to all elements, independent of kind.
   * @throws IllegalStateException If this method has already been called.
   */
  void executeCallbacks(
      Multimap<String, DatastoreCallbacksImpl.Callback> callbacksByKind,
      Collection<DatastoreCallbacksImpl.Callback> noKindCallbacks) {
    Preconditions.checkState(
        currentIndex == 0, "executeCallbacks cannot be called more than once.");
    for (T ele : elements) {
      // We run the callbacks registered with the specific kind and then we run the
      // callbacks registered for all kinds.
      Iterable<DatastoreCallbacksImpl.Callback> allCallbacksToRun =
          Iterables.concat(callbacksByKind.get(getKind(ele)), noKindCallbacks);
      for (DatastoreCallbacksImpl.Callback callback : allCallbacksToRun) {
        callback.run(this);
      }
      currentIndex++;
    }
  }

  /** Abstract method that, given an element, knows how to extract its kind. */
  abstract String getKind(T ele);

  @Override
  public String toString() {
    return MoreObjects.toStringHelper(this)
        .add("elements", elements)
        .add("currentIndex", currentIndex)
        .toString();
  }
}


text:
// Copyright (c) 2014, The Outercurve Foundation. The software is licensed under the (the "License"); you may not use the software except in compliance with the License.
using Antlr4.Runtime;

namespace Outercurve.SQLiteCreateTree.Nodes.ColumnConstraint
{
    public abstract class ColumnConstraintNode :SQLiteParseTreeNode
    {
        protected ColumnConstraintNode()
        {

        }

        protected ColumnConstraintNode(ParserRuleContext context)   : base(context)
        {

        }

        public string Name { get; set; }

    }
}


text:
class RemoveCiVariablesProjectIdIndex < ActiveRecord::Migration
  include Gitlab::Database::MigrationHelpers

  DOWNTIME = false

  disable_ddl_transaction!

  def up
    if index_exists?(:ci_variables, :project_id)
      remove_concurrent_index(:ci_variables, :project_id)
    end
  end

  def down
    unless index_exists?(:ci_variables, :project_id)
      add_concurrent_index(:ci_variables, :project_id)
    end
  end
end


text:
package io.openex.config;

import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonProperty;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.stereotype.Component;

@Component
@ConfigurationProperties(prefix = "openex")
public class OpenExConfig {

    @JsonProperty("parameters_id")
    private String id = "global";

    @JsonProperty("application_name")
    private String name = "OpenEx";

    @JsonProperty("application_base_url")
    private String baseUrl;

    @JsonProperty("application_version")
    private String version;

    @JsonProperty("map_tile_server_light")
    private String mapTileServerLight;

    @JsonProperty("map_tile_server_dark")
    private String mapTileServerDark;

    @JsonProperty("auth_local_enable")
    private boolean authLocalEnable;

    @JsonProperty("auth_openid_enable")
    private boolean authOpenidEnable;

    @JsonProperty("auth_kerberos_enable")
    private boolean authKerberosEnable;

    @JsonIgnore
    private String cookieName = "openex_token";

    @JsonIgnore
    private String cookieDuration = "P1D";

    @JsonIgnore
    private boolean cookieSecure = false;

    public String getId() {
        return id;
    }

    public void setId(String id) {
        this.id = id;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getBaseUrl() {
        return baseUrl.endsWith("/") ? baseUrl.substring(0, baseUrl.length() - 1) : baseUrl;
    }

    public void setBaseUrl(String baseUrl) {
        this.baseUrl = baseUrl;
    }

    public String getVersion() {
        return version;
    }

    public void setVersion(String version) {
        this.version = version;
    }

    public String getCookieName() {
        return cookieName;
    }

    public void setCookieName(String cookieName) {
        this.cookieName = cookieName;
    }

    public boolean isCookieSecure() {
        return cookieSecure;
    }

    public void setCookieSecure(boolean cookieSecure) {
        this.cookieSecure = cookieSecure;
    }

    public String getCookieDuration() {
        return cookieDuration;
    }

    public void setCookieDuration(String cookieDuration) {
        this.cookieDuration = cookieDuration;
    }

    public String getMapTileServerLight() {
        return mapTileServerLight;
    }

    public void setMapTileServerLight(String mapTileServerLight) {
        this.mapTileServerLight = mapTileServerLight;
    }

    public String getMapTileServerDark() {
        return mapTileServerDark;
    }

    public void setMapTileServerDark(String mapTileServerDark) {
        this.mapTileServerDark = mapTileServerDark;
    }

    public boolean isAuthLocalEnable() {
        return authLocalEnable;
    }

    public void setAuthLocalEnable(boolean authLocalEnable) {
        this.authLocalEnable = authLocalEnable;
    }

    public boolean isAuthOpenidEnable() {
        return authOpenidEnable;
    }

    public void setAuthOpenidEnable(boolean authOpenidEnable) {
        this.authOpenidEnable = authOpenidEnable;
    }

    public boolean isAuthKerberosEnable() {
        return authKerberosEnable;
    }

    public void setAuthKerberosEnable(boolean authKerberosEnable) {
        this.authKerberosEnable = authKerberosEnable;
    }
}


text:
	footerPush = function () {
		if ($('.footer').length) {
			$('body').css('padding-bottom', $('.footer').outerHeight());
		};
	}


text:
/**
  * bootstrap-table - An extended table to integration with some of the most widely used CSS frameworks. (Supports Bootstrap, Semantic UI, Bulma, Material Design, Foundation)
  *
  * @version v1.20.1
  * @homepage https://bootstrap-table.com
  * @author wenzhixin <wenzhixin2010@gmail.com> (http://wenzhixin.net.cn/)
  * @license MIT
  */

.fixed-columns,.fixed-columns-right{position:absolute;top:0;height:100%;background-color:#fff;box-sizing:border-box;z-index:1}.fixed-columns{left:0}.fixed-columns .fixed-table-body{overflow:hidden!important}.fixed-columns-right{right:0}.fixed-columns-right .fixed-table-body{overflow-x:hidden!important}