in support/jakarta-ee/src/main/java/org/apache/shiro/ee/faces/tags/PrincipalTag.java [68:107]
protected void doEncodeAll(FacesContext ctx) throws IOException {
String strValue = null;
try {
if (getSubject() != null) {
// Get the principal to print out
Object principal;
if (type == null) {
principal = getSubject().getPrincipal();
} else {
principal = getPrincipalFromClassName();
}
// Get the string value of the principal
if (principal != null) {
if (property == null) {
strValue = principal.toString();
} else {
strValue = getPrincipalProperty(principal, property);
}
}
}
} catch (IOException e) {
log.error("Error getting principal type [" + type + "], property [" + property + "]: " + e.getMessage(), e);
}
if (strValue == null) {
strValue = defaultValue;
}
// Print out the principal value if not null
if (strValue != null) {
try {
ctx.getResponseWriter().write(strValue);
} catch (IOException e) {
throw new IOException("Error writing [" + strValue + "] to output.");
}
}
}