@@ -72,32 +72,36 @@ public FieldCapabilitiesBuilder metricType(TimeSeriesParams.MetricType metricTyp
7272 }
7373
7474 public FieldCapabilitiesBuilder indices (String ... indices ) {
75- this .indices = Arrays . copyOf (indices , indices . length );
75+ this .indices = copyStringArray (indices );
7676 return this ;
7777 }
7878
7979 public FieldCapabilitiesBuilder nonSearchableIndices (String ... nonSearchableIndices ) {
80- this .nonSearchableIndices = Arrays . copyOf (nonSearchableIndices , nonAggregatableIndices . length );
80+ this .nonSearchableIndices = copyStringArray (nonSearchableIndices );
8181 return this ;
8282 }
8383
8484 public FieldCapabilitiesBuilder nonAggregatableIndices (String ... nonAggregatableIndices ) {
85- this .nonAggregatableIndices = Arrays . copyOf (nonAggregatableIndices , nonAggregatableIndices . length );
85+ this .nonAggregatableIndices = copyStringArray (nonAggregatableIndices );
8686 return this ;
8787 }
8888
8989 public FieldCapabilitiesBuilder nonDimensionIndices (String ... nonDimensionIndices ) {
90- this .nonDimensionIndices = Arrays . copyOf (nonDimensionIndices , nonDimensionIndices . length );
90+ this .nonDimensionIndices = copyStringArray (nonDimensionIndices );
9191 return this ;
9292 }
9393
9494 public FieldCapabilitiesBuilder metricConflictsIndices (String ... metricConflictsIndices ) {
95- this .metricConflictsIndices = Arrays . copyOf (metricConflictsIndices , metricConflictsIndices . length );
95+ this .metricConflictsIndices = copyStringArray (metricConflictsIndices );
9696 return this ;
9797 }
9898
99+ private static String [] copyStringArray (@ Nullable String [] strings ) {
100+ return strings != null ? Arrays .copyOf (strings , strings .length ) : null ;
101+ }
102+
99103 public FieldCapabilitiesBuilder meta (Map <String , Set <String >> meta ) {
100- this .meta = new TreeMap <>(meta );
104+ this .meta = meta != null ? new TreeMap <>(meta ) : null ;
101105 return this ;
102106 }
103107
0 commit comments