mirror of
https://code.briarproject.org/briar/briar.git
synced 2026-02-18 13:49:53 +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/hamcrest-library-1.1.jar"/>
|
||||||
<classpathentry kind="lib" path="lib/test/jmock-2.5.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/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/test/junit-4.9b3.jar"/>
|
||||||
<classpathentry kind="lib" path="lib/bcprov-jdk15-146.jar"/>
|
<classpathentry kind="lib" path="lib/bcprov-jdk15-146.jar"/>
|
||||||
<classpathentry kind="lib" path="lib/jna.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/jnotify-0.93.jar"/>
|
||||||
<classpathentry kind="lib" path="lib/bluecove-2.1.0.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/bluecove-gpl-2.1.0.jar"/>
|
||||||
|
<classpathentry kind="lib" path="lib/h2small-snapshot-2011-10-25.jar"/>
|
||||||
<classpathentry kind="output" path="bin"/>
|
<classpathentry kind="output" path="bin"/>
|
||||||
</classpath>
|
</classpath>
|
||||||
|
|||||||
@@ -1,9 +1,7 @@
|
|||||||
package net.sf.briar.db;
|
package net.sf.briar.db;
|
||||||
|
|
||||||
import java.io.EOFException;
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.InputStream;
|
|
||||||
import java.sql.Connection;
|
import java.sql.Connection;
|
||||||
import java.sql.PreparedStatement;
|
import java.sql.PreparedStatement;
|
||||||
import java.sql.ResultSet;
|
import java.sql.ResultSet;
|
||||||
@@ -1083,29 +1081,8 @@ abstract class JdbcDatabase implements Database<Connection> {
|
|||||||
if(!rs.next()) throw new DbStateException();
|
if(!rs.next()) throw new DbStateException();
|
||||||
int bodyStart = rs.getInt(1);
|
int bodyStart = rs.getInt(1);
|
||||||
int bodyLength = rs.getInt(2);
|
int bodyLength = rs.getInt(2);
|
||||||
InputStream in = rs.getBlob(3).getBinaryStream();
|
// Bytes are indexed from 1 rather than 0
|
||||||
// FIXME: We have to read and discard the header because
|
byte[] body = rs.getBlob(3).getBytes(bodyStart + 1, bodyLength);
|
||||||
// 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);
|
|
||||||
}
|
|
||||||
if(rs.next()) throw new DbStateException();
|
if(rs.next()) throw new DbStateException();
|
||||||
rs.close();
|
rs.close();
|
||||||
ps.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