/** * Convert an ObjectId from hex characters. * * @param str * the string to read from. Must be 40 characters long. * @return the converted object id. */ public static ObjectId fromString(String str) { if (str.length() != Constants.OBJECT_ID_STRING_LENGTH) { throw new InvalidObjectIdException(str); } return fromHexString(Constants.encodeASCII(str), 0); }
private void parseShallow(String idStr) throws PackProtocolException { ObjectId id; try { id = ObjectId.fromString(idStr); } catch (InvalidObjectIdException e) { throw new PackProtocolException(e.getMessage(), e); } clientShallowCommits.add(id); }
/** * Create exception with bytes of the invalid object id. * * @param bytes containing the invalid id. * @param offset in the byte array where the error occurred. * @param length of the sequence of invalid bytes. */ public InvalidObjectIdException(byte[] bytes, int offset, int length) { super(msg(bytes, offset, length)); }
private void fromHexString(byte[] bs, int p) { try { w1 = RawParseUtils.parseHexInt32(bs, p); w2 = RawParseUtils.parseHexInt32(bs, p + 8); w3 = RawParseUtils.parseHexInt32(bs, p + 16); w4 = RawParseUtils.parseHexInt32(bs, p + 24); w5 = RawParseUtils.parseHexInt32(bs, p + 32); } catch (ArrayIndexOutOfBoundsException e1) { throw new InvalidObjectIdException(bs, p, Constants.OBJECT_ID_STRING_LENGTH); } }
/** * Create exception with bytes of the invalid object id. * * @param bytes containing the invalid id. * @param offset in the byte array where the error occurred. * @param length of the sequence of invalid bytes. */ public InvalidObjectIdException(byte[] bytes, int offset, int length) { super(msg(bytes, offset, length)); }
private void parseShallow(String idStr) throws PackProtocolException { ObjectId id; try { id = ObjectId.fromString(idStr); } catch (InvalidObjectIdException e) { throw new PackProtocolException(e.getMessage(), e); } clientShallowCommits.add(id); }
private static final AbbreviatedObjectId fromHexString(final byte[] bs, int ptr, final int end) { try { final int a = hexUInt32(bs, ptr, end); final int b = hexUInt32(bs, ptr + 8, end); final int c = hexUInt32(bs, ptr + 16, end); final int d = hexUInt32(bs, ptr + 24, end); final int e = hexUInt32(bs, ptr + 32, end); return new AbbreviatedObjectId(end - ptr, a, b, c, d, e); } catch (ArrayIndexOutOfBoundsException e1) { throw new InvalidObjectIdException(bs, ptr, end - ptr); } }
/** * Create exception with bytes of the invalid object id. * * @param bytes containing the invalid id. * @param offset in the byte array where the error occurred. * @param length of the sequence of invalid bytes. */ public InvalidObjectIdException(byte[] bytes, int offset, int length) { super(msg(bytes, offset, length)); }
private void parseShallow(String idStr) throws PackProtocolException { ObjectId id; try { id = ObjectId.fromString(idStr); } catch (InvalidObjectIdException e) { throw new PackProtocolException(e.getMessage(), e); } clientShallowCommits.add(id); }
private static final ObjectId fromHexString(byte[] bs, int p) { try { final int a = RawParseUtils.parseHexInt32(bs, p); final int b = RawParseUtils.parseHexInt32(bs, p + 8); final int c = RawParseUtils.parseHexInt32(bs, p + 16); final int d = RawParseUtils.parseHexInt32(bs, p + 24); final int e = RawParseUtils.parseHexInt32(bs, p + 32); return new ObjectId(a, b, c, d, e); } catch (ArrayIndexOutOfBoundsException e1) { throw new InvalidObjectIdException(bs, p, Constants.OBJECT_ID_STRING_LENGTH); } }
/** * Convert an ObjectId from hex characters. * * @param str * the string to read from. Must be 40 characters long. * @return the converted object id. */ public static ObjectId fromString(final String str) { if (str.length() != Constants.OBJECT_ID_STRING_LENGTH) { throw new InvalidObjectIdException(str); } return fromHexString(Constants.encodeASCII(str), 0); }
/** * Convert an ObjectId from hex characters. * * @param str * the string to read from. Must be 40 characters long. * @return the converted object id. */ public static ObjectId fromString(String str) { if (str.length() != Constants.OBJECT_ID_STRING_LENGTH) { throw new InvalidObjectIdException(str); } return fromHexString(Constants.encodeASCII(str), 0); }
private void fromHexString(byte[] bs, int p) { try { w1 = RawParseUtils.parseHexInt32(bs, p); w2 = RawParseUtils.parseHexInt32(bs, p + 8); w3 = RawParseUtils.parseHexInt32(bs, p + 16); w4 = RawParseUtils.parseHexInt32(bs, p + 24); w5 = RawParseUtils.parseHexInt32(bs, p + 32); } catch (ArrayIndexOutOfBoundsException e1) { throw new InvalidObjectIdException(bs, p, Constants.OBJECT_ID_STRING_LENGTH); } }
private void fromHexString(final byte[] bs, int p) { try { w1 = RawParseUtils.parseHexInt32(bs, p); w2 = RawParseUtils.parseHexInt32(bs, p + 8); w3 = RawParseUtils.parseHexInt32(bs, p + 16); w4 = RawParseUtils.parseHexInt32(bs, p + 24); w5 = RawParseUtils.parseHexInt32(bs, p + 32); } catch (ArrayIndexOutOfBoundsException e1) { throw new InvalidObjectIdException(bs, p, Constants.OBJECT_ID_STRING_LENGTH); } }
private static final AbbreviatedObjectId fromHexString(final byte[] bs, int ptr, final int end) { try { final int a = hexUInt32(bs, ptr, end); final int b = hexUInt32(bs, ptr + 8, end); final int c = hexUInt32(bs, ptr + 16, end); final int d = hexUInt32(bs, ptr + 24, end); final int e = hexUInt32(bs, ptr + 32, end); return new AbbreviatedObjectId(end - ptr, a, b, c, d, e); } catch (ArrayIndexOutOfBoundsException e1) { throw new InvalidObjectIdException(bs, ptr, end - ptr); } }
private static final AbbreviatedObjectId fromHexString(final byte[] bs, int ptr, final int end) { try { final int a = hexUInt32(bs, ptr, end); final int b = hexUInt32(bs, ptr + 8, end); final int c = hexUInt32(bs, ptr + 16, end); final int d = hexUInt32(bs, ptr + 24, end); final int e = hexUInt32(bs, ptr + 32, end); return new AbbreviatedObjectId(end - ptr, a, b, c, d, e); } catch (ArrayIndexOutOfBoundsException e1) { throw new InvalidObjectIdException(bs, ptr, end - ptr); } }
private static final ObjectId fromHexString(byte[] bs, int p) { try { final int a = RawParseUtils.parseHexInt32(bs, p); final int b = RawParseUtils.parseHexInt32(bs, p + 8); final int c = RawParseUtils.parseHexInt32(bs, p + 16); final int d = RawParseUtils.parseHexInt32(bs, p + 24); final int e = RawParseUtils.parseHexInt32(bs, p + 32); return new ObjectId(a, b, c, d, e); } catch (ArrayIndexOutOfBoundsException e1) { throw new InvalidObjectIdException(bs, p, Constants.OBJECT_ID_STRING_LENGTH); } }
private static final ObjectId fromHexString(final byte[] bs, int p) { try { final int a = RawParseUtils.parseHexInt32(bs, p); final int b = RawParseUtils.parseHexInt32(bs, p + 8); final int c = RawParseUtils.parseHexInt32(bs, p + 16); final int d = RawParseUtils.parseHexInt32(bs, p + 24); final int e = RawParseUtils.parseHexInt32(bs, p + 32); return new ObjectId(a, b, c, d, e); } catch (ArrayIndexOutOfBoundsException e1) { throw new InvalidObjectIdException(bs, p, Constants.OBJECT_ID_STRING_LENGTH); } }