ervandew / eclim

Expose eclipse features inside of vim.
http://eclim.org
GNU General Public License v3.0
1.04k stars 127 forks source link

JavaDocSearch has an issue with fragment identifier #249

Open gkb opened 11 years ago

gkb commented 11 years ago

I noticed a problem when looking up the javadoc for methods using JavaDocSearch. There's a hashmark in the fragment identifier of the URL which should't be URL encoded. But this URL http://docs.oracle.com/javase/7/docs/api/javax/xml/transform/sax/SAXSource.html#SAXSource(org.xml.sax.XMLReader, org.xml.sax.InputSource) comes across instead as http://docs.oracle.com/javase/7/docs/api/javax/xml/transform/sax/SAXSource.html%23SAXSource(org.xml.sax.XMLReader, org.xml.sax.InputSource) which not unexpectedly returns in a 404. I thought the problem lay in the substitutions performed in this file ./org.eclim.core/vim/eclim/autoload/eclim/html/util.vim, but removing line 103 didn't change the URL.

  let result = substitute(result, '#', '%23', 'g')
ervandew commented 11 years ago

I finally got a chance to start looking at this, but so far I've been unable to reproduce the issue. When I run a :JavaDocSearch on a member (constructor, method, etc), the # comes back unencoded:

$ /opt/eclipse/eclim --nailgun-port 9091 -pretty -command java_docsearch -n eclim -f org.eclim/java/org/eclim/Services.java -o 1282 -e utf-8 -l 11 -x declarations
[
  "http://download.oracle.com/javase/7/docs/api/java/lang/System.html#getProperty(java.lang.String)"
]

I even constructed an example using SAXSource, but it worked as expected.

gkb commented 11 years ago
system: "/Applications/eclipse/plugins/org.eclim_2.3.2.7-g4bc267b/bin/eclim" --nai
lgun-port 9091 -editor vim -command java_docsearch -n "Core_Java" -f "trans
form/TransformTest.java" -o 1379 -e utf-8 -l 9
1 more line; before #1  2 seconds ago

Here's the snippet of code that I alluded to earlier. I positioned my cursor on the constructor for SAXSource and ran the :JavaDocSearch command. Maybe eclim was confused by the constructor. My expectation was that I'd get the link to the constructor or class in the Javadoc.

t.transform(new SAXSource(new EmployeeReader(), new InputSource(docIn)), 
               new StreamResult(System.out));
ervandew commented 11 years ago

Can you run this in a console and post the output?

$ /Applications/eclipse/eclim --pretty -command java_docsearch -n Core_Java -f transform/TransformTest.java -o 1379 -e utf-8 -l 9

When I get a chance I'll try reproducing this on OSX.

gkb commented 11 years ago

Eric, thanks for looking into this. The output of the command you provided looks perfect:

[
 "http://download.oracle.com/javase/7/docs/api/javax/xml/transform/sax/SAXSource.html#SAXSource(org.xml.sax.XMLReader, org.xml.sax.InputSource)"
]
ervandew commented 10 years ago

I just got a chance to start playing with this on OSX and I immediately ran into an issue with eclim's default usage of open <url> that would fail completely on the above example. I've fixed that issue, but in trying to test the problem you are encountering I can't find any reference to a chrome script/binary. Can you point me at where I would find that?

I did test forcing open to use chrome with no issues using:

:let g:EclimBrowser = 'open -a "Google Chrome"' 
gkb commented 10 years ago

Sorry about the delay. I wanted to provide a more helpful answer than just writing that I still get the same error. I tried to find javadoc help for newInputStream on the line quoted below. I get directed to http://docs.oracle.com/javase/7/docs/api/java/nio/file/Files.html%23newInputStream(java.nio.file.Path,%20java.nio.file.OpenOption...) instead of http://docs.oracle.com/javase/7/docs/api/java/nio/file/Files.html#newInputStream(java.nio.file.Path,%20java.nio.file.OpenOption...).

      try (InputStream styleIn = Files.newInputStream(path))

Can you point me at where I would find that?

Oh, that was a softlink to the Chrome binary I created. It doesn't get created by default. But to keep things consistent, I set the value of g:EclimBrowser to 'open -a "Google Chrome"' while testing it now.

I'm going to try and completely uninstall eclim and reinstall it again to see if it fixes things.

Thanks again!

PS-Reinstalled it after pulling in the latest updates to the repo. But no dice. I continue to get the same error.