Menu

#92 ReverseSourceLookup.wrapNonVirtualContainer is out of sync with SourceNameMapperContainer.findSourceElements when using a WorkspaceSourceContainer

New
nobody
None
Medium
Defect
2013-09-12
2013-09-12
Anonymous
No

Originally created by: jcompag...@servoy.com

SDK/Debugger version: 0.3.9 (current checked trunk out)
Eclipse version: 3.7.2
Google Chrome/V8 Embedder + version: N/A
[For WebKit (WIP) protocol] Backend version: N/A
OS + version:

What steps will reproduce the problem?
I have a source mapper configured with Workspace scope.
because my urls are like this:

http://localhost:8080/test/test.js
http://localhost:8080/test2/test.js

the prefix is http://localhost:8080 (i can't use the extra slash because then setting breakpoints wants to send it to: http://localhost:8080//test/test.js so with an extra /)

the ReverseSourceLookup works perfect because /test/test.js on the workspace:

if (container instanceof WorkspaceSourceContainer) {
      return new ContainerWrapper() {
        @Override
        public String lookup(IFile resource) {
          return lookupInResourceContainer(resource, ResourcesPlugin.getWorkspace().getRoot());
        }
      };

when using that code so the resource == /test/test.js and the workspace root is really the workspace root then it finds my file correctly

But the implementation of WorkspaceSourceContainer is really that it genererates ProjectSourceContainers and ask the project source container on its name so it expects "test.js"
I think this is kind of a bug in eclipse. because thats not what i ask for.. I don't say that i want to search relative to a project, i want to search relative to the workspace root...

But the problem is that the reverse lookup does it how i expect it to behave but the other way around (when the breakpoint is hit) then it can't find it.

i patched it in SourceNameMapperContainer.findSourceElements

i added this part inside that method:

String shortName = name.substring(prefix.length());
    if (targetContainer instanceof WorkspaceSourceContainer) {
         IFile file = ResourcesPlugin.getWorkspace().getRoot().getFile(Path.fromOSString(shortName));
         if (file != null && file.exists()) return new Object[] {file};
    }

then it behaves the same and the source is found.

Discussion

  • Anonymous

    Anonymous - 2013-09-12

    Originally posted by: jcompag...@servoy.com

    to make it a bit more clear: test/test.js  that first test is really a project and that test.js is a file inside that project. This is because what is running in the browser is really multi project for us. So i make sure that the urls are also really constructed like this so that we can debug it nicely.

     
  • Anonymous

    Anonymous - 2013-09-12

    Originally posted by: jcompag...@servoy.com

    The problem is that ReverseSourceLookup on a WorkspaceSourceContainer can also go wrong just fine because that code (and my patch) expects that the project is really in the workspace root. This doesn't have to be the case.
    the project itself can be in a completely different location then the workspace root.

    So the right implementation should be to first get the project by name (the first name in the resource path) and then ask the project for the resources.

     

Log in to post a comment.

MongoDB Logo MongoDB