1 23 24 package org.objectweb.dream.control.activity.task; 25 26 import java.io.PrintStream ; 27 28 import org.objectweb.fractal.api.control.NameController; 29 30 34 public class IllegalTaskException extends Exception 35 { 36 Task task; 37 Throwable cause; 38 39 42 public IllegalTaskException(Task task) 43 { 44 this.task = task; 45 } 46 47 52 public IllegalTaskException(Task task, String message, Throwable cause) 53 { 54 super(message); 55 this.task = task; 56 this.cause = cause; 57 } 58 59 62 public Task getTask() 63 { 64 return task; 65 } 66 67 70 public String toString() 71 { 72 String s; 73 if (task == null) 74 { 75 s = super.toString(); 76 } 77 else 78 { 79 if (task instanceof NameController) 80 { 81 s = super.toString() + " task name : " 82 + ((NameController) task).getFcName(); 83 } 84 else 85 { 86 s = super.toString(); 87 } 88 } 89 if (cause != null) 90 { 91 s += " causeb by " + cause.toString(); 92 } 93 return s; 94 } 95 96 99 public void printStackTrace(PrintStream s) 100 { 101 super.printStackTrace(s); 102 if (cause != null) 103 { 104 s.print("Caused by : "); 105 cause.printStackTrace(s); 106 } 107 } 108 } | Popular Tags |