232 // less than pos. Since docPosns is a list of pairs of integers |
232 // less than pos. Since docPosns is a list of pairs of integers |
233 // we must make sure the index is always even. |
233 // we must make sure the index is always even. |
234 // If we find an exact match for pos, the other item in the pair |
234 // If we find an exact match for pos, the other item in the pair |
235 // gives the source pos; otherwise, compute the source position |
235 // gives the source pos; otherwise, compute the source position |
236 // relative to the best match found in the array. |
236 // relative to the best match found in the array. |
|
237 if (pos == Position.NOPOS) |
|
238 return Position.NOPOS; |
237 if (pos < 0 || pos >= docComment.length()) |
239 if (pos < 0 || pos >= docComment.length()) |
238 throw new StringIndexOutOfBoundsException(); |
240 throw new StringIndexOutOfBoundsException(String.valueOf(pos)); |
239 if (docPosns == null) |
241 if (docPosns == null) |
240 return -1; |
242 return Position.NOPOS; |
241 int start = 0; |
243 int start = 0; |
242 int end = docPosns.length; |
244 int end = docPosns.length; |
243 while (start < end - 2) { |
245 while (start < end - 2) { |
244 // find an even index midway between start and end |
246 // find an even index midway between start and end |
245 int index = ((start + end) / 4) * 2; |
247 int index = ((start + end) / 4) * 2; |