Examples of HgInvalidDataFormatException


Examples of org.tmatesoft.hg.repo.HgInvalidDataFormatException

        ds = new ByteArrayDataSource(complete);
        revLen = complete.length;
      } catch (IOException ex) {
        // unlikely to happen, as ByteArrayDataSource throws IOException only in case of programming errors
        // hence, throwing rt exception here makes more sense here than HgIOException (even that latter is in throws)
        throw new HgInvalidDataFormatException("Failed to reconstruct revision", ex);
      }
    }
    doAdd(nodeRev, p1, p2, linkRev, baseRev, revLen, ds);
    if (complete != null) {
      lastFullContent = new Pair<Integer, byte[]>(lastEntryIndex, complete);
View Full Code Here

Examples of org.tmatesoft.hg.repo.HgInvalidDataFormatException

  private RawChangeset init(byte[] data, int offset, int length) throws HgInvalidDataFormatException {
    final int bufferEndIndex = offset + length;
    final byte lineBreak = (byte) '\n';
    int breakIndex1 = indexOf(data, lineBreak, offset, bufferEndIndex);
    if (breakIndex1 == -1) {
      throw new HgInvalidDataFormatException("Bad Changeset data");
    }
    Nodeid _nodeid = Nodeid.fromAscii(data, 0, breakIndex1);
    int breakIndex2 = indexOf(data, lineBreak, breakIndex1 + 1, bufferEndIndex);
    if (breakIndex2 == -1) {
      throw new HgInvalidDataFormatException("Bad Changeset data");
    }
    String _user;
    _user = encHelper.userFromChangeset(data, breakIndex1 + 1, breakIndex2 - breakIndex1 - 1);
    _user = usersPool.unify(_user);

    int breakIndex3 = indexOf(data, lineBreak, breakIndex2 + 1, bufferEndIndex);
    if (breakIndex3 == -1) {
      throw new HgInvalidDataFormatException("Bad Changeset data");
    }
    String _timeString = new String(data, breakIndex2 + 1, breakIndex3 - breakIndex2 - 1);
    int space1 = _timeString.indexOf(' ');
    if (space1 == -1) {
      throw new HgInvalidDataFormatException(String.format("Bad Changeset data: %s in [%d..%d]", "time string", breakIndex2+1, breakIndex3));
    }
    int space2 = _timeString.indexOf(' ', space1 + 1);
    if (space2 == -1) {
      space2 = _timeString.length();
    }
    long unixTime = Long.parseLong(_timeString.substring(0, space1));
    int _timezone = Integer.parseInt(_timeString.substring(space1 + 1, space2));
    // unixTime is local time, and timezone records difference of the local time to UTC.
    Date _time = new Date(unixTime * 1000);
    String _extras = space2 < _timeString.length() ? _timeString.substring(space2 + 1) : null;
    Map<String, String> _extrasMap = parseExtras(_extras);
    //
    int lastStart = breakIndex3 + 1;
    int breakIndex4 = indexOf(data, lineBreak, lastStart, bufferEndIndex);
    ArrayList<String> _files = null;
    if (breakIndex4 > lastStart) {
      // if breakIndex4 == lastStart, we already found \n\n and hence there are no files (e.g. merge revision)
      _files = new ArrayList<String>(5);
      while (breakIndex4 != -1 && breakIndex4 + 1 < bufferEndIndex) {
        String fname = encHelper.fileFromChangeset(data, lastStart, breakIndex4 - lastStart);
        _files.add(filesPool.unify(fname));
        lastStart = breakIndex4 + 1;
        if (data[breakIndex4 + 1] == lineBreak) {
          // found \n\n
          break;
        } else {
          breakIndex4 = indexOf(data, lineBreak, lastStart, bufferEndIndex);
        }
      }
      if (breakIndex4 == -1 || breakIndex4 >= bufferEndIndex) {
        throw new HgInvalidDataFormatException("Bad Changeset data");
      }
    } else {
      breakIndex4--;
    }
    String _comment = encHelper.commentFromChangeset(data, breakIndex4 + 2, bufferEndIndex - breakIndex4 - 2);
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.