28 lines
658 B
Plaintext
28 lines
658 B
Plaintext
include::../description.adoc[]
|
|
|
|
== Noncompliant Code Example
|
|
|
|
----
|
|
protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws IOException {
|
|
String param1 = req.getParameter("param1");
|
|
Logger.info("Param1: " + param1 + " " + Logger.getName()); // Noncompliant
|
|
// ...
|
|
}
|
|
----
|
|
|
|
== Compliant Solution
|
|
|
|
----
|
|
protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws IOException {
|
|
String param1 = req.getParameter("param1");
|
|
|
|
// Replace pattern-breaking characters
|
|
param1 = param1.replaceAll("[\n|\r|\t]", "_");
|
|
|
|
Logger.info("Param1: " + param1 + " " + Logger.getName());
|
|
// ...
|
|
}
|
|
----
|
|
|
|
include::../see.adoc[]
|