diff options
-rw-r--r-- | src/changes/changes.xml | 3 | ||||
-rw-r--r-- | src/java/com/healthmarketscience/jackcess/Column.java | 18 |
2 files changed, 21 insertions, 0 deletions
diff --git a/src/changes/changes.xml b/src/changes/changes.xml index a019ca8..e47124f 100644 --- a/src/changes/changes.xml +++ b/src/changes/changes.xml @@ -8,6 +8,9 @@ <action dev="jahlborn" type="fix" system="SourceForge2" issue="97"> Ignore invalid column usage map definitions. </action> + <action dev="jahlborn" type="fix"> + Make reading long value columns more lenient (MEMO/OLE). + </action> </release> <release version="1.2.14.2" date="2013-08-25"> <action dev="jahlborn" type="fix" system="SourceForge2" issue="96"> diff --git a/src/java/com/healthmarketscience/jackcess/Column.java b/src/java/com/healthmarketscience/jackcess/Column.java index 69412a8..4652e5f 100644 --- a/src/java/com/healthmarketscience/jackcess/Column.java +++ b/src/java/com/healthmarketscience/jackcess/Column.java @@ -931,6 +931,15 @@ public class Column implements Comparable<Column> { // 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 { @@ -954,6 +963,15 @@ public class Column implements Comparable<Column> { short rowStart = Table.findRowStart(lvalPage, rowNum, getFormat()); short rowEnd = Table.findRowEnd(lvalPage, rowNum, getFormat()); + 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]; + } + + if((rowEnd - rowStart) != length) { throw new IOException("Unexpected lval row length"); } |