Browse Source

Merge changes I50095928,Idadec0ab,I1f2747d6,I6d2a7e28

* changes:
  LargeObjectException: Add constructor that takes Throwable
  InvalidPatternException: Add constructor that takes Throwable
  Don't unnecessarily explicitly call CorruptObjectException#initCause
  Use new StoredObjectRepresentationNotAvailableException constructor
stable-4.10
David Pursehouse 7 years ago committed by Gerrit Code Review @ Eclipse.org
parent
commit
19864c6c02
  1. 17
      org.eclipse.jgit/src/org/eclipse/jgit/errors/InvalidPatternException.java
  2. 11
      org.eclipse.jgit/src/org/eclipse/jgit/errors/LargeObjectException.java
  3. 4
      org.eclipse.jgit/src/org/eclipse/jgit/errors/StoredObjectRepresentationNotAvailableException.java
  4. 6
      org.eclipse.jgit/src/org/eclipse/jgit/ignore/internal/Strings.java
  5. 7
      org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/dfs/DfsInserter.java
  6. 30
      org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/dfs/DfsPackFile.java
  7. 4
      org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/LargePackedWholeObject.java
  8. 30
      org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/PackFile.java
  9. 7
      org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/PackInserter.java

17
org.eclipse.jgit/src/org/eclipse/jgit/errors/InvalidPatternException.java

@ -66,6 +66,23 @@ public class InvalidPatternException extends Exception {
this.pattern = pattern;
}
/**
* Constructor for InvalidPatternException
*
* @param message
* explains what was wrong with the pattern.
* @param pattern
* the invalid pattern.
* @param cause
* the cause.
* @since 4.10
*/
public InvalidPatternException(String message, String pattern,
Throwable cause) {
this(message, pattern);
initCause(cause);
}
/**
* Get the invalid pattern
*

11
org.eclipse.jgit/src/org/eclipse/jgit/errors/LargeObjectException.java

@ -64,6 +64,17 @@ public class LargeObjectException extends RuntimeException {
// Do nothing.
}
/**
* Create a large object exception, where the object isn't known.
*
* @param cause
* the cause
* @since 4.10
*/
public LargeObjectException(Throwable cause) {
initCause(cause);
}
/**
* Create a large object exception, naming the object that is too big.
*

4
org.eclipse.jgit/src/org/eclipse/jgit/errors/StoredObjectRepresentationNotAvailableException.java

@ -56,8 +56,12 @@ public class StoredObjectRepresentationNotAvailableException extends Exception {
*
* @param otp
* the object whose current representation is no longer present.
* @deprecated use
* {@link #StoredObjectRepresentationNotAvailableException(ObjectToPack, Throwable)}
* instead.
* @since 3.0
*/
@Deprecated
public StoredObjectRepresentationNotAvailableException(ObjectToPack otp) {
// Do nothing.
}

6
org.eclipse.jgit/src/org/eclipse/jgit/ignore/internal/Strings.java

@ -442,12 +442,10 @@ public class Strings {
try {
return Pattern.compile(sb.toString());
} catch (PatternSyntaxException e) {
InvalidPatternException patternException = new InvalidPatternException(
throw new InvalidPatternException(
MessageFormat.format(JGitText.get().invalidIgnoreRule,
pattern),
pattern);
patternException.initCause(e);
throw patternException;
pattern, e);
}
}

7
org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/dfs/DfsInserter.java

@ -616,13 +616,12 @@ public class DfsInserter extends ObjectInserter {
try {
return packOut.inflate(ctx, zpos, sz);
} catch (DataFormatException dfe) {
CorruptObjectException coe = new CorruptObjectException(
throw new CorruptObjectException(
MessageFormat.format(
JGitText.get().objectAtHasBadZlibStream,
Long.valueOf(obj.getOffset()),
packDsc.getFileName(PackExt.PACK)));
coe.initCause(dfe);
throw coe;
packDsc.getFileName(PackExt.PACK)),
dfe);
}
}

30
org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/dfs/DfsPackFile.java

@ -657,19 +657,15 @@ public final class DfsPackFile extends BlockBasedFile {
CorruptObjectException corruptObject = new CorruptObjectException(
MessageFormat.format(
JGitText.get().objectAtHasBadZlibStream,
Long.valueOf(src.offset), getFileName()));
corruptObject.initCause(dataFormat);
Long.valueOf(src.offset), getFileName()),
dataFormat);
StoredObjectRepresentationNotAvailableException gone;
gone = new StoredObjectRepresentationNotAvailableException(src);
gone.initCause(corruptObject);
throw gone;
throw new StoredObjectRepresentationNotAvailableException(src,
corruptObject);
} catch (IOException ioError) {
StoredObjectRepresentationNotAvailableException gone;
gone = new StoredObjectRepresentationNotAvailableException(src);
gone.initCause(ioError);
throw gone;
throw new StoredObjectRepresentationNotAvailableException(src,
ioError);
}
if (quickCopy != null) {
@ -870,12 +866,11 @@ public final class DfsPackFile extends BlockBasedFile {
return new ObjectLoader.SmallObject(type, data);
} catch (DataFormatException dfe) {
CorruptObjectException coe = new CorruptObjectException(
throw new CorruptObjectException(
MessageFormat.format(
JGitText.get().objectAtHasBadZlibStream, Long.valueOf(pos),
getFileName()));
coe.initCause(dfe);
throw coe;
getFileName()),
dfe);
}
}
@ -1018,12 +1013,11 @@ public final class DfsPackFile extends BlockBasedFile {
try {
return BinaryDelta.getResultSize(getDeltaHeader(ctx, deltaAt));
} catch (DataFormatException dfe) {
CorruptObjectException coe = new CorruptObjectException(
throw new CorruptObjectException(
MessageFormat.format(
JGitText.get().objectAtHasBadZlibStream, Long.valueOf(pos),
getFileName()));
coe.initCause(dfe);
throw coe;
getFileName()),
dfe);
}
}

4
org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/LargePackedWholeObject.java

@ -101,9 +101,7 @@ class LargePackedWholeObject extends ObjectLoader {
try {
throw new LargeObjectException(getObjectId());
} catch (IOException cannotObtainId) {
LargeObjectException err = new LargeObjectException();
err.initCause(cannotObtainId);
throw err;
throw new LargeObjectException(cannotObtainId);
}
}

30
org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/PackFile.java

@ -515,19 +515,15 @@ public class PackFile implements Iterable<PackIndex.MutableEntry> {
CorruptObjectException corruptObject = new CorruptObjectException(
MessageFormat.format(
JGitText.get().objectAtHasBadZlibStream,
Long.valueOf(src.offset), getPackFile()));
corruptObject.initCause(dataFormat);
Long.valueOf(src.offset), getPackFile()),
dataFormat);
StoredObjectRepresentationNotAvailableException gone;
gone = new StoredObjectRepresentationNotAvailableException(src);
gone.initCause(corruptObject);
throw gone;
throw new StoredObjectRepresentationNotAvailableException(src,
corruptObject);
} catch (IOException ioError) {
StoredObjectRepresentationNotAvailableException gone;
gone = new StoredObjectRepresentationNotAvailableException(src);
gone.initCause(ioError);
throw gone;
throw new StoredObjectRepresentationNotAvailableException(src,
ioError);
}
if (quickCopy != null) {
@ -612,11 +608,8 @@ public class PackFile implements Iterable<PackIndex.MutableEntry> {
try {
doOpen();
} catch (IOException thisPackNotValid) {
StoredObjectRepresentationNotAvailableException gone;
gone = new StoredObjectRepresentationNotAvailableException(otp);
gone.initCause(thisPackNotValid);
throw gone;
throw new StoredObjectRepresentationNotAvailableException(otp,
thisPackNotValid);
}
}
}
@ -902,12 +895,11 @@ public class PackFile implements Iterable<PackIndex.MutableEntry> {
return new ObjectLoader.SmallObject(type, data);
} catch (DataFormatException dfe) {
CorruptObjectException coe = new CorruptObjectException(
throw new CorruptObjectException(
MessageFormat.format(
JGitText.get().objectAtHasBadZlibStream,
Long.valueOf(pos), getPackFile()));
coe.initCause(dfe);
throw coe;
Long.valueOf(pos), getPackFile()),
dfe);
}
}

7
org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/PackInserter.java

@ -582,13 +582,12 @@ class PackInserter extends ObjectInserter {
try {
return packOut.inflate(zpos, sz);
} catch (DataFormatException dfe) {
CorruptObjectException coe = new CorruptObjectException(
throw new CorruptObjectException(
MessageFormat.format(
JGitText.get().objectAtHasBadZlibStream,
Long.valueOf(obj.getOffset()),
tmpPack.getAbsolutePath()));
coe.initCause(dfe);
throw coe;
tmpPack.getAbsolutePath()),
dfe);
}
}

Loading…
Cancel
Save