if (httpCode == HttpURLConnection.HTTP_UNAUTHORIZED) {
throw new UnauthorizedException();
}
else if (httpCode == HttpURLConnection.HTTP_UNSUPPORTED_TYPE) {
throw new UnsupportedRDFormatException(method.getResponseBodyAsString());
}
else if (!HttpClientUtil.is2xx(httpCode)) {
ErrorInfo errInfo = ErrorInfo.parse(method.getResponseBodyAsString());
if (errInfo.getErrorType() == ErrorType.MALFORMED_DATA) {
throw new RDFParseException(errInfo.getErrorMessage());
}
else if (errInfo.getErrorType() == ErrorType.UNSUPPORTED_FILE_FORMAT) {
throw new UnsupportedRDFormatException(errInfo.getErrorMessage());
}
else {
throw new RepositoryException("Failed to upload data: " + errInfo);
}
}