All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.openl.rules.common.CommonException Maven / Gradle / Ivy

There is a newer version: 5.27.9
Show newest version
package org.openl.rules.common;

import java.text.MessageFormat;

/**
 * There are no CommonException(String pattern, Object... params) constructor since it will lead to ambiguous case with
 * Throwable. Thus, Throwable can be placed in "Object..." and will be treated like parameter for result message, not a
 * cause. That kind of bug is hard to detect.
 * 

* If you cannot provide Throwable just use null. * * @author Aleh Bykhavets */ public class CommonException extends Exception { private static String format(String pattern, Object... params) { return MessageFormat.format(pattern, params); } /** * Constructs a new exception with the specified detail message. The cause is not initialized, and may subsequently * be initialized by a call to {@link #initCause}. * * @param message the detail message. The detail message is saved for later retrieval by the {@link #getMessage()} * method. */ public CommonException(String message) { super(message); } public CommonException(String msg, Throwable cause) { super(msg, cause); } // --- private public CommonException(String pattern, Throwable cause, Object... params) { super(format(pattern, params), cause); } }





© 2015 - 2024 Weber Informatics LLC | Privacy Policy