If path is simple, i.e. just the project name, then ppath.lastSegment().equals(path) is true and as a consequence locatioURI is set to null (the default location). The parameter insidews is not taken into account in this case. Please fix that.

I think (!ppath.lastSegment().equals(path) || !insidews) would work.