Removed deprecated search.dir-property; added null check for directory properties

This commit is contained in:
Ilja Sidoroff
2016-09-13 12:56:40 +00:00
parent 92b58c62c8
commit 5061c0bb49

View File

@@ -43,18 +43,15 @@ public class InfoCheck extends Check {
sb.append("\n"); sb.append("\n");
DSBitStoreService localStore = new DSpace().getServiceManager().getServicesByType(DSBitStoreService.class).get(0); DSBitStoreService localStore = new DSpace().getServiceManager().getServicesByType(DSBitStoreService.class).get(0);
for (String[] ss : new String[][] { for (String[] ss : new String[][] {
new String[] { new String[] {
localStore.getBaseDir().toString(), localStore.getBaseDir().toString(),
"Assetstore size", }, "Assetstore size", },
new String[] {
configurationService.getProperty("search.dir"),
"Search dir size", },
new String[] { new String[] {
configurationService.getProperty("log.report.dir"), configurationService.getProperty("log.report.dir"),
"Log dir size", }, }) "Log dir size", }, })
{ {
if (ss[0] != null) {
try { try {
File dir = new File(ss[0]); File dir = new File(ss[0]);
if (dir.exists()) { if (dir.exists()) {
@@ -69,6 +66,10 @@ public class InfoCheck extends Check {
error(e, "directory - " + ss[0]); error(e, "directory - " + ss[0]);
} }
} }
else { // cannot read property for some reason
sb.append(String.format("Could not get information for %s!\n", ss[1]));
}
}
return sb.toString(); return sb.toString();
} }