]> git.mxchange.org Git - hub.git/commitdiff
Continued:
authorRoland Häder <roland@mxchange.org>
Sun, 6 Dec 2020 23:59:03 +0000 (00:59 +0100)
committerRoland Häder <roland@mxchange.org>
Sun, 6 Dec 2020 23:59:03 +0000 (00:59 +0100)
- private methods shall not throw exceptions as they can be unit-tested very
  complicated
- updated core framework

Signed-off-by: Roland Häder <roland@mxchange.org>
application/hub/classes/source/urls/class_CrawlerUploadedListUrlSource.php
core

index cee8d06c849b2b6002ca1c51bc8eb7bfc65ecb9f..2da427c2727d5f885c843893ec0b99bcc9106a7d 100644 (file)
@@ -299,21 +299,10 @@ class CrawlerUploadedListUrlSource extends BaseUrlSource implements UrlSource, R
         * Initializes the import of the CSV file which is being processed by other task
         *
         * @return      void
-        * @throws      NullPointerException    If lastCsvFileInstance is not set
         */
        private function addCsvFile () {
-               // Is the instance set?
-               /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('CRAWLER-UPLOADED-LIST-URL-SOURCE: CALLED!');
-               if (is_null($this->lastCsvFileInstance)) {
-                       // This should not happen
-                       throw new NullPointerException($this, self::EXCEPTION_IS_NULL_POINTER);
-               } elseif ($this->isLastCsvFileImported()) {
-                       // Already stacked
-                       return;
-               }
-
                // Stack this file
-               /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('CRAWLER-UPLOADED-LIST-URL-SOURCE: this->lastCsvFileInstance=' . $this->lastCsvFileInstance);
+               /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('CRAWLER-UPLOADED-LIST-URL-SOURCE: this->lastCsvFileInstance=%s - CALLED!', $this->lastCsvFileInstance->__toString()));
                $this->getStackSourceInstance()->pushNamed(self::STACK_NAME_CSV_FILE, $this->lastCsvFileInstance);
 
                // ... and mark it as "imported"
@@ -397,6 +386,7 @@ class CrawlerUploadedListUrlSource extends BaseUrlSource implements UrlSource, R
         */
        public function fillUrlStack () {
                // Does the stack have some entries left?
+               /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('CRAWLER-UPLOADED-LIST-URL-SOURCE: CALLED!');
                if ($this->isCsvEntryAdded()) {
                        /*
                         * A CSV file has been found and "imported" (added to stack). Now
@@ -409,7 +399,7 @@ class CrawlerUploadedListUrlSource extends BaseUrlSource implements UrlSource, R
                         * the file can be read line by line and checked every one of it.
                         */
                        $this->parseCsvFile();
-               } elseif ($this->isCsvFileFound()) {
+               } elseif ($this->isCsvFileFound() && !$this->isLastCsvFileImported()) {
                        /*
                         * A file containing an URL list is found. Please note the format is
                         * CSV-like as you may wish to provide meta data such as crawl
@@ -419,6 +409,9 @@ class CrawlerUploadedListUrlSource extends BaseUrlSource implements UrlSource, R
                }
 
                $this->partialStub('Please implement this method.');
+
+               // Trace message
+               /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('CRAWLER-UPLOADED-LIST-URL-SOURCE: EXIT!');
        }
 
 }
diff --git a/core b/core
index 6e91754d589773df8bd3746008dd782133a48674..ea4641a1e423961447ad6e0a113278f9d283cbeb 160000 (submodule)
--- a/core
+++ b/core
@@ -1 +1 @@
-Subproject commit 6e91754d589773df8bd3746008dd782133a48674
+Subproject commit ea4641a1e423961447ad6e0a113278f9d283cbeb