From 968d80f311cc56f901ff1c945756e45d0686352f Mon Sep 17 00:00:00 2001 From: Rudy De Busscher Date: Fri, 2 Sep 2022 14:32:08 +0200 Subject: [PATCH 1/2] Validate parameter passed to ConfiguratorBase.param() to not to be null. Fixes #27664. --- .../arc/processor/ConfiguratorBase.java | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/independent-projects/arc/processor/src/main/java/io/quarkus/arc/processor/ConfiguratorBase.java b/independent-projects/arc/processor/src/main/java/io/quarkus/arc/processor/ConfiguratorBase.java index a2cd7a59449d3..de4e756496596 100644 --- a/independent-projects/arc/processor/src/main/java/io/quarkus/arc/processor/ConfiguratorBase.java +++ b/independent-projects/arc/processor/src/main/java/io/quarkus/arc/processor/ConfiguratorBase.java @@ -2,6 +2,7 @@ import java.util.HashMap; import java.util.Map; +import java.util.Objects; import org.jboss.jandex.AnnotationInstance; import org.jboss.jandex.ClassInfo; @@ -31,6 +32,7 @@ public THIS param(String name, boolean value) { } public THIS param(String name, boolean[] value) { + Objects.requireNonNull(value, "Parameter value can't be null"); params.put(name, value); return self(); } @@ -41,6 +43,7 @@ public THIS param(String name, byte value) { } public THIS param(String name, byte[] value) { + Objects.requireNonNull(value, "Parameter value can't be null"); params.put(name, value); return self(); } @@ -51,6 +54,7 @@ public THIS param(String name, short value) { } public THIS param(String name, short[] value) { + Objects.requireNonNull(value, "Parameter value can't be null"); params.put(name, value); return self(); } @@ -61,6 +65,7 @@ public THIS param(String name, int value) { } public THIS param(String name, int[] value) { + Objects.requireNonNull(value, "Parameter value can't be null"); params.put(name, value); return self(); } @@ -71,6 +76,7 @@ public THIS param(String name, long value) { } public THIS param(String name, long[] value) { + Objects.requireNonNull(value, "Parameter value can't be null"); params.put(name, value); return self(); } @@ -81,6 +87,7 @@ public THIS param(String name, float value) { } public THIS param(String name, float[] value) { + Objects.requireNonNull(value, "Parameter value can't be null"); params.put(name, value); return self(); } @@ -91,6 +98,7 @@ public THIS param(String name, double value) { } public THIS param(String name, double[] value) { + Objects.requireNonNull(value, "Parameter value can't be null"); params.put(name, value); return self(); } @@ -101,56 +109,67 @@ public THIS param(String name, char value) { } public THIS param(String name, char[] value) { + Objects.requireNonNull(value, "Parameter value can't be null"); params.put(name, value); return self(); } public THIS param(String name, String value) { + Objects.requireNonNull(value, "Parameter value can't be null"); params.put(name, value); return self(); } public THIS param(String name, String[] value) { + Objects.requireNonNull(value, "Parameter value can't be null"); params.put(name, value); return self(); } public THIS param(String name, Enum value) { + Objects.requireNonNull(value, "Parameter value can't be null"); params.put(name, value); return self(); } public THIS param(String name, Enum[] value) { + Objects.requireNonNull(value, "Parameter value can't be null"); params.put(name, value); return self(); } public THIS param(String name, Class value) { + Objects.requireNonNull(value, "Parameter value can't be null"); params.put(name, value); return self(); } public THIS param(String name, Class[] value) { + Objects.requireNonNull(value, "Parameter value can't be null"); params.put(name, value); return self(); } public THIS param(String name, ClassInfo value) { + Objects.requireNonNull(value, "Parameter value can't be null"); params.put(name, value); return self(); } public THIS param(String name, ClassInfo[] value) { + Objects.requireNonNull(value, "Parameter value can't be null"); params.put(name, value); return self(); } public THIS param(String name, AnnotationInstance value) { + Objects.requireNonNull(value, "Parameter value can't be null"); params.put(name, value); return self(); } public THIS param(String name, AnnotationInstance[] value) { + Objects.requireNonNull(value, "Parameter value can't be null"); params.put(name, value); return self(); } From 322e1baf50add7461cb4b3b304612ee780215611 Mon Sep 17 00:00:00 2001 From: Rudy De Busscher Date: Fri, 9 Sep 2022 09:25:38 +0200 Subject: [PATCH 2/2] Validate parameter passed to ConfiguratorBase.param() to not to be null. Fixes #27664. --- .../arc/processor/ConfiguratorBase.java | 54 +++++++------------ 1 file changed, 18 insertions(+), 36 deletions(-) diff --git a/independent-projects/arc/processor/src/main/java/io/quarkus/arc/processor/ConfiguratorBase.java b/independent-projects/arc/processor/src/main/java/io/quarkus/arc/processor/ConfiguratorBase.java index de4e756496596..813897822caf3 100644 --- a/independent-projects/arc/processor/src/main/java/io/quarkus/arc/processor/ConfiguratorBase.java +++ b/independent-projects/arc/processor/src/main/java/io/quarkus/arc/processor/ConfiguratorBase.java @@ -32,8 +32,7 @@ public THIS param(String name, boolean value) { } public THIS param(String name, boolean[] value) { - Objects.requireNonNull(value, "Parameter value can't be null"); - params.put(name, value); + params.put(name, Objects.requireNonNull(value)); return self(); } @@ -43,8 +42,7 @@ public THIS param(String name, byte value) { } public THIS param(String name, byte[] value) { - Objects.requireNonNull(value, "Parameter value can't be null"); - params.put(name, value); + params.put(name, Objects.requireNonNull(value)); return self(); } @@ -54,8 +52,7 @@ public THIS param(String name, short value) { } public THIS param(String name, short[] value) { - Objects.requireNonNull(value, "Parameter value can't be null"); - params.put(name, value); + params.put(name, Objects.requireNonNull(value)); return self(); } @@ -65,8 +62,7 @@ public THIS param(String name, int value) { } public THIS param(String name, int[] value) { - Objects.requireNonNull(value, "Parameter value can't be null"); - params.put(name, value); + params.put(name, Objects.requireNonNull(value)); return self(); } @@ -76,8 +72,7 @@ public THIS param(String name, long value) { } public THIS param(String name, long[] value) { - Objects.requireNonNull(value, "Parameter value can't be null"); - params.put(name, value); + params.put(name, Objects.requireNonNull(value)); return self(); } @@ -87,8 +82,7 @@ public THIS param(String name, float value) { } public THIS param(String name, float[] value) { - Objects.requireNonNull(value, "Parameter value can't be null"); - params.put(name, value); + params.put(name, Objects.requireNonNull(value)); return self(); } @@ -98,8 +92,7 @@ public THIS param(String name, double value) { } public THIS param(String name, double[] value) { - Objects.requireNonNull(value, "Parameter value can't be null"); - params.put(name, value); + params.put(name, Objects.requireNonNull(value)); return self(); } @@ -109,68 +102,57 @@ public THIS param(String name, char value) { } public THIS param(String name, char[] value) { - Objects.requireNonNull(value, "Parameter value can't be null"); - params.put(name, value); + params.put(name, Objects.requireNonNull(value)); return self(); } public THIS param(String name, String value) { - Objects.requireNonNull(value, "Parameter value can't be null"); - params.put(name, value); + params.put(name, Objects.requireNonNull(value)); return self(); } public THIS param(String name, String[] value) { - Objects.requireNonNull(value, "Parameter value can't be null"); - params.put(name, value); + params.put(name, Objects.requireNonNull(value)); return self(); } public THIS param(String name, Enum value) { - Objects.requireNonNull(value, "Parameter value can't be null"); - params.put(name, value); + params.put(name, Objects.requireNonNull(value)); return self(); } public THIS param(String name, Enum[] value) { - Objects.requireNonNull(value, "Parameter value can't be null"); - params.put(name, value); + params.put(name, Objects.requireNonNull(value)); return self(); } public THIS param(String name, Class value) { - Objects.requireNonNull(value, "Parameter value can't be null"); - params.put(name, value); + params.put(name, Objects.requireNonNull(value)); return self(); } public THIS param(String name, Class[] value) { - Objects.requireNonNull(value, "Parameter value can't be null"); - params.put(name, value); + params.put(name, Objects.requireNonNull(value)); return self(); } public THIS param(String name, ClassInfo value) { - Objects.requireNonNull(value, "Parameter value can't be null"); - params.put(name, value); + params.put(name, Objects.requireNonNull(value)); return self(); } public THIS param(String name, ClassInfo[] value) { - Objects.requireNonNull(value, "Parameter value can't be null"); - params.put(name, value); + params.put(name, Objects.requireNonNull(value)); return self(); } public THIS param(String name, AnnotationInstance value) { - Objects.requireNonNull(value, "Parameter value can't be null"); - params.put(name, value); + params.put(name, Objects.requireNonNull(value)); return self(); } public THIS param(String name, AnnotationInstance[] value) { - Objects.requireNonNull(value, "Parameter value can't be null"); - params.put(name, value); + params.put(name, Objects.requireNonNull(value)); return self(); }