Patch to Pebble submitted

The problem was caused by the madicon RSS Reader (which it turns out is a Lotus Notes application). Madicon apparently supplies a referer of “0” when accessing my RSS feed. The following is from the log (again – RegEx to the rescue):

lekkimworld@splinter:~/blogs/lekkimworld/logs > cat * | egrep " "GET .* - - "0"
<hostname> - - [08/Aug/2005:09:56:30 +0200] "GET /rdf.xml" - - "0" "madicon RSS Reader"
<hostname> - - [08/Aug/2005:09:57:56 +0200] "GET /rss.xml" - - "0" "madicon RSS Reader"
<hostname> - - [08/Aug/2005:11:29:21 +0200] "GET /rss.xml" - - "0" "madicon RSS Reader"
...
...
...
lekkimworld@splinter:~/blogs/lekkimworld/logs >

I created an issue in the Pebble JIRA but as a good Open Source citizen I tried to fix the issue myself. The issue turned out to be quite easy to solve and was caused by a missing equal sign in the code (in my case the getUrl() would return a java.lang.String of “0”).

The code was:
int index = getUrl().indexOf("://");
if (index < -1) {
   return getUrl();
}

But should be:
int index = getUrl().indexOf("://");
if (index <= -1) {
   return getUrl();
}

People programming in Java knows that the indexOf (similar to the LotusScript instr-function) returns -1 if the substring cannot be found so the Exception is thrown since the test for “less than -1” is never true.

Link to issue in Pebble JIRA.

Updates:
Updated on 14 August 2005: Uploaded patch to the JUnit test case as well.