Some really bad code

Here’s some particularly bad (Java) code I came across at work. Note the use of “FirstTime”.

public void addship(String value1, String value2 , String value3, String value4, String value5)
{
    /* this line just concatenates all the values together as a
        specially formatted string - Robert (comment not in original code)
    */
    String row = setRow(value1, value2 , value3, value4, value5);
    System.out.println("row = " +row + "    " +i);
    list.insertElementAt(row,i);
    checkBoxValue.trim();
    value5.trim();
    if(FirstTime.equals("Yes")){
        temp_row1 = value5;
        FirstTime = "No";
        checkBoxValue = value5;
    }else{
        if(checkBoxValue.equals(value5)){
        }else
            {
                if(FirstTime.equals("No")){
                    String temp_row2 = temp_row1 + "   " + 1 + "   " + i + "   ";
                    BoxRow.insertElementAt(temp_row2,BoxRowCount);
                    FirstTime = "DoNot";
                    BoxRowCount = BoxRowCount + 1;
                    start = i;
                }else{
                    String temp_row = checkBoxValue + "   " + start + "   " + i + "   ";
                    BoxRow.insertElementAt(temp_row,BoxRowCount);
                    BoxRowCount = BoxRowCount + 1;
                    start = i;
                }
            }
        checkBoxValue = value5;
    }
    i = i + 1;
    last_row = checkBoxValue + "   " + start + "   " + i + "   ";
}
This entry was posted in Uncategorized. Bookmark the permalink.