Fix javadoc in org.eclipse.jgit internal and fsck packages

Change-Id: Ib12da10aacda9389d594bf4f521e9a58d1935701
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
This commit is contained in:
Matthias Sohn 2017-12-18 13:25:04 +01:00
parent 107c71a6e6
commit 6dca3cc024
3 changed files with 54 additions and 9 deletions

View File

@ -53,6 +53,8 @@
public class JGitText extends TranslationBundle {
/**
* Get an instance of this translation bundle
*
* @return an instance of this translation bundle
*/
public static JGitText get() {

View File

@ -51,7 +51,9 @@
import org.eclipse.jgit.lib.ObjectChecker;
import org.eclipse.jgit.lib.ObjectId;
/** Holds all fsck errors of a git repository. */
/**
* Holds all fsck errors of a git repository.
*/
public class FsckError {
/** Represents a corrupt object. */
public static class CorruptObject {
@ -130,22 +132,38 @@ public ErrorType getErrorType() {
private final Set<String> nonCommitHeads = new HashSet<>();
/** @return corrupt objects from all pack files. */
/**
* Get corrupt objects from all pack files
*
* @return corrupt objects from all pack files
*/
public Set<CorruptObject> getCorruptObjects() {
return corruptObjects;
}
/** @return missing objects that should present in pack files. */
/**
* Get missing objects that should present in pack files
*
* @return missing objects that should present in pack files
*/
public Set<ObjectId> getMissingObjects() {
return missingObjects;
}
/** @return corrupt index files associated with the packs. */
/**
* Get corrupt index files associated with the packs
*
* @return corrupt index files associated with the packs
*/
public Set<CorruptIndex> getCorruptIndices() {
return corruptIndices;
}
/** @return refs/heads/* point to non-commit object. */
/**
* Get refs/heads/* which point to non-commit object
*
* @return refs/heads/* which point to non-commit object
*/
public Set<String> getNonCommitHeads() {
return nonCommitHeads;
}

View File

@ -62,13 +62,14 @@
import org.eclipse.jgit.internal.storage.file.PackIndex;
import org.eclipse.jgit.internal.storage.file.PackIndex.MutableEntry;
import org.eclipse.jgit.lib.AnyObjectId;
import org.eclipse.jgit.lib.ObjectChecker;
import org.eclipse.jgit.lib.ObjectDatabase;
import org.eclipse.jgit.lib.ObjectIdOwnerMap;
import org.eclipse.jgit.transport.PackParser;
import org.eclipse.jgit.transport.PackedObjectInfo;
/** A read-only pack parser for object validity checking. */
/**
* A read-only pack parser for object validity checking.
*/
public class FsckPackParser extends PackParser {
private final CRC32 crc;
@ -83,6 +84,8 @@ public class FsckPackParser extends PackParser {
private int blockSize;
/**
* Constructor for FsckPackParser
*
* @param db
* the object database which stores repository's data.
* @param channel
@ -96,6 +99,7 @@ public FsckPackParser(ObjectDatabase db, ReadableChannel channel) {
this.blockSize = channel.blockSize() > 0 ? channel.blockSize() : 65536;
}
/** {@inheritDoc} */
@Override
protected void onPackHeader(long objCnt) throws IOException {
if (expectedObjectCount >= 0) {
@ -107,41 +111,48 @@ protected void onPackHeader(long objCnt) throws IOException {
}
}
/** {@inheritDoc} */
@Override
protected void onBeginWholeObject(long streamPosition, int type,
long inflatedSize) throws IOException {
crc.reset();
}
/** {@inheritDoc} */
@Override
protected void onObjectHeader(Source src, byte[] raw, int pos, int len)
throws IOException {
crc.update(raw, pos, len);
}
/** {@inheritDoc} */
@Override
protected void onObjectData(Source src, byte[] raw, int pos, int len)
throws IOException {
crc.update(raw, pos, len);
}
/** {@inheritDoc} */
@Override
protected void onEndWholeObject(PackedObjectInfo info) throws IOException {
info.setCRC((int) crc.getValue());
}
/** {@inheritDoc} */
@Override
protected void onBeginOfsDelta(long deltaStreamPosition,
long baseStreamPosition, long inflatedSize) throws IOException {
crc.reset();
}
/** {@inheritDoc} */
@Override
protected void onBeginRefDelta(long deltaStreamPosition, AnyObjectId baseId,
long inflatedSize) throws IOException {
crc.reset();
}
/** {@inheritDoc} */
@Override
protected UnresolvedDelta onEndDelta() throws IOException {
UnresolvedDelta delta = new UnresolvedDelta();
@ -149,12 +160,14 @@ protected UnresolvedDelta onEndDelta() throws IOException {
return delta;
}
/** {@inheritDoc} */
@Override
protected void onInflatedObjectData(PackedObjectInfo obj, int typeCode,
byte[] data) throws IOException {
// FsckPackParser ignores this event.
}
/** {@inheritDoc} */
@Override
protected void verifySafeObject(final AnyObjectId id, final int type,
final byte[] data) {
@ -170,11 +183,13 @@ protected void verifySafeObject(final AnyObjectId id, final int type,
}
}
/** {@inheritDoc} */
@Override
protected void onPackFooter(byte[] hash) throws IOException {
// Do nothing.
}
/** {@inheritDoc} */
@Override
protected boolean onAppendBase(int typeCode, byte[] data,
PackedObjectInfo info) throws IOException {
@ -182,11 +197,13 @@ protected boolean onAppendBase(int typeCode, byte[] data,
return false;
}
/** {@inheritDoc} */
@Override
protected void onEndThinPack() throws IOException {
// Do nothing.
}
/** {@inheritDoc} */
@Override
protected ObjectTypeAndSize seekDatabase(PackedObjectInfo obj,
ObjectTypeAndSize info) throws IOException {
@ -195,6 +212,7 @@ protected ObjectTypeAndSize seekDatabase(PackedObjectInfo obj,
return readObjectHeader(info);
}
/** {@inheritDoc} */
@Override
protected ObjectTypeAndSize seekDatabase(UnresolvedDelta delta,
ObjectTypeAndSize info) throws IOException {
@ -203,6 +221,7 @@ protected ObjectTypeAndSize seekDatabase(UnresolvedDelta delta,
return readObjectHeader(info);
}
/** {@inheritDoc} */
@Override
protected int readDatabase(byte[] dst, int pos, int cnt)
throws IOException {
@ -247,11 +266,13 @@ private byte[] readFromChannel(long block) throws IOException {
return buf.array();
}
/** {@inheritDoc} */
@Override
protected boolean checkCRC(int oldCRC) {
return oldCRC == (int) crc.getValue();
}
/** {@inheritDoc} */
@Override
protected void onStoreStream(byte[] raw, int pos, int len)
throws IOException {
@ -259,7 +280,11 @@ protected void onStoreStream(byte[] raw, int pos, int len)
}
/**
* @return corrupt objects that reported by {@link ObjectChecker}.
* Get corrupt objects reported by
* {@link org.eclipse.jgit.lib.ObjectChecker}
*
* @return corrupt objects that are reported by
* {@link org.eclipse.jgit.lib.ObjectChecker}.
*/
public Set<CorruptObject> getCorruptObjects() {
return corruptObjects;
@ -270,7 +295,7 @@ public Set<CorruptObject> getCorruptObjects() {
*
* @param idx
* index file associate with the pack
* @throws CorruptPackIndexException
* @throws org.eclipse.jgit.errors.CorruptPackIndexException
* when the index file is corrupt.
*/
public void verifyIndex(PackIndex idx)