maven.sourceforge.username=javajedi
maven.test.source=1.5
maven.username=javajedi
-log4j.configuration=com/hmsonline/common/access/log4j.properties
+log4j.configuration=com/healthmarketscience/jackcess/log4j.properties
statcvs.include=**/*.java;**/*.xml
<pomVersion>1</pomVersion>
<id>jackcess</id>
<name>Jackcess</name>
- <currentVersion>1.1.1</currentVersion>
+ <currentVersion>1.1.2</currentVersion>
<organization>
<name>Health Market Science, Inc.</name>
<url>http://www.healthmarketscience.com</url>
if (_type == DataType.BOOLEAN) {
//Do nothing
} else if (_type == DataType.BYTE) {
- buffer.put(((Number) obj).byteValue());
+ buffer.put(obj != null ? ((Number) obj).byteValue() : (byte) 0);
} else if (_type == DataType.INT) {
- buffer.putShort(((Number) obj).shortValue());
+ buffer.putShort(obj != null ? ((Number) obj).shortValue() : (short) 0);
} else if (_type == DataType.LONG) {
- buffer.putInt(((Number) obj).intValue());
+ buffer.putInt(obj != null ? ((Number) obj).intValue() : 0);
} else if (_type == DataType.DOUBLE) {
- buffer.putDouble(((Number) obj).doubleValue());
+ buffer.putDouble(obj != null ? ((Number) obj).doubleValue() : (double) 0);
} else if (_type == DataType.FLOAT) {
- buffer.putFloat(((Number) obj).floatValue());
+ buffer.putFloat(obj != null ? ((Number) obj).floatValue() : (float) 0);
} else if (_type == DataType.SHORT_DATE_TIME) {
- Calendar cal = Calendar.getInstance();
- cal.setTime((Date) obj);
- long ms = cal.getTimeInMillis();
- ms += (long) TimeZone.getDefault().getOffset(ms);
- buffer.putDouble((double) ms / MILLISECONDS_PER_DAY +
- DAYS_BETWEEN_EPOCH_AND_1900);
+ if (obj instanceof Date) {
+ Calendar cal = Calendar.getInstance();
+ cal.setTime((Date) obj);
+ long ms = cal.getTimeInMillis();
+ ms += (long) TimeZone.getDefault().getOffset(ms);
+ buffer.putDouble((double) ms / MILLISECONDS_PER_DAY +
+ DAYS_BETWEEN_EPOCH_AND_1900);
+ } else {
+ buffer.putDouble(0d);
+ }
} else if (_type == DataType.BINARY) {
buffer.put((byte[]) obj);
} else if (_type == DataType.TEXT) {
//Now read in the fixed length columns and populate the columnData array
//with the combination of fixed length and variable length data.
- byte[] columnData;
+ byte[] columnData = null;
for (Iterator iter = _columns.iterator(); iter.hasNext(); columnNumber++) {
Column column = (Column) iter.next();
boolean isNull = nullMask.isNull(columnNumber);
Object value = null;
if (column.getType() == DataType.BOOLEAN) {
value = new Boolean(!isNull); //Boolean values are stored in the null mask
- } else if (!isNull) {
+ } else {
if (!column.isVariableLength()) {
//Read in fixed length column data
columnData = new byte[column.size()];
_buffer.get(columnData);
- } else {
+ } else if (!isNull) {
//Refer to already-read-in variable length data
columnData = varColumnData[varColumnDataIndex--];
}
- if (columnNames == null || columnNames.contains(column.getName())) {
+ if (!isNull && columnData != null &&
+ (columnNames == null || columnNames.contains(column.getName())))
+ {
//Add the value if we are interested in it.
value = column.read(columnData);
}
col = (Column) iter.next();
if (!col.isVariableLength()) {
//Fixed length column data comes first
- if (row.get(index) != null) {
- buffer.put(col.write(row.get(index)));
- }
+ buffer.put(col.write(row.get(index)));
}
if (col.getType() == DataType.BOOLEAN) {
if (row.get(index) != null) {
private Database create() throws Exception {
File tmp = File.createTempFile("databaseTest", ".mdb");
- //tmp.deleteOnExit();
+ tmp.deleteOnExit();
return Database.create(tmp);
}
row[0] = "Tim";
row[1] = "R";
row[2] = "McCune";
- row[3] = new Integer(1234);
+ row[3] = null;
row[4] = new Byte((byte) 0xad);
row[5] = new Double(555.66d);
row[6] = new Float(777.88d);