Source:
<code>public void handleCustomClaims(IDTokenBuilder builder, OAuthTokenReqMessageContext requestMsgCtx) { Assertion assertion = (Assertion) requestMsgCtx.getProperty(OAuthConstants.OAUTH_SAML2_ASSERTION); if (assertion != null) { List<AttributeStatement> list = assertion.getAttributeStatements(); if (CollectionUtils.isNotEmpty(list)) { Iterator<Attribute> attributeIterator = list.get(0).getAttributes() .iterator(); while (attributeIterator.hasNext()) { Attribute attribute = attributeIterator.next(); String value = attribute.getAttributeValues().get(0).getDOM().getTextContent(); builder.setClaim(attribute.getName(), value); if (log.isDebugEnabled()) { log.debug("Attribute: " + attribute.getName() + ", Value: " + value); } } } else { log.debug("No AttributeStatement found! "); } } else { if (log.isDebugEnabled()) { log.debug("Adding claims for user " + requestMsgCtx.getAuthorizedUser() + " to id token."); } try { JSONArray values; Map<String, Object> claims = getResponse(requestMsgCtx); Object claimSeparator = claims.get(MULTI_ATTRIBUTE_SEPARATOR); if (claimSeparator != null) { userAttributeSeparator = (String) claimSeparator; claims.remove(MULTI_ATTRIBUTE_SEPARATOR); } for (Map.Entry<String, Object> entry : claims.entrySet()) { String value = entry.getValue().toString(); values = new JSONArray(); if (userAttributeSeparator != null && value.contains(userAttributeSeparator)) { StringTokenizer st = new StringTokenizer(value, userAttributeSeparator); while (st.hasMoreElements()) { <START> String attValue = st.nextElement().toString(); <END> if (StringUtils.isNotBlank(attValue)) { values.add(attValue); } } } else { values.add(value); } builder.setClaim(entry.getKey(), values.toJSONString()); } } catch (OAuthSystemException e) { log.error("Error occurred while adding claims of " + requestMsgCtx.getAuthorizedUser() + " to id token.", e); } } }</code><technical_language>meaningful variable name</technical_language>

Target:
public void handleCustomClaims(IDTokenBuilder builder, OAuthTokenReqMessageContext requestMsgCtx) { Assertion assertion = (Assertion) requestMsgCtx.getProperty(OAuthConstants.OAUTH_SAML2_ASSERTION); if (assertion != null) { List<AttributeStatement> list = assertion.getAttributeStatements(); if (CollectionUtils.isNotEmpty(list)) { Iterator<Attribute> attributeIterator = list.get(0).getAttributes() .iterator(); while (attributeIterator.hasNext()) { Attribute attribute = attributeIterator.next(); String value = attribute.getAttributeValues().get(0).getDOM().getTextContent(); builder.setClaim(attribute.getName(), value); if (log.isDebugEnabled()) { log.debug("Attribute: " + attribute.getName() + ", Value: " + value); } } } else { log.debug("No AttributeStatement found! "); } } else { if (log.isDebugEnabled()) { log.debug("Adding claims for user " + requestMsgCtx.getAuthorizedUser() + " to id token."); } try { JSONArray values; Map<String, Object> claims = getResponse(requestMsgCtx); Object claimSeparator = claims.get(MULTI_ATTRIBUTE_SEPARATOR); if (claimSeparator != null) { userAttributeSeparator = (String) claimSeparator; claims.remove(MULTI_ATTRIBUTE_SEPARATOR); } for (Map.Entry<String, Object> entry : claims.entrySet()) { String value = entry.getValue().toString(); values = new JSONArray(); if (userAttributeSeparator != null && value.contains(userAttributeSeparator)) { StringTokenizer st = new StringTokenizer(value, userAttributeSeparator); while (st.hasMoreElements()) { String attributeValue = st.nextElement().toString(); if (StringUtils.isNotBlank(attributeValue)) { values.add(attributeValue); } } } else { values.add(value); } builder.setClaim(entry.getKey(), values.toJSONString()); } } catch (OAuthSystemException e) { log.error("Error occurred while adding claims of " + requestMsgCtx.getAuthorizedUser() + " to id token.", e); } } }