|
@@ -79,8 +79,7 @@ class WordEncoder {
|
|
* @throws IllegalArgumentException If the encoded string doesn't consist of a multiple of two words or one of the words is unknown to this encoder.
|
|
* @throws IllegalArgumentException If the encoded string doesn't consist of a multiple of two words or one of the words is unknown to this encoder.
|
|
*/
|
|
*/
|
|
public byte[] decode(String encoded) {
|
|
public byte[] decode(String encoded) {
|
|
- Preconditions.checkArgument(!Strings.isNullOrEmpty(encoded));
|
|
|
|
- List<String> splitted = Splitter.on(DELIMITER).omitEmptyStrings().splitToList(encoded);
|
|
|
|
|
|
+ List<String> splitted = Splitter.on(DELIMITER).omitEmptyStrings().splitToList(Strings.nullToEmpty(encoded));
|
|
Preconditions.checkArgument(splitted.size() % 2 == 0, "%s needs to be a multiple of two words", encoded);
|
|
Preconditions.checkArgument(splitted.size() % 2 == 0, "%s needs to be a multiple of two words", encoded);
|
|
byte[] result = new byte[splitted.size() / 2 * 3];
|
|
byte[] result = new byte[splitted.size() / 2 * 3];
|
|
for (int i = 0; i < splitted.size(); i+=2) {
|
|
for (int i = 0; i < splitted.size(); i+=2) {
|