\r
#### fixes\r
\r
+- Fixed nullpointer on recursively calculating folder sizes when there is a named pipe in the hierarchy\r
- Fixed nullpointer on creating a repository with mixed case (issue 185)\r
- Fixed nullpointer when using web.allowForking = true && git.cacheRepositoryList = false (issue 182)\r
- Build project models from the repository model cache, when possible, to reduce page load time (issue 172)\r
public static long folderSize(File directory) {\r
if (directory == null || !directory.exists()) {\r
return -1;\r
- }\r
- if (directory.isFile()) {\r
- return directory.length();\r
- }\r
- long length = 0;\r
- for (File file : directory.listFiles()) {\r
- if (file.isFile()) {\r
- length += file.length();\r
- } else {\r
+ } \r
+ if (directory.isDirectory()) {\r
+ long length = 0;\r
+ for (File file : directory.listFiles()) {\r
length += folderSize(file);\r
}\r
+ return length;\r
+ } else if (directory.isFile()) {\r
+ return directory.length();\r
}\r
- return length;\r
+ return 0;\r
}\r
\r
/**\r