@ -306,7 +306,9 @@ public class PackFile implements Iterable<PackIndex.MutableEntry> {
}
}
if ( curs . inflate ( this , position , dstbuf , 0 ) ! = sz )
if ( curs . inflate ( this , position , dstbuf , 0 ) ! = sz )
throw new EOFException ( MessageFormat . format ( JGitText . get ( ) . shortCompressedStreamAt , position ) ) ;
throw new EOFException ( MessageFormat . format (
JGitText . get ( ) . shortCompressedStreamAt ,
Long . valueOf ( position ) ) ) ;
return dstbuf ;
return dstbuf ;
}
}
@ -406,7 +408,7 @@ public class PackFile implements Iterable<PackIndex.MutableEntry> {
setCorrupt ( src . offset ) ;
setCorrupt ( src . offset ) ;
throw new CorruptObjectException ( MessageFormat . format (
throw new CorruptObjectException ( MessageFormat . format (
JGitText . get ( ) . objectAtHasBadZlibStream ,
JGitText . get ( ) . objectAtHasBadZlibStream ,
src . offset , getPackFile ( ) ) ) ;
Long . valueOf ( src . offset ) , getPackFile ( ) ) ) ;
}
}
} else if ( validate ) {
} else if ( validate ) {
// We don't have a CRC32 code in the index, so compute it
// We don't have a CRC32 code in the index, so compute it
@ -435,7 +437,7 @@ public class PackFile implements Iterable<PackIndex.MutableEntry> {
setCorrupt ( src . offset ) ;
setCorrupt ( src . offset ) ;
throw new EOFException ( MessageFormat . format (
throw new EOFException ( MessageFormat . format (
JGitText . get ( ) . shortCompressedStreamAt ,
JGitText . get ( ) . shortCompressedStreamAt ,
src . offset ) ) ;
Long . valueOf ( src . offset ) ) ) ;
}
}
expectedCRC = crc1 . getValue ( ) ;
expectedCRC = crc1 . getValue ( ) ;
} else {
} else {
@ -447,7 +449,7 @@ public class PackFile implements Iterable<PackIndex.MutableEntry> {
CorruptObjectException corruptObject = new CorruptObjectException (
CorruptObjectException corruptObject = new CorruptObjectException (
MessageFormat . format (
MessageFormat . format (
JGitText . get ( ) . objectAtHasBadZlibStream ,
JGitText . get ( ) . objectAtHasBadZlibStream ,
src . offset , getPackFile ( ) ) ) ;
Long . valueOf ( src . offset ) , getPackFile ( ) ) ) ;
corruptObject . initCause ( dataFormat ) ;
corruptObject . initCause ( dataFormat ) ;
StoredObjectRepresentationNotAvailableException gone ;
StoredObjectRepresentationNotAvailableException gone ;
@ -503,9 +505,9 @@ public class PackFile implements Iterable<PackIndex.MutableEntry> {
cnt - = n ;
cnt - = n ;
}
}
if ( validate & & crc2 . getValue ( ) ! = expectedCRC ) {
if ( validate & & crc2 . getValue ( ) ! = expectedCRC ) {
throw new CorruptObjectException ( MessageFormat . format ( JGitText
throw new CorruptObjectException ( MessageFormat . format (
. get ( ) . objectAtHasBadZlibStream , src . offset ,
JGitText . get ( ) . objectAtHasBadZlibStream ,
getPackFile ( ) ) ) ;
Long . valueOf ( src . offset ) , getPackFile ( ) ) ) ;
}
}
}
}
}
}
@ -650,11 +652,14 @@ public class PackFile implements Iterable<PackIndex.MutableEntry> {
final long vers = NB . decodeUInt32 ( buf , 4 ) ;
final long vers = NB . decodeUInt32 ( buf , 4 ) ;
final long packCnt = NB . decodeUInt32 ( buf , 8 ) ;
final long packCnt = NB . decodeUInt32 ( buf , 8 ) ;
if ( vers ! = 2 & & vers ! = 3 )
if ( vers ! = 2 & & vers ! = 3 )
throw new IOException ( MessageFormat . format ( JGitText . get ( ) . unsupportedPackVersion , vers ) ) ;
throw new IOException ( MessageFormat . format (
JGitText . get ( ) . unsupportedPackVersion , Long . valueOf ( vers ) ) ) ;
if ( packCnt ! = idx . getObjectCount ( ) )
if ( packCnt ! = idx . getObjectCount ( ) )
throw new PackMismatchException ( MessageFormat . format (
throw new PackMismatchException ( MessageFormat . format (
JGitText . get ( ) . packObjectCountMismatch , packCnt , idx . getObjectCount ( ) , getPackFile ( ) ) ) ;
JGitText . get ( ) . packObjectCountMismatch ,
Long . valueOf ( packCnt ) , Long . valueOf ( idx . getObjectCount ( ) ) ,
getPackFile ( ) ) ) ;
fd . seek ( length - 20 ) ;
fd . seek ( length - 20 ) ;
fd . readFully ( buf , 0 , 20 ) ;
fd . readFully ( buf , 0 , 20 ) ;
@ -753,7 +758,8 @@ public class PackFile implements Iterable<PackIndex.MutableEntry> {
default :
default :
throw new IOException ( MessageFormat . format (
throw new IOException ( MessageFormat . format (
JGitText . get ( ) . unknownObjectType , typeCode ) ) ;
JGitText . get ( ) . unknownObjectType ,
Integer . valueOf ( typeCode ) ) ) ;
}
}
}
}
@ -801,8 +807,8 @@ public class PackFile implements Iterable<PackIndex.MutableEntry> {
} catch ( DataFormatException dfe ) {
} catch ( DataFormatException dfe ) {
CorruptObjectException coe = new CorruptObjectException (
CorruptObjectException coe = new CorruptObjectException (
MessageFormat . format (
MessageFormat . format (
JGitText . get ( ) . objectAtHasBadZlibStream , pos ,
JGitText . get ( ) . objectAtHasBadZlibStream ,
getPackFile ( ) ) ) ;
Long . valueOf ( pos ) , getPackFile ( ) ) ) ;
coe . initCause ( dfe ) ;
coe . initCause ( dfe ) ;
throw coe ;
throw coe ;
}
}
@ -906,8 +912,9 @@ public class PackFile implements Iterable<PackIndex.MutableEntry> {
}
}
default :
default :
throw new IOException ( MessageFormat . format (
throw new IOException (
JGitText . get ( ) . unknownObjectType , type ) ) ;
MessageFormat . format ( JGitText . get ( ) . unknownObjectType ,
Integer . valueOf ( type ) ) ) ;
}
}
}
}
}
}
@ -954,14 +961,15 @@ public class PackFile implements Iterable<PackIndex.MutableEntry> {
default :
default :
throw new IOException ( MessageFormat . format (
throw new IOException ( MessageFormat . format (
JGitText . get ( ) . unknownObjectType , type ) ) ;
JGitText . get ( ) . unknownObjectType , Integer . valueOf ( type ) ) ) ;
}
}
try {
try {
return BinaryDelta . getResultSize ( getDeltaHeader ( curs , deltaAt ) ) ;
return BinaryDelta . getResultSize ( getDeltaHeader ( curs , deltaAt ) ) ;
} catch ( DataFormatException e ) {
} catch ( DataFormatException e ) {
throw new CorruptObjectException ( MessageFormat . format ( JGitText
throw new CorruptObjectException ( MessageFormat . format (
. get ( ) . objectAtHasBadZlibStream , pos , getPackFile ( ) ) ) ;
JGitText . get ( ) . objectAtHasBadZlibStream , Long . valueOf ( pos ) ,
getPackFile ( ) ) ) ;
}
}
}
}
@ -1009,8 +1017,9 @@ public class PackFile implements Iterable<PackIndex.MutableEntry> {
}
}
default :
default :
throw new IOException ( MessageFormat . format (
throw new IOException (
JGitText . get ( ) . unknownObjectType , typeCode ) ) ;
MessageFormat . format ( JGitText . get ( ) . unknownObjectType ,
Integer . valueOf ( typeCode ) ) ) ;
}
}
}
}