41 lines
881 B
Plaintext
41 lines
881 B
Plaintext
include::../description.adoc[]
|
|
|
|
== Noncompliant Code Example
|
|
|
|
[source,java]
|
|
----
|
|
protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws IOException {
|
|
String param1 = req.getParameter("param1");
|
|
Logger.info("Param1: " + param1 + " " + Logger.getName()); // Noncompliant
|
|
// ...
|
|
}
|
|
----
|
|
|
|
== Compliant Solution
|
|
|
|
[source,java]
|
|
----
|
|
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[]
|
|
ifdef::env-github,rspecator-view[]
|
|
|
|
'''
|
|
== Implementation Specification
|
|
(visible only on this page)
|
|
|
|
include::../message.adoc[]
|
|
|
|
include::../highlighting.adoc[]
|
|
|
|
endif::env-github,rspecator-view[]
|