diff options
author | James Ahlborn <jtahlborn@yahoo.com> | 2008-03-10 15:31:02 +0000 |
---|---|---|
committer | James Ahlborn <jtahlborn@yahoo.com> | 2008-03-10 15:31:02 +0000 |
commit | 2da73555e67237897d736b9e28e6d8aec8df23cd (patch) | |
tree | 76454f4de18b137adf5eb17d522859092fced56c /src | |
parent | a440c22d4d9778e577a89999a50031bdaaa28404 (diff) | |
download | jackcess-2da73555e67237897d736b9e28e6d8aec8df23cd.tar.gz jackcess-2da73555e67237897d736b9e28e6d8aec8df23cd.zip |
make sure database file fits expected criteria
git-svn-id: https://svn.code.sf.net/p/jackcess/code/jackcess/trunk@261 f203690c-595d-4dc9-a70b-905162fa7fd2
Diffstat (limited to 'src')
-rw-r--r-- | src/java/com/healthmarketscience/jackcess/PageChannel.java | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/src/java/com/healthmarketscience/jackcess/PageChannel.java b/src/java/com/healthmarketscience/jackcess/PageChannel.java index 5a94c39..4aaa08b 100644 --- a/src/java/com/healthmarketscience/jackcess/PageChannel.java +++ b/src/java/com/healthmarketscience/jackcess/PageChannel.java @@ -166,6 +166,12 @@ public class PageChannel implements Channel, Flushable { throw new IOException("Database is at maximum size " + getFormat().MAX_DATABASE_SIZE); } + if((size % getFormat().PAGE_SIZE) != 0L) { + throw new IOException("Database corrupted, file size " + size + + " is not multiple of page size " + + getFormat().PAGE_SIZE); + } + page.rewind(); // push the buffer to the end of the page, so that a full page's worth of // data is written regardless of the incoming buffer size (we use a tiny |