From b551b666deb2b54fea1ce171ef99cecd3518696e Mon Sep 17 00:00:00 2001
From: Dries <dries@buytaert.net>
Date: Mon, 14 May 2012 21:31:16 -0400
Subject: [PATCH] - Patch #1506630 by Alan Evans, David_Rothstein: Fixed
 Namedspaced code throws and catches 'Exceptions' which don't exist (causing
 the DB settings form validation to break on install).

---
 .../lib/Drupal/Component/Archiver/ArchiveTar.php |  2 ++
 .../Component/Archiver/ArchiverException.php     | 16 ++++++++++++++++
 .../Component/Archiver/ArchiverInterface.php     |  2 ++
 core/lib/Drupal/Component/Archiver/Zip.php       |  3 +--
 .../Core/Database/Driver/pgsql/Install/Tasks.php |  2 ++
 core/lib/Drupal/Core/Database/Install/Tasks.php  |  1 +
 core/lib/Drupal/Core/Database/Query/Insert.php   |  2 ++
 .../lib/Drupal/Core/Updater/UpdaterException.php |  2 ++
 8 files changed, 28 insertions(+), 2 deletions(-)
 create mode 100644 core/lib/Drupal/Component/Archiver/ArchiverException.php

diff --git a/core/lib/Drupal/Component/Archiver/ArchiveTar.php b/core/lib/Drupal/Component/Archiver/ArchiveTar.php
index f6ef5061d79d..4a8d828eb840 100644
--- a/core/lib/Drupal/Component/Archiver/ArchiveTar.php
+++ b/core/lib/Drupal/Component/Archiver/ArchiveTar.php
@@ -42,6 +42,8 @@
 
 namespace Drupal\Component\Archiver;
 
+use Exception;
+
 //require_once 'PEAR.php';
 //
 //
diff --git a/core/lib/Drupal/Component/Archiver/ArchiverException.php b/core/lib/Drupal/Component/Archiver/ArchiverException.php
new file mode 100644
index 000000000000..12af470491de
--- /dev/null
+++ b/core/lib/Drupal/Component/Archiver/ArchiverException.php
@@ -0,0 +1,16 @@
+<?php
+
+/**
+ * @file
+ * Definition of Drupal\Component\Archiver\ArchiverException.
+ */
+
+namespace Drupal\Component\Archiver;
+
+use Exception;
+
+/**
+ * Defines an exception class for Drupal\Component\Archiver\ArchiverInterface.
+ */
+class ArchiverException extends Exception {
+}
diff --git a/core/lib/Drupal/Component/Archiver/ArchiverInterface.php b/core/lib/Drupal/Component/Archiver/ArchiverInterface.php
index 12752e4db604..3b2dc28386a6 100644
--- a/core/lib/Drupal/Component/Archiver/ArchiverInterface.php
+++ b/core/lib/Drupal/Component/Archiver/ArchiverInterface.php
@@ -19,6 +19,8 @@ interface ArchiverInterface {
    *   The full system path of the archive to manipulate. Only local files
    *   are supported. If the file does not yet exist, it will be created if
    *   appropriate.
+   *
+   * @throws Drupal\Component\Archiver\ArchiverException
    */
   public function __construct($file_path);
 
diff --git a/core/lib/Drupal/Component/Archiver/Zip.php b/core/lib/Drupal/Component/Archiver/Zip.php
index c6f5a4c47621..47bfb678b90d 100644
--- a/core/lib/Drupal/Component/Archiver/Zip.php
+++ b/core/lib/Drupal/Component/Archiver/Zip.php
@@ -32,8 +32,7 @@ class Zip implements ArchiverInterface {
   public function __construct($file_path) {
     $this->zip = new ZipArchive();
     if ($this->zip->open($file_path) !== TRUE) {
-      // @todo: This should be an interface-specific exception some day.
-      throw new Exception(t('Cannot open %file_path', array('%file_path' => $file_path)));
+      throw new ArchiverException(t('Cannot open %file_path', array('%file_path' => $file_path)));
     }
   }
 
diff --git a/core/lib/Drupal/Core/Database/Driver/pgsql/Install/Tasks.php b/core/lib/Drupal/Core/Database/Driver/pgsql/Install/Tasks.php
index ae2db873a03c..6dc40a218ab6 100644
--- a/core/lib/Drupal/Core/Database/Driver/pgsql/Install/Tasks.php
+++ b/core/lib/Drupal/Core/Database/Driver/pgsql/Install/Tasks.php
@@ -10,6 +10,8 @@
 use Drupal\Core\Database\Database;
 use Drupal\Core\Database\Install\Tasks as InstallTasks;
 
+use Exception;
+
 /**
  * PostgreSQL specific install functions
  */
diff --git a/core/lib/Drupal/Core/Database/Install/Tasks.php b/core/lib/Drupal/Core/Database/Install/Tasks.php
index ece3c7c25193..5d34a62b2633 100644
--- a/core/lib/Drupal/Core/Database/Install/Tasks.php
+++ b/core/lib/Drupal/Core/Database/Install/Tasks.php
@@ -10,6 +10,7 @@
 use Drupal\Core\Database\Database;
 
 use PDO;
+use Exception;
 
 /**
  * Database installer structure.
diff --git a/core/lib/Drupal/Core/Database/Query/Insert.php b/core/lib/Drupal/Core/Database/Query/Insert.php
index e19de45cfa75..b3c4c0e40a7a 100644
--- a/core/lib/Drupal/Core/Database/Query/Insert.php
+++ b/core/lib/Drupal/Core/Database/Query/Insert.php
@@ -9,6 +9,8 @@
 
 use Drupal\Core\Database\Database;
 
+use Exception;
+
 /**
  * General class for an abstracted INSERT query.
  */
diff --git a/core/lib/Drupal/Core/Updater/UpdaterException.php b/core/lib/Drupal/Core/Updater/UpdaterException.php
index fc9cb9db6901..aee43a660d66 100644
--- a/core/lib/Drupal/Core/Updater/UpdaterException.php
+++ b/core/lib/Drupal/Core/Updater/UpdaterException.php
@@ -7,6 +7,8 @@
 
 namespace Drupal\Core\Updater;
 
+use Exception;
+
 /**
  * Defines a Exception class for the Drupal\Core\Updater\Updater class
  * hierarchy.
-- 
GitLab