Skip to content

Commit 4014222

Browse files
resolve requests for changes
1 parent f209654 commit 4014222

File tree

2 files changed

+14
-5
lines changed

2 files changed

+14
-5
lines changed

core/src/main/java/oracle/weblogic/deploy/util/XPathUtil.java

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
import org.w3c.dom.Node;
88
import org.xml.sax.SAXException;
99

10+
import javax.xml.XMLConstants;
1011
import javax.xml.parsers.DocumentBuilder;
1112
import javax.xml.parsers.DocumentBuilderFactory;
1213
import javax.xml.parsers.ParserConfigurationException;
@@ -60,8 +61,8 @@ public String getPSU() {
6061
for (String patch_file : patch_files){
6162
Document doc = readXmlFile(patch_file);
6263
String descrip = description(doc, "//@description");
63-
LOGGER.info("Description {0}", descrip);
64-
if (descrip.startsWith("WLS PATCH SET UPDATE")) {
64+
LOGGER.fine("Description {0}", descrip);
65+
if (descrip != null && descrip.startsWith("WLS PATCH SET UPDATE")) {
6566
int idx = descrip.lastIndexOf('.');
6667
String psu = descrip.substring(idx+1);
6768
LOGGER.info("PSU Is {0}", psu);
@@ -79,8 +80,7 @@ public String getPSU() {
7980
*/
8081
public List<String> findPatchFiles() {
8182
List<String> patch_files = new ArrayList<String>();
82-
try {
83-
DirectoryStream<Path> stream = Files.newDirectoryStream(new File(patches_home).toPath());
83+
try (DirectoryStream<Path> stream = Files.newDirectoryStream(new File(patches_home).toPath())){
8484
for (Path path : stream) {
8585
patch_files.add(path.toString());
8686
}
@@ -97,6 +97,16 @@ public List<String> findPatchFiles() {
9797
*/
9898
public Document readXmlFile(String path) {
9999
DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
100+
try {
101+
dbf.setXIncludeAware(false);
102+
dbf.setExpandEntityReferences(false);
103+
dbf.setFeature("http://apache.org/xml/features/disallow-doctype-decl", true);
104+
dbf.setAttribute(XMLConstants.ACCESS_EXTERNAL_DTD, "");
105+
dbf.setAttribute(XMLConstants.ACCESS_EXTERNAL_SCHEMA, "");
106+
dbf.setFeature(XMLConstants.FEATURE_SECURE_PROCESSING, true);
107+
} catch (ParserConfigurationException pce) {
108+
LOGGER.warning("Unable to set feature in DocumentBuilderFactory : {0}");
109+
}
100110

101111
Document doc = null;
102112
try {

core/src/main/python/wlsdeploy/util/model_context.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,6 @@ def __copy_from_args(self, arg_map):
113113
if CommandLineArgUtil.ORACLE_HOME_SWITCH in arg_map:
114114
self._oracle_home = arg_map[CommandLineArgUtil.ORACLE_HOME_SWITCH]
115115
psu = XPathUtil(self._oracle_home).getPSU()
116-
self._logger.info("PSU is {0}", psu)
117116
if psu is not None:
118117
self._wl_version += '.' + psu
119118
self._logger.info('WLSDPLY-01050', self._wl_version, class_name=self._class_name,

0 commit comments

Comments
 (0)