Index: ContentList.java =================================================================== RCS file: /home/cvspublic/jdom/src/java/org/jdom/ContentList.java,v retrieving revision 1.6 diff -c -r1.6 ContentList.java *** ContentList.java 2002/03/13 03:57:41 1.6 --- ContentList.java 2002/03/15 00:30:06 *************** *** 133,138 **** --- 133,141 ---- if (obj instanceof Element) { add(index, (Element) obj); } + else if (obj instanceof Text) { + add(index, (Text) obj); + } else if (obj instanceof Comment) { add(index, (Comment) obj); } *************** *** 142,150 **** else if (obj instanceof CDATA) { add(index, (CDATA) obj); } - else if (obj instanceof Text) { - add(index, (Text) obj); - } else if (obj instanceof EntityRef) { add(index, (EntityRef) obj); } --- 145,150 ---- *************** *** 596,601 **** --- 596,605 ---- Element element = (Element) obj; element.setParent(null); } + else if (obj instanceof Text) { + Text text = (Text) obj; + text.setParent(null); + } else if (obj instanceof Comment) { Comment comment = (Comment) obj; comment.setParent(null); *************** *** 608,620 **** CDATA cdata = (CDATA) obj; cdata.setParent(null); } - else if (obj instanceof Text) { - Text text = (Text) obj; - text.setParent(null); - } else if (obj instanceof EntityRef) { EntityRef entity = (EntityRef) obj; entity.setParent(null); } } --- 612,624 ---- CDATA cdata = (CDATA) obj; cdata.setParent(null); } else if (obj instanceof EntityRef) { EntityRef entity = (EntityRef) obj; entity.setParent(null); + } + else { + // Should never happen. + throw new RuntimeException("Unexpected object."); } }