} catch (java.net.URISyntaxException oEx) {
XRD err = createErrorXRD(qxri.getAuthorityPath().toURINormalForm(),
Status.INVALID_INPUT,
"Unable to construct URI to access proxy resolution service");
xrdsOut.add(err);
throw new PartialResolutionException(xrdsOut);
} catch (UnsupportedEncodingException e) {
// thrown from URLEncoder.encode() - this should never happen since the
// US-ASCII encoding should be supported on every computer or so we hope :)
XRD err = createErrorXRD(qxri.getAuthorityPath().toURINormalForm(),
Status.INVALID_INPUT, "Charset not supported");
xrdsOut.add(err);
throw new PartialResolutionException(xrdsOut);
} catch (Exception e) {
XRD err = createErrorXRD(qxri.getAuthorityPath().toURINormalForm(),
Status.PERM_FAIL,
"Unexpected error while constructing proxy URI: "
+ e.getMessage());
xrdsOut.add(err);
throw new PartialResolutionException(xrdsOut);
}
InputStream in = null;
try {
// try to get the data from it
in = getDataFromURI(newURI, qxri.toURINormalForm(), flags, state);
XRDS xrds = readXRDS(in);
XRD finalXRD = xrds.getFinalXRD();
String code = finalXRD.getStatusCode();
if ((flags.isRefs() && !code.equals(Status.SUCCESS) && !code
.equals(Status.REF_NOT_FOLLOWED))
|| !code.equals(Status.SUCCESS)) {
// got either a non-SUCCESS code or
// followRefs is on but we got non-SUCCESS and non-REF_NOT_FOLLOWED
throw new PartialResolutionException(xrds);
}
return xrds;
} catch (PartialResolutionException e) {
// re-throw
throw e;
} catch (Exception e) {
XRD err = createErrorXRD(qxri.getAuthorityPath().toURINormalForm(),
Status.PERM_FAIL, "Error fetching XRDS from proxy: "
+ e.getMessage());
xrdsOut.add(err);
throw new PartialResolutionException(xrdsOut);
}
}