Browse Source

Get rid of warning about possible NullPointerException

Do this by using one of the two references that are dependent
of checkReferencedIsReachable.

Change-Id: I4f16916c62ed8ea434013925f49fb03fe57b7d7e
stable-2.1
Robin Rosenberg 13 years ago
parent
commit
130925b879
  1. 10
      org.eclipse.jgit/src/org/eclipse/jgit/transport/BaseReceivePack.java

10
org.eclipse.jgit/src/org/eclipse/jgit/transport/BaseReceivePack.java

@ -957,7 +957,7 @@ public abstract class BaseReceivePack {
final ObjectWalk ow = new ObjectWalk(db);
ow.setRetainBody(false);
if (checkReferencedIsReachable) {
if (baseObjects != null) {
ow.sort(RevSort.TOPO);
if (!baseObjects.isEmpty())
ow.sort(RevSort.BOUNDARY, true);
@ -974,7 +974,7 @@ public abstract class BaseReceivePack {
RevObject o = ow.parseAny(have);
ow.markUninteresting(o);
if (checkReferencedIsReachable && !baseObjects.isEmpty()) {
if (baseObjects != null && !baseObjects.isEmpty()) {
o = ow.peel(o);
if (o instanceof RevCommit)
o = ((RevCommit) o).getTree();
@ -985,7 +985,7 @@ public abstract class BaseReceivePack {
RevCommit c;
while ((c = ow.next()) != null) {
if (checkReferencedIsReachable //
if (providedObjects != null //
&& !c.has(RevFlag.UNINTERESTING) //
&& !providedObjects.contains(c))
throw new MissingObjectException(c, Constants.TYPE_COMMIT);
@ -996,7 +996,7 @@ public abstract class BaseReceivePack {
if (o.has(RevFlag.UNINTERESTING))
continue;
if (checkReferencedIsReachable) {
if (providedObjects != null) {
if (providedObjects.contains(o))
continue;
else
@ -1007,7 +1007,7 @@ public abstract class BaseReceivePack {
throw new MissingObjectException(o, Constants.TYPE_BLOB);
}
if (checkReferencedIsReachable) {
if (baseObjects != null) {
for (ObjectId id : baseObjects) {
o = ow.parseAny(id);
if (!o.has(RevFlag.UNINTERESTING))

Loading…
Cancel
Save