]> gerrit.simantics Code Review - simantics/platform.git/blobdiff - bundles/org.simantics/src/org/simantics/PlatformException.java
Migrated source code from Simantics SVN
[simantics/platform.git] / bundles / org.simantics / src / org / simantics / PlatformException.java
diff --git a/bundles/org.simantics/src/org/simantics/PlatformException.java b/bundles/org.simantics/src/org/simantics/PlatformException.java
new file mode 100644 (file)
index 0000000..b03f26a
--- /dev/null
@@ -0,0 +1,76 @@
+/*******************************************************************************\r
+ * Copyright (c) 2007, 2014 Association for Decentralized Information Management\r
+ * in Industry THTH ry.\r
+ * All rights reserved. This program and the accompanying materials\r
+ * are made available under the terms of the Eclipse Public License v1.0\r
+ * which accompanies this distribution, and is available at\r
+ * http://www.eclipse.org/legal/epl-v10.html\r
+ *\r
+ * Contributors:\r
+ *     VTT Technical Research Centre of Finland - initial API and implementation\r
+ *     Semantum Oy - optional fillStackTrace\r
+ *******************************************************************************/\r
+package org.simantics;\r
+\r
+/**\r
+ * @author Toni Kalajainen\r
+ */\r
+public class PlatformException extends Exception {\r
+\r
+    private static final long serialVersionUID = -2967261259650645038L;\r
+\r
+    private final boolean fillStackTrace;\r
+\r
+    public PlatformException() {\r
+        this(true);\r
+    }\r
+\r
+    public PlatformException(String message) {\r
+        this(message, true);\r
+    }\r
+\r
+    public PlatformException(Throwable cause) {\r
+        this(cause, true);\r
+    }\r
+\r
+    public PlatformException(String message, Throwable cause) {\r
+        this(message, cause, true);\r
+    }\r
+\r
+    /**\r
+     * @since Simantics 1.15\r
+     */\r
+    public PlatformException(boolean fillStackTrace) {\r
+        this.fillStackTrace = fillStackTrace;\r
+    }\r
+\r
+    /**\r
+     * @since Simantics 1.15\r
+     */\r
+    public PlatformException(String message, boolean fillStackTrace) {\r
+        super(message);\r
+        this.fillStackTrace = fillStackTrace;\r
+    }\r
+\r
+    /**\r
+     * @since Simantics 1.15\r
+     */\r
+    public PlatformException(Throwable cause, boolean fillStackTrace) {\r
+        super(cause);\r
+        this.fillStackTrace = fillStackTrace;\r
+    }\r
+\r
+    /**\r
+     * @since Simantics 1.15\r
+     */\r
+    public PlatformException(String message, Throwable cause, boolean fillStackTrace) {\r
+        super(message, cause);\r
+        this.fillStackTrace = fillStackTrace;\r
+    }\r
+\r
+    @Override\r
+    public synchronized Throwable fillInStackTrace() {\r
+        return fillStackTrace ? super.fillInStackTrace() : this;\r
+    }\r
+\r
+}
\ No newline at end of file