1 package oracle.toplink.essentials.internal.ejb.cmp3.xml.parser; 2 3 import java.util.ArrayList ; 4 import java.util.List ; 5 6 import oracle.toplink.essentials.internal.helper.Helper; 7 8 public class XMLException extends RuntimeException { 9 private List m_nestedExceptions; 10 11 public XMLException() { 12 super(); 13 m_nestedExceptions = new ArrayList (); 14 } 15 16 public void addNestedException(Exception nestedException) { 17 m_nestedExceptions.add(nestedException); 18 } 19 20 public String getMessage() { 21 StringBuffer buffer = new StringBuffer (); 22 Exception nestedException; 23 for (int x=0; x<m_nestedExceptions.size(); x++) { 24 nestedException = (Exception ) m_nestedExceptions.get(x); 25 buffer.append(Helper.cr()); 26 buffer.append('('); 27 buffer.append(x + 1); 28 buffer.append(". "); 29 buffer.append(nestedException.getMessage()); 30 buffer.append(')'); 31 } 32 return buffer.toString(); 33 } 34 35 public String toString() { return getMessage(); } 36 } 37 | Popular Tags |