@@ -1210,7 +1210,7 @@ public static Metadata readFrom(StreamInput in) throws IOException {
12101210 for (int i = 0 ; i < size ; i ++) {
12111211 projectBuilder .put (IndexTemplateMetadata .readFrom (in ));
12121212 }
1213- readBwcCustoms (in , builder );
1213+ readBwcCustoms (in , builder , projectBuilder );
12141214
12151215 int reservedStateSize = in .readVInt ();
12161216 for (int i = 0 ; i < reservedStateSize ; i ++) {
@@ -1229,7 +1229,7 @@ public static Metadata readFrom(StreamInput in) throws IOException {
12291229 return builder .build ();
12301230 }
12311231
1232- private static void readBwcCustoms (StreamInput in , Builder builder ) throws IOException {
1232+ private static void readBwcCustoms (StreamInput in , Builder builder , ProjectMetadata . Builder projectBuilder ) throws IOException {
12331233 final Set <String > clusterScopedNames = in .namedWriteableRegistry ().getReaders (ClusterCustom .class ).keySet ();
12341234 final Set <String > projectScopedNames = in .namedWriteableRegistry ().getReaders (ProjectCustom .class ).keySet ();
12351235 final int count = in .readVInt ();
@@ -1245,9 +1245,9 @@ private static void readBwcCustoms(StreamInput in, Builder builder) throws IOExc
12451245 if (custom instanceof PersistentTasksCustomMetadata persistentTasksCustomMetadata ) {
12461246 final var tuple = persistentTasksCustomMetadata .split ();
12471247 builder .putCustom (tuple .v1 ().getWriteableName (), tuple .v1 ());
1248- builder . putProjectCustom (tuple .v2 ().getWriteableName (), tuple .v2 ());
1248+ projectBuilder . putCustom (tuple .v2 ().getWriteableName (), tuple .v2 ());
12491249 } else {
1250- builder . putProjectCustom (custom .getWriteableName (), custom );
1250+ projectBuilder . putCustom (custom .getWriteableName (), custom );
12511251 }
12521252 } else {
12531253 throw new IllegalArgumentException ("Unknown custom name [" + name + "]" );
@@ -1569,7 +1569,8 @@ public Builder putCustom(String type, ClusterCustom custom) {
15691569
15701570 @ Deprecated (forRemoval = true )
15711571 public Builder putCustom (String type , ProjectCustom custom ) {
1572- return putProjectCustom (type , custom );
1572+ getSingleProject ().putCustom (type , Objects .requireNonNull (custom , type ));
1573+ return this ;
15731574 }
15741575
15751576 public ClusterCustom getCustom (String type ) {
@@ -1592,12 +1593,6 @@ public Builder customs(Map<String, ClusterCustom> clusterCustoms) {
15921593 return this ;
15931594 }
15941595
1595- @ Deprecated (forRemoval = true )
1596- public Builder putProjectCustom (String type , ProjectCustom custom ) {
1597- getSingleProject ().putCustom (type , Objects .requireNonNull (custom , type ));
1598- return this ;
1599- }
1600-
16011596 @ Deprecated (forRemoval = true )
16021597 public Builder projectCustoms (Map <String , ProjectCustom > projectCustoms ) {
16031598 projectCustoms .forEach ((key , value ) -> Objects .requireNonNull (value , key ));
0 commit comments