NullPointers in property handling
This commit is contained in:
parent
e30d26fd77
commit
dec7a70e42
@ -117,6 +117,7 @@ public class CASTicket {
|
||||
}
|
||||
|
||||
private String readFiledGrantingTicket() throws JSCliException {
|
||||
String filedTicket = null;
|
||||
String userHome = System.getProperty("user.home");
|
||||
String ticketFileName = userHome + "/.hsadmin.tgt";
|
||||
File file = new File(ticketFileName);
|
||||
@ -124,12 +125,15 @@ public class CASTicket {
|
||||
Properties properties = new Properties();
|
||||
try {
|
||||
properties.load(new FileReader(file));
|
||||
return properties.getProperty(user);
|
||||
filedTicket = properties.getProperty(user);
|
||||
} catch (IOException e) {
|
||||
throw new JSCliException(e);
|
||||
}
|
||||
}
|
||||
return null;
|
||||
if (filedTicket == null) {
|
||||
filedTicket = getGrantingTicket();
|
||||
}
|
||||
return filedTicket;
|
||||
}
|
||||
|
||||
private void writeFiledGrantingTicket(String ticket) throws JSCliException {
|
||||
|
@ -43,7 +43,11 @@ public class Config {
|
||||
}
|
||||
|
||||
public String getProperty(String propertyName) {
|
||||
return props.getProperty(propertyName).trim();
|
||||
String property = props.getProperty(propertyName);
|
||||
if (property == null) {
|
||||
return null;
|
||||
}
|
||||
return property.trim();
|
||||
}
|
||||
|
||||
public String getProperty(String propertyName, String defaultValue) {
|
||||
|
Loading…
Reference in New Issue
Block a user