mirror of
https://code.briarproject.org/briar/briar.git
synced 2026-02-12 10:49:06 +01:00
Upgraded H2 jar and removed workaround for Blob.getBytes() bug.
The H2 developers are amazing. :-)
This commit is contained in:
@@ -14,7 +14,6 @@
|
||||
<classpathentry kind="lib" path="lib/test/hamcrest-library-1.1.jar"/>
|
||||
<classpathentry kind="lib" path="lib/test/jmock-2.5.1.jar"/>
|
||||
<classpathentry kind="lib" path="lib/commons-io-2.0.1.jar"/>
|
||||
<classpathentry kind="lib" path="lib/h2small-1.3.157.jar"/>
|
||||
<classpathentry kind="lib" path="lib/test/junit-4.9b3.jar"/>
|
||||
<classpathentry kind="lib" path="lib/bcprov-jdk15-146.jar"/>
|
||||
<classpathentry kind="lib" path="lib/jna.jar"/>
|
||||
@@ -22,5 +21,6 @@
|
||||
<classpathentry kind="lib" path="lib/jnotify-0.93.jar"/>
|
||||
<classpathentry kind="lib" path="lib/bluecove-2.1.0.jar"/>
|
||||
<classpathentry kind="lib" path="lib/bluecove-gpl-2.1.0.jar"/>
|
||||
<classpathentry kind="lib" path="lib/h2small-snapshot-2011-10-25.jar"/>
|
||||
<classpathentry kind="output" path="bin"/>
|
||||
</classpath>
|
||||
|
||||
@@ -1,9 +1,7 @@
|
||||
package net.sf.briar.db;
|
||||
|
||||
import java.io.EOFException;
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.sql.Connection;
|
||||
import java.sql.PreparedStatement;
|
||||
import java.sql.ResultSet;
|
||||
@@ -1083,29 +1081,8 @@ abstract class JdbcDatabase implements Database<Connection> {
|
||||
if(!rs.next()) throw new DbStateException();
|
||||
int bodyStart = rs.getInt(1);
|
||||
int bodyLength = rs.getInt(2);
|
||||
InputStream in = rs.getBlob(3).getBinaryStream();
|
||||
// FIXME: We have to read and discard the header because
|
||||
// InputStream.skip() is broken for blobs - find out why
|
||||
byte[] head = new byte[bodyStart];
|
||||
byte[] body = new byte[bodyLength];
|
||||
try {
|
||||
int offset = 0;
|
||||
while(offset < head.length) {
|
||||
int read = in.read(head, offset, head.length - offset);
|
||||
if(read == -1) throw new SQLException(new EOFException());
|
||||
offset += read;
|
||||
}
|
||||
offset = 0;
|
||||
while(offset < body.length) {
|
||||
int read = in.read(body, offset, body.length - offset);
|
||||
if(read == -1) throw new SQLException(new EOFException());
|
||||
offset += read;
|
||||
}
|
||||
in.close();
|
||||
} catch(IOException e) {
|
||||
if(LOG.isLoggable(Level.WARNING)) LOG.warning(e.getMessage());
|
||||
throw new SQLException(e);
|
||||
}
|
||||
// Bytes are indexed from 1 rather than 0
|
||||
byte[] body = rs.getBlob(3).getBytes(bodyStart + 1, bodyLength);
|
||||
if(rs.next()) throw new DbStateException();
|
||||
rs.close();
|
||||
ps.close();
|
||||
|
||||
Binary file not shown.
BIN
lib/h2small-snapshot-2011-10-25.jar
Normal file
BIN
lib/h2small-snapshot-2011-10-25.jar
Normal file
Binary file not shown.
Reference in New Issue
Block a user