Browse Source

UploadPack: Prevent setting null protocolV2Hook

The setProtocolV2Hook sets the protocolV2Hook to whatever value is
passed, which could be null, but the invocations of protocolV2Hook's
methods are not guarded by null-checks.

Annotate the parameter as @Nullable and set ProtocolV2Hook.DEFAULT
when null is passed. This makes the implementation consistent with
other similar methods that set a hook or filter with possible null
value.

Change-Id: I70919a3248d4c2658783941a37c47e437cff0baa
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
stable-5.3
David Pursehouse 6 years ago
parent
commit
fc07fa26b9
  1. 5
      org.eclipse.jgit/src/org/eclipse/jgit/transport/UploadPack.java

5
org.eclipse.jgit/src/org/eclipse/jgit/transport/UploadPack.java

@ -583,10 +583,11 @@ public class UploadPack {
* Set the protocol V2 hook.
*
* @param hook
* the hook; if null no special actions are taken.
* @since 5.1
*/
public void setProtocolV2Hook(ProtocolV2Hook hook) {
this.protocolV2Hook = hook;
public void setProtocolV2Hook(@Nullable ProtocolV2Hook hook) {
this.protocolV2Hook = hook != null ? hook : ProtocolV2Hook.DEFAULT;
}
/**

Loading…
Cancel
Save