]
Martin Malina closed JBIDE-23040.
---------------------------------
Verified by [~lvalach]. (create jsf project, edit in external editor, go through build and
search)
NPE in ELReference when validating non-synchronized resources
-------------------------------------------------------------
Key: JBIDE-23040
URL:
https://issues.jboss.org/browse/JBIDE-23040
Project: Tools (JBoss Tools)
Issue Type: Bug
Components: common/jst/core
Affects Versions: 4.4.1.AM3
Reporter: Viacheslav Kabanovich
Assignee: Viacheslav Kabanovich
Fix For: 4.4.1.Final
Open in Eclipse workspace with a jsf project. Open one of page files in an external
editor and modify it. Do not open the file in an editor inside Eclipse. Rebuild project.
{code}
org.jboss.tools.common.validation.JBTValidationException
at
org.jboss.tools.common.validation.ValidatorManager.validate(ValidatorManager.java:147)
at
org.jboss.tools.common.validation.ValidatorManager.validateInJob(ValidatorManager.java:81)
at
org.eclipse.wst.validation.internal.core.ValidatorLauncher.start(ValidatorLauncher.java:77)
at org.eclipse.wst.validation.Validator$V1.validate(Validator.java:768)
at org.eclipse.wst.validation.Validator.validate(Validator.java:405)
at org.eclipse.wst.validation.internal.ValManager.validate(ValManager.java:704)
at org.eclipse.wst.validation.internal.ValManager$1.visit(ValManager.java:665)
at org.eclipse.wst.validation.internal.ValManager.accept(ValManager.java:810)
at org.eclipse.wst.validation.internal.ValManager.validate(ValManager.java:669)
at
org.eclipse.wst.validation.internal.ValidationRunner.execute(ValidationRunner.java:134)
at
org.eclipse.wst.validation.internal.ValidationRunner.validate(ValidationRunner.java:68)
at
org.eclipse.wst.validation.ui.internal.ManualValidationRunner.runInWorkspace(ManualValidationRunner.java:83)
at
org.eclipse.core.internal.resources.InternalWorkspaceJob.run(InternalWorkspaceJob.java:39)
at org.eclipse.core.internal.jobs.Worker.run(Worker.java:55)
Caused by: java.lang.NullPointerException
at org.jboss.tools.common.el.core.ELReference.getText(ELReference.java:175)
at org.jboss.tools.common.el.core.ELReference.getSourceText(ELReference.java:134)
at org.jboss.tools.common.el.core.ELReference.getEl(ELReference.java:164)
at
org.jboss.tools.jst.web.kb.internal.validation.ELValidator.validateEL(ELValidator.java:336)
at
org.jboss.tools.jst.web.kb.internal.validation.ELValidator.validate(ELValidator.java:209)
at
org.jboss.tools.common.validation.ValidatorManager.validate(ValidatorManager.java:140)
... 13 more
{code}
If the file is open in editor in Eclipse, its content is stored in a buffer, and method
FileUtil.getContentFromEditorOrFile(IFile) takes it from the buffer. When the file was not
open in editor in Eclipse, the content is not buffered, and the method accesses the file
but fails if it is not synchronized. However, clients of the method (e.g. search) may need
the content even if the file is not synchronized in order to check its relevance and
report synchronization problem only if the case is relevant. As it is, an error is logged
now any time when user's resources are not synchronized. So, I suggest not only
checking for null in ELReference but also returning in
FileUtil.getContentFromEditorOrFile(IFile) content from the file on disk (if it exists)
for not synchronized files.