/** * Get string form of the SHA-1, in lower case hexadecimal. * * @return string form of the SHA-1, in lower case hexadecimal. */ public final String getName() { return name(); }
/** {@inheritDoc} */ @SuppressWarnings("nls") @Override public String toString() { return "AnyObjectId[" + name() + "]"; }
@Override public String toString() { return "DatedRevTag{" + "id=" + id.name() + ", tagName='" + tagName + '\'' + ", date=" + DateTimeFormat.longDateTime().print(date) + '}'; } }
/** * Construct a CorruptObjectException for reporting a problem specified * object id * * @param id * a {@link org.eclipse.jgit.lib.AnyObjectId} * @param why * error message */ public CorruptObjectException(AnyObjectId id, String why) { super(MessageFormat.format(JGitText.get().objectIsCorrupt, id.name(), why)); }
/** * {@inheritDoc} * <p> * Compute the location of a loose object file. */ @Override public File fileFor(AnyObjectId objectId) { String n = objectId.name(); String d = n.substring(0, 2); String f = n.substring(2); return new File(new File(getDirectory(), d), f); }
private static String msg(AnyObjectId id) { return MessageFormat.format(JGitText.get().wantNotValid, id.name()); } }
/** * Set the upstream commit * * @param upstream * id of the upstream commit * @return {@code this} */ public RebaseCommand setUpstream(AnyObjectId upstream) { try { this.upstreamCommit = walk.parseCommit(upstream); this.upstreamCommitName = upstream.name(); } catch (IOException e) { throw new JGitInternalException(MessageFormat.format( JGitText.get().couldNotReadObjectWhileParsingCommit, upstream.name()), e); } return this; }
/** * Report a specific error condition discovered in an object. * * @param type * type of error * @param id * identity of the bad object * @param why * description of the error. * @since 4.2 */ public CorruptObjectException(ObjectChecker.ErrorType type, AnyObjectId id, String why) { super(MessageFormat.format(JGitText.get().objectIsCorrupt3, type.getMessageId(), id.name(), why)); this.errorType = type; }
private void checkObjectCollision(AnyObjectId obj, int type, byte[] data) throws IOException { try { final ObjectLoader ldr = readCurs.open(obj, type); final byte[] existingData = ldr.getCachedBytes(data.length); if (!Arrays.equals(data, existingData)) { throw new IOException(MessageFormat.format( JGitText.get().collisionOn, obj.name())); } } catch (MissingObjectException notLocal) { // This is OK, we don't have a copy of the object locally // but the API throws when we try to read it as usually its // an error to read something that doesn't exist. } }
private boolean alreadyHave(AnyObjectId id) throws TransportException { try { return reader.has(id); } catch (IOException error) { throw new TransportException(MessageFormat.format( JGitText.get().cannotReadObject, id.name()), error); } }
final String idStr = id.name(); final String subdir = idStr.substring(0, 2); final String file = idStr.substring(2); final TransportException te; te = new TransportException(MessageFormat.format(JGitText.get().cannotGet, id.name())); if (failures != null && !failures.isEmpty()) { if (failures.size() == 1)
private boolean downloadLooseObject(final AnyObjectId id, final String looseName, final WalkRemoteObjectDatabase remote) throws TransportException { try { final byte[] compressed = remote.open(looseName).toArray(); verifyAndInsertLooseObject(id, compressed); return true; } catch (FileNotFoundException e) { // Not available in a loose format from this alternate? // Try another strategy to get the object. // recordError(id, e); return false; } catch (IOException e) { throw new TransportException(MessageFormat.format(JGitText.get().cannotDownload, id.name()), e); } }
e = new FileNotFoundException(id.name()); e.initCause(parsingError); throw e; throw new TransportException(MessageFormat.format( JGitText.get().transportExceptionInvalid, Constants.typeString(type), id.name(), e.getMessage())); if (!AnyObjectId.equals(id, act)) { throw new TransportException(MessageFormat.format( JGitText.get().incorrectHashFor, id.name(), act.name(), Constants.typeString(type), Integer.valueOf(compressed.length)));
JGitText.get().objectNotFoundIn, id.name(), pack.packName))); continue;
/** * Verify the integrity of the object. * * @param id * identity of the object to be checked. * @param type * the type of the object. * @param data * raw content of the object. * @throws org.eclipse.jgit.errors.CorruptObjectException * @since 4.9 */ protected void verifySafeObject(final AnyObjectId id, final int type, final byte[] data) throws CorruptObjectException { if (objCheck != null) { try { objCheck.check(id, type, data); } catch (CorruptObjectException e) { if (e.getErrorType() != null) { throw e; } throw new CorruptObjectException( MessageFormat.format(JGitText.get().invalidObject, Constants.typeString(type), id.name(), e.getMessage()), e); } } }
/** * @return string form of the SHA-1, in lower case hexadecimal. */ public final String getName() { return name(); }
throw new IllegalStateException(MessageFormat.format( JGitText.get().bitmapMissingObject, cmit.name(), last.name())); last = cmit; writeBitmaps.addBitmap(cmit, bitmap.build(), cmit.getFlags());
public static String loose(URIish base, AnyObjectId id) { final String objectName = id.name(); final String d = objectName.substring(0, 2); final String f = objectName.substring(2); return join(base, "objects/" + d + "/" + f); }
private void show(final AnyObjectId id, final String name) throws IOException { outw.print(id.name()); outw.print('\t'); outw.print(name); outw.println(); } }
private void show(final AnyObjectId id, final String name) throws IOException { outw.print(id.name()); outw.print('\t'); outw.print(name); outw.println(); } }