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

Loading…
Cancel
Save