3

I am using an external library called superCSV and this library apparently makes use of isEmpty. After a search on SO, I found that this method was introduced in 2.3 and indeed the crash I am getting is from 2.2

Is there anyway I can fix it that while still using the library? Perhaps provide an implementation of isEmpty? or somehow get it not to crash? Thank you

Snake
  • 14,228
  • 27
  • 117
  • 250

2 Answers2

4

Are you using the latest version of SuperCSV?
This has been fixed with SuperCSV 2.0.1 (and higher) by restoring Java 5 compatibility.

You can see the related commit here: http://sourceforge.net/p/supercsv/code/264/

Instead of calling java.lang.String.isEmpty() the library is now doing a simple check for String.length() == 0. That should fix your problem.

jenzz
  • 7,239
  • 6
  • 49
  • 69
  • Perfect! I guess I didn't realize they introduced a new version. – Snake Jan 15 '13 at 21:36
  • Thanks @Jens, you beat me to it :) It's funny that the only people to report this are Android devs (both this question and the bug on SF were) - we were in beta for 2.0.0 for a month or so and no users picked it up (until after the release). So I'm guessing Java 5 is on the decline finally, though as I mentioned on SF, Android pre-Gingerbread is based on Java 5, so I had to fix it pretty quick ;) – James Bassett Jan 16 '13 at 01:25
2

If you have the source of the library, change the call to from isEmpty() to equals("").

If you don't have the source of the library, not really.

Gabe Sechan
  • 90,003
  • 9
  • 87
  • 127
  • The source is available at http://supercsv.sourceforge.net/. You could also try changing the Java compiler for the project to 1.6 instead of 1.5. – jim Jan 15 '13 at 21:19