FileDocCategorySizeDatePackage
ErrorMsg.javaAPI DocGlassfish v2 API7023Fri May 04 22:34:50 BST 2007com.sun.jdo.spi.persistence.support.ejb.ejbqlc

ErrorMsg

public class ErrorMsg extends Object
This is a helper class to report error messages from the EJBQL compiler.
author
Michael Bouschen
author
Shing Wai Chan

Fields Summary
private static final ResourceBundle
msgs
I18N support.
private static com.sun.jdo.spi.persistence.utility.logging.Logger
logger
The logger
Constructors Summary
Methods Summary
public static voiderror(int line, int col, java.lang.String text)
This method throws an EJBQLException indicating an user error.

param
line line number
param
col column number
param
text error message
exception
EJBQLException describes the user error.

    
                                    
            
         
    
        EJBQLException ex = null;
        if (line > 1) {
            // include line and column info
            Object args[] = {new Integer(line), new Integer(col), text};
            ex = new EJBQLException(I18NHelper.getMessage(
                msgs, "EXC_PositionInfoMsgLineColumn", args)); //NOI18N
        }
        else if (col > 0) {
            // include column info
            Object args[] = {new Integer(col), text};
            ex = new EJBQLException(I18NHelper.getMessage(
                msgs, "EXC_PositionInfoMsgColumn", args)); //NOI18N
        }
        else {
            ex = new EJBQLException(I18NHelper.getMessage(
                msgs, "EXC_PositionInfoMsg", text)); //NOI18N
        }
        throw ex;
    
public static voiderror(java.lang.String text, java.lang.Throwable cause)
This method throws an EJBQLException indicating an user error.

param
text error message
param
cause the cause of the error
exception
EJBQLException describes the user error.

        throw new EJBQLException(text, cause);
    
public static voiderror(java.lang.String text)
This method throws an EJBQLException indicating an user error.

param
text error message
exception
EJBQLException describes the user error.

        throw new EJBQLException(text);
    
public static voidfatal(java.lang.String text)
This method is called in the case of an fatal internal error.

param
text error message
exception
EJBQLException describes the fatal internal error.

        throw new EJBQLException(I18NHelper.getMessage(
            msgs, "ERR_FatalInternalError", text)); //NOI18N
    
public static voidfatal(java.lang.String text, java.lang.Throwable nested)
This method is called in the case of an fatal internal error.

param
text error message
param
nested the cause of the error
exception
EJBQLException describes the fatal internal error.

        throw new EJBQLException(I18NHelper.getMessage(
            msgs, "ERR_FatalInternalError", text), nested); //NOI18N
    
public static voidlog(int level, java.lang.String text, java.lang.Throwable nested)
This method is called when we want to log an exception in a given level. Note that all other methods in this class do not log a stack trace.

param
level log level
param
text error message
param
nested the cause of the error
exception
EJBQLException describes the fatal internal error.

        logger.log(level, text, nested);
        throw new EJBQLException(text, nested);
    
public static voidunsupported(int line, int col, java.lang.String text)
This method throws an UnsupportedOperationException indicating an unsupported feature.

param
line line number
param
col column number
param
text message
exception
UnsupportedOperationException describes the unsupported feature.

        UnsupportedOperationException ex;
        if (line > 1)
        {
            // include line and column info
            Object args[] = {new Integer(line), new Integer(col), text};
            ex = new UnsupportedOperationException(I18NHelper.getMessage(
                msgs, "EXC_PositionInfoMsgLineColumn", args)); //NOI18N
        }
        else if (col > 0) {
            // include column info
            Object args[] = {new Integer(col), text};
            ex = new UnsupportedOperationException(I18NHelper.getMessage(
                msgs, "EXC_PositionInfoMsgColumn", args)); //NOI18N
        }
        else {
            Object args[] = {text};
            ex = new UnsupportedOperationException(I18NHelper.getMessage(
                msgs, "EXC_PositionInfoMsg", args)); //NOI18N
        }   
        throw ex;