mirror of
https://github.com/DSpace/DSpace.git
synced 2025-10-17 23:13:10 +00:00
[DS-707] Close stream
git-svn-id: http://scm.dspace.org/svn/repo/dspace/trunk@5656 9c30dcfa-912a-0410-8fc2-9e0234be79fd
This commit is contained in:
@@ -62,6 +62,7 @@ import org.xml.sax.SAXException;
|
|||||||
import java.io.ByteArrayInputStream;
|
import java.io.ByteArrayInputStream;
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
import java.io.InputStream;
|
||||||
import java.io.UnsupportedEncodingException;
|
import java.io.UnsupportedEncodingException;
|
||||||
import java.net.URLEncoder;
|
import java.net.URLEncoder;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
@@ -145,19 +146,17 @@ public class JSONSolrSearcher extends AbstractReader implements Recyclable {
|
|||||||
ExtendedProperties props = null;
|
ExtendedProperties props = null;
|
||||||
//Method that will retrieve all the possible configs we have
|
//Method that will retrieve all the possible configs we have
|
||||||
|
|
||||||
props = ExtendedProperties
|
props = ExtendedProperties.convertProperties(ConfigurationManager.getProperties());
|
||||||
.convertProperties(ConfigurationManager.getProperties());
|
|
||||||
|
|
||||||
|
InputStream is = null;
|
||||||
try {
|
try {
|
||||||
File config = new File(props.getProperty("dspace.dir")
|
File config = new File(props.getProperty("dspace.dir") + "/config/dspace-solr-search.cfg");
|
||||||
+ "/config/dspace-solr-search.cfg");
|
|
||||||
if (config.exists()) {
|
if (config.exists()) {
|
||||||
props.combine(new ExtendedProperties(config.getAbsolutePath()));
|
props.combine(new ExtendedProperties(config.getAbsolutePath()));
|
||||||
} else {
|
} else {
|
||||||
|
is = SolrServiceImpl.class.getResourceAsStream("dspace-solr-search.cfg");
|
||||||
ExtendedProperties defaults = new ExtendedProperties();
|
ExtendedProperties defaults = new ExtendedProperties();
|
||||||
defaults
|
defaults.load(is);
|
||||||
.load(SolrServiceImpl.class
|
|
||||||
.getResourceAsStream("dspace-solr-search.cfg"));
|
|
||||||
props.combine(defaults);
|
props.combine(defaults);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -165,6 +164,11 @@ public class JSONSolrSearcher extends AbstractReader implements Recyclable {
|
|||||||
log.error("Error while retrieving solr url", e);
|
log.error("Error while retrieving solr url", e);
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
|
finally {
|
||||||
|
if (is != null) {
|
||||||
|
is.close();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if(props.getProperty("solr.search.server") != null)
|
if(props.getProperty("solr.search.server") != null)
|
||||||
{
|
{
|
||||||
|
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user