I'm not sure if this is the right forum, as this might be related to either NFS or the underlying FS, but anyways... I'm going through a number of Folders to find subfolders and the files in those subfolders:
Media_Folder1
|-> subfolder_1 -> File1, file2, etc...
|-> subfolder_2 -> File1, file2, etc...
Media_Folder2
|-> subfolder_1 -> File1, file2, etc...
|-> subfolder_2 -> File1, file2, etc...
...
I use the following code:
File rFolder = new File("/Media_Folder/");
File[] subFolderArray = rFolder.listFiles();
for (int i = 0; i < subFolderArray.length(); i++) {
if (subFolderArray[i].isDirectory()) {
// For each subfolder I'll enter it, and add each file to a custom file class array
File[] tmpFolderContent = subFolderArray[i].listFiles();
for (int i2 = 0; i2 < tmpFolderContent.length(); i2++) {
myCustomFileClass tmpCustFile = new myCustomFileClass(tmpFolderContent[i2].getPath());
}
.... // etc...
The problem is that the code above (or a bit more complicated version) is working fine, until a certain point. Then suddenly the tmpFolderContent array gives a nullpointer exception. 1. The code above (...and then some) creates a MediaObject that contains a StringArray that holds names of all subfolders. 2. Then the code goes through all those subfolders to create a CUSTOM FileObject array (Not the regular java.IO.File class, but a custom one that holds only enough info to create a new java.io.File object). The Custom FileObject ARRAY holds the filename and path of all files in all subfolders. 3. The number of files in each subfolder is never more than 25-30, and the number of subfolders is never more than 10, but the number of MediaObjects is fairly large (450++). There are some ways I can go around this problem (Like add each object to the database right after it's creation [which is what I want anyways, although I want to do something more with the objects before I do this], but this means creating the objects, store them in DB, read them from db and then change them accordingly). But I'd rather know what is causing this problem, so I know WHY I need to do it that way ;). The strange thing is that it appears on the same media folder, and the exact same subfolder each time. If I skip this folder, it happens on the next subfolder. So something is reaching it's limit. I've also tried running the above code on ONLY the failing folder, and then it