log.info("No input files in {}", inputDir);
return;
}
Arrays.sort(inputFiles, ByLastModifiedComparator.INSTANCE);
IDMigrator hash = new OneWayMigrator();
int lines = 0;
int badLines = 0;
for (File inputFile : inputFiles) {
log.info("Reading {}", inputFile);
for (String line : new FileLineIterable(inputFile)) {
if (badLines > 100) { // Crude check
throw new IOException("Too many bad lines; aborting");
}
lines++;
if (line.isEmpty() || line.charAt(0) == '#') {
continue;
}
Iterator<String> it = COMMA.split(line).iterator();
long userID;
boolean userIsTag;
long itemID;
boolean itemIsTag;
float value;
try {
String userIDString = it.next();
userIsTag = userIDString.startsWith("\"");
if (userIsTag) {
userID = hash.toLongID(userIDString.substring(1, userIDString.length() - 1));
} else {
userID = Long.parseLong(userIDString);
}
String itemIDString = it.next();
itemIsTag = itemIDString.startsWith("\"");
if (itemIsTag) {
itemID = hash.toLongID(itemIDString.substring(1, itemIDString.length() - 1));
} else {
itemID = Long.parseLong(itemIDString);
}
if (it.hasNext()) {