Can we replace these four lines with just `String name = getFileName(name);`?