Skip to content

Commit

Permalink
Catch ValueError when parsing javadoc refs
Browse files Browse the repository at this point in the history
If javadoc contains a reference without a package ({@link #sort(List)})
i.e. the call to rindex will fail with a ValueError.  This change eats
that exception and continues processing
  • Loading branch information
Rob LaRubbio committed Jan 10, 2014
1 parent 23c3e4a commit 059b720
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions javasphinx/extdoc.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,15 @@ def get_javadoc_ref(app, rawtext, text):
method = None

if '(' in text:
split_point = text.rindex('.', 0, text.index('('))
method = text[split_point + 1:]
text = text[:split_point]
# If the javadoc contains a line like this:
# {@link #sort(List)}
# there is no package so the text.rindex will fail
try:
split_point = text.rindex('.', 0, text.index('('))
method = text[split_point + 1:]
text = text[:split_point]
except ValueError:
pass

for pkg, (baseurl, ext_type) in javadoc_url_map.items():
if text.startswith(pkg + '.') and len(pkg) > len(package):
Expand Down

0 comments on commit 059b720

Please sign in to comment.