text: public String[] listAll() throws IOException {List<String> files = new ArrayList<>();NoSuchFileException exc = null;try {for(String f : primaryDir.listAll()) {String ext = getExtension(f);if (primaryExtensions.contains(ext)) {files.add(f);}}} catch (NoSuchFileException e) {exc = e;}try {for(String f : secondaryDir.listAll()) {String ext = getExtension(f);if (primaryExtensions.contains(ext) == false) {files.add(f);}}} catch (NoSuchFileException e) {if (exc != null) {throw exc;}if (files.isEmpty()) {throw e;}}if (exc != null && files.isEmpty()) {throw exc;}String[] result = files.toArray(new String[files.size()]);Arrays.sort(result);return result;}