Introduced FileNotFoundException
[core.git] / inc / classes / main / file_directories / input / raw / class_FrameworkRawFileInputPointer.php
index a3b3702004fbbabd44113024a3af059aba84050e..9fb6e1db819bb2a5398ec1197319308099788d97 100644 (file)
@@ -40,6 +40,7 @@ class FrameworkRawFileInputPointer extends BaseFileIo implements InputPointer {
         * @throws      FileIsEmptyException            If the provided file name is empty.
         * @throws      FileIoException                         If the file is not reachable
         * @throws      FileReadProtectedException      If the file is not found or cannot be read
+        * @throws      FileNotFoundException           If the file does not exist
         * @return      void
         */
        public static final function createFrameworkRawFileInputPointer ($fileName) {
@@ -48,11 +49,14 @@ class FrameworkRawFileInputPointer extends BaseFileIo implements InputPointer {
                        // No filename given
                        throw new FileIsEmptyException(NULL, self::EXCEPTION_UNEXPECTED_EMPTY_STRING);
                } elseif (!BaseFrameworkSystem::isReachableFilePath($fileName)) {
-                       // File does not exist!
+                       // File cannot be accessed (due to open_basedir restriction)
                        throw new FileIoException($fileName, self::EXCEPTION_FILE_NOT_REACHABLE);
-               } elseif (!BaseFrameworkSystem::isReadableFile($fileName)) {
-                       // File does not exist!
+               } elseif ((!BaseFrameworkSystem::isReadableFile($fileName)) && (file_exists($fileName))) {
+                       // File exists but cannot be read from
                        throw new FileReadProtectedException($fileName, self::EXCEPTION_FILE_CANNOT_BE_READ);
+               } elseif ((!BaseFrameworkSystem::isReadableFile($fileName)) && (!file_exists($fileName))) {
+                       // File does not exist
+                       throw new FileNotFoundException($fileName, self::EXCEPTION_FILE_NOT_FOUND);
                }
 
                // Try to open a handler