Limit names to 100 bytes
This commit is contained in:
committed by
Gunnar Morling
parent
a094d07925
commit
e09cb7deea
@@ -21,6 +21,7 @@ import java.io.FileReader;
|
||||
import java.io.FileWriter;
|
||||
import java.io.IOException;
|
||||
import java.io.StringReader;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashSet;
|
||||
import java.util.concurrent.ThreadLocalRandom;
|
||||
@@ -113,6 +114,9 @@ public class CreateMeasurements3 {
|
||||
while (names.contains(name)) {
|
||||
name = name.substring(1) + readNonSpace(nameSource);
|
||||
}
|
||||
while (name.getBytes(StandardCharsets.UTF_8).length > 100) {
|
||||
name = name.substring(0, name.length() - 1);
|
||||
}
|
||||
if (name.indexOf(';') != -1) {
|
||||
throw new Exception("Station name contains a semicolon!");
|
||||
}
|
||||
|
Reference in New Issue
Block a user