* This seems to be used sometimes, but I am not able to find documentation
* on its origin or official format?
*
- * @author srowen@google.com (Sean Owen)
+ * @author Sean Owen
*/
final class URLTOResultParser {
public static URIParsedResult parse(Result result) {
String rawText = result.getText();
- if (rawText == null || !rawText.startsWith("URLTO:")) {
+ if (rawText == null || (!rawText.startsWith("urlto:") && !rawText.startsWith("URLTO:"))) {
return null;
}
int titleEnd = rawText.indexOf(':', 6);
if (titleEnd < 0) {
return null;
}
- String title = rawText.substring(6, titleEnd);
+ String title = titleEnd <= 6 ? null : rawText.substring(6, titleEnd);
String uri = rawText.substring(titleEnd + 1);
return new URIParsedResult(uri, title);
}