Package org.tmatesoft.hg.core

Examples of org.tmatesoft.hg.core.HgRemoteConnectionException


 
  public void connect() throws HgAuthFailedException, HgRemoteConnectionException, HgRuntimeException {
    try {
      url = uri.toURL();
    } catch (MalformedURLException ex) {
      throw new HgRemoteConnectionException("Bad URL", ex);
    }
    authMediator = new HttpAuthMethod(sessionCtx, url);
    authenticateClient();
  }
View Full Code Here


      if (line != null && line.startsWith(capsPrefix)) {
        return line.substring(capsPrefix.length()).trim();
      }
      return new String();
    } catch (MalformedURLException ex) {
      throw new HgRemoteConnectionException("Bad URL", ex).setRemoteCommand(CMD_HELLO).setServerInfo(getServerLocation());
    } catch (IOException ex) {
      throw new HgRemoteConnectionException("Communication failure", ex).setRemoteCommand(CMD_HELLO).setServerInfo(getServerLocation());
    }
  }
View Full Code Here

      if (debug) {
        dumpResponseHeader(u);
      }
      return conn.getInputStream();
    } catch (MalformedURLException ex) {
      throw new HgRemoteConnectionException("Bad URL", ex).setRemoteCommand(CMD_HEADS).setServerInfo(getServerLocation());
    } catch (IOException ex) {
      throw new HgRemoteConnectionException("Communication failure", ex).setRemoteCommand(CMD_HEADS).setServerInfo(getServerLocation());
    }
  }
View Full Code Here

        System.out.printf("%d ranges, method:%s \n", ranges.size(), conn.getRequestMethod());
        dumpResponseHeader(u);
      }
      return conn.getInputStream();
    } catch (MalformedURLException ex) {
      throw new HgRemoteConnectionException("Bad URL", ex).setRemoteCommand(CMD_BETWEEN).setServerInfo(getServerLocation());
    } catch (IOException ex) {
      throw new HgRemoteConnectionException("Communication failure", ex).setRemoteCommand(CMD_BETWEEN).setServerInfo(getServerLocation());
    }
  }
View Full Code Here

      if (debug) {
        dumpResponseHeader(u);
      }
      return conn.getInputStream();
    } catch (MalformedURLException ex) {
      throw new HgRemoteConnectionException("Bad URL", ex).setRemoteCommand(CMD_BRANCHES).setServerInfo(getServerLocation());
    } catch (IOException ex) {
      throw new HgRemoteConnectionException("Communication failure", ex).setRemoteCommand(CMD_BRANCHES).setServerInfo(getServerLocation());
    }
  }
View Full Code Here

      return new SequenceInputStream(prefix, cg);
    } catch (MalformedURLException ex) {
      // although there's little user can do about this issue (URLs are constructed by our code)
      // it's still better to throw it as checked exception than RT because url is likely malformed due to parameters
      // and this may help user to understand the cause (and e.g. change them)
      throw new HgRemoteConnectionException("Bad URL", ex).setRemoteCommand("changegroup").setServerInfo(getServerLocation());
    } catch (IOException ex) {
      throw new HgRemoteConnectionException("Communication failure", ex).setRemoteCommand("changegroup").setServerInfo(getServerLocation());
    }
  }
View Full Code Here

            throw e;
          }
        }
      };
    } catch (MalformedURLException ex) {
      throw new HgRemoteConnectionException("Bad URL", ex).setRemoteCommand(CMD_UNBUNDLE).setServerInfo(getServerLocation());
    } catch (IOException ex) {
      // FIXME consume c.getErrorStream as http://docs.oracle.com/javase/6/docs/technotes/guides/net/http-keepalive.html suggests
      throw new HgRemoteConnectionException("Communication failure", ex).setRemoteCommand(CMD_UNBUNDLE).setServerInfo(getServerLocation());
    }
  }
View Full Code Here

        dumpResponseHeader(u);
      }
      checkResponseOk(opName, "pushkey");
      return conn.getInputStream();
    } catch (MalformedURLException ex) {
      throw new HgRemoteConnectionException("Bad URL", ex).setRemoteCommand("pushkey").setServerInfo(getServerLocation());
    } catch (IOException ex) {
      throw new HgRemoteConnectionException("Communication failure", ex).setRemoteCommand("pushkey").setServerInfo(getServerLocation());
    }
  }
View Full Code Here

        dumpResponseHeader(u);
      }
      checkResponseOk(actionName, "listkeys");
      return conn.getInputStream();
    } catch (MalformedURLException ex) {
      throw new HgRemoteConnectionException("Bad URL", ex).setRemoteCommand(CMD_LISTKEYS).setServerInfo(getServerLocation());
    } catch (IOException ex) {
      throw new HgRemoteConnectionException("Communication failure", ex).setRemoteCommand(CMD_LISTKEYS).setServerInfo(getServerLocation());
    }
  }
View Full Code Here

 
  private void checkResponseOk(String opName, String remoteCmd) throws HgRemoteConnectionException, IOException {
    if (conn.getResponseCode() != 200) {
      String m = conn.getResponseMessage() == null ? "unknown reason" : conn.getResponseMessage();
      String em = String.format("%s failed: %s (HTTP error:%d)", opName, m, conn.getResponseCode());
      throw new HgRemoteConnectionException(em).setRemoteCommand(remoteCmd).setServerInfo(getServerLocation());
    }
  }
View Full Code Here

TOP

Related Classes of org.tmatesoft.hg.core.HgRemoteConnectionException

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.