1313use SimpleSAML \XMLSecurity \Constants as C ;
1414use SimpleSAML \XMLSecurity \Exception \InvalidArgumentException ;
1515use SimpleSAML \XMLSecurity \Exception \NoSignatureFoundException ;
16+ use SimpleSAML \XMLSecurity \Exception \ReferenceValidationFailedException ;
1617use SimpleSAML \XMLSecurity \Exception \RuntimeException ;
1718use SimpleSAML \XMLSecurity \Exception \SignatureVerificationFailedException ;
1819use SimpleSAML \XMLSecurity \Key \AbstractKey ;
@@ -90,7 +91,7 @@ private function validateReferenceUri(Reference $reference, DOMElement $xml): vo
9091 )
9192 && !$ reference ->isXPointer ()
9293 ) { // canonicalization with comments used, but reference wasn't an xpointer!
93- throw new RuntimeException ('Invalid reference for canonicalization algorithm. ' );
94+ throw new ReferenceValidationFailedException ('Invalid reference for canonicalization algorithm. ' );
9495 }
9596
9697 $ id = $ this ->getId ();
@@ -100,13 +101,13 @@ private function validateReferenceUri(Reference $reference, DOMElement $xml): vo
100101 Assert::true (
101102 $ xml ->isSameNode ($ xml ->ownerDocument ->documentElement ),
102103 'Cannot use document reference when element is not the root of the document. ' ,
103- RuntimeException ::class,
104+ ReferenceValidationFailedException ::class,
104105 );
105106 } else { // short-name or scheme-based xpointer
106107 Assert::notEmpty (
107108 $ id ,
108109 'Reference points to an element, but given element does not have an ID. ' ,
109- RuntimeException ::class,
110+ ReferenceValidationFailedException ::class,
110111 );
111112 Assert::oneOf (
112113 $ uri ,
@@ -115,7 +116,7 @@ private function validateReferenceUri(Reference $reference, DOMElement $xml): vo
115116 '#xpointer(id( ' . $ id . ')) ' ,
116117 ],
117118 'Reference does not point to given element. ' ,
118- RuntimeException ::class,
119+ ReferenceValidationFailedException ::class,
119120 );
120121 }
121122 }
0 commit comments