View Javadoc

1   /*
2    * Licensed to the Apache Software Foundation (ASF) under one or more
3    * contributor license agreements.  See the NOTICE file distributed with
4    * this work for additional information regarding copyright ownership.
5    * The ASF licenses this file to You under the Apache License, Version 2.0
6    * (the "License"); you may not use this file except in compliance with
7    * the License.  You may obtain a copy of the License at
8    * 
9    *     http://www.apache.org/licenses/LICENSE-2.0
10   * 
11   * Unless required by applicable law or agreed to in writing, software
12   * distributed under the License is distributed on an "AS IS" BASIS,
13   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14   * See the License for the specific language governing permissions and
15   * limitations under the License. 
16   */
17  
18  package org.apache.commons.pipeline;
19  
20  /**
21   * Exception wrapper class for exceptions that occur while processing a stage.
22   */
23  public class StageException extends java.lang.Exception {
24      /**
25       *
26       */
27      private static final long serialVersionUID = -7427836310660170668L;
28      
29      //Stage within which the error occurred
30      private Stage source;    
31      
32      /**
33       * Creates a new instance of <code>StageException</code> without detail message.
34       * @param source the stage that was the source of the exception
35       */
36      public StageException(Stage source) {
37          this.source = source;
38      }
39      
40      
41      /**
42       * Constructs an instance of <code>StageException</code> with the specified detail message.
43       * @param source the stage that was the source of the exception
44       * @param msg the detail message.
45       */
46      public StageException(Stage source, String msg) {
47          super(msg);
48          this.source = source;
49      }
50      
51      
52      /**
53       * Constructs an instance of <code>StageException</code> with the specified detail message and cause
54       * @param source the stage where the error occurred
55       * @param msg the detail message.
56       * @param cause Throwable that caused this exception.
57       */
58      public StageException(Stage source, Throwable cause) {
59          super(cause);
60          this.source = source;
61      }    
62      
63      
64      /**
65       * Constructs an instance of <code>StageException</code> with the specified detail message and cause
66       * @param source the stage where the error occurred
67       * @param msg the detail message.
68       * @param cause Throwable that caused this exception.
69       */
70      public StageException(Stage source, String msg, Throwable cause) {
71          super(msg, cause);
72          this.source = source;
73      }    
74      
75      
76      /**
77       * Returns a reference to the Stage object where the exception occurred.
78       * @return a reference to the Stage object where the exception occurred.
79       */
80      public Stage getSource() {
81          return this.source;
82      }
83  }