import org.eclipse.jgit.api.errors.GitAPIException;
import org.eclipse.jgit.api.errors.InvalidRefNameException;
import org.eclipse.jgit.api.errors.JGitInternalException;
+import org.eclipse.jgit.api.errors.RefNotFoundException;
import org.eclipse.jgit.errors.LockFailedException;
import org.eclipse.jgit.internal.JGitText;
import org.eclipse.jgit.internal.storage.file.ReflogWriter;
List<ReflogEntry> entries;
try {
ReflogReader reader = repo.getReflogReader(R_STASH);
+ if (reader == null) {
+ throw new RefNotFoundException(MessageFormat
+ .format(JGitText.get().refNotResolved, stashRef));
+ }
entries = reader.getReverseEntries();
} catch (IOException e) {
throw new JGitInternalException(JGitText.get().stashDropFailed, e);
private String resolveReflogCheckout(int checkoutNo)
throws IOException {
- List<ReflogEntry> reflogEntries = getReflogReader(Constants.HEAD)
- .getReverseEntries();
+ ReflogReader reader = getReflogReader(Constants.HEAD);
+ if (reader == null) {
+ return null;
+ }
+ List<ReflogEntry> reflogEntries = reader.getReverseEntries();
for (ReflogEntry entry : reflogEntries) {
CheckoutEntry checkout = entry.parseCheckout();
if (checkout != null)
}
assert number >= 0;
ReflogReader reader = getReflogReader(ref.getName());
+ if (reader == null) {
+ throw new RevisionSyntaxException(
+ MessageFormat.format(JGitText.get().reflogEntryNotFound,
+ Integer.valueOf(number), ref.getName()));
+ }
ReflogEntry entry = reader.getReverseEntry(number);
if (entry == null)
throw new RevisionSyntaxException(MessageFormat.format(