From c67869dac107479f9731b5c534afb3d0e2146eed Mon Sep 17 00:00:00 2001 From: akwizgran <akwizgran@users.sourceforge.net> Date: Sat, 25 Jan 2014 13:39:12 +0000 Subject: [PATCH] Skip special files (symlinks etc) when calculating disk space. --- briar-core/src/org/briarproject/db/H2Database.java | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/briar-core/src/org/briarproject/db/H2Database.java b/briar-core/src/org/briarproject/db/H2Database.java index 664a2f68d4..d7f064ddb2 100644 --- a/briar-core/src/org/briarproject/db/H2Database.java +++ b/briar-core/src/org/briarproject/db/H2Database.java @@ -70,11 +70,15 @@ class H2Database extends JdbcDatabase { } private long getDiskSpace(File f) { - long total = 0; if(f.isDirectory()) { + long total = 0; for(File child : f.listFiles()) total += getDiskSpace(child); return total; - } else return f.length(); + } else if(f.isFile()) { + return f.length(); + } else { + return 0; + } } protected Connection createConnection() throws SQLException { -- GitLab