*/
private void checkXRI(
String sXRI, int nNumAuthSub, int nNumRelativeSegments,
boolean bAbsolute)
{
XRIReference oXRI = null;
if (bAbsolute)
{
oXRI = new XRI(sXRI);
}
else
{
oXRI = new RelativeXRI(sXRI);
}
if (!oXRI.toString().equals(sXRI))
{
throw new RuntimeException(
"Parsed xri \"" + oXRI.toString() +
"\" did not match original xri \"" + sXRI);
}
int nNum = 0;
if (oXRI.getAuthorityPath() instanceof XRIAuthority)
{
nNum = ((XRIAuthority) oXRI.getAuthorityPath()).getNumSubSegments();
}
if (nNum != nNumAuthSub)
{
throw new RuntimeException(
"Parsed xri \"" + oXRI.toString() +
"\" did not parse into correct number of subsegments. " +
"Expected " + nNumAuthSub + ", Got " + nNum);
}
nNum = 0;
if (oXRI.getXRIPath() != null)
{
nNum = oXRI.getXRIPath().getNumSegments();
}
if (nNum != nNumRelativeSegments)
{
throw new RuntimeException(
"Parsed xri \"" + oXRI.toString() +
"\" did not parse into correct number of xrisegments. " +
"Expected " + nNumRelativeSegments + ", Got " + nNum);
}
} // checkXRI()