Open ghost opened 10 years ago
Adding some more specifics:
NPE happens in a less file which contains an import statement using an improper file extension, e.g. @import "style.xx";
As long as this file extension error exists any character typed or deleted will raise the above mentioned NPE.
After correcting the file extension the NPE no longer appears.
My session data: eclipse.buildId=4.4.1.M20140925-0400 java.version=1.8.0_25 java.vendor=Oracle Corporation BootLoader constants: OS=win32, ARCH=x86_64, WS=win32, NL=en_US Framework arguments: -product org.eclipse.epp.package.php.product Command-line arguments: -os win32 -ws win32 -arch x86_64 -product org.eclipse.epp.package.php.product
Same NPE gets raised on @import with absolute path. Any keystroke in the editor will raise the NPE.
same issue (error message on every click) with @import url('https://fonts.googleapis.com/css?family=Open+Sans:400,400italic,700'); in the style.less file.
same here using
Version: Luna Release (4.4.0)
Build id: 20140612-0600
Eclipse Web Developer Tools
Version: 3.6.1.v201409112028
LESS 1.0.22 net.vtst.ow.eclipse.less.feature.feature.group Vincent Simonet
as a workaround i added the .less
extension for all imports
I believe the ResolvedImportStatement constructor is to blame, I don't think it's correctly identifying a lack of extension as a .less file import and thus not noticing that it doesn't set the stylesheet correctly, leaving it null.
Side-Note: When adding the file extension, variables don't get recognized any longer from the imported file.
Blocking issue without workaround for now. I've tried to downgrade Xtext from 2.7.3 to 2.7.2 without success (same error):
java.lang.NullPointerException
at net.vtst.ow.eclipse.less.scoping.LessImportingStatementFinder$ResourceAdapter.update(LessImportingStatementFinder.java:233)
Here is the code implied in this error:
// TODO: What happen when a resource is deleted? Is it counter removed in all resources it is importing?
private void update() {
// Clear the importing statements
for (ResourceAdapter adapter: this.importedResources) {
adapter.removeImportingStatement(this.resource);
}
this.importedResources.clear();
// Add the importing statement
StyleSheet styleSheet = this.getStyleSheet();
if (styleSheet != null) {
for (ResolvedImportStatement ris : importStatementResolver.getResolvedImportStatements(styleSheet)) {
if (!ris.hasError()) {
// TODO: This might be null?
ResourceAdapter adapter = getOrCreateResourceAdapter(ris.getImportedStyleSheet().eResource());
importedResources.add(adapter);
adapter.addImportingStatement(this.resource, ris.getStatement());
}
}
}
}
Please note the TODO just above the line causing the NullPointerException.
This also happens for me with an import of a file called "something.less.css", both this file and "something.less" exists (the former beeing the compiled version of the latter).
same here:
eclipse.buildId=4.5.1.M20150904-0015
java.version=1.8.0_65
java.vendor=Oracle Corporation
BootLoader constants: OS=win32, ARCH=x86_64, WS=win32, NL=pl_PL
Framework arguments: -product org.eclipse.epp.package.jee.product
Command-line arguments: -os win32 -ws win32 -arch x86_64 -product org.eclipse.epp.package.jee.product
java.lang.NullPointerException
at net.vtst.ow.eclipse.less.scoping.LessImportingStatementFinder$ResourceAdapter.update(LessImportingStatementFinder.java:233)
at net.vtst.ow.eclipse.less.scoping.LessImportingStatementFinder$ResourceAdapter.notifyChanged(LessImportingStatementFinder.java:182)
at org.eclipse.emf.common.notify.impl.BasicNotifierImpl.eNotify(BasicNotifierImpl.java:374)
at org.eclipse.emf.common.notify.impl.NotificationChainImpl.dispatch(NotificationChainImpl.java:98)
at org.eclipse.emf.common.notify.impl.NotificationChainImpl.dispatch(NotificationChainImpl.java:86)
at org.eclipse.emf.common.notify.impl.NotifyingListImpl.remove(NotifyingListImpl.java:718)
at org.eclipse.xtext.resource.SynchronizedXtextResourceSet$1.remove(SynchronizedXtextResourceSet.java:404)
at org.eclipse.xtext.resource.SynchronizedXtextResourceSet$1.remove(SynchronizedXtextResourceSet.java:1)
at org.eclipse.emf.common.util.AbstractEList.remove(AbstractEList.java:462)
at org.eclipse.xtext.resource.SynchronizedXtextResourceSet$1.remove(SynchronizedXtextResourceSet.java:133)
at org.eclipse.xtext.builder.clustering.ClusteringBuilderState.doUpdate(ClusteringBuilderState.java:267)
at org.eclipse.xtext.builder.builderState.AbstractBuilderState.update(AbstractBuilderState.java:115)
at org.eclipse.xtext.builder.impl.XtextBuilder.doBuild(XtextBuilder.java:248)
at org.eclipse.xtext.builder.impl.XtextBuilder.fullBuild(XtextBuilder.java:280)
at org.eclipse.xtext.builder.impl.XtextBuilder.build(XtextBuilder.java:117)
at org.eclipse.core.internal.events.BuildManager$2.run(BuildManager.java:734)
at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:42)
at org.eclipse.core.internal.events.BuildManager.basicBuild(BuildManager.java:205)
at org.eclipse.core.internal.events.BuildManager.basicBuild(BuildManager.java:245)
at org.eclipse.core.internal.events.BuildManager$1.run(BuildManager.java:300)
at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:42)
at org.eclipse.core.internal.events.BuildManager.basicBuild(BuildManager.java:303)
at org.eclipse.core.internal.events.BuildManager.basicBuildLoop(BuildManager.java:359)
at org.eclipse.core.internal.events.BuildManager.build(BuildManager.java:382)
at org.eclipse.core.internal.events.AutoBuildJob.doBuild(AutoBuildJob.java:144)
at org.eclipse.core.internal.events.AutoBuildJob.run(AutoBuildJob.java:235)
at org.eclipse.core.internal.jobs.Worker.run(Worker.java:55)
any update on this? this plugin seems the only less editor available in eclipse.
Sorry, I've moved on to Netbeans and SCSS/Sass
@pamtbaau oh :(
@vtst do you have time to check this?
Same here with Google fonts import.
With Eclipse Luna,I am getting a java.lang.NullPointerException when i try to edit a LESS file.
It seems that after typing any char triggers the exception.
here is the stack trace:
java.lang.NullPointerException at net.vtst.ow.eclipse.less.scoping.LessImportingStatementFinder$ResourceAdapter.update(LessImportingStatementFinder.java:233) at net.vtst.ow.eclipse.less.scoping.LessImportingStatementFinder$ResourceAdapter.notifyChanged(LessImportingStatementFinder.java:182) at org.eclipse.emf.common.notify.impl.BasicNotifierImpl.eNotify(BasicNotifierImpl.java:374) at org.eclipse.emf.common.notify.impl.NotifyingListImpl.dispatchNotification(NotifyingListImpl.java:261) at org.eclipse.emf.common.notify.impl.NotifyingListImpl.addUnique(NotifyingListImpl.java:356) at org.eclipse.emf.common.util.AbstractEList.add(AbstractEList.java:341) at org.eclipse.xtext.resource.XtextResource.updateInternalState(XtextResource.java:256) at org.eclipse.xtext.resource.XtextResource.updateInternalState(XtextResource.java:250) at org.eclipse.xtext.resource.XtextResource.doLoad(XtextResource.java:163) at org.eclipse.xtext.linking.lazy.LazyLinkingResource.doLoad(LazyLinkingResource.java:81) at org.eclipse.xtext.resource.XtextResource.reparse(XtextResource.java:196) at org.eclipse.xtext.ui.editor.model.XtextDocument$XtextDocumentLocker.modify(XtextDocument.java:225) at org.eclipse.xtext.ui.editor.model.XtextDocument.internalModify(XtextDocument.java:103) at org.eclipse.xtext.ui.editor.reconciler.XtextReconciler.run(XtextReconciler.java:290) at org.eclipse.core.internal.jobs.Worker.run(Worker.java:54)