aboutsummaryrefslogtreecommitdiffstats
path: root/org.eclipse.jgit
diff options
context:
space:
mode:
authorDavid Pursehouse <david.pursehouse@gmail.com>2018-12-18 11:44:00 +0900
committerDavid Pursehouse <david.pursehouse@gmail.com>2018-12-19 15:31:31 +0900
commitfc07fa26b9b9e2b0f89111aea498a08ff09c7167 (patch)
treefe0bb05d4a02d5c6c9f75744cf71f65a4bed7163 /org.eclipse.jgit
parent3d203114bdacc3f9c73aa7fbaa4c201151bf0152 (diff)
downloadjgit-fc07fa26b9b9e2b0f89111aea498a08ff09c7167.tar.gz
jgit-fc07fa26b9b9e2b0f89111aea498a08ff09c7167.zip
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>
Diffstat (limited to 'org.eclipse.jgit')
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/transport/UploadPack.java5
1 files changed, 3 insertions, 2 deletions
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/transport/UploadPack.java b/org.eclipse.jgit/src/org/eclipse/jgit/transport/UploadPack.java
index 12e5480487..9d90057293 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/transport/UploadPack.java
+++ b/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;
}
/**