From 24df82c0310f8ab48a09f7f1e5329285d3c6e8f1 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Roland=20H=C3=A4der?= Date: Mon, 7 Dec 2020 00:59:03 +0100 Subject: [PATCH] Continued: - private methods shall not throw exceptions as they can be unit-tested very complicated - updated core framework MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Signed-off-by: Roland Häder --- .../class_CrawlerUploadedListUrlSource.php | 19 ++++++------------- core | 2 +- 2 files changed, 7 insertions(+), 14 deletions(-) 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 -- 2.39.5