Examples of TuboException


Examples of org.tubo.exception.TuboException

     * @return an exception instance identified by exceptionId
     */
    public TuboException getException(String exceptionId, String message, Throwable cause) {
        //
        // get bean (TuboException) instance using default constructor
        TuboException exception = null;
        try {
            exception = (TuboException)beanFactory.getBean(exceptionId);
        } catch (BeansException e) {
            log.error("Error when obtains bean (exception) from beanFactory", e) ;
            //
            // if there is an error when create bean, then use super default
            exception = super.getException(exceptionId, message,cause);
            //
            // return
            return exception;
        }
        //
        // then now if message or cause are not null then I need recreate exception
        try {
            if (message!=null && cause!=null) {
                exception = (TuboException)exception.getClass().getConstructor(new Class[] {String.class,Throwable.class}).newInstance(new Object[] {message,cause});
            }
            else
                if (message!=null && cause==null) {
                    exception = (TuboException)exception.getClass().getConstructor(new Class[] {String.class}).newInstance(new Object[] {message});
                }
                else
                    if (message==null && cause!=null) {
                        exception = (TuboException)exception.getClass().getConstructor(new Class[] {Throwable.class}).newInstance(new Object[] {cause});
                    }
        } catch (InstantiationException e) {
            log.error("Error, Exception can't be instanciated", e);
        } catch (IllegalAccessException e) {
            log.error("Error, accesing Exception", e);
View Full Code Here

Examples of org.tubo.exception.TuboException

                foundRank = true;
            }
        }
        //
        // get exception
        TuboException exception = getException(exceptionId, (""+errorCode), args, cause);
        //
        // return
        return exception;
    }
View Full Code Here

Examples of org.tubo.exception.TuboException

        // format message with bind args
        if (args!=null)
            message = MessageFormat.format(message,args);
        //
        // call hook to create exception from an id
        TuboException exception = getException(exceptionId, message, cause);
        //
        // return
        return exception;
    }
View Full Code Here

Examples of org.tubo.exception.TuboException

     * This default implementation to create a TuboException
     * @param exceptionId exception identifier
     * @return by default returns TuboException for any exceptionId
     */
    public TuboException getException(String exceptionId, String message, Throwable cause) {
        return new TuboException();
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.