aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJames Ahlborn <jtahlborn@yahoo.com>2006-08-04 17:28:49 +0000
committerJames Ahlborn <jtahlborn@yahoo.com>2006-08-04 17:28:49 +0000
commit7c1c301b79b1cea281752a4b8556f3f8e1c78741 (patch)
treeb7cd8113d8db8b436ba6bc2fb39cbb1fe6a57ca6
parent479c633c30387d9f91ff6cee97adc979d231d59f (diff)
downloadjackcess-7c1c301b79b1cea281752a4b8556f3f8e1c78741.tar.gz
jackcess-7c1c301b79b1cea281752a4b8556f3f8e1c78741.zip
reduce usage of SQLException
git-svn-id: https://svn.code.sf.net/p/jackcess/code/jackcess/trunk@93 f203690c-595d-4dc9-a70b-905162fa7fd2
-rw-r--r--src/java/com/healthmarketscience/jackcess/Column.java2
-rw-r--r--src/java/com/healthmarketscience/jackcess/DataType.java5
-rw-r--r--src/java/com/healthmarketscience/jackcess/Database.java25
-rw-r--r--src/java/com/healthmarketscience/jackcess/Table.java5
4 files changed, 17 insertions, 20 deletions
diff --git a/src/java/com/healthmarketscience/jackcess/Column.java b/src/java/com/healthmarketscience/jackcess/Column.java
index ac40588..2f0bf23 100644
--- a/src/java/com/healthmarketscience/jackcess/Column.java
+++ b/src/java/com/healthmarketscience/jackcess/Column.java
@@ -126,7 +126,7 @@ public class Column implements Comparable<Column> {
* @param format Format that the containing database is in
*/
public Column(ByteBuffer buffer, int offset, PageChannel pageChannel, JetFormat format)
- throws SQLException
+ throws IOException
{
if (LOG.isDebugEnabled()) {
LOG.debug("Column def block:\n" + ByteUtil.toHexString(buffer, offset, 25));
diff --git a/src/java/com/healthmarketscience/jackcess/DataType.java b/src/java/com/healthmarketscience/jackcess/DataType.java
index a14d668..d3b1711 100644
--- a/src/java/com/healthmarketscience/jackcess/DataType.java
+++ b/src/java/com/healthmarketscience/jackcess/DataType.java
@@ -27,6 +27,7 @@ King of Prussia, PA 19406
package com.healthmarketscience.jackcess;
+import java.io.IOException;
import java.sql.SQLException;
import java.sql.Types;
import java.util.HashMap;
@@ -128,12 +129,12 @@ public enum DataType {
}
}
- public static DataType fromByte(byte b) throws SQLException {
+ public static DataType fromByte(byte b) throws IOException {
DataType rtn = DATA_TYPES.get(b);
if (rtn != null) {
return rtn;
} else {
- throw new SQLException("Unrecognized data type: " + b);
+ throw new IOException("Unrecognized data type: " + b);
}
}
diff --git a/src/java/com/healthmarketscience/jackcess/Database.java b/src/java/com/healthmarketscience/jackcess/Database.java
index 181a5a3..b36471f 100644
--- a/src/java/com/healthmarketscience/jackcess/Database.java
+++ b/src/java/com/healthmarketscience/jackcess/Database.java
@@ -184,7 +184,7 @@ public class Database
* Open an existing Database
* @param mdbFile File containing the database
*/
- public static Database open(File mdbFile) throws IOException, SQLException {
+ public static Database open(File mdbFile) throws IOException {
if(!mdbFile.exists() || !mdbFile.canRead()) {
throw new FileNotFoundException("given file does not exist: " + mdbFile);
}
@@ -196,7 +196,7 @@ public class Database
* @param mdbFile Location to write the new database to. <b>If this file
* already exists, it will be overwritten.</b>
*/
- public static Database create(File mdbFile) throws IOException, SQLException {
+ public static Database create(File mdbFile) throws IOException {
FileChannel channel = openChannel(mdbFile);
channel.transferFrom(Channels.newChannel(
Thread.currentThread().getContextClassLoader().getResourceAsStream(
@@ -214,7 +214,7 @@ public class Database
* FileChannel instead of a ReadableByteChannel because we need to
* randomly jump around to various points in the file.
*/
- protected Database(FileChannel channel) throws IOException, SQLException {
+ protected Database(FileChannel channel) throws IOException {
_format = JetFormat.getFormat(channel);
_pageChannel = new PageChannel(channel, _format);
_buffer = _pageChannel.createPageBuffer();
@@ -239,7 +239,7 @@ public class Database
/**
* Read the system catalog
*/
- private void readSystemCatalog() throws IOException, SQLException {
+ private void readSystemCatalog() throws IOException {
_pageChannel.readPage(_buffer, PAGE_SYSTEM_CATALOG);
byte pageType = _buffer.get();
if (pageType != PageTypes.TABLE_DEF) {
@@ -272,7 +272,7 @@ public class Database
* Read the system access control entries table
* @param pageNum Page number of the table def
*/
- private void readAccessControlEntries(int pageNum) throws IOException, SQLException {
+ private void readAccessControlEntries(int pageNum) throws IOException {
ByteBuffer buffer = _pageChannel.createPageBuffer();
_pageChannel.readPage(buffer, pageNum);
byte pageType = buffer.get();
@@ -298,9 +298,8 @@ public class Database
/**
* @return an unmodifiable Iterator of the user Tables in this Database.
- * @throws IllegalStateException if an IOException or SQLException is thrown
- * by one of the operations, the actual exception will be contained
- * within
+ * @throws IllegalStateException if an IOException is thrown by one of the
+ * operations, the actual exception will be contained within
* @throws ConcurrentModificationException if a table is added to the
* database while an Iterator is in use.
*/
@@ -312,7 +311,7 @@ public class Database
* @param name Table name
* @return The table, or null if it doesn't exist
*/
- public Table getTable(String name) throws IOException, SQLException {
+ public Table getTable(String name) throws IOException {
TableInfo tableInfo = lookupTable(name);
@@ -333,7 +332,7 @@ public class Database
*/
//XXX Set up 1-page rollback buffer?
public void createTable(String name, List<Column> columns)
- throws IOException, SQLException
+ throws IOException
{
if(getTable(name) != null) {
@@ -651,7 +650,7 @@ public class Database
* @param delim Regular expression representing the delimiter string.
*/
public void importFile(String name, File f, String delim)
- throws IOException, SQLException
+ throws IOException
{
BufferedReader in = null;
try {
@@ -676,7 +675,7 @@ public class Database
* @param delim Regular expression representing the delimiter string.
*/
public void importReader(String name, BufferedReader in, String delim)
- throws IOException, SQLException
+ throws IOException
{
String line = in.readLine();
if (line == null || line.trim().length() == 0) {
@@ -819,8 +818,6 @@ public class Database
return getTable(_tableNameIter.next());
} catch(IOException e) {
throw new IllegalStateException(e);
- } catch(SQLException e) {
- throw new IllegalStateException(e);
}
}
}
diff --git a/src/java/com/healthmarketscience/jackcess/Table.java b/src/java/com/healthmarketscience/jackcess/Table.java
index 1a896ad..dd067ee 100644
--- a/src/java/com/healthmarketscience/jackcess/Table.java
+++ b/src/java/com/healthmarketscience/jackcess/Table.java
@@ -30,7 +30,6 @@ package com.healthmarketscience.jackcess;
import java.io.IOException;
import java.nio.ByteBuffer;
import java.nio.ByteOrder;
-import java.sql.SQLException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
@@ -120,7 +119,7 @@ public class Table
* @param name Table name
*/
protected Table(ByteBuffer buffer, PageChannel pageChannel, JetFormat format, int pageNumber, String name)
- throws IOException, SQLException
+ throws IOException
{
_buffer = buffer;
_pageChannel = pageChannel;
@@ -377,7 +376,7 @@ public class Table
/**
* Read the table definition
*/
- private void readPage() throws IOException, SQLException {
+ private void readPage() throws IOException {
if (LOG.isDebugEnabled()) {
_buffer.rewind();
LOG.debug("Table def block:\n" + ByteUtil.toHexString(_buffer,