1 21 22 package org.apache.derby.impl.load; 23 24 import java.sql.SQLException ; 25 import org.apache.derby.iapi.error.ExceptionSeverity; 26 import org.apache.derby.iapi.reference.SQLState; 27 import org.apache.derby.iapi.error.StandardException; 28 import org.apache.derby.iapi.error.PublicAPI; 29 30 37 class LoadError { 38 39 42 43 static SQLException connectionNull() { 44 return PublicAPI.wrapStandardException( 45 StandardException.newException(SQLState.CONNECTION_NULL)); 46 } 47 48 53 static SQLException dataAfterStopDelimiter(int lineNumber, int columnNumber) { 54 return PublicAPI.wrapStandardException( 55 StandardException.newException(SQLState.DATA_AFTER_STOP_DELIMITER, 56 new Integer (lineNumber),new Integer (columnNumber))); 57 } 58 59 63 static SQLException dataFileNotFound(String fileName) { 64 65 return PublicAPI.wrapStandardException( 66 StandardException.newException(SQLState.DATA_FILE_NOT_FOUND, fileName)); 67 } 68 69 70 73 static SQLException dataFileNull() { 74 return PublicAPI.wrapStandardException( 75 StandardException.newException(SQLState.DATA_FILE_NULL)); 76 } 77 78 81 82 static SQLException entityNameMissing() { 83 return PublicAPI.wrapStandardException( 84 StandardException.newException(SQLState.ENTITY_NAME_MISSING)); 85 86 } 87 88 89 92 static SQLException fieldAndRecordSeparatorsSubset() { 93 return PublicAPI.wrapStandardException( 94 StandardException.newException(SQLState.FIELD_IS_RECORD_SEPERATOR_SUBSET)); 95 } 96 97 101 static SQLException invalidColumnName(String columnName) { 102 return PublicAPI.wrapStandardException( 103 StandardException.newException(SQLState.INVALID_COLUMN_NAME , columnName)); 104 105 } 106 107 108 112 static SQLException invalidColumnNumber(int numberOfColumns) { 113 114 return PublicAPI.wrapStandardException( 115 StandardException.newException(SQLState.INVALID_COLUMN_NUMBER, 116 new Integer (numberOfColumns) 117 )); 118 } 119 120 124 static SQLException nonSupportedTypeColumn(String columnName, String typeName) { 125 return PublicAPI.wrapStandardException( 126 StandardException.newException(SQLState.UNSUPPORTED_COLUMN_TYPE, 127 columnName, 128 typeName)); 129 } 130 131 132 136 static SQLException recordSeparatorMissing(int lineNumber) { 137 138 return PublicAPI.wrapStandardException( 139 StandardException.newException(SQLState.RECORD_SEPERATOR_MISSING, 140 new Integer (lineNumber))); 141 } 142 143 146 static SQLException unexpectedEndOfFile(int lineNumber) { 147 return PublicAPI.wrapStandardException( 148 StandardException.newException(SQLState.UNEXPECTED_END_OF_FILE, 149 new Integer (lineNumber))); 150 } 151 152 155 static SQLException errorWritingData() { 156 return PublicAPI.wrapStandardException( 157 StandardException.newException(SQLState.ERROR_WRITING_DATA)); 158 } 159 160 161 164 static SQLException periodAsCharDelimiterNotAllowed() 165 { 166 return PublicAPI.wrapStandardException( 167 StandardException.newException(SQLState.PERIOD_AS_CHAR_DELIMITER_NOT_ALLOWED)); 168 } 169 170 174 static SQLException delimitersAreNotMutuallyExclusive() 175 { 176 return PublicAPI.wrapStandardException( 177 StandardException.newException(SQLState.DELIMITERS_ARE_NOT_MUTUALLY_EXCLUSIVE)); 178 } 179 180 181 static SQLException tableNotFound(String tableName) 182 { 183 184 return PublicAPI.wrapStandardException( 185 StandardException.newException(SQLState.TABLE_NOT_FOUND, tableName)); 186 } 187 188 189 193 194 static SQLException unexpectedError(Throwable t ) 195 { 196 if (!(t instanceof SQLException )) 197 { 198 return PublicAPI.wrapStandardException(StandardException.plainWrapException(t)); 199 } 200 else 201 return (SQLException ) t; 202 } 203 204 205 206 207 } 208 209 210 211 212 213 | Popular Tags |