Skip to content

Commit 460218c

Browse files
committed
print out conflict results
Former-commit-id: 78cad8bf23577d524f30169528ebd742e4443ae2
1 parent dfd2599 commit 460218c

File tree

1 file changed

+36
-1
lines changed
  • src/main/java/com/oracle/weblogicx/imagebuilder/builder/util

1 file changed

+36
-1
lines changed

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

Lines changed: 36 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -164,8 +164,43 @@ public static boolean validatePatches(List<String> patches, String category, Str
164164

165165
try {
166166
NodeList conflictSets = XPathUtil.applyXPathReturnNodeList(result, "/conflict_sets");
167-
if (conflictSets.getLength() == 0)
167+
if (conflictSets.getLength() == 0) {
168+
169+
170+
try {
171+
String expression = "/conflict_check/conflict_sets/set/merge_patches";
172+
173+
NodeList nodeList = XPathUtil.applyXPathReturnNodeList(result, expression);
174+
175+
DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
176+
DocumentBuilder builder = dbf.newDocumentBuilder();
177+
Document doc = builder.newDocument();
178+
Element element = doc.createElement("conflict_check_results");
179+
180+
for (int i = 0; i < nodeList.getLength(); i++) {
181+
Node n = nodeList.item(i);
182+
Node copyNode = doc.importNode(n, true);
183+
184+
if (n instanceof Element )
185+
element.appendChild(copyNode);
186+
}
187+
188+
doc.appendChild(element);
189+
System.out.println("===================================================");
190+
System.out.println("There are conflicts between the patches requested:-");
191+
System.out.println("===================================================");
192+
System.out.println("");
193+
XPathUtil.prettyPrint(doc);
194+
168195
return true;
196+
197+
198+
} catch (XPathExpressionException | ParserConfigurationException xpe) {
199+
throw new IOException(xpe);
200+
}
201+
202+
}
203+
169204
} catch (XPathExpressionException xpe) {
170205
throw new IOException(xpe);
171206

0 commit comments

Comments
 (0)