org.eclipse.jgit.lib
Class ObjectChecker

java.lang.Object
  extended by org.eclipse.jgit.lib.ObjectChecker

public class ObjectChecker
extends Object

Verifies that an object is formatted correctly.

Verifications made by this class only check that the fields of an object are formatted correctly. The ObjectId checksum of the object is not verified, and connectivity links between objects are also not verified. Its assumed that the caller can provide both of these validations on its own.

Instances of this class are not thread safe, but they may be reused to perform multiple object validations.


Field Summary
static byte[] author
          Header "author "
static byte[] committer
          Header "committer "
static byte[] encoding
          Header "encoding "
static byte[] object
          Header "object "
static byte[] parent
          Header "parent "
static byte[] tag
          Header "tag "
static byte[] tagger
          Header "tagger "
static byte[] tree
          Header "tree "
static byte[] type
          Header "type "
 
Constructor Summary
ObjectChecker()
           
 
Method Summary
 void check(int objType, byte[] raw)
          Check an object for parsing errors.
 void checkBlob(byte[] raw)
          Check a blob for errors.
 void checkCommit(byte[] raw)
          Check a commit for errors.
 void checkTag(byte[] raw)
          Check an annotated tag for errors.
 void checkTree(byte[] raw)
          Check a canonical formatted tree for errors.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

tree

public static final byte[] tree
Header "tree "


parent

public static final byte[] parent
Header "parent "


author

public static final byte[] author
Header "author "


committer

public static final byte[] committer
Header "committer "


encoding

public static final byte[] encoding
Header "encoding "


object

public static final byte[] object
Header "object "


type

public static final byte[] type
Header "type "


tag

public static final byte[] tag
Header "tag "


tagger

public static final byte[] tagger
Header "tagger "

Constructor Detail

ObjectChecker

public ObjectChecker()
Method Detail

check

public void check(int objType,
                  byte[] raw)
           throws CorruptObjectException
Check an object for parsing errors.

Parameters:
objType - type of the object. Must be a valid object type code in Constants.
raw - the raw data which comprises the object. This should be in the canonical format (that is the format used to generate the ObjectId of the object). The array is never modified.
Throws:
CorruptObjectException - if an error is identified.

checkCommit

public void checkCommit(byte[] raw)
                 throws CorruptObjectException
Check a commit for errors.

Parameters:
raw - the commit data. The array is never modified.
Throws:
CorruptObjectException - if any error was detected.

checkTag

public void checkTag(byte[] raw)
              throws CorruptObjectException
Check an annotated tag for errors.

Parameters:
raw - the tag data. The array is never modified.
Throws:
CorruptObjectException - if any error was detected.

checkTree

public void checkTree(byte[] raw)
               throws CorruptObjectException
Check a canonical formatted tree for errors.

Parameters:
raw - the raw tree data. The array is never modified.
Throws:
CorruptObjectException - if any error was detected.

checkBlob

public void checkBlob(byte[] raw)
               throws CorruptObjectException
Check a blob for errors.

Parameters:
raw - the blob data. The array is never modified.
Throws:
CorruptObjectException - if any error was detected.


Copyright © 2013. All Rights Reserved.