1 23 24 package org.apache.slide.common; 25 26 import java.util.Vector ; 27 import java.util.Enumeration ; 28 29 34 public class NestedSlideException extends SlideException { 35 36 37 39 40 43 public NestedSlideException(String message) { 44 super(message, false); 45 exceptions = new Vector (); 46 } 47 48 49 51 52 55 protected Vector exceptions; 56 57 58 60 61 66 public void addException(SlideException exception) { 67 exceptions.addElement(exception); 68 } 69 70 71 76 public Enumeration enumerateExceptions() { 77 return exceptions.elements(); 78 } 79 80 81 86 public int getExceptionsCount() { 87 return exceptions.size(); 88 } 89 90 91 92 97 public SlideException unpackSingleException() { 98 if (getExceptionsCount() != 1) return null; 99 return (SlideException)enumerateExceptions().nextElement(); 100 } 101 102 103 108 public boolean isEmpty() { 109 return exceptions.isEmpty(); 110 } 111 112 113 115 116 121 public String toString() { 122 String result = new String (); 123 if( exceptions != null ) { 124 Enumeration list = exceptions.elements(); 125 while (list.hasMoreElements()) { 126 SlideException e = (SlideException) list.nextElement(); 127 result = result + e.getMessage() + "\n"; 128 } 129 } 130 return result; 131 } 132 133 } 134 | Popular Tags |