You're right, I misread the spec http://docs.oracle.com/javase/6/docs/api/java/lang/String.html#trim%28%29.
Yet, there could be still rare cases, when it wouldn't be sufficient, e.g. \u2028, \u2029, \u0085 which might need a special handling and are not covered by java.lang.String#trim().
For now I'll change the implementation and will mention above problematic characters in the comment.