use of com.sequenceiq.cloudbreak.auth.crn.CrnParseException in project cloudbreak by hortonworks.
the class CrnService method getCurrentAccountId.
public String getCurrentAccountId() {
String userCrn = ThreadBasedUserCrnProvider.getUserCrn();
Crn crn = null;
try {
crn = Crn.fromString(userCrn);
} catch (NullPointerException e) {
LOGGER.warn("Crn is not set", e);
throw new CrnParseException("CRN is not set");
}
if (crn != null) {
return crn.getAccountId();
} else {
throw new CrnParseException("Can not parse account ID from CRN");
}
}
Aggregations