Community
Participate
Working Groups
Build Identifier: 20110301-1815 I created my own EFS. In a project, I link to a folder in that EFS. When I do this, I get an NPE: 1) Select the link 2) CTRL-C 3) Go to another (ordinary) project and do CTRL-V The NPE occurs in LocationValidator.validateLocation: public IStatus validateLinkLocation(IResource resource, IPath unresolvedLocation) { IPath location = resource.getPathVariableManager().resolvePath(unresolvedLocation); if (location.isEmpty()) return new ResourceStatus(IResourceStatus.INVALID_VALUE, resource.getFullPath(), Messages.links_noPath); //check that the location is absolute if (!location.isAbsolute()) { //we know there is at least one segment, because of previous isEmpty check String message = NLS.bind(Messages.pathvar_undefined, location.toOSString(), location.segment(0)); return new ResourceStatus(IResourceStatus.VARIABLE_NOT_DEFINED_WARNING, resource.getFullPath(), message); } //if the location doesn't have a device, see if the OS will assign one if (location.getDevice() == null) location = new Path(location.toFile().getAbsolutePath()); return validateLinkLocationURI(resource, URIUtil.toURI(location)); } The "location" variable is null so the "if (location.isEmpty())" throws NPE. The cause is in Resource.getRawLocation: public IPath getRawLocation() { if (isLinked()) return FileUtil.toPath(((Project) getProject()).internalGetDescription().getLinkLocationURI(getProjectRelativePath())); return getLocation(); } My resource is a link (link to my EFS folder). The FileUtil.toPath therefore receives a URI with my URI-scheme. FileUtil.toPath does this: public static IPath toPath(URI uri) { if (uri == null) return null; final String scheme = uri.getScheme(); // null scheme represents path variable if (scheme == null || EFS.SCHEME_FILE.equals(scheme)) return new Path(uri.getSchemeSpecificPart()); return null; } Since I'm not using an ordinary EFS.SCHEME_FILE-scheme this routine returns null. The null propagates until we get the NPE. Reproducible: Always
Seems to be a regression of https://bugs.eclipse.org/bugs/show_bug.cgi?id=163968
This bug hasn't had any activity in quite some time. Maybe the problem got resolved, was a duplicate of something else, or became less pressing for some reason - or maybe it's still relevant but just hasn't been looked at yet. If you have further information on the current state of the bug, please add it. The information can be, for example, that the problem still occurs, that you still want the feature, that more information is needed, or that the bug is (for whatever reason) no longer relevant. -- The automated Eclipse Genie.