]> gerrit.simantics Code Review - simantics/platform.git/blob - bundles/org.simantics/src/org/simantics/PlatformException.java
Merge commit 'ffdf837'
[simantics/platform.git] / bundles / org.simantics / src / org / simantics / PlatformException.java
1 /*******************************************************************************\r
2  * Copyright (c) 2007, 2014 Association for Decentralized Information Management\r
3  * in Industry THTH ry.\r
4  * All rights reserved. This program and the accompanying materials\r
5  * are made available under the terms of the Eclipse Public License v1.0\r
6  * which accompanies this distribution, and is available at\r
7  * http://www.eclipse.org/legal/epl-v10.html\r
8  *\r
9  * Contributors:\r
10  *     VTT Technical Research Centre of Finland - initial API and implementation\r
11  *     Semantum Oy - optional fillStackTrace\r
12  *******************************************************************************/\r
13 package org.simantics;\r
14 \r
15 /**\r
16  * @author Toni Kalajainen\r
17  */\r
18 public class PlatformException extends Exception {\r
19 \r
20     private static final long serialVersionUID = -2967261259650645038L;\r
21 \r
22     private final boolean fillStackTrace;\r
23 \r
24     public PlatformException() {\r
25         this(true);\r
26     }\r
27 \r
28     public PlatformException(String message) {\r
29         this(message, true);\r
30     }\r
31 \r
32     public PlatformException(Throwable cause) {\r
33         this(cause, true);\r
34     }\r
35 \r
36     public PlatformException(String message, Throwable cause) {\r
37         this(message, cause, true);\r
38     }\r
39 \r
40     /**\r
41      * @since Simantics 1.15\r
42      */\r
43     public PlatformException(boolean fillStackTrace) {\r
44         this.fillStackTrace = fillStackTrace;\r
45     }\r
46 \r
47     /**\r
48      * @since Simantics 1.15\r
49      */\r
50     public PlatformException(String message, boolean fillStackTrace) {\r
51         super(message);\r
52         this.fillStackTrace = fillStackTrace;\r
53     }\r
54 \r
55     /**\r
56      * @since Simantics 1.15\r
57      */\r
58     public PlatformException(Throwable cause, boolean fillStackTrace) {\r
59         super(cause);\r
60         this.fillStackTrace = fillStackTrace;\r
61     }\r
62 \r
63     /**\r
64      * @since Simantics 1.15\r
65      */\r
66     public PlatformException(String message, Throwable cause, boolean fillStackTrace) {\r
67         super(message, cause);\r
68         this.fillStackTrace = fillStackTrace;\r
69     }\r
70 \r
71     @Override\r
72     public synchronized Throwable fillInStackTrace() {\r
73         return fillStackTrace ? super.fillInStackTrace() : this;\r
74     }\r
75 \r
76 }