This rule detects the use of WebLogic setAttribute and getAttribute attributes for parsing XML. This rule detects the Java code. A separate rule detects the use of the WebLogic weblogic.servlet.XMLParsingHelper, which enables this feature.
Example:
request.setAttribute("org.xml.sax.helpers.DefaultHandler", someObject)
Example:
String handler = "org.xml.sax.helpers.DefaultHandler";
request.setAttribute(handler, someObject);
Example: Document myDocument = request.getAttribute("org.w3c.dom.Document")
Example:
String handler = "org.w3c.dom.Document";
Document myDoc = request.getAttribute(handler);
Examples:
request.setAttribute("org.xml.sax.helpers.DefaultHandler", myHandler);
request.getAttribute("org.w3c.dom.Document");
When the automated fix is applied to the previous lines, those lines are deleted.
Note: Verify that the object,
myHandler
,
is initialized in other ways if it is used within the code later.
Examples:
Document myDocument = request.getAttribute("org.w3c.dom.Document");
When the automated fix is applied, the previous code is changed to:
Document myDocument;
Note: Verify that the object,
myDocument
,
is initialized in other ways if it is used within the code later.