mirror of
https://github.com/DSpace/DSpace.git
synced 2025-10-07 18:14:26 +00:00
Merge pull request #10146 from DSpace/backport-9817-to-dspace-8_x
[Port dspace-8_x] fix for #9312: properly type in field id, adjust use of getProperty and add error handling
This commit is contained in:
@@ -357,7 +357,7 @@ public class StatisticsImporter {
|
|||||||
SolrInputDocument sid = new SolrInputDocument();
|
SolrInputDocument sid = new SolrInputDocument();
|
||||||
sid.addField("ip", ip);
|
sid.addField("ip", ip);
|
||||||
sid.addField("type", dso.getType());
|
sid.addField("type", dso.getType());
|
||||||
sid.addField("id", dso.getID());
|
sid.addField("id", dso.getID().toString());
|
||||||
sid.addField("time", DateFormatUtils.format(date, SolrLoggerServiceImpl.DATE_FORMAT_8601));
|
sid.addField("time", DateFormatUtils.format(date, SolrLoggerServiceImpl.DATE_FORMAT_8601));
|
||||||
sid.addField("continent", continent);
|
sid.addField("continent", continent);
|
||||||
sid.addField("country", country);
|
sid.addField("country", country);
|
||||||
@@ -471,13 +471,13 @@ public class StatisticsImporter {
|
|||||||
boolean verbose = line.hasOption('v');
|
boolean verbose = line.hasOption('v');
|
||||||
|
|
||||||
// Find our solr server
|
// Find our solr server
|
||||||
String sserver = configurationService.getProperty("solr-statistics", "server");
|
String sserver = configurationService.getProperty("solr-statistics.server");
|
||||||
if (verbose) {
|
if (verbose) {
|
||||||
System.out.println("Writing to solr server at: " + sserver);
|
System.out.println("Writing to solr server at: " + sserver);
|
||||||
}
|
}
|
||||||
solr = new HttpSolrClient.Builder(sserver).build();
|
solr = new HttpSolrClient.Builder(sserver).build();
|
||||||
|
|
||||||
String dbPath = configurationService.getProperty("usage-statistics", "dbfile");
|
String dbPath = configurationService.getProperty("usage-statistics.dbfile");
|
||||||
try {
|
try {
|
||||||
File dbFile = new File(dbPath);
|
File dbFile = new File(dbPath);
|
||||||
geoipLookup = new DatabaseReader.Builder(dbFile).build();
|
geoipLookup = new DatabaseReader.Builder(dbFile).build();
|
||||||
@@ -492,6 +492,11 @@ public class StatisticsImporter {
|
|||||||
"Unable to load GeoLite Database file (" + dbPath + ")! You may need to reinstall it. See the DSpace " +
|
"Unable to load GeoLite Database file (" + dbPath + ")! You may need to reinstall it. See the DSpace " +
|
||||||
"installation instructions for more details.",
|
"installation instructions for more details.",
|
||||||
e);
|
e);
|
||||||
|
} catch (NullPointerException e) {
|
||||||
|
log.error(
|
||||||
|
"The value of the property usage-statistics.dbfile is null. You may need to install the GeoLite " +
|
||||||
|
"Database file and/or uncomment the property in the config file!",
|
||||||
|
e);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user