diff --git extensions/modeshape-connector-filesystem/src/main/java/org/modeshape/connector/filesystem/FileSystemI18n.java extensions/modeshape-connector-filesystem/src/main/java/org/modeshape/connector/filesystem/FileSystemI18n.java index 6d3ffb2..0b213dc 100644 --- extensions/modeshape-connector-filesystem/src/main/java/org/modeshape/connector/filesystem/FileSystemI18n.java +++ extensions/modeshape-connector-filesystem/src/main/java/org/modeshape/connector/filesystem/FileSystemI18n.java @@ -104,6 +104,7 @@ public final class FileSystemI18n { public static I18n maxPathLengthExceeded; public static I18n couldNotStoreProperty; public static I18n couldNotStoreProperties; + public static I18n couldNotReadListOfFilesInDirectory; static { try { diff --git extensions/modeshape-connector-filesystem/src/main/java/org/modeshape/connector/filesystem/FileSystemWorkspace.java extensions/modeshape-connector-filesystem/src/main/java/org/modeshape/connector/filesystem/FileSystemWorkspace.java index 79896dc..8852553 100644 --- extensions/modeshape-connector-filesystem/src/main/java/org/modeshape/connector/filesystem/FileSystemWorkspace.java +++ extensions/modeshape-connector-filesystem/src/main/java/org/modeshape/connector/filesystem/FileSystemWorkspace.java @@ -527,7 +527,20 @@ class FileSystemWorkspace extends PathWorkspace implements NodeCaching if (file == null) return null; if (file.isDirectory()) { - String[] childNames = file.list(source.filenameFilter(true)); + String[] childNames = null; + int attempts = 5; + while (childNames == null && (--attempts) >= 0) { + // there must have been an I/O error, so try again ... + childNames = file.list(source.filenameFilter(true)); + } + if (childNames == null) { + // Still null after multiple attempts; we can't really proceed. + // Meaning the file/directory will not be mapped as a node ... + Logger.getLogger(getClass()).error(FileSystemI18n.couldNotReadListOfFilesInDirectory, + file.getAbsolutePath(), + path.getString(registry)); + return null; + } Arrays.sort(childNames); List childSegments = new ArrayList(childNames.length); diff --git extensions/modeshape-connector-filesystem/src/main/resources/org/modeshape/connector/filesystem/FileSystemI18n.properties extensions/modeshape-connector-filesystem/src/main/resources/org/modeshape/connector/filesystem/FileSystemI18n.properties index 61e48a0..ed88f85 100644 --- extensions/modeshape-connector-filesystem/src/main/resources/org/modeshape/connector/filesystem/FileSystemI18n.properties +++ extensions/modeshape-connector-filesystem/src/main/resources/org/modeshape/connector/filesystem/FileSystemI18n.properties @@ -95,3 +95,4 @@ getCanonicalPathFailed = Could not determine canonical path maxPathLengthExceeded = The maximum absolute path length ({0}) for source "{1}" was exceeded by the node at: {2} ({3}) couldNotStoreProperty = Unable to store "{0}" property for the file "{1}" in the "{2}" file system source. Check the "extraProperties" setting for this source. couldNotStoreProperties = Unable to store the extra properties {0} for the file "{1}" in the "{2}" file system source. Check the "extraProperties" setting for this source. +couldNotReadListOfFilesInDirectory = Unable to read the list of files/directories within the "{0}" directory; the node "{1}" will be hidden \ No newline at end of file