[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:
Graham Triggs
2010-10-26 18:34:51 +00:00
parent 68c18ef276
commit 2e1b944087
2 changed files with 12 additions and 8 deletions

View File

@@ -62,6 +62,7 @@ import org.xml.sax.SAXException;
import java.io.ByteArrayInputStream;
import java.io.File;
import java.io.IOException;
import java.io.InputStream;
import java.io.UnsupportedEncodingException;
import java.net.URLEncoder;
import java.util.HashMap;
@@ -145,19 +146,17 @@ public class JSONSolrSearcher extends AbstractReader implements Recyclable {
ExtendedProperties props = null;
//Method that will retrieve all the possible configs we have
props = ExtendedProperties
.convertProperties(ConfigurationManager.getProperties());
props = ExtendedProperties.convertProperties(ConfigurationManager.getProperties());
InputStream is = null;
try {
File config = new File(props.getProperty("dspace.dir")
+ "/config/dspace-solr-search.cfg");
File config = new File(props.getProperty("dspace.dir") + "/config/dspace-solr-search.cfg");
if (config.exists()) {
props.combine(new ExtendedProperties(config.getAbsolutePath()));
} else {
is = SolrServiceImpl.class.getResourceAsStream("dspace-solr-search.cfg");
ExtendedProperties defaults = new ExtendedProperties();
defaults
.load(SolrServiceImpl.class
.getResourceAsStream("dspace-solr-search.cfg"));
defaults.load(is);
props.combine(defaults);
}
}
@@ -165,6 +164,11 @@ public class JSONSolrSearcher extends AbstractReader implements Recyclable {
log.error("Error while retrieving solr url", e);
e.printStackTrace();
}
finally {
if (is != null) {
is.close();
}
}
if(props.getProperty("solr.search.server") != null)
{

File diff suppressed because one or more lines are too long