<commit_before>package org.xdevs23.management.config;

public class SharedPreferenceArray {

    public static String getPreferenceString(String[] array) {
        if(array == null)     return "";
        if(array.length == 0) return "";
        StringBuilder sb = new StringBuilder();
        for ( String s : array) {
            String aps;
            if(s == null) aps = "";
            else aps = s;
            assert s != null;
            if(s.contains(":")) aps = s.replace(":", "::");
            if(s.contains("|")) aps = aps.replace("|", "||");
            sb.append(aps).append("|:|");
        }
        sb.delete(sb.length() - 3, sb.length());
        return sb.toString();
    }

    public static String[] getStringArray(String preferenceString) {
        if(preferenceString.isEmpty()) return null;
        String[] array = preferenceString.split("([|][:][|])");
        for ( int i = 0; i < array.length; i++ ) {
            String aps = array[i];
            if(aps.contains(":")) aps = aps.replace("::", ":");
            if(aps.contains("|")) aps = aps.replace("||", "|");
            array[i] = aps;
        }
        return array;
    }

}<commit_msg>SharedPreferenceArray: fix NPE in getPreferenceString()<commit_after>package org.xdevs23.management.config;

public class SharedPreferenceArray {

    public static String getPreferenceString(String[] array) {
        if(array == null)     return "";
        if(array.length == 0) return "";
        StringBuilder sb = new StringBuilder();
        for ( String s : array) {
            String aps;
            if(s == null) return "";
            else aps = s;
            if(s.contains(":")) aps = s.replace(":", "::");
            if(s.contains("|")) aps = aps.replace("|", "||");
            sb.append(aps).append("|:|");
        }
        sb.delete(sb.length() - 3, sb.length());
        return sb.toString();
    }

    public static String[] getStringArray(String preferenceString) {
        if(preferenceString.isEmpty()) return null;
        String[] array = preferenceString.split("([|][:][|])");
        for ( int i = 0; i < array.length; i++ ) {
            String aps = array[i];
            if(aps.contains(":")) aps = aps.replace("::", ":");
            if(aps.contains("|")) aps = aps.replace("||", "|");
            array[i] = aps;
        }
        return array;
    }

}
{'fraction_non_alphanumeric': 0.18324164198053322, 'fraction_numerical': 0.004231908590774439, 'mean_word_length': 2.0861618798955615, 'pattern_counts': {'":': 12, '<': 5, '<?xml version=': 0, '>': 3, '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': '7251859', 'n_tokens_mistral': 721, 'n_tokens_neox': 709, 'n_words': 157}