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

Loading…
Cancel
Save