fix for Table in case that requested file does not exist and paths also

do not exist
pull/1/head
Michael Peter Christen 11 years ago
parent b4b0d14c04
commit 1aea01fe5b

@ -109,6 +109,7 @@ public class Table implements Index, Iterable<Row.Entry> {
// make new file // make new file
freshFile = true; freshFile = true;
FileOutputStream fos = null; FileOutputStream fos = null;
tablefile.getParentFile().mkdirs();
try { try {
fos = new FileOutputStream(tablefile); fos = new FileOutputStream(tablefile);
} catch (final FileNotFoundException e) { } catch (final FileNotFoundException e) {
@ -365,7 +366,7 @@ public class Table implements Index, Iterable<Row.Entry> {
try { try {
return this.file.size() == this.index.size(); return this.file.size() == this.index.size();
} catch (final IOException e) { } catch (final IOException e) {
log.logException(e); ConcurrentLog.logException(e);
return false; return false;
} }
} }
@ -761,7 +762,7 @@ public class Table implements Index, Iterable<Row.Entry> {
try { try {
this.index.put(k, i); this.index.put(k, i);
} catch (final SpaceExceededException e) { } catch (final SpaceExceededException e) {
log.logException(e); ConcurrentLog.logException(e);
throw new IOException("RowSpaceExceededException: " + e.getMessage()); throw new IOException("RowSpaceExceededException: " + e.getMessage());
} }
} }
@ -791,7 +792,7 @@ public class Table implements Index, Iterable<Row.Entry> {
try { try {
this.table.set(i, te); this.table.set(i, te);
} catch (final SpaceExceededException e) { } catch (final SpaceExceededException e) {
log.logException(e); ConcurrentLog.logException(e);
this.table = null; this.table = null;
} }
@ -1118,7 +1119,7 @@ public class Table implements Index, Iterable<Row.Entry> {
} }
System.out.println("FINISHED test after " + ((System.currentTimeMillis() - start) / 1000) + " seconds."); System.out.println("FINISHED test after " + ((System.currentTimeMillis() - start) / 1000) + " seconds.");
} catch (final Exception e) { } catch (final Exception e) {
log.logException(e); ConcurrentLog.logException(e);
System.out.println("TERMINATED"); System.out.println("TERMINATED");
} }
} }

Loading…
Cancel
Save