<commit_before>package nl.sikken.bertrik.cayenne;

import java.nio.BufferUnderflowException;
import java.nio.ByteBuffer;
import java.util.Arrays;
import java.util.Locale;

/**
 * Representation of one measurement item in a cayenne message.
 */
public final class CayenneItem {
    
    private final int channel;
    private final ECayenneItem type;
    private final Double[] values;

    /**
     * Constructor.
     * 
     * @param channel the unique channel
     * @param type the type
     * @param values the values
     */
    public CayenneItem(int channel, ECayenneItem type, Double[] values) {
        this.channel = channel;
        this.type = type;
        this.values = values;
    }

    public int getChannel() {
        return channel;
    }

    public ECayenneItem getType() {
        return type;
    }

    public Double[] getValues() {
        return values;
    }
    
    public String[] format() {
        return type.format(values);
    }
    
    /**
     * Parses one item from the byte buffer and returns it.
     * 
     * @param bb the byte buffer
     * @return a new cayenne item
     * @throws CayenneException if an error occurs during parsing
     */
    public static CayenneItem parse(ByteBuffer bb) throws CayenneException {
        try {
            final int channel = bb.get();
            final int type = bb.get() & 0xFF;
            final ECayenneItem ct = ECayenneItem.parse(type);
            if (ct == null) {
                throw new CayenneException("Invalid cayenne type " + type);
            }
            final Double[] values = ct.parse(bb);
            return new CayenneItem(channel, ct, values);
        } catch (BufferUnderflowException e) {
            throw new CayenneException(e);
        }
    }
    
    @Override
    public String toString() {
        return String.format(Locale.US, "{chan=%d,type=%s,value=%s}", channel, type, Arrays.toString(format()));  
    }
    
}
<commit_msg>Findbugs fix.<commit_after>package nl.sikken.bertrik.cayenne;

import java.nio.BufferUnderflowException;
import java.nio.ByteBuffer;
import java.util.Arrays;
import java.util.Locale;

/**
 * Representation of one measurement item in a cayenne message.
 */
public final class CayenneItem {
    
    private final int channel;
    private final ECayenneItem type;
    private final Double[] values;

    /**
     * Constructor.
     * 
     * @param channel the unique channel
     * @param type the type
     * @param values the values
     */
    public CayenneItem(int channel, ECayenneItem type, Double[] values) {
        this.channel = channel;
        this.type = type;
        this.values = values.clone();
    }

    public int getChannel() {
        return channel;
    }

    public ECayenneItem getType() {
        return type;
    }

    public Double[] getValues() {
        return values.clone();
    }
    
    public String[] format() {
        return type.format(values);
    }
    
    /**
     * Parses one item from the byte buffer and returns it.
     * 
     * @param bb the byte buffer
     * @return a new cayenne item
     * @throws CayenneException if an error occurs during parsing
     */
    public static CayenneItem parse(ByteBuffer bb) throws CayenneException {
        try {
            final int channel = bb.get();
            final int type = bb.get() & 0xFF;
            final ECayenneItem ct = ECayenneItem.parse(type);
            if (ct == null) {
                throw new CayenneException("Invalid cayenne type " + type);
            }
            final Double[] values = ct.parse(bb);
            return new CayenneItem(channel, ct, values);
        } catch (BufferUnderflowException e) {
            throw new CayenneException(e);
        }
    }
    
    @Override
    public String toString() {
        return String.format(Locale.US, "{chan=%d,type=%s,value=%s}", channel, type, Arrays.toString(format()));  
    }
    
}

{'fraction_non_alphanumeric': 0.09468765371372356, 'fraction_numerical': 0.0004918839153959665, 'mean_word_length': 1.9112383679312812, 'pattern_counts': {'":': 0, '<': 3, '<?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': '3022785', 'n_tokens_mistral': 1176, 'n_tokens_neox': 1109, 'n_words': 331}