MOA 12.03
Real Time Analytics for Data Streams
|
00001 /* 00002 * FailedTaskReport.java 00003 * Copyright (C) 2007 University of Waikato, Hamilton, New Zealand 00004 * @author Richard Kirkby ([email protected]) 00005 * 00006 * This program is free software; you can redistribute it and/or modify 00007 * it under the terms of the GNU General Public License as published by 00008 * the Free Software Foundation; either version 3 of the License, or 00009 * (at your option) any later version. 00010 * 00011 * This program is distributed in the hope that it will be useful, 00012 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00013 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00014 * GNU General Public License for more details. 00015 * 00016 * You should have received a copy of the GNU General Public License 00017 * along with this program. If not, see <http://www.gnu.org/licenses/>. 00018 * 00019 */ 00020 package moa.tasks; 00021 00022 import java.io.PrintWriter; 00023 import java.io.StringWriter; 00024 00025 import moa.AbstractMOAObject; 00026 import moa.core.StringUtils; 00027 00035 public class FailedTaskReport extends AbstractMOAObject { 00036 00037 private static final long serialVersionUID = 1L; 00038 00039 protected Throwable failureReason; 00040 00041 public FailedTaskReport(Throwable failureReason) { 00042 this.failureReason = failureReason; 00043 } 00044 00045 public Throwable getFailureReason() { 00046 return this.failureReason; 00047 } 00048 00049 @Override 00050 public void getDescription(StringBuilder sb, int indent) { 00051 sb.append("Failure reason: "); 00052 sb.append(this.failureReason.getMessage()); 00053 StringUtils.appendNewlineIndented(sb, indent, "*** STACK TRACE ***"); 00054 StringWriter stackTraceWriter = new StringWriter(); 00055 this.failureReason.printStackTrace(new PrintWriter(stackTraceWriter)); 00056 sb.append(stackTraceWriter.toString()); 00057 } 00058 }