When using classpath-inetlib 1.1.1, I found that some servers will use
tabs instead of spaces when returning a LIST result. The RFC does
specify that commands may use tabs, but does not state about results.
This patch fixes crashes on 3/21 servers that I tested (when using the
NNTPConnection.listNewsgroups() function).
The patch should be applied to
inetlib-1.1.1/source/gnu/inet/nntp/PairIterator.java
*** PairIterator.orig.java 2004-11-25 15:15:05.000000000 -0700
--- PairIterator.java 2009-01-17 01:17:16.000000000 -0700
***************
*** 80,86 ****
--- 80,93 ----
// Parse line
int start = 0, end;
+
+ // The RFC is somewhat unclear what is allowed to seperate fields. For
+ // commands either space or tab are allowed, returned text is less
+ // defined. Some servers do separate fields with the tab character.
end = line.indexOf(' ', start);
+ if (end == -1) {
+ end = line.indexOf('\t');
+ }
String key = line.substring(start, end);
start = end + 1;
String value = line.substring(start);