A constructor can never return null, but it can throw an exception. So don't bother to test whether the FileInputStream is null; instead, catch a FileNotFoundException.
This commit is contained in:
parent
fa5cb40ff7
commit
b28fa05ffd
1 changed files with 44 additions and 44 deletions
|
@ -4,6 +4,7 @@ package edu.cornell.mannlib.vitro.webapp.utils;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.FileInputStream;
|
import java.io.FileInputStream;
|
||||||
|
import java.io.FileNotFoundException;
|
||||||
import java.io.InputStream;
|
import java.io.InputStream;
|
||||||
import java.util.Properties;
|
import java.util.Properties;
|
||||||
|
|
||||||
|
@ -58,14 +59,6 @@ public class FedoraConfiguration {
|
||||||
String path = context.getRealPath(FEDORA_PROPERTIES);
|
String path = context.getRealPath(FEDORA_PROPERTIES);
|
||||||
try{
|
try{
|
||||||
InputStream in = new FileInputStream(new File( path ));
|
InputStream in = new FileInputStream(new File( path ));
|
||||||
if( in == null ){
|
|
||||||
log.error("No fedora.properties file found,"+
|
|
||||||
"it should be located at " + path);
|
|
||||||
status.append("<h1>Fedora configuration failed.</h1>\n");
|
|
||||||
status.append("<p>No fedora.properties file found,"+
|
|
||||||
"it should be located at " + path + "</p>\n");
|
|
||||||
configured = false;
|
|
||||||
} else {
|
|
||||||
props.load( in );
|
props.load( in );
|
||||||
fedoraUrl = props.getProperty("fedoraUrl");
|
fedoraUrl = props.getProperty("fedoraUrl");
|
||||||
adminUser = props.getProperty("adminUser");
|
adminUser = props.getProperty("adminUser");
|
||||||
|
@ -103,7 +96,14 @@ public class FedoraConfiguration {
|
||||||
} else {
|
} else {
|
||||||
configured = true;
|
configured = true;
|
||||||
}
|
}
|
||||||
}
|
}catch(FileNotFoundException e){
|
||||||
|
log.error("No fedora.properties file found,"+
|
||||||
|
"it should be located at " + path);
|
||||||
|
status.append("<h1>Fedora configuration failed.</h1>\n");
|
||||||
|
status.append("<p>No fedora.properties file found,"+
|
||||||
|
"it should be located at " + path + "</p>\n");
|
||||||
|
configured = false;
|
||||||
|
return;
|
||||||
}catch(Exception ex){
|
}catch(Exception ex){
|
||||||
status.append("<p>Fedora configuration failed.</p>\n");
|
status.append("<p>Fedora configuration failed.</p>\n");
|
||||||
status.append("<p>Exception while loading" + path + "</p>\n");
|
status.append("<p>Exception while loading" + path + "</p>\n");
|
||||||
|
|
Loading…
Add table
Reference in a new issue