From: Roland Häder Date: Sun, 6 Dec 2020 23:59:03 +0000 (+0100) Subject: Continued: X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=24df82c0310f8ab48a09f7f1e5329285d3c6e8f1;p=hub.git Continued: - private methods shall not throw exceptions as they can be unit-tested very complicated - updated core framework Signed-off-by: Roland Häder --- diff --git a/application/hub/classes/source/urls/class_CrawlerUploadedListUrlSource.php b/application/hub/classes/source/urls/class_CrawlerUploadedListUrlSource.php index cee8d06c8..2da427c27 100644 --- a/application/hub/classes/source/urls/class_CrawlerUploadedListUrlSource.php +++ b/application/hub/classes/source/urls/class_CrawlerUploadedListUrlSource.php @@ -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 6e91754d5..ea4641a1e 160000 --- a/core +++ b/core @@ -1 +1 @@ -Subproject commit 6e91754d589773df8bd3746008dd782133a48674 +Subproject commit ea4641a1e423961447ad6e0a113278f9d283cbeb