Bug 466220 - False-positive in Blind analisys
diff --git a/plugins/org.eclipse.actf.examples.adesigner.eval.html/src/org/eclipse/actf/examples/adesigner/eval/html/internal/CheckEngine.java b/plugins/org.eclipse.actf.examples.adesigner.eval.html/src/org/eclipse/actf/examples/adesigner/eval/html/internal/CheckEngine.java
index 51815de..f4c08c7 100644
--- a/plugins/org.eclipse.actf.examples.adesigner.eval.html/src/org/eclipse/actf/examples/adesigner/eval/html/internal/CheckEngine.java
+++ b/plugins/org.eclipse.actf.examples.adesigner.eval.html/src/org/eclipse/actf/examples/adesigner/eval/html/internal/CheckEngine.java
@@ -2023,18 +2023,12 @@
}
}
// C_54.3 check
- if (fieldsets.size() >= 2) {
- FieldsetManager map = new FieldsetManager();
- int index = 0;
- for (Element fieldset : fieldsets) {
- for (Element ctrl : getRadioAndCheck(fieldset)) {
- map.addEntry(ctrl.getAttribute("name"), ctrl, index);
- }
- index++;
- }
- for (Vector<Node> error : map.getErrorList()) {
- addCheckerProblem("C_54.3", "", error); //$NON-NLS-1$
- }
+ FieldsetManager map = new FieldsetManager();
+ for (Element ctrl : getRadioAndCheck(form)) {
+ map.addEntry(ctrl.getAttribute("name"), ctrl);
+ }
+ for (Vector<Node> error : map.getErrorList()) {
+ addCheckerProblem("C_54.3", "", error); //$NON-NLS-1$
}
}
if (noFieldSetForms.size() > 0)
@@ -3751,15 +3745,15 @@
}
/**
- * Returns radio buttons and check boxes contained in the specified fieldset
+ * Returns radio buttons and check boxes contained in the specified form
* element.
*
- * @param fieldset
+ * @param form
* @return A <code>List</code> of <code>Element</code>s.
*/
- private List<Element> getRadioAndCheck(Element fieldset) {
+ private List<Element> getRadioAndCheck(Element form) {
List<Element> returns = new ArrayList<Element>();
- List<Element> inputs = edu.getElementsList(fieldset, "input");
+ List<Element> inputs = edu.getElementsList(form, "input");
for (Element e : inputs) {
if (e.getAttribute("type").toLowerCase().matches("radio|checkbox"))
returns.add(e);
diff --git a/plugins/org.eclipse.actf.examples.adesigner.eval.html/src/org/eclipse/actf/examples/adesigner/eval/html/internal/FieldsetManager.java b/plugins/org.eclipse.actf.examples.adesigner.eval.html/src/org/eclipse/actf/examples/adesigner/eval/html/internal/FieldsetManager.java
index 6303384..7547ea2 100644
--- a/plugins/org.eclipse.actf.examples.adesigner.eval.html/src/org/eclipse/actf/examples/adesigner/eval/html/internal/FieldsetManager.java
+++ b/plugins/org.eclipse.actf.examples.adesigner.eval.html/src/org/eclipse/actf/examples/adesigner/eval/html/internal/FieldsetManager.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2010,2011 IBM Corporation and Others
+ * Copyright (c) 2010, 2015 IBM Corporation and Others
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -18,41 +18,46 @@
import java.util.Set;
import java.util.Vector;
+import org.eclipse.actf.visualization.eval.html.HtmlTagUtil;
import org.w3c.dom.Element;
import org.w3c.dom.Node;
class FieldsetManager {
private Map<String, List<Element>> ctrlMap = new HashMap<String, List<Element>>();
- private Map<String, Set<Integer>> fieldSetMap = new HashMap<String, Set<Integer>>();
+ private Map<String, Set<Node>> fieldSetMap = new HashMap<String, Set<Node>>();
/**
- * Adds a form control with the specified name attribute and contained in a
- * fieldset with the specified index.
+ * Adds a form control with the specified name attribute.
*
* @param name
* @param ctrl
- * @param fieldsetIndex
*/
- public void addEntry(String name, Element ctrl, int fieldsetIndex) {
+ public void addEntry(String name, Element ctrl) {
List<Element> list;
- Set<Integer> set;
+ Set<Node> set;
if (ctrlMap.containsKey(name)) {
list = ctrlMap.get(name);
set = fieldSetMap.get(name);
} else {
list = new ArrayList<Element>();
ctrlMap.put(name, list);
- set = new HashSet<Integer>();
+ set = new HashSet<Node>();
fieldSetMap.put(name, set);
}
list.add(ctrl);
- set.add(fieldsetIndex);
+
+ Node fieldset = HtmlTagUtil.getAncestor(ctrl, "fieldset");
+ set.add(fieldset);
}
public List<Vector<Node>> getErrorList() {
List<Vector<Node>> returns = new ArrayList<Vector<Node>>();
for (String key : fieldSetMap.keySet()) {
- if (fieldSetMap.get(key).size() > 1) {
+ //System.out.println(key + " : " + fieldSetMap.get(key).size());
+ int size = fieldSetMap.get(key).size();
+ if (size > 1) {
+ returns.add(new Vector<Node>(ctrlMap.get(key)));
+ } else if (size == 1 && null == fieldSetMap.get(key).toArray()[0]) {
returns.add(new Vector<Node>(ctrlMap.get(key)));
}
}