Browse Source

File compile and API errors in JGit

* Photon throws null analysis errors on the repeated invocation of those
previously null checked methods. Extract them to a local variable to
avoid this. (the null analysis is configured in project properties)
* setUseProtocolV2() misses @since tag. Problem was introduced with
332bc61124. Might be caused by the long
delay of 2 months from creation to merging.

Change-Id: Ibbb1a1580b604b8e7cd4bf7edc4643e292b6b4a8
Signed-off-by: Michael Keppler <Michael.Keppler@gmx.de>
stable-5.0
Michael Keppler 7 years ago committed by Matthias Sohn
parent
commit
32a8162bc3
  1. 18
      org.eclipse.jgit/src/org/eclipse/jgit/transport/RefAdvertiser.java

18
org.eclipse.jgit/src/org/eclipse/jgit/transport/RefAdvertiser.java

@ -194,8 +194,9 @@ public abstract class RefAdvertiser {
/** /**
* @param b * @param b
* true if this advertiser should advertise using the * true if this advertiser should advertise using the protocol
* protocol v2 format, false otherwise * v2 format, false otherwise
* @since 5.0
*/ */
public void setUseProtocolV2(boolean b) { public void setUseProtocolV2(boolean b) {
useProtocolV2 = b; useProtocolV2 = b;
@ -289,8 +290,10 @@ public abstract class RefAdvertiser {
*/ */
public Set<ObjectId> send(Map<String, Ref> refs) throws IOException { public Set<ObjectId> send(Map<String, Ref> refs) throws IOException {
for (Ref ref : getSortedRefs(refs)) { for (Ref ref : getSortedRefs(refs)) {
if (ref.getObjectId() == null) ObjectId objectId = ref.getObjectId();
if (objectId == null) {
continue; continue;
}
if (useProtocolV2) { if (useProtocolV2) {
String symrefPart = symrefs.containsKey(ref.getName()) String symrefPart = symrefs.containsKey(ref.getName())
@ -301,15 +304,16 @@ public abstract class RefAdvertiser {
if (!ref.isPeeled() && repository != null) { if (!ref.isPeeled() && repository != null) {
ref = repository.peel(ref); ref = repository.peel(ref);
} }
if (ref.getPeeledObjectId() != null) { ObjectId peeledObjectId = ref.getPeeledObjectId();
peelPart = " peeled:" + ref.getPeeledObjectId().getName(); if (peeledObjectId != null) {
peelPart = " peeled:" + peeledObjectId.getName();
} }
} }
writeOne(ref.getObjectId().getName() + " " + ref.getName() + symrefPart + peelPart + "\n"); writeOne(objectId.getName() + " " + ref.getName() + symrefPart + peelPart + "\n");
continue; continue;
} }
advertiseAny(ref.getObjectId(), ref.getName()); advertiseAny(objectId, ref.getName());
if (!derefTags) if (!derefTags)
continue; continue;

Loading…
Cancel
Save