ItEr56S04ValidacionEProbasFuncionaisItEr55S04: [Bug #423] Prevent NoSuchElementException when clicking in some places of a bandboxMultipleSearch.
This commit is contained in:
parent
2e61fe3564
commit
1c42ba6349
1 changed files with 14 additions and 6 deletions
|
|
@ -24,6 +24,7 @@ import static org.navalplanner.web.I18nHelper._;
|
|||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.NoSuchElementException;
|
||||
|
||||
import javax.servlet.ServletContext;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
|
|
@ -134,11 +135,13 @@ public class BandboxMultipleSearch extends HtmlMacroComponent {
|
|||
}
|
||||
|
||||
private void pickElementFromListAndCloseBandbox() {
|
||||
final Object object = getSelectedItem().getValue();
|
||||
if (multipleFiltersFinder.isValidNewFilter(object)) {
|
||||
addSelectedElement(object);
|
||||
clearListbox();
|
||||
listbox.setModel(getSubModel());
|
||||
if(getSelectedItem() != null) {
|
||||
final Object object = getSelectedItem().getValue();
|
||||
if (multipleFiltersFinder.isValidNewFilter(object)) {
|
||||
addSelectedElement(object);
|
||||
clearListbox();
|
||||
listbox.setModel(getSubModel());
|
||||
}
|
||||
}
|
||||
bandbox.close();
|
||||
}
|
||||
|
|
@ -239,7 +242,12 @@ public class BandboxMultipleSearch extends HtmlMacroComponent {
|
|||
}
|
||||
|
||||
private Listitem getSelectedItem() {
|
||||
return (Listitem) listbox.getSelectedItems().iterator().next();
|
||||
try {
|
||||
return (Listitem) listbox.getSelectedItems().iterator().next();
|
||||
}
|
||||
catch (NoSuchElementException e) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
public void setDisabled(boolean disabled) {
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue