Skip to content

Commit 9895c80

Browse files
committed
fixup! fixup! WIP Refactoring and cleanup of BTree storage classes
1 parent 982676d commit 9895c80

File tree

3 files changed

+29
-7
lines changed

3 files changed

+29
-7
lines changed

exist-core/src/main/java/org/exist/storage/btree/AbstractBTree.java

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -545,9 +545,13 @@ public TreeMetrics treeStatistics() throws IOException {
545545

546546
@Override
547547
public boolean flush() throws DBException {
548-
boolean flushed = cache.flush();
549-
flushed = flushed | super.flush();
550-
return flushed;
548+
try {
549+
boolean flushed = cache.flush();
550+
flushed = flushed | super.flush();
551+
return flushed;
552+
} catch (final IOException e) {
553+
throw new DBException(e);
554+
}
551555
}
552556

553557
@Override
@@ -1715,7 +1719,7 @@ private void split(final Txn transaction, int pivot) throws IOException, BTreeEx
17151719
/**
17161720
* Set the parent-link in all child nodes to point to this node
17171721
*/
1718-
private void setAsParent() {
1722+
private void setAsParent() throws IOException {
17191723
if (pageHeader.getStatus() == PageStatus.BRANCH) {
17201724
for (int i = 0; i < nPtrs; i++) {
17211725
final BTreeNode node = getBTreeNode(ptrs[i]);

exist-core/src/main/java/org/exist/storage/btree/AbstractPagedFile.java

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,7 @@ public void close() throws DBException {
151151
raf.close();
152152
} catch (final IOException e) {
153153
throw new DBException("An error occurred whilst closing the database file '"
154-
+ file == null ? "null" : FileUtils.fileName(file) + "': " + e.getMessage());
154+
+ file == null ? "null" : FileUtils.fileName(file) + "': " + e.getMessage(), e);
155155
}
156156
}
157157

@@ -197,8 +197,7 @@ public boolean flush() throws DBException {
197197
flushed = true;
198198
}
199199
} catch (final IOException ioe) {
200-
LOG.warn("report me");
201-
//TODO : this exception is *silently* ignored ?
200+
throw new DBException(ioe);
202201
} finally {
203202
fileHeaderWriteLock.unlock();
204203
}

exist-core/src/main/java/org/exist/storage/btree/DBException.java

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,13 @@
11
/*
2+
* Copyright (C) 2014 Evolved Binary Ltd
3+
*
4+
* Changes made by Evolved Binary are proprietary and are not Open Source.
5+
*
6+
* NOTE: Parts of this file contain code from The eXist-db Authors.
7+
* The original license header is included below.
8+
*
9+
* ----------------------------------------------------------------------------
10+
*
211
* NOTE: This file is in part based on code from The dbXML Group.
312
* The original license statement is also included below.
413
*
@@ -72,6 +81,8 @@
7281
*/
7382
package org.exist.storage.btree;
7483

84+
import java.io.IOException;
85+
7586
/**
7687
* A DBException is thrown by the database if an exception occurs in the
7788
* managing (creating, dropping) database objects such as Collections, Indexes,
@@ -100,4 +111,12 @@ public DBException(final int faultCode, final String message) {
100111
this.faultCode = faultCode;
101112
}
102113

114+
public DBException(final IOException e) {
115+
super(e);
116+
}
117+
118+
public DBException(final String message, final IOException e) {
119+
super(message, e);
120+
}
121+
103122
}

0 commit comments

Comments
 (0)