MER-C/wiki-java

Nullpointer in exists method for pages with additional whitespaces

Closed this issue · 5 comments

When calling the "exists" method with a page with leading, trailing or multiple 
connected whitespaces a NullPointerException is thrown. Example page names: " 
Foo", "Foo " or "Foo  Bar".

Seems that meadiawiki internally removes these whitespaces causing the problem 
that the results of getPageInfo cannot be matched by the titles parameter.

Original issue reported on code.google.com by arnd.sch...@gmail.com on 23 Apr 2014 at 5:01

Does changing char[] temp = s.toCharArray(); to char[] temp = 
s.trim().toCharArray(); in normalize() fix this problem? (This will be 
committed with the next major changes.)

Original comment by stop.squark on 12 May 2014 at 10:56

It think it will help in cases of leading and trailing whitespaces but not for 
multiple ones such as in "Foo  Bar".

Original comment by arnd.sch...@gmail.com on 13 May 2014 at 6:32

new String(temp).replace("\\s{2,}", " ") should take care of the latter.

Original comment by stop.squark on 17 May 2014 at 4:00

Not sure, one needs to test this. Generally, i would suggest that one looks 
into the mediawiki code or asks the guys there and apply the same code in your 
lib.

Original comment by arnd.sch...@gmail.com on 17 May 2014 at 6:20

This issue was closed by revision r201.

Original comment by stop.squark on 26 May 2014 at 11:55

  • Changed state: Fixed