diff options
author | James Ahlborn <jtahlborn@yahoo.com> | 2013-10-04 02:40:42 +0000 |
---|---|---|
committer | James Ahlborn <jtahlborn@yahoo.com> | 2013-10-04 02:40:42 +0000 |
commit | 1adb6ea69dc29d01e080b059d625a27a8f3e75c0 (patch) | |
tree | 8683151ce001aa343272e7af00464f9281e1cbc9 /src/main | |
parent | 97eadc5acd14baf615376a47aca70ba739b88ab1 (diff) | |
download | jackcess-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.java | 17 |
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); |