@@ -65,16 +65,22 @@ public RegistrationRequest() {
6565
6666 /**
6767 * Create a new registration request using the supplied {@link GridNodeConfiguration}
68- * @param configuration the {@link GridNodeConfiguration} to use
68+ *
69+ * @param configuration the {@link GridNodeConfiguration} to use. Internally calls {@code new
70+ * GridNodeConfiguration()} if a {@code null} value is provided since a
71+ * request without configuration is not valid.
6972 */
7073 public RegistrationRequest (GridNodeConfiguration configuration ) {
7174 this (configuration , null , null );
7275 }
7376
7477 /**
7578 * Create a new registration request using the supplied {@link GridNodeConfiguration}, and name
76- * @param configuration the {@link GridNodeConfiguration} to use
77- * @param name the name for the remote
79+ *
80+ * @param configuration the {@link GridNodeConfiguration} to use. Internally calls {@code new
81+ * GridNodeConfiguration()} if a {@code null} value is provided since a
82+ * request without configuration is not valid.
83+ * @param name the name for the remote
7884 */
7985 public RegistrationRequest (GridNodeConfiguration configuration , String name ) {
8086 this (configuration , name , null );
@@ -83,12 +89,15 @@ public RegistrationRequest(GridNodeConfiguration configuration, String name) {
8389 /**
8490 * Create a new registration request using the supplied {@link GridNodeConfiguration}, name, and
8591 * description
86- * @param configuration the {@link GridNodeConfiguration} to use
87- * @param name the name for the remote
88- * @param description the description for the remote host
92+ *
93+ * @param configuration the {@link GridNodeConfiguration} to use. Internally calls {@code new
94+ * GridNodeConfiguration()} if a {@code null} value is provided since a
95+ * request without configuration is not valid.
96+ * @param name the name for the remote
97+ * @param description the description for the remote host
8998 */
9099 public RegistrationRequest (GridNodeConfiguration configuration , String name , String description ) {
91- this .configuration = configuration ;
100+ this .configuration = ( configuration == null ) ? new GridNodeConfiguration () : configuration ;
92101 this .name = name ;
93102 this .description = description ;
94103
@@ -155,55 +164,57 @@ public static RegistrationRequest fromJson(String json) throws JsonSyntaxExcepti
155164 }
156165
157166 /**
158- * Build a RegistrationRequest. This is different than {@code new RegistrationRequest()} because
159- * it will "fixup" the resulting RegistrationRequest before returning the result
167+ * Build a RegistrationRequest.
160168 * @return
161169 */
162170 public static RegistrationRequest build () {
163- return RegistrationRequest .build (null , null , null );
171+ return RegistrationRequest .build (new GridNodeConfiguration () , null , null );
164172 }
165173
166174 /**
167175 * Build a RegistrationRequest from the provided {@link GridNodeConfiguration}. This is different
168- * than {@code new RegistrationRequest(GridNodeConfiguration)} because it will merge any
169- * specified {@link GridNodeConfiguration#nodeConfigFile} onto the provided configuration and it
170- * will "fixup" the resulting RegistrationRequest before returning the result
171- * @param configuration the {@link GridNodeConfiguration} to use
172- * @return
176+ * than {@code new RegistrationRequest(GridNodeConfiguration)} because it will first load any
177+ * specified {@link GridNodeConfiguration#nodeConfigFile} and then merge the provided
178+ * configuration onto it.
179+ *
180+ * @param configuration the {@link GridNodeConfiguration} to use. Internally calls {@code new
181+ * GridNodeConfiguration()} if a {@code null} value is provided since a
182+ * request without configuration is not valid.
173183 */
174184 public static RegistrationRequest build (GridNodeConfiguration configuration ) {
175185 return RegistrationRequest .build (configuration , null , null );
176186 }
177187
178188 /**
179- * Build a RegistrationRequest from the provided {@link GridNodeConfiguration}, use the provided name.
180- * This is different than {@code new RegistrationRequest(GridNodeConfiguration, String)} because it
181- * will merge any specified {@link GridNodeConfiguration#nodeConfigFile} onto the provided
182- * configuration and it will "fixup" the resulting RegistrationRequest before returning the result
183- * @param configuration the {@link GridNodeConfiguration} to use
184- * @param name the name for the remote
185- * @return
189+ * Build a RegistrationRequest from the provided {@link GridNodeConfiguration}, use the provided
190+ * name. This is different than {@code new RegistrationRequest(GridNodeConfiguration, String)}
191+ * because it will first load any specified {@link GridNodeConfiguration#nodeConfigFile} and then
192+ * merge the provided configuration onto it.
193+ *
194+ * @param configuration the {@link GridNodeConfiguration} to use. Internally calls {@code new
195+ * GridNodeConfiguration()} if a {@code null} value is provided since a
196+ * request without configuration is not valid.
197+ * @param name the name for the remote
186198 */
187199 public static RegistrationRequest build (GridNodeConfiguration configuration , String name ) {
188200 return RegistrationRequest .build (configuration , name , null );
189201 }
190202
191203 /**
192- * Build a RegistrationRequest from the provided {@link GridNodeConfiguration}, use the provided name
193- * and description. This is different than
194- * {@code new RegistrationRequest(GridNodeConfiguration, String, String)} because it will merge any
195- * specified {@link GridNodeConfiguration#nodeConfigFile} onto the provided configuration and it
196- * will "fixup" the resulting RegistrationRequest before returning the result
197- * @param configuration the {@link GridNodeConfiguration} to use
198- * @param name the name for the remote
199- * @param description the description for the remote host
200- * @return
204+ * Build a RegistrationRequest from the provided {@link GridNodeConfiguration}, use the provided
205+ * name and description. This is different than {@code new RegistrationRequest(GridNodeConfiguration,
206+ * String, String)} because it will first load any specified {@link
207+ * GridNodeConfiguration#nodeConfigFile} and then merge the provided configuration onto it.
208+ *
209+ * @param configuration the {@link GridNodeConfiguration} to use. Internally calls {@code new
210+ * GridNodeConfiguration()} if a {@code null} value is provided since a
211+ * request without configuration is not valid.
212+ * @param name the name for the remote
213+ * @param description the description for the remote host
201214 */
202215 public static RegistrationRequest build (GridNodeConfiguration configuration , String name , String description ) {
203- GridNodeConfiguration pendingConfiguration = (configuration == null ) ?
204- new GridNodeConfiguration () : configuration ;
205-
206- RegistrationRequest pendingRequest = new RegistrationRequest (pendingConfiguration , name , description );
216+ RegistrationRequest pendingRequest = new RegistrationRequest (configuration , name , description );
217+ GridNodeConfiguration pendingConfiguration = pendingRequest .configuration ;
207218
208219 if (pendingConfiguration .nodeConfigFile != null ) {
209220 pendingRequest .configuration = GridNodeConfiguration .loadFromJSON (pendingConfiguration .nodeConfigFile );
@@ -227,6 +238,10 @@ public static RegistrationRequest build(GridNodeConfiguration configuration, Str
227238 }
228239
229240 private void fixUpCapabilities () {
241+ if (configuration .capabilities == null ) {
242+ return ; // assumes the caller set it/wants it this way
243+ }
244+
230245 Platform current = Platform .getCurrent ();
231246 for (DesiredCapabilities cap : configuration .capabilities ) {
232247 if (cap .getPlatform () == null ) {
0 commit comments