data not being added to arrayList
<p>I'm having troubling with my java code. For some reason my attributes that i'm trying to add to a list is sort of working, but it only keeps or shows the object in the list. I dont know if the attributes are being erased or what but it's really annoying.</p>

<pre><code>public static Program parseProgram(File fileName)
        throws FileNotFoundException {
    Scanner in1 = new Scanner(fileName);

    Program program = new Program();
    Short value = 0;
    Short address = 0;
    boolean indirect = false;
    String[] temp = null;

    while (in1.hasNextLine()) {
        String line = in1.nextLine();
        temp = line.split("\\s+");

        Scanner in2 = new Scanner(temp[0]);

        if (in2.hasNextInt(16)) {
            int temp1 = Integer.parseInt(temp[0]);
            Short temp2 = (short) temp1;
            int temped = Integer.parseInt(temp[1]);
            Short temp3 = (short) temped;
            DataLine data = new DataLine(temp2, temp3);
            try {
                program.addDataLine(data);
            } catch (DataAccessException e) {
                // TODO Auto-generated catch block
                e.printStackTrace();
            }
        } else {
            String s = "*";
            String ss = new String();

            Instruction instruction = Instruction.getByName(temp[0]);

            if (instruction.requiresArgument()) {
                int temped = Integer.parseInt(temp[1], 16);
                Short arg = (short) temped;
                if (temp.length &gt; 1) {
                    if (temp[1].endsWith("*")) {
                        indirect = true;
                        ss = temp[1].substring(0, temp[1].indexOf("*"));
                        arg = (short) Integer.parseInt(ss);
                        CodeLine code = new CodeLine(instruction, arg,
                                indirect);
                        try {
                            program.addCodeLine(code);
                        } catch (CodeAccessException e) {
                            // TODO Auto-generated catch block
                            e.printStackTrace();
                        }
                    } else if (line.contains(s)) {
                        indirect = true;
                        String sg = temp[1].substring(0,
                                temp[1].indexOf("*"));
                String st = temp[1]
                                .substring(temp[1].indexOf("*") + 1);
                        ss = sg + st;
                        arg = (short) Integer.parseInt(ss);
                CodeLine code = new CodeLine(instruction, arg);
                        try {
                            program.addCodeLine(code);
                        } catch (CodeAccessException e) {
                        // TODO Auto-generated  catch block
                            e.printStackTrace();
                        }
                    }
                } else {
                    System.out.println("error");
                }
            }

            else {
                CodeLine code = new CodeLine(instruction);
                try {
                    program.addCodeLine(code);
                } catch (CodeAccessException e) {
                    // TODO Auto-generated catch block
                    e.printStackTrace();
                }
            }

        }

    }
    return program;

}
</code></pre>

<p>}
}</p>

<p>public class Program implements Serializable{</p>

<pre><code>private List&lt;CodeLine&gt; codeSegment = new ArrayList&lt;CodeLine&gt;();

private List&lt;DataLine&gt; dataSegment = new ArrayList&lt;DataLine&gt;();

/**
 * Add a line of code to this program.
 * 
 * @param line must not be null.
 * @throws CodeAccessException if line is null
 */
public void addCodeLine(CodeLine line) throws CodeAccessException{
    if(line == null)
        throw new CodeAccessException("Cannot add null code lines to a program.");
    codeSegment.add(line);
}

/**
 * Add a data instructionn to this program.  A data instruction is
 * a address - value pair.
 * 
 * @param line must not be null.
 * @throws DataAccessException if line is null
 */
public void addDataLine(DataLine line) throws DataAccessException{
    if(line == null)
        throw new DataAccessException("Cannot add null data lines to a program.");
    dataSegment.add(line);
}
</code></pre>
