-/*******************************************************************************\r
- * Copyright (c) 2007, 2010 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
- *******************************************************************************/\r
-package org.simantics.utils;\r
-\r
-import java.util.Collection;\r
-\r
-/**\r
- * GroupRuntimeException is a RuntimeException container for a set of exceptions.\r
- * \r
- * <p>\r
- * Use {@link #group(Collection)} or {@link #group(Exception[])} to construct\r
- * it.\r
- * \r
- * @author Toni Kalajainen\r
- */\r
-public class GroupRuntimeException extends RuntimeException {\r
-\r
- private static final long serialVersionUID = 1L;\r
-\r
- private RuntimeException errors[];\r
- \r
- private GroupRuntimeException(RuntimeException[] errors) {\r
- super(GroupRuntimeException.getAsText(errors));\r
- this.errors = errors;\r
- }\r
-\r
- public static RuntimeException group(RuntimeException... errors) {\r
- if (errors.length == 0)\r
- throw new IllegalArgumentException("zero exceptions for GroupRuntimeException");\r
- if (errors.length == 1)\r
- return errors[0];\r
- return new GroupRuntimeException(errors);\r
- }\r
-\r
- public static RuntimeException group(Collection<RuntimeException> collection) {\r
- if (collection.size() == 0)\r
- throw new IllegalArgumentException("zero exceptions for GroupRuntimeException");\r
- if (collection.size() == 1)\r
- return collection.iterator().next();\r
- return new GroupRuntimeException(collection.toArray(new RuntimeException[collection.size()]));\r
- }\r
- \r
- private static String getAsText(Throwable errors[]) {\r
- String result = "";\r
- for (Throwable error : errors) {\r
- result += error.getClass().getName()+": "+error.getMessage() + "\n";\r
- }\r
- return result;\r
- }\r
- \r
- public RuntimeException[] getErrors() {\r
- return errors;\r
- }\r
-\r
-}\r
+/*******************************************************************************
+ * Copyright (c) 2007, 2010 Association for Decentralized Information Management
+ * in Industry THTH ry.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * VTT Technical Research Centre of Finland - initial API and implementation
+ *******************************************************************************/
+package org.simantics.utils;
+
+import java.util.Collection;
+
+/**
+ * GroupRuntimeException is a RuntimeException container for a set of exceptions.
+ *
+ * <p>
+ * Use {@link #group(Collection)} or {@link #group(Exception[])} to construct
+ * it.
+ *
+ * @author Toni Kalajainen
+ */
+public class GroupRuntimeException extends RuntimeException {
+
+ private static final long serialVersionUID = 1L;
+
+ private RuntimeException errors[];
+
+ private GroupRuntimeException(RuntimeException[] errors) {
+ super(GroupRuntimeException.getAsText(errors));
+ this.errors = errors;
+ }
+
+ public static RuntimeException group(RuntimeException... errors) {
+ if (errors.length == 0)
+ throw new IllegalArgumentException("zero exceptions for GroupRuntimeException");
+ if (errors.length == 1)
+ return errors[0];
+ return new GroupRuntimeException(errors);
+ }
+
+ public static RuntimeException group(Collection<RuntimeException> collection) {
+ if (collection.size() == 0)
+ throw new IllegalArgumentException("zero exceptions for GroupRuntimeException");
+ if (collection.size() == 1)
+ return collection.iterator().next();
+ return new GroupRuntimeException(collection.toArray(new RuntimeException[collection.size()]));
+ }
+
+ private static String getAsText(Throwable errors[]) {
+ String result = "";
+ for (Throwable error : errors) {
+ result += error.getClass().getName()+": "+error.getMessage() + "\n";
+ }
+ return result;
+ }
+
+ public RuntimeException[] getErrors() {
+ return errors;
+ }
+
+}