<commit_before>package uy.com.cs.jpos.iso;

import java.io.*;
import java.util.*;

/*
 * $Log$
 * Revision 1.4  1999/10/01 19:20:27  apr
 * Added String.intern() in order to minimize memory usage
 *
 */

/**
 * implements <b>Leaf</b> for standard fields
 *
 * See the
 * <a href="API_users_guide.html">API User's Guide</a>
 * for details.
 *
 * @author <EMAIL>
 * @version $Id$
 * @see ISOComponent
 */
public class ISOField extends ISOComponent implements Cloneable {
    protected int fieldNumber;
    protected String value;

    /**
     * @param n - the FieldNumber
     */
    public ISOField (int n) {
        fieldNumber = n;
    }
    /**
     * @param n - fieldNumber
     * @param v - fieldValue
     */
    public ISOField (int n, String v) {
        fieldNumber = n;
        value = v.intern();
    }
    /**
     * not available on Leaf - always throw ISOException
     * @exception ISOException
     */
    public byte[] pack() throws ISOException {
        throw new ISOException ("Not available on Leaf");
    }
    /**
     * not available on Leaf - always throw ISOException
     * @exception ISOException
     */
    public int unpack(byte[] b) throws ISOException {
        throw new ISOException ("Not available on Leaf");
    }
    /**
     * @return Object representing this field number
     */
    public Object getKey() {
        return new Integer(fieldNumber);
    }
    /**
     * @return Object representing this field value
     */
    public Object getValue() {
        return value;
    }
    /**
     * @param obj - Object representing this field value
     * @exception ISOException
     */
    public void setValue(Object obj) throws ISOException {
        value = ((String) obj).intern();
    }
    /**
     * dump this field to PrintStream. The output is sorta
     * XML, intended to be easily parsed.
     * @param p - print stream
     * @param indent - optional indent string
     */
    public void dump (PrintStream p, String indent) {
        p.println (indent +"<fld id=\"" 
            +fieldNumber +"\" value=\"" +value +"\"/>");
    }
}<commit_msg>Bugfix to bug introduced on 1.4 with setValue and intern() when obj == null<commit_after>package uy.com.cs.jpos.iso;

import java.io.*;
import java.util.*;

/*
 * $Log$
 * Revision 1.5  1999/11/18 23:33:41  apr
 * Bugfix to bug introduced on 1.4 with setValue and intern() when obj == null
 *
 * Revision 1.4  1999/10/01 19:20:27  apr
 * Added String.intern() in order to minimize memory usage
 *
 */

/**
 * implements <b>Leaf</b> for standard fields
 *
 * See the
 * <a href="API_users_guide.html">API User's Guide</a>
 * for details.
 *
 * @author <EMAIL>
 * @version $Id$
 * @see ISOComponent
 */
public class ISOField extends ISOComponent implements Cloneable {
    protected int fieldNumber;
    protected String value;

    /**
     * @param n - the FieldNumber
     */
    public ISOField (int n) {
        fieldNumber = n;
    }
    /**
     * @param n - fieldNumber
     * @param v - fieldValue
     */
    public ISOField (int n, String v) {
        fieldNumber = n;
        value = v.intern();
    }
    /**
     * not available on Leaf - always throw ISOException
     * @exception ISOException
     */
    public byte[] pack() throws ISOException {
        throw new ISOException ("Not available on Leaf");
    }
    /**
     * not available on Leaf - always throw ISOException
     * @exception ISOException
     */
    public int unpack(byte[] b) throws ISOException {
        throw new ISOException ("Not available on Leaf");
    }
    /**
     * @return Object representing this field number
     */
    public Object getKey() {
        return new Integer(fieldNumber);
    }
    /**
     * @return Object representing this field value
     */
    public Object getValue() {
        return value;
    }
    /**
     * @param obj - Object representing this field value
     * @exception ISOException
     */
    public void setValue(Object obj) throws ISOException {
	if (obj instanceof String)
	    value = ((String) obj).intern();
	else
	    value = (String) obj;
    }
    /**
     * dump this field to PrintStream. The output is sorta
     * XML, intended to be easily parsed.
     * @param p - print stream
     * @param indent - optional indent string
     */
    public void dump (PrintStream p, String indent) {
        p.println (indent +"<fld id=\"" 
            +fieldNumber +"\" value=\"" +value +"\"/>");
    }
}
{'fraction_non_alphanumeric': 0.11801801801801802, 'fraction_numerical': 0.011711711711711712, 'mean_word_length': 2.2298181818181817, 'pattern_counts': {'":': 0, '<': 15, '<?xml version=': 0, '>': 15, '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': '7544786', 'n_tokens_mistral': 1333, 'n_tokens_neox': 1279, 'n_words': 438}