aboutsummaryrefslogtreecommitdiffstats
path: root/src/main
diff options
context:
space:
mode:
authorJames Ahlborn <jtahlborn@yahoo.com>2013-10-04 02:40:42 +0000
committerJames Ahlborn <jtahlborn@yahoo.com>2013-10-04 02:40:42 +0000
commit1adb6ea69dc29d01e080b059d625a27a8f3e75c0 (patch)
tree8683151ce001aa343272e7af00464f9281e1cbc9 /src/main
parent97eadc5acd14baf615376a47aca70ba739b88ab1 (diff)
downloadjackcess-1adb6ea69dc29d01e080b059d625a27a8f3e75c0.tar.gz
jackcess-1adb6ea69dc29d01e080b059d625a27a8f3e75c0.zip
Make reading long value columns more lenient (MEMO/OLE)
git-svn-id: https://svn.code.sf.net/p/jackcess/code/jackcess/trunk@814 f203690c-595d-4dc9-a70b-905162fa7fd2
Diffstat (limited to 'src/main')
-rw-r--r--src/main/java/com/healthmarketscience/jackcess/impl/ColumnImpl.java17
1 files changed, 15 insertions, 2 deletions
diff --git a/src/main/java/com/healthmarketscience/jackcess/impl/ColumnImpl.java b/src/main/java/com/healthmarketscience/jackcess/impl/ColumnImpl.java
index 8f808cb..65b276f 100644
--- a/src/main/java/com/healthmarketscience/jackcess/impl/ColumnImpl.java
+++ b/src/main/java/com/healthmarketscience/jackcess/impl/ColumnImpl.java
@@ -671,6 +671,15 @@ public class ColumnImpl implements Column, Comparable<ColumnImpl> {
// inline long value
def.getInt(); //Skip over lval_dp
def.getInt(); //Skip over unknown
+
+ int rowLen = def.remaining();
+ if(rowLen < length) {
+ // warn the caller, but return whatever we can
+ LOG.warn(getName() + " value may be truncated: expected length " +
+ length + " found " + rowLen);
+ rtn = new byte[rowLen];
+ }
+
def.get(rtn);
} else {
@@ -694,8 +703,12 @@ public class ColumnImpl implements Column, Comparable<ColumnImpl> {
short rowStart = TableImpl.findRowStart(lvalPage, rowNum, getFormat());
short rowEnd = TableImpl.findRowEnd(lvalPage, rowNum, getFormat());
- if((rowEnd - rowStart) != length) {
- throw new IOException("Unexpected lval row length");
+ int rowLen = rowEnd - rowStart;
+ if(rowLen < length) {
+ // warn the caller, but return whatever we can
+ LOG.warn(getName() + " value may be truncated: expected length " +
+ length + " found " + rowLen);
+ rtn = new byte[rowLen];
}
lvalPage.position(rowStart);