[
https://issues.jboss.org/browse/JBIDE-12609?page=com.atlassian.jira.plugi...
]
Victor Rubezhny commented on JBIDE-12609:
-----------------------------------------
Issue is fixed (including NPE in steps ##9-10).
JUnit Test Case org.jboss.tools.jsf.text.ext.test.JSF2BeanMapValuesOpenOnTest is added for
the issue.
NPE when validating EL which uses java.util.Map
-----------------------------------------------
Key: JBIDE-12609
URL:
https://issues.jboss.org/browse/JBIDE-12609
Project: Tools (JBoss Tools)
Issue Type: Bug
Components: jsp/jsf/xml source editing
Affects Versions: 4.0.0.Alpha2
Reporter: Alexey Kazakov
Assignee: Victor Rubezhny
Fix For: 4.0.0.Alpha2
1. Create JSF 2 KickStart project
2. Modify User.java:
{code}
package demo;
import java.util.Collection;
import java.util.HashMap;
import java.util.Map;
import javax.faces.bean.ManagedBean;
import javax.faces.bean.SessionScoped;
@ManagedBean(name="user")
@SessionScoped
public class User {
private Map<String, User> users = new HashMap<String, User>();
private Map<String, Collection> list = new HashMap<String, Collection>();
private String name;
public User() {
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String sayHello() {
return "greeting";
}
public Map<String, User> getUsers() {
return users;
}
public void setUsers(Map<String, User> users) {
this.users = users;
}
public Map<String, Collection> getList() {
return list;
}
public void setList(Map<String, Collection> list) {
this.list = list;
}
}
{code}
3. Open inputname.xhtml
4. Add <ui:param name="group" value="#{user}" /> inside
<ui:composition> (line #9)
5. Save the file.
6. Open common.xhtml
7. Add <h:outputText value="#{group.users['admin'].nam}" />
8. See the log:
{code}
Caused by: java.lang.NullPointerException
at
org.jboss.tools.jst.web.kb.internal.validation.ELValidator.validateElOperand(ELValidator.java:493)
at
org.jboss.tools.jst.web.kb.internal.validation.ELValidator.validateELExpression(ELValidator.java:350)
at
org.jboss.tools.jst.web.kb.internal.validation.ELValidator.validateEL(ELValidator.java:325)
at
org.jboss.tools.jst.web.kb.internal.validation.ELValidator.validate(ELValidator.java:270)
at
org.jboss.tools.common.validation.AsYouTypeValidatorManager.validate(AsYouTypeValidatorManager.java:174)
... 10 more
{code}
9. Press Ctrl and move the mouse over ['admin']
10. See the log:
{code}
java.lang.NullPointerException
at
org.jboss.tools.common.el.core.resolver.ELSegmentImpl$1.getStartPosition(ELSegmentImpl.java:63)
at
org.jboss.tools.common.el.core.resolver.ELResolutionImpl.findSegmentByOffset(ELResolutionImpl.java:94)
at
org.jboss.tools.jst.text.ext.hyperlink.ELHyperlinkDetector.detectHyperlinks(ELHyperlinkDetector.java:61)
at
org.eclipse.ui.texteditor.HyperlinkDetectorRegistry$HyperlinkDetectorDelegate.detectHyperlinks(HyperlinkDetectorRegistry.java:80)
at
org.eclipse.jface.text.hyperlink.HyperlinkManager.findHyperlinks(HyperlinkManager.java:286)
at
org.eclipse.jface.text.hyperlink.HyperlinkManager.findHyperlinks(HyperlinkManager.java:258)
at
org.eclipse.jface.text.hyperlink.HyperlinkManager.mouseMove(HyperlinkManager.java:462)
at org.eclipse.swt.widgets.TypedListener.handleEvent(TypedListener.java:212)
...
{code}
11. Add <h:outputText value="#{group.users['admin'].name}" />
12. Try Ctrl+Click on name. java.util.Iterator is open instead of User.getName()
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see:
http://www.atlassian.com/software/jira