summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/java/com/healthmarketscience/jackcess/ByteUtil.java4
-rw-r--r--src/java/com/healthmarketscience/jackcess/Column.java9
-rw-r--r--src/java/com/healthmarketscience/jackcess/Cursor.java1
-rw-r--r--src/java/com/healthmarketscience/jackcess/DataType.java9
-rw-r--r--src/java/com/healthmarketscience/jackcess/Database.java3
-rw-r--r--src/java/com/healthmarketscience/jackcess/Index.java4
-rw-r--r--src/java/com/healthmarketscience/jackcess/JetFormat.java3
-rw-r--r--src/java/com/healthmarketscience/jackcess/PageChannel.java4
-rw-r--r--src/java/com/healthmarketscience/jackcess/Table.java28
-rw-r--r--src/java/com/healthmarketscience/jackcess/UsageMap.java7
10 files changed, 33 insertions, 39 deletions
diff --git a/src/java/com/healthmarketscience/jackcess/ByteUtil.java b/src/java/com/healthmarketscience/jackcess/ByteUtil.java
index 29ddecd..dacc404 100644
--- a/src/java/com/healthmarketscience/jackcess/ByteUtil.java
+++ b/src/java/com/healthmarketscience/jackcess/ByteUtil.java
@@ -252,9 +252,9 @@ public final class ByteUtil {
byte h = (byte) (b & 0xF0);
h = (byte) (h >>> 4);
h = (byte) (h & 0x0F);
- rtn.append(HEX_CHARS[(int) h]);
+ rtn.append(HEX_CHARS[h]);
h = (byte) (b & 0x0F);
- rtn.append(HEX_CHARS[(int) h]);
+ rtn.append(HEX_CHARS[h]);
if (formatted == true)
{
diff --git a/src/java/com/healthmarketscience/jackcess/Column.java b/src/java/com/healthmarketscience/jackcess/Column.java
index e628984..3b0f3cf 100644
--- a/src/java/com/healthmarketscience/jackcess/Column.java
+++ b/src/java/com/healthmarketscience/jackcess/Column.java
@@ -148,7 +148,6 @@ public class Column implements Comparable<Column> {
* @param table owning table
* @param buffer Buffer containing column definition
* @param offset Offset in the buffer at which the column definition starts
- * @param format Format that the containing database is in
*/
public Column(Table table, ByteBuffer buffer, int offset)
throws IOException
@@ -420,8 +419,6 @@ public class Column implements Comparable<Column> {
/**
* @param lvalDefinition Column value that points to an LVAL record
- * @param outType optional 1 element array for returning the
- * <code>LONG_VALUE_TYPE_*</code>
* @return The LVAL data
*/
private byte[] readLongValue(byte[] lvalDefinition)
@@ -530,7 +527,7 @@ public class Column implements Comparable<Column> {
/**
* Decodes "Currency" values.
*
- * @param valueBytes Column value that points to currency data
+ * @param buffer Column value that points to currency data
* @return BigDecimal representing the monetary value
* @throws IOException if the value cannot be parsed
*/
@@ -661,7 +658,7 @@ public class Column implements Comparable<Column> {
long time = ((Date)value).getTime();
time += getTimeZoneOffset(time);
time += MILLIS_BETWEEN_EPOCH_AND_1900;
- double dTime = ((double)time) / MILLISECONDS_PER_DAY;
+ double dTime = time / MILLISECONDS_PER_DAY;
buffer.putDouble(dTime);
}
}
@@ -1099,7 +1096,7 @@ public class Column implements Comparable<Column> {
public String toString() {
StringBuilder rtn = new StringBuilder();
rtn.append("\tName: " + _name);
- rtn.append("\n\tType: 0x" + Integer.toHexString((int)_type.getValue()) +
+ rtn.append("\n\tType: 0x" + Integer.toHexString(_type.getValue()) +
" (" + _type + ")");
rtn.append("\n\tNumber: " + _columnNumber);
rtn.append("\n\tLength: " + _columnLength);
diff --git a/src/java/com/healthmarketscience/jackcess/Cursor.java b/src/java/com/healthmarketscience/jackcess/Cursor.java
index 6ca0c84..28d848a 100644
--- a/src/java/com/healthmarketscience/jackcess/Cursor.java
+++ b/src/java/com/healthmarketscience/jackcess/Cursor.java
@@ -775,7 +775,6 @@ public abstract class Cursor implements Iterable<Map<String, Object>>
/**
* Returns the current row in this cursor (Column name -> Column value).
- * @param columnNames Only column names in this collection will be returned
*/
public Map<String, Object> getCurrentRow()
throws IOException
diff --git a/src/java/com/healthmarketscience/jackcess/DataType.java b/src/java/com/healthmarketscience/jackcess/DataType.java
index eac9bd8..1dc97ab 100644
--- a/src/java/com/healthmarketscience/jackcess/DataType.java
+++ b/src/java/com/healthmarketscience/jackcess/DataType.java
@@ -204,9 +204,8 @@ public enum DataType {
public int getFixedSize() {
if(_fixedSize != null) {
return _fixedSize;
- } else {
- throw new IllegalArgumentException("FIX ME");
}
+ throw new IllegalArgumentException("FIX ME");
}
public int getMinSize() {
@@ -224,9 +223,8 @@ public enum DataType {
public int getSQLType() throws SQLException {
if (_sqlType != null) {
return _sqlType;
- } else {
- throw new SQLException("Unsupported data type: " + toString());
}
+ throw new SQLException("Unsupported data type: " + toString());
}
public int getMinScale() {
@@ -277,9 +275,8 @@ public enum DataType {
DataType rtn = DATA_TYPES.get(b);
if (rtn != null) {
return rtn;
- } else {
- throw new IOException("Unrecognized data type: " + b);
}
+ throw new IOException("Unrecognized data type: " + b);
}
public static DataType fromSQLType(int sqlType)
diff --git a/src/java/com/healthmarketscience/jackcess/Database.java b/src/java/com/healthmarketscience/jackcess/Database.java
index d1f1e2b..84acf51 100644
--- a/src/java/com/healthmarketscience/jackcess/Database.java
+++ b/src/java/com/healthmarketscience/jackcess/Database.java
@@ -44,6 +44,7 @@ import java.sql.SQLException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
+import java.util.ConcurrentModificationException;
import java.util.Date;
import java.util.HashMap;
import java.util.HashSet;
@@ -273,7 +274,7 @@ public class Database
FileChannel channel = openChannel(mdbFile, false);
channel.transferFrom(Channels.newChannel(
Thread.currentThread().getContextClassLoader().getResourceAsStream(
- EMPTY_MDB)), 0, (long) Integer.MAX_VALUE);
+ EMPTY_MDB)), 0, Integer.MAX_VALUE);
return new Database(channel, autoSync);
}
diff --git a/src/java/com/healthmarketscience/jackcess/Index.java b/src/java/com/healthmarketscience/jackcess/Index.java
index 88eff7b..9c5639e 100644
--- a/src/java/com/healthmarketscience/jackcess/Index.java
+++ b/src/java/com/healthmarketscience/jackcess/Index.java
@@ -960,8 +960,8 @@ public class Index implements Comparable<Index> {
/**
* Create a new entry
* @param values Indexed row values
- * @param page Page number on which the row is stored
- * @param rowNumber Row number at which the row is stored
+ * @param rowId rowId in which the row is stored
+ * @param columns map of columns for this index
*/
private Entry(Object[] values, RowId rowId,
Map<Column, Byte> columns)
diff --git a/src/java/com/healthmarketscience/jackcess/JetFormat.java b/src/java/com/healthmarketscience/jackcess/JetFormat.java
index a9e96da..a38f7af 100644
--- a/src/java/com/healthmarketscience/jackcess/JetFormat.java
+++ b/src/java/com/healthmarketscience/jackcess/JetFormat.java
@@ -138,9 +138,8 @@ public abstract class JetFormat {
byte version = buffer.get();
if (version == CODE_VERSION_4) {
return VERSION_4;
- } else {
- throw new IOException("Unsupported version: " + version);
}
+ throw new IOException("Unsupported version: " + version);
}
private JetFormat(String name) {
diff --git a/src/java/com/healthmarketscience/jackcess/PageChannel.java b/src/java/com/healthmarketscience/jackcess/PageChannel.java
index b5301aa..cd4bd43 100644
--- a/src/java/com/healthmarketscience/jackcess/PageChannel.java
+++ b/src/java/com/healthmarketscience/jackcess/PageChannel.java
@@ -146,7 +146,7 @@ public class PageChannel implements Channel, Flushable {
page.rewind();
page.position(pageOffset);
_channel.write(page, (((long) pageNumber * (long) getFormat().PAGE_SIZE) +
- (long) pageOffset));
+ pageOffset));
if(_autoSync) {
flush();
}
@@ -177,7 +177,7 @@ public class PageChannel implements Channel, Flushable {
/**
* Allocates a new page in the database. Data in the page is undefined
- * until it is written in a call to {@link #writePage}.
+ * until it is written in a call to {@link #writePage(ByteBuffer,int)}.
*/
public int allocateNewPage() throws IOException {
// this will force the file to be extended with mostly undefined bytes
diff --git a/src/java/com/healthmarketscience/jackcess/Table.java b/src/java/com/healthmarketscience/jackcess/Table.java
index 3e3cbbe..11eec91 100644
--- a/src/java/com/healthmarketscience/jackcess/Table.java
+++ b/src/java/com/healthmarketscience/jackcess/Table.java
@@ -128,11 +128,10 @@ public class Table
}
/**
+ * @param database database which owns this table
* @param tableBuffer Buffer to read the table with
- * @param pageChannel Page channel to get database pages from
- * @param format Format of the database that contains this table
* @param pageNumber Page number of the table definition
- * @param name Table name
+ * @param name Table name
*/
protected Table(Database database, ByteBuffer tableBuffer,
int pageNumber, String name)
@@ -277,7 +276,7 @@ public class Table
}
/**
- * Delete the current row (retrieved by a call to {@link #getNextRow}).
+ * Delete the current row (retrieved by a call to {@link #getNextRow()}).
*/
public void deleteCurrentRow() throws IOException {
_cursor.deleteCurrentRow();
@@ -782,7 +781,7 @@ public class Table
// variable length values so that we have a better chance of fitting it
// all (because "long variable" values can go in separate pages)
short longVariableOffset =
- (short) Column.countNonLongVariableLength(columns);
+ Column.countNonLongVariableLength(columns);
for (Column col : columns) {
int position = buffer.position();
buffer.put(col.getType().getValue());
@@ -801,8 +800,8 @@ public class Table
}
buffer.putShort(columnNumber); //Column Number again
if(col.getType().getHasScalePrecision()) {
- buffer.put((byte) col.getPrecision()); // numeric precision
- buffer.put((byte) col.getScale()); // numeric scale
+ buffer.put(col.getPrecision()); // numeric precision
+ buffer.put(col.getScale()); // numeric scale
} else {
buffer.put((byte) 0x00); //unused
buffer.put((byte) 0x00); //unused
@@ -882,10 +881,10 @@ public class Table
rtn.putShort(getRowStartOffset(i, format), (short)rowStart);
if(i == 0) {
// initial "usage pages" map definition
- rtn.put(rowStart, (byte)UsageMap.MAP_TYPE_REFERENCE);
+ rtn.put(rowStart, UsageMap.MAP_TYPE_REFERENCE);
} else {
// initial "pages with free space" map definition
- rtn.put(rowStart, (byte)UsageMap.MAP_TYPE_INLINE);
+ rtn.put(rowStart, UsageMap.MAP_TYPE_INLINE);
}
rowStart -= usageMapRowLength;
}
@@ -941,12 +940,12 @@ public class Table
}
offset += columnCount * getFormat().SIZE_COLUMN_HEADER;
for (int i = 0; i < columnCount; i++) {
- column = (Column) _columns.get(i);
+ column = _columns.get(i);
short nameLength = tableBuffer.getShort(offset);
offset += 2;
byte[] nameBytes = new byte[nameLength];
tableBuffer.position(offset);
- tableBuffer.get(nameBytes, 0, (int) nameLength);
+ tableBuffer.get(nameBytes, 0, nameLength);
column.setName(getFormat().CHARSET.decode(ByteBuffer.wrap(nameBytes)).toString());
offset += nameLength;
}
@@ -1162,7 +1161,7 @@ public class Table
*/
ByteBuffer createRow(Object[] rowArray, int maxRowSize) throws IOException {
ByteBuffer buffer = getPageChannel().createPageBuffer();
- buffer.putShort((short) _maxColumnCount);
+ buffer.putShort(_maxColumnCount);
NullMask nullMask = new NullMask(_maxColumnCount);
List<Object> row = new ArrayList<Object>(_columns.size());
@@ -1259,7 +1258,7 @@ public class Table
for (int i = _maxVarColumnCount - 1; i >= 0; i--) {
buffer.putShort(varColumnOffsets[i]);
}
- buffer.putShort((short) _maxVarColumnCount); //Number of var length columns
+ buffer.putShort(_maxVarColumnCount); //Number of var length columns
}
buffer.put(nullMask.wrap()); //Null mask
@@ -1279,7 +1278,8 @@ public class Table
// note, the saved value is the last one handed out, so pre-increment
return ++_lastAutoNumber;
}
-
+
+ @Override
public String toString() {
StringBuilder rtn = new StringBuilder();
rtn.append("Type: " + _tableType);
diff --git a/src/java/com/healthmarketscience/jackcess/UsageMap.java b/src/java/com/healthmarketscience/jackcess/UsageMap.java
index ac6b7a8..f045661 100644
--- a/src/java/com/healthmarketscience/jackcess/UsageMap.java
+++ b/src/java/com/healthmarketscience/jackcess/UsageMap.java
@@ -87,7 +87,7 @@ public class UsageMap
_tableBuffer = tableBuffer;
_tablePageNum = pageNum;
_rowStart = rowStart;
- _tableBuffer.position((int) _rowStart + getFormat().OFFSET_USAGE_MAP_START);
+ _tableBuffer.position(_rowStart + getFormat().OFFSET_USAGE_MAP_START);
_startOffset = _tableBuffer.position();
if (LOG.isDebugEnabled()) {
LOG.debug("Usage map block:\n" + ByteUtil.toHexString(_tableBuffer, _rowStart,
@@ -380,7 +380,8 @@ public class UsageMap
addPageNumber(newPageNumber);
}
}
-
+
+ @Override
public String toString() {
StringBuilder builder = new StringBuilder("page numbers: [");
PageCursor pCursor = cursor();
@@ -676,7 +677,7 @@ public class UsageMap
throw new IOException("Page number " + pageNumber +
" is out of supported range");
}
- int pageIndex = (int)(pageNumber / getMaxPagesPerUsagePage());
+ int pageIndex = (pageNumber / getMaxPagesPerUsagePage());
int mapPageNum = getTableBuffer().getInt(
calculateMapPagePointerOffset(pageIndex));
ByteBuffer mapPageBuffer = null;