Skip to content

Commit a769681

Browse files
committed
change return type
Former-commit-id: 6ccfcdbb4a16c7f7d33f49663dc61c177f0460d4
1 parent 6737879 commit a769681

File tree

1 file changed

+34
-18
lines changed
  • src/main/java/com/oracle/weblogicx/imagebuilder/builder/util

1 file changed

+34
-18
lines changed

src/main/java/com/oracle/weblogicx/imagebuilder/builder/util/ARUUtil.java

Lines changed: 34 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
import java.io.File;
44
import java.io.IOException;
5+
import java.util.ArrayList;
56
import java.util.List;
67

78
import javax.xml.parsers.DocumentBuilder;
@@ -75,10 +76,11 @@ public static void getAllFMWReleases(String userId, String password) throws IOEx
7576
* @param userId userid for support account
7677
* @param password password for support account
7778
* @throws IOException when failed to access the aru api
79+
* @return String bug number
7880
*/
79-
public static void getLatestWLSPSU(String version, String userId, String password) throws IOException {
81+
public static String getLatestWLSPSU(String version, String userId, String password) throws IOException {
8082
String releaseNumber = getReleaseNumber("wls", version, userId, password);
81-
getLatestPSU("wls", releaseNumber, userId, password);
83+
return getLatestPSU("wls", releaseNumber, userId, password);
8284
}
8385

8486
/**
@@ -88,10 +90,11 @@ public static void getLatestWLSPSU(String version, String userId, String passwor
8890
* @param userId userid for support account
8991
* @param password password for support account
9092
* @throws IOException when failed to access the aru api
93+
* @return String bug number
9194
*/
92-
public static void getLatestFMWPSU(String version, String userId, String password) throws IOException {
95+
public static String getLatestFMWPSU(String version, String userId, String password) throws IOException {
9396
String releaseNumber = getReleaseNumber("wls", version, userId, password);
94-
getLatestPSU("fmw", releaseNumber, userId, password);
97+
return getLatestPSU("fmw", releaseNumber, userId, password);
9598
}
9699

97100
/**
@@ -102,10 +105,16 @@ public static void getLatestFMWPSU(String version, String userId, String passwo
102105
* @param password password for support account
103106
* @throws IOException when failed to access the aru api
104107
*/
105-
public static void getWLSPatches(List<String> patches, String userId, String password) throws
108+
public static List<String> getWLSPatches(List<String> patches, String userId, String password) throws
106109
IOException {
107-
for (String patch : patches)
108-
getPatch("wls", patch, userId, password);
110+
List<String> results = new ArrayList<>();
111+
for (String patch : patches) {
112+
String rs = getPatch("wls", patch, userId, password);
113+
if (rs != null) {
114+
results.add(rs);
115+
}
116+
}
117+
return results;
109118
}
110119

111120
/**
@@ -116,10 +125,17 @@ public static void getWLSPatches(List<String> patches, String userId, String pa
116125
* @param password password for support account
117126
* @throws IOException when failed to access the aru api
118127
*/
119-
public static void getFMWPatches(String category, List<String> patches, String userId, String password) throws
128+
public static List<String> getFMWPatches(String category, List<String> patches, String userId, String password)
129+
throws
120130
IOException {
121-
for (String patch : patches)
122-
getPatch("fmw", patch, userId, password);
131+
List<String> results = new ArrayList<>();
132+
for (String patch : patches) {
133+
String rs = getPatch("fmw", patch, userId, password);
134+
if (rs != null) {
135+
results.add(rs);
136+
}
137+
}
138+
return results;
123139
}
124140

125141
/**
@@ -201,7 +217,8 @@ private static Document getAllReleases(String category, String userId, String p
201217

202218
}
203219

204-
private static void getLatestPSU(String category, String release, String userId, String password) throws IOException {
220+
private static String getLatestPSU(String category, String release, String userId, String password) throws
221+
IOException {
205222

206223
String xpath = "https://updates.oracle"
207224
+ ".com/Orion/Services/search?product=%s&release=%s";
@@ -214,10 +231,10 @@ private static void getLatestPSU(String category, String release, String userId
214231
Document allPatches = HttpUtil.getXMLContent(expression, userId, password);
215232

216233
//XPathUtil.prettyPrint(allPatches);
217-
savePatch(allPatches, userId, password);
234+
return savePatch(allPatches, userId, password);
218235
}
219236

220-
private static void getPatch(String category, String patchNumber, String userId, String password) throws
237+
private static String getPatch(String category, String patchNumber, String userId, String password) throws
221238
IOException {
222239

223240
// HTTP_STATUS=$(curl -v -w "%{http_code}" -b cookies.txt -L --header 'Authorization: Basic ${basicauth}' "https://updates.oracle.com/Orion/Services/search?product=15991&release=$releaseid&include_prereqs=true" -o latestpsu.xml)
@@ -233,13 +250,10 @@ private static void getPatch(String category, String patchNumber, String userId,
233250

234251
Document allPatches = HttpUtil.getXMLContent(url, userId, password);
235252

236-
savePatch(allPatches, userId, password);
237-
238-
239-
253+
return savePatch(allPatches, userId, password);
240254
}
241255

242-
private static void savePatch(Document allPatches, String userId, String password) throws IOException {
256+
private static String savePatch(Document allPatches, String userId, String password) throws IOException {
243257
try {
244258

245259
// TODO: needs to make sure there is one and some filtering if not sorting
@@ -264,12 +278,14 @@ private static void savePatch(Document allPatches, String userId, String passwor
264278
}
265279

266280
CacheDownLoadUtil.updateTableOfContext(bugName, fileName);
281+
return bugName;
267282
}
268283

269284
} catch (XPathExpressionException xpe) {
270285
throw new IOException(xpe);
271286
}
272287

288+
return null;
273289
}
274290

275291
private static String getReleaseNumber(String category, String version, String userId, String password) throws

0 commit comments

Comments
 (0)