in ingestion-beam/src/main/java/com/mozilla/telemetry/amplitude/ParseAmplitudeEvents.java [218:255]
List<String[]> readAllowedEventsFromFile() throws IOException {
if (singletonAllowedEvents != null) {
return singletonAllowedEvents;
}
if (eventsAllowListPath == null) {
throw new IllegalArgumentException("File location must be defined");
}
synchronized (ParseAmplitudeEvents.class) {
if (singletonAllowedEvents == null) {
try (InputStream inputStream = BeamFileInputStream.open(eventsAllowListPath);
InputStreamReader inputStreamReader = new InputStreamReader(inputStream);
BufferedReader reader = new BufferedReader(inputStreamReader)) {
singletonAllowedEvents = new ArrayList<String[]>();
while (reader.ready()) {
String line = reader.readLine();
if (line != null && !line.isEmpty()) {
String[] separated = line.split(",");
if (separated.length != 4) {
throw new IllegalArgumentException(
"Invalid mapping: " + line + "; four-column csv expected");
}
singletonAllowedEvents.add(separated);
}
}
} catch (IOException e) {
throw new IOException("Exception thrown while fetching " + eventsAllowListPath, e);
}
}
}
return singletonAllowedEvents;
}