Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorCarsten Hammer2020-11-01 10:59:54 +0000
committerThomas Watson2020-11-02 15:17:09 +0000
commit6aeac91aa91276d5a3a9721291290d4136edf3e3 (patch)
tree0e92cf17caa4329e06df2dd576c36fb87d0fdb01
parentf68fc044d8ddd3b46806324192c05e4052b6df2e (diff)
downloadrt.equinox.bundles-6aeac91aa91276d5a3a9721291290d4136edf3e3.tar.gz
rt.equinox.bundles-6aeac91aa91276d5a3a9721291290d4136edf3e3.tar.xz
rt.equinox.bundles-6aeac91aa91276d5a3a9721291290d4136edf3e3.zip
Bug: Potentially dangerous use of non-short-circuit logic in
org.eclipse.equinox.http.servlet.tests.ServletTest.getUnsupportedMethods() This code seems to be using non-short-circuit logic (e.g., & or |) rather than short-circuit logic (&& or ||). In addition, it seem possible that, depending on the value of the left hand side, you might not want to evaluate the right hand side (because it would have side effects, could cause an exception or could be expensive. Non-short-circuit logic causes both sides of the expression to be evaluated even when the result can be inferred from knowing the left-hand side. This can be less efficient and can result in errors if the left-hand side guards cases when evaluating the right-hand side can generate an error. See the Java Language Specification for details. Rank: Of Concern (15), confidence: High Pattern: NS_DANGEROUS_NON_SHORT_CIRCUIT Type: NS, Category: STYLE (Dodgy code) Change-Id: Ifff9909b2819a6387d8703b9ec93348e56852848 Signed-off-by: Carsten Hammer <carsten.hammer@t-online.de>
-rw-r--r--bundles/org.eclipse.equinox.http.servlet.tests/src/org/eclipse/equinox/http/servlet/tests/ServletTest.java2
1 files changed, 1 insertions, 1 deletions
diff --git a/bundles/org.eclipse.equinox.http.servlet.tests/src/org/eclipse/equinox/http/servlet/tests/ServletTest.java b/bundles/org.eclipse.equinox.http.servlet.tests/src/org/eclipse/equinox/http/servlet/tests/ServletTest.java
index bcb04cf9c..9c5f6cb8e 100644
--- a/bundles/org.eclipse.equinox.http.servlet.tests/src/org/eclipse/equinox/http/servlet/tests/ServletTest.java
+++ b/bundles/org.eclipse.equinox.http.servlet.tests/src/org/eclipse/equinox/http/servlet/tests/ServletTest.java
@@ -2857,7 +2857,7 @@ public class ServletTest extends BaseTest {
Class<ServletContext> contextClass = ServletContext.class;
for(Method m : contextClass.getMethods()) {
String name = m.getName();
- if (name.equals("addFilter") || name.equals("addListener") || name.equals("addServlet") || name.equals("createFilter") || name.equals("createListener") || name.equals("createServlet") | name.equals("declareRoles")) {
+ if (name.equals("addFilter") || name.equals("addListener") || name.equals("addServlet") || name.equals("createFilter") || name.equals("createListener") || name.equals("createServlet") || name.equals("declareRoles")) {
methods.add(m);
}
}

Back to the top