Quellcode durchsuchen

cleanup stream on database open failure

git-svn-id: https://svn.code.sf.net/p/jackcess/code/jackcess/trunk@461 f203690c-595d-4dc9-a70b-905162fa7fd2
tags/jackcess-1.2.0
James Ahlborn vor 14 Jahren
Ursprung
Commit
56f5901af8
1 geänderte Dateien mit 24 neuen und 9 gelöschten Zeilen
  1. 24
    9
      src/java/com/healthmarketscience/jackcess/Database.java

+ 24
- 9
src/java/com/healthmarketscience/jackcess/Database.java Datei anzeigen

@@ -476,15 +476,30 @@ public class Database
FileFormat fileFormat)
throws IOException
{
_format = JetFormat.getFormat(channel);
_fileFormat = fileFormat;
_pageChannel = new PageChannel(channel, _format, autoSync);
// note, it's slighly sketchy to pass ourselves along partially
// constructed, but only our _format and _pageChannel refs should be
// needed
_pageChannel.initialize(this);
_buffer = _pageChannel.createPageBuffer();
readSystemCatalog();
boolean success = false;
try {

_format = JetFormat.getFormat(channel);
_fileFormat = fileFormat;
_pageChannel = new PageChannel(channel, _format, autoSync);
// note, it's slighly sketchy to pass ourselves along partially
// constructed, but only our _format and _pageChannel refs should be
// needed
_pageChannel.initialize(this);
_buffer = _pageChannel.createPageBuffer();
readSystemCatalog();
success = true;

} finally {
if(!success && (channel != null)) {
// something blew up, shutdown the channel (quietly)
try {
channel.close();
} catch(Exception ignored) {
// we don't care
}
}
}
}
public PageChannel getPageChannel() {

Laden…
Abbrechen
Speichern