Peter Nabbefeld created NETBEANS-914:
----------------------------------------
Summary: Generated WizardDescriptor.InstantiatingIterator contains
suspicious code
Key: NETBEANS-914
URL: https://issues.apache.org/jira/browse/NETBEANS-914
Project: NetBeans
Issue Type: Improvement
Affects Versions: 9.0
Environment: Linux
Reporter: Peter Nabbefeld
The InstantiatingIterator contains following code:
String[] steps = createSteps();
for (int i = 0; i < panels.size(); i++) {
Component c = panels.get(i).getComponent();
if (steps[i] == null) {
// Default step name to component name of panel. Mainly
// useful for getting the name of the target chooser to
// appear in the list of steps.
steps[i] = c.getName();
}
Here, "steps" is used as a zero-based array.
It uses following method:
private String[] createSteps() {
String[] beforeSteps =
(String[])wizard.getProperty("WizardPanel_contentData");
assert beforeSteps != null : "This wizard may only be used embedded in the
template wizard";
String[] res = new String[(beforeSteps.length - 1) + panels.size()];
for (int i = 0; i < res.length; i++) {
if (i < (beforeSteps.length - 1)) {
res[i] = beforeSteps[i];
} else {
res[i] = panels.get(i - beforeSteps.length +
1).getComponent().getName();
}
}
return res;
}
Here, "steps" has a bias-value (the size of beforeSteps - 1), which seems to be
zero in most cases, but the different usage may cause errors if bias > 0.
Probably it should be made clear, what this bias value exactly is, and then it
should also be used in the code above, if needed.
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]
For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists