⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 reporteventexception.java

📁 swing编写的库存管理程序。毕业设计类
💻 JAVA
字号:
/**
 * ========================================
 * JFreeReport : a free Java report library
 * ========================================
 *
 * Project Info:  http://www.jfree.org/jfreereport/index.html
 * Project Lead:  Thomas Morgner;
 *
 * (C) Copyright 2000-2003, by Object Refinery Limited and Contributors.
 *
 * This library is free software; you can redistribute it and/or modify it under the terms
 * of the GNU Lesser General Public License as published by the Free Software Foundation;
 * either version 2.1 of the License, or (at your option) any later version.
 *
 * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
 * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
 * See the GNU Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public License along with this
 * library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
 * Boston, MA 02111-1307, USA.
 *
 * -------------------------
 * ReportEventException.java
 * -------------------------
 * (C)opyright 2003, by Object Refinery Limited and Contributors.
 *
 * Original Author:  David Gilbert (for Object Refinery Limited);
 * Contributor(s):   Thomas Morgner;
 *
 * $Id: ReportEventException.java,v 1.3 2003/08/24 15:13:21 taqua Exp $
 *
 * Changes
 * -------
 * 04-Mar-2003 : Initial version
 */

package org.jfree.report;

import java.io.PrintStream;
import java.io.PrintWriter;
import java.util.List;

/**
 * The ReportEventException is thrown, if there were unrecoverable exceptions
 * during the report processing.
 *
 * @author Thomas Morgner
 */
public class ReportEventException extends ReportProcessingException
{
  /** the collected child exceptions. */
  private List childExceptions;

  /**
   * Creates an ReportEventException to handle exceptions, that occured
   * during the event dispatching.
   *
   * @param message  the exception message.
   * @param childExceptions the collected exceptions.
   */
  public ReportEventException(final String message, final List childExceptions)
  {
    super(message);
    if (childExceptions == null)
    {
      throw new NullPointerException();
    }
    this.childExceptions = childExceptions;
  }

  /**
   * Gets the collected child exceptions, that occured during the event
   * dispatching.
   *
   * @return the collected child exceptions.
   */
  public List getChildExceptions()
  {
    return childExceptions;
  }

  /**
   * Returns the errort message string of this throwable object.
   *
   * @return  the error message string of this <code>Throwable</code>
   *          object if it was created with an
   *          error message string; or <code>null</code> if it was
   *          created with no error message.
   *
   */
  public String getMessage()
  {
    return super.getMessage() + ": " + childExceptions.size() + " exceptions occured.";
  }

  /**
   * Prints the stack trace to the specified writer.
   *
   * @param writer  the writer.
   */
  public void printStackTrace(final PrintWriter writer)
  {
    super.printStackTrace(writer);
    for (int i = 0; i < childExceptions.size(); i++)
    {
      writer.print("Exception #");
      writer.println(i);
      final Exception ex = (Exception) childExceptions.get(i);
      if (ex != null)
      {
        ex.printStackTrace(writer);
      }
      else
      {
        writer.println("<not defined>");
      }
    }
  }

  /**
   * Prints the stack trace to the specified stream.
   *
   * @param stream  the output stream.
   */
  public void printStackTrace(final PrintStream stream)
  {
    super.printStackTrace(stream);
    for (int i = 0; i < childExceptions.size(); i++)
    {
      stream.print("Exception #");
      stream.println(i);
      final Exception ex = (Exception) childExceptions.get(i);
      if (ex != null)
      {
        ex.printStackTrace(stream);
      }
      else
      {
        stream.println("<not defined>");
      }
    }
  }
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -