Permalink
Browse files

Fix usage of String.split

The build currently fails with this error:

```
/Users/prateek/dev/src/github.com/f2prateek/rx-preferences/rx-preferences/src/test/java/com/f2prateek/rx/preferences2/PointPreferenceConverter.java:7: warning: [StringSplitter] String.split(String) has surprising behavior
    String[] parts = serialized.split(",");
                                     ^
    (see http://errorprone.info/bugpattern/StringSplitter)
  Did you mean 'String[] parts = serialized.split(",", -1);'?
error: warnings found and -Werror specified
1 error
```

This fixes the usage of String.split as recommended by http://errorprone.info/bugpattern/StringSplitter.
  • Loading branch information...
f2prateek committed Apr 22, 2018
1 parent acf2289 commit 4add60b60d894c9a95f7f781590231a6f17a21f1
@@ -4,7 +4,7 @@
final class PointPreferenceConverter implements Preference.Converter<Point> {
@NonNull @Override public Point deserialize(@NonNull String serialized) {
String[] parts = serialized.split(",");
String[] parts = serialized.split(",", -1);
if (parts.length != 2) {
throw new IllegalStateException("Malformed point value: '" + serialized + "'");
}

0 comments on commit 4add60b

Please sign in to comment.