Add information to SAML parser exceptions
Include namespaces and location of expected/found elements Closes #29698 Signed-off-by: esagalara <erik.sagalara@gmail.com>
This commit is contained in:
parent
cdfd46f191
commit
42eec96f61
3 changed files with 17 additions and 15 deletions
|
@ -441,14 +441,10 @@ public class DefaultPicketLinkLogger implements PicketLinkLogger {
|
||||||
return new RuntimeException(expectedXsi);
|
return new RuntimeException(expectedXsi);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
*(non-Javadoc)
|
|
||||||
*
|
|
||||||
*@see org.picketlink.identity.federation.PicketLinkLogger#parserExpectedTag(java.lang.String, java.lang.String)
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
public RuntimeException parserExpectedTag(String tag, String foundElementTag) {
|
public RuntimeException parserExpectedTag(String tag, String foundElementTag, Integer line, Integer column) {
|
||||||
return new RuntimeException(ErrorCodes.EXPECTED_TAG + tag + ". Found <" + foundElementTag + ">");
|
return new RuntimeException(ErrorCodes.EXPECTED_TAG + " " + tag + ". Found " + foundElementTag +
|
||||||
|
" at line " + line.toString() + ", column " + column);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -291,10 +291,12 @@ public interface PicketLinkLogger {
|
||||||
/**
|
/**
|
||||||
* @param tag
|
* @param tag
|
||||||
* @param foundElementTag
|
* @param foundElementTag
|
||||||
|
* @param line
|
||||||
|
* @param column
|
||||||
*
|
*
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
RuntimeException parserExpectedTag(String tag, String foundElementTag);
|
RuntimeException parserExpectedTag(String tag, String foundElementTag, Integer line, Integer column);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param ns
|
* @param ns
|
||||||
|
|
|
@ -880,8 +880,10 @@ public class StaxParserUtil {
|
||||||
@Deprecated
|
@Deprecated
|
||||||
public static void validate(StartElement startElement, String tag) {
|
public static void validate(StartElement startElement, String tag) {
|
||||||
String foundElementTag = StaxParserUtil.getElementName(startElement);
|
String foundElementTag = StaxParserUtil.getElementName(startElement);
|
||||||
if (!tag.equals(foundElementTag))
|
if (!tag.equals(foundElementTag)) {
|
||||||
throw logger.parserExpectedTag(tag, foundElementTag);
|
Location location = startElement.getLocation();
|
||||||
|
throw logger.parserExpectedTag(tag, foundElementTag, location.getLineNumber(), location.getColumnNumber());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -894,8 +896,10 @@ public class StaxParserUtil {
|
||||||
*/
|
*/
|
||||||
public static void validate(StartElement startElement, QName tag) {
|
public static void validate(StartElement startElement, QName tag) {
|
||||||
if (! Objects.equals(startElement.getName(), tag)) {
|
if (! Objects.equals(startElement.getName(), tag)) {
|
||||||
String foundElementTag = StaxParserUtil.getElementName(startElement);
|
Location location = startElement.getLocation();
|
||||||
throw logger.parserExpectedTag(tag.getLocalPart(), foundElementTag);
|
throw logger.parserExpectedTag(
|
||||||
|
tag.toString(), startElement.getName().toString(),
|
||||||
|
location.getLineNumber(), location.getColumnNumber());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue