1 23 24 25 26 31 32 package com.sun.jdo.spi.persistence.support.ejb.ejbqlc; 33 34 import java.util.ResourceBundle ; 35 import com.sun.jdo.spi.persistence.utility.I18NHelper; 36 import com.sun.jdo.spi.persistence.utility.logging.Logger; 37 38 43 public class ErrorMsg 44 { 45 46 private final static ResourceBundle msgs = I18NHelper.loadBundle( 47 ErrorMsg.class); 48 49 50 private static Logger logger = LogHelperQueryCompilerEJB.getLogger(); 51 52 59 public static void error(int line, int col, String text) 60 throws EJBQLException 61 { 62 EJBQLException ex = null; 63 if (line > 1) { 64 Object args[] = {new Integer (line), new Integer (col), text}; 66 ex = new EJBQLException(I18NHelper.getMessage( 67 msgs, "EXC_PositionInfoMsgLineColumn", args)); } 69 else if (col > 0) { 70 Object args[] = {new Integer (col), text}; 72 ex = new EJBQLException(I18NHelper.getMessage( 73 msgs, "EXC_PositionInfoMsgColumn", args)); } 75 else { 76 ex = new EJBQLException(I18NHelper.getMessage( 77 msgs, "EXC_PositionInfoMsg", text)); } 79 throw ex; 80 } 81 82 88 public static void error(String text, Throwable cause) 89 throws EJBQLException 90 { 91 throw new EJBQLException(text, cause); 92 } 93 94 99 public static void error(String text) 100 throws EJBQLException 101 { 102 throw new EJBQLException(text); 103 } 104 105 114 public static void unsupported(int line, int col, String text) 115 throws UnsupportedOperationException 116 { 117 UnsupportedOperationException ex; 118 if (line > 1) 119 { 120 Object args[] = {new Integer (line), new Integer (col), text}; 122 ex = new UnsupportedOperationException (I18NHelper.getMessage( 123 msgs, "EXC_PositionInfoMsgLineColumn", args)); } 125 else if (col > 0) { 126 Object args[] = {new Integer (col), text}; 128 ex = new UnsupportedOperationException (I18NHelper.getMessage( 129 msgs, "EXC_PositionInfoMsgColumn", args)); } 131 else { 132 Object args[] = {text}; 133 ex = new UnsupportedOperationException (I18NHelper.getMessage( 134 msgs, "EXC_PositionInfoMsg", args)); } 136 throw ex; 137 } 138 139 144 public static void fatal(String text) 145 throws EJBQLException 146 { 147 throw new EJBQLException(I18NHelper.getMessage( 148 msgs, "ERR_FatalInternalError", text)); } 150 151 157 public static void fatal(String text, Throwable nested) 158 throws EJBQLException 159 { 160 throw new EJBQLException(I18NHelper.getMessage( 161 msgs, "ERR_FatalInternalError", text), nested); } 163 164 172 public static void log(int level, String text, Throwable nested) 173 throws EJBQLException 174 { 175 logger.log(level, text, nested); 176 throw new EJBQLException(text, nested); 177 } 178 } 179 | Popular Tags |