2
2
3
3
import java .io .File ;
4
4
import java .io .IOException ;
5
+ import java .util .ArrayList ;
5
6
import java .util .List ;
6
7
7
8
import javax .xml .parsers .DocumentBuilder ;
@@ -75,10 +76,11 @@ public static void getAllFMWReleases(String userId, String password) throws IOEx
75
76
* @param userId userid for support account
76
77
* @param password password for support account
77
78
* @throws IOException when failed to access the aru api
79
+ * @return String bug number
78
80
*/
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 {
80
82
String releaseNumber = getReleaseNumber ("wls" , version , userId , password );
81
- getLatestPSU ("wls" , releaseNumber , userId , password );
83
+ return getLatestPSU ("wls" , releaseNumber , userId , password );
82
84
}
83
85
84
86
/**
@@ -88,10 +90,11 @@ public static void getLatestWLSPSU(String version, String userId, String passwor
88
90
* @param userId userid for support account
89
91
* @param password password for support account
90
92
* @throws IOException when failed to access the aru api
93
+ * @return String bug number
91
94
*/
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 {
93
96
String releaseNumber = getReleaseNumber ("wls" , version , userId , password );
94
- getLatestPSU ("fmw" , releaseNumber , userId , password );
97
+ return getLatestPSU ("fmw" , releaseNumber , userId , password );
95
98
}
96
99
97
100
/**
@@ -102,10 +105,16 @@ public static void getLatestFMWPSU(String version, String userId, String passwo
102
105
* @param password password for support account
103
106
* @throws IOException when failed to access the aru api
104
107
*/
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
106
109
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 ;
109
118
}
110
119
111
120
/**
@@ -116,10 +125,17 @@ public static void getWLSPatches(List<String> patches, String userId, String pa
116
125
* @param password password for support account
117
126
* @throws IOException when failed to access the aru api
118
127
*/
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
120
130
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 ;
123
139
}
124
140
125
141
/**
@@ -201,7 +217,8 @@ private static Document getAllReleases(String category, String userId, String p
201
217
202
218
}
203
219
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 {
205
222
206
223
String xpath = "https://updates.oracle"
207
224
+ ".com/Orion/Services/search?product=%s&release=%s" ;
@@ -214,10 +231,10 @@ private static void getLatestPSU(String category, String release, String userId
214
231
Document allPatches = HttpUtil .getXMLContent (expression , userId , password );
215
232
216
233
//XPathUtil.prettyPrint(allPatches);
217
- savePatch (allPatches , userId , password );
234
+ return savePatch (allPatches , userId , password );
218
235
}
219
236
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
221
238
IOException {
222
239
223
240
// 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,
233
250
234
251
Document allPatches = HttpUtil .getXMLContent (url , userId , password );
235
252
236
- savePatch (allPatches , userId , password );
237
-
238
-
239
-
253
+ return savePatch (allPatches , userId , password );
240
254
}
241
255
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 {
243
257
try {
244
258
245
259
// 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
264
278
}
265
279
266
280
CacheDownLoadUtil .updateTableOfContext (bugName , fileName );
281
+ return bugName ;
267
282
}
268
283
269
284
} catch (XPathExpressionException xpe ) {
270
285
throw new IOException (xpe );
271
286
}
272
287
288
+ return null ;
273
289
}
274
290
275
291
private static String getReleaseNumber (String category , String version , String userId , String password ) throws
0 commit comments