@@ -137,14 +137,19 @@ List<AruPatch> getLatestPsu(AruProduct product, String version, String userId, S
137
137
try {
138
138
logger .info ("IMG-0019" , product .description ());
139
139
String releaseNumber = getReleaseNumber (product , version , userId , password );
140
+ if (Utils .isEmptyString (releaseNumber )) {
141
+ // ARU does not have a release number for the given product and version, return empty patch list
142
+ logger .info (Utils .getMessage ("IMG-0082" , version , product .description ()));
143
+ return Collections .emptyList ();
144
+ }
140
145
Document aruRecommendations = retry (
141
146
() -> getRecommendedPatchesMetadata (product , releaseNumber , userId , password ));
142
147
logger .exiting ();
143
148
return AruPatch .getPatches (aruRecommendations )
144
149
.filter (AruPatch ::isPsu )
145
150
.filter (not (AruPatch ::isStackPatchBundle ))
146
151
.collect (Collectors .toList ());
147
- } catch (NoPatchesFoundException | ReleaseNotFoundException ex ) {
152
+ } catch (NoPatchesFoundException ex ) {
148
153
logger .exiting ();
149
154
return Collections .emptyList ();
150
155
} catch (RetryFailedException | XPathExpressionException e ) {
@@ -154,7 +159,7 @@ List<AruPatch> getLatestPsu(AruProduct product, String version, String userId, S
154
159
}
155
160
156
161
/**
157
- * Get list of recommended patches available for a given product and version .
162
+ * Get list of recommended patches available for all the products that are part of the FMW installer type .
158
163
*
159
164
* @param type FMW installer type
160
165
* @param version version number like 12.2.1.3.0
@@ -203,44 +208,43 @@ public List<AruPatch> getRecommendedPatches(FmwInstallerType type, String versio
203
208
List <AruPatch > getRecommendedPatches (AruProduct product , String version , String userId , String password )
204
209
throws AruException {
205
210
logger .entering (product , version );
211
+ List <AruPatch > patches = Collections .emptyList ();
206
212
try {
207
213
logger .info ("IMG-0067" , product .description ());
208
214
String releaseNumber = getReleaseNumber (product , version , userId , password );
209
- Document aruRecommendations = retry (
210
- () -> getRecommendedPatchesMetadata (product , releaseNumber , userId , password ));
211
- // TODO: Need an option for the user to request the Coherence additional feature pack.
212
- List <AruPatch > patches = AruPatch .getPatches (aruRecommendations )
213
- .filter (not (AruPatch ::isStackPatchBundle )) //remove Stack Patch Bundle
214
- .filter (not (AruPatch ::isCoherenceFeaturePack )) //remove COH feature pack
215
- .collect (Collectors .toList ());
216
- String psuVersion = getPsuVersion (product .description (), patches );
217
- if (psuVersion != null ) {
218
- //repeat the same process to get recommended patches, but use the PSU release instead of the GA release
219
- // All the same patches are in the PSU release, but also the overlay patches (if any)
220
- patches .forEach (p -> logger .fine ("Discarding recommended patch {0} {1}" , p .patchId (), p .description ()));
221
- logger .fine ("Recommended patch list contains a PSU, getting recommendations for PSU version {0}" ,
222
- psuVersion );
223
- // get release number for PSU
224
- String psuReleaseNumber = getReleaseNumber (product , psuVersion , userId , password );
225
- // get recommended patches for PSU release (Overlay patches are only recommended on the PSU release)
226
- Document psuOverrides = retry (
227
- () -> getRecommendedPatchesMetadata (product , psuReleaseNumber , userId , password ));
228
-
229
- patches = AruPatch .getPatches (psuOverrides )
230
- .filter (not (AruPatch ::isStackPatchBundle )) // remove the Stack Patch Bundle patch, if returned
231
- .filter (not (AruPatch ::isCoherenceFeaturePack )) // remove the Coherence feature pack, if returned
232
- .collect (Collectors .toList ());
215
+ if (Utils .isEmptyString (releaseNumber )) {
216
+ // ARU does not have a release number for the given product and version, return an empty patch list
217
+ logger .info (Utils .getMessage ("IMG-0082" , version , product .description ()));
218
+ } else {
219
+ // Get a list of patches applicable to the given product and release number
220
+ patches = getReleaseRecommendations (product , releaseNumber , userId , password );
221
+ String psuVersion = getPsuVersion (product .description (), patches );
222
+ if (psuVersion != null ) {
223
+ // Check to see if there is a release with the PSU version that contains overlay patches.
224
+ logger .fine ("Recommended patch list contains a PSU, getting recommendations for PSU version {0}" ,
225
+ psuVersion );
226
+ // Get the release number for the PSU version number
227
+ String psuReleaseNumber = getReleaseNumber (product , psuVersion , userId , password );
228
+ // If there is a release for the specific PSU, check it for overlay patches
229
+ if (!Utils .isEmptyString (psuReleaseNumber )) {
230
+ // Debug log - useful to know what was thrown away when "patches" is replaced by the new array
231
+ patches .forEach (p -> logger .fine ("Discarding recommended patch {0} {1}" ,
232
+ p .patchId (), p .description ()));
233
+ // Get recommended patches for PSU release (includes PSU overlay patches)
234
+ patches = getReleaseRecommendations (product , psuReleaseNumber , userId , password );
235
+ } else {
236
+ // ARU does not have a release number for the PSU version found (no overlays needed)
237
+ logger .fine ("PSU release was not found for {0} : {1}" , product , psuVersion );
238
+ }
239
+ }
233
240
}
234
- logger .exiting (patches );
235
- return patches ;
236
- } catch (ReleaseNotFoundException nf ) {
237
- return Collections .emptyList ();
238
241
} catch (NoPatchesFoundException npf ) {
239
242
logger .info ("IMG-0069" , product .description (), version );
240
- return Collections .emptyList ();
241
243
} catch (RetryFailedException | XPathExpressionException e ) {
242
244
throw new AruException (Utils .getMessage ("IMG-0070" , product .description (), version ), e );
243
245
}
246
+ logger .exiting (patches );
247
+ return patches ;
244
248
}
245
249
246
250
private String getPsuVersion (String productName , Collection <AruPatch > patches ) {
@@ -256,6 +260,19 @@ private String getPsuVersion(String productName, Collection<AruPatch> patches) {
256
260
return null ;
257
261
}
258
262
263
+ List <AruPatch > getReleaseRecommendations (AruProduct product , String releaseNumber , String userId , String password )
264
+ throws AruException , XPathExpressionException , RetryFailedException {
265
+
266
+ Document patchesDocument = retry (
267
+ () -> getRecommendedPatchesMetadata (product , releaseNumber , userId , password ));
268
+
269
+ return AruPatch .getPatches (patchesDocument )
270
+ .filter (not (AruPatch ::isStackPatchBundle )) // remove the Stack Patch Bundle patch, if returned
271
+ // TODO: Need an option for the user to request the Coherence additional feature pack.
272
+ .filter (not (AruPatch ::isCoherenceFeaturePack )) // remove the Coherence feature pack, if returned
273
+ .collect (Collectors .toList ());
274
+ }
275
+
259
276
static class PatchLists {
260
277
List <InstalledPatch > installedPatches ;
261
278
List <AruPatch > candidatePatches ;
@@ -358,7 +375,6 @@ Document getRecommendedPatchesMetadata(AruProduct product, String releaseNumber,
358
375
* @param password OTN credential password
359
376
* @return release number for the product and version provided
360
377
* @throws AruException if the call to ARU fails, or the response from ARU had an error
361
- * @throws ReleaseNotFoundException if the specified version for the requested product was not found
362
378
*/
363
379
private String getReleaseNumber (AruProduct product , String version , String userId , String password )
364
380
throws AruException {
@@ -375,11 +391,6 @@ private String getReleaseNumber(AruProduct product, String version, String userI
375
391
} catch (XPathExpressionException xpe ) {
376
392
throw new AruException ("Could not extract release number with XPath" , xpe );
377
393
}
378
- if (Utils .isEmptyString (result )) {
379
- String msg = Utils .getMessage ("IMG-0082" , version , product .description ());
380
- logger .info (msg );
381
- throw new ReleaseNotFoundException (msg );
382
- }
383
394
logger .exiting (result );
384
395
return result ;
385
396
}
0 commit comments