@@ -137,14 +137,19 @@ List<AruPatch> getLatestPsu(AruProduct product, String version, String userId, S
137137 try {
138138 logger .info ("IMG-0019" , product .description ());
139139 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+ }
140145 Document aruRecommendations = retry (
141146 () -> getRecommendedPatchesMetadata (product , releaseNumber , userId , password ));
142147 logger .exiting ();
143148 return AruPatch .getPatches (aruRecommendations )
144149 .filter (AruPatch ::isPsu )
145150 .filter (not (AruPatch ::isStackPatchBundle ))
146151 .collect (Collectors .toList ());
147- } catch (NoPatchesFoundException | ReleaseNotFoundException ex ) {
152+ } catch (NoPatchesFoundException ex ) {
148153 logger .exiting ();
149154 return Collections .emptyList ();
150155 } catch (RetryFailedException | XPathExpressionException e ) {
@@ -154,7 +159,7 @@ List<AruPatch> getLatestPsu(AruProduct product, String version, String userId, S
154159 }
155160
156161 /**
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 .
158163 *
159164 * @param type FMW installer type
160165 * @param version version number like 12.2.1.3.0
@@ -203,44 +208,43 @@ public List<AruPatch> getRecommendedPatches(FmwInstallerType type, String versio
203208 List <AruPatch > getRecommendedPatches (AruProduct product , String version , String userId , String password )
204209 throws AruException {
205210 logger .entering (product , version );
211+ List <AruPatch > patches = Collections .emptyList ();
206212 try {
207213 logger .info ("IMG-0067" , product .description ());
208214 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+ }
233240 }
234- logger .exiting (patches );
235- return patches ;
236- } catch (ReleaseNotFoundException nf ) {
237- return Collections .emptyList ();
238241 } catch (NoPatchesFoundException npf ) {
239242 logger .info ("IMG-0069" , product .description (), version );
240- return Collections .emptyList ();
241243 } catch (RetryFailedException | XPathExpressionException e ) {
242244 throw new AruException (Utils .getMessage ("IMG-0070" , product .description (), version ), e );
243245 }
246+ logger .exiting (patches );
247+ return patches ;
244248 }
245249
246250 private String getPsuVersion (String productName , Collection <AruPatch > patches ) {
@@ -256,6 +260,19 @@ private String getPsuVersion(String productName, Collection<AruPatch> patches) {
256260 return null ;
257261 }
258262
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+
259276 static class PatchLists {
260277 List <InstalledPatch > installedPatches ;
261278 List <AruPatch > candidatePatches ;
@@ -358,7 +375,6 @@ Document getRecommendedPatchesMetadata(AruProduct product, String releaseNumber,
358375 * @param password OTN credential password
359376 * @return release number for the product and version provided
360377 * @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
362378 */
363379 private String getReleaseNumber (AruProduct product , String version , String userId , String password )
364380 throws AruException {
@@ -375,11 +391,6 @@ private String getReleaseNumber(AruProduct product, String version, String userI
375391 } catch (XPathExpressionException xpe ) {
376392 throw new AruException ("Could not extract release number with XPath" , xpe );
377393 }
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- }
383394 logger .exiting (result );
384395 return result ;
385396 }
0 commit comments