code: @Override
      protected File downloadResource(URLConnection urlConnection,
              String namespaceDownloadLocation)
              throws ResourceDownloadError {
          HttpURLConnection httpUrlConnection = (HttpURLConnection) urlConnection;
          try {
              httpUrlConnection
                      .setConnectTimeout(ProtocolHandlerConstants.CONNECTION_TIMEOUT);
              httpUrlConnection.setInstanceFollowRedirects(true);
  
              final int code = httpUrlConnection.getResponseCode();
              if (code != HttpURLConnection.HTTP_OK) {
                  final String url = urlConnection.getURL().toString();
                  final String msg = "Bad response code: " + code;
                  throw new ResourceDownloadError(url, msg);
              }
  
              return super.downloadResource(httpUrlConnection,
                      namespaceDownloadLocation);
          } catch (InterruptedIOException e) {
              final String url = urlConnection.getURL().toString();
              final String msg = "Interrupted I/O";
              throw new ResourceDownloadError(url, msg, e);
          } catch (IOException e) {
              final String url = urlConnection.getURL().toString();
              final String msg = e.getMessage();
              throw new ResourceDownloadError(url, msg, e);
          }
      }
docs: {@inheritDoc}