[Pkg-owncloud-commits] [owncloud] 27/121: return null instead of throwing an exception

David Prévot taffit at moszumanska.debian.org
Thu Aug 21 16:44:28 UTC 2014


This is an automated email from the git hooks/post-receive script.

taffit pushed a commit to branch master
in repository owncloud.

commit 8c56be5722e776d69e41b15091b88eadac904e31
Author: Robin Appelman <icewind at owncloud.com>
Date:   Wed Aug 6 12:06:41 2014 +0200

    return null instead of throwing an exception
---
 lib/private/files/node/folder.php | 3 +--
 tests/lib/files/node/folder.php   | 6 ++----
 2 files changed, 3 insertions(+), 6 deletions(-)

diff --git a/lib/private/files/node/folder.php b/lib/private/files/node/folder.php
index f5211d5..8c7acc3 100644
--- a/lib/private/files/node/folder.php
+++ b/lib/private/files/node/folder.php
@@ -27,7 +27,6 @@ class Folder extends Node implements \OCP\Files\Folder {
 
 	/**
 	 * @param string $path
-	 * @throws \OCP\Files\NotFoundException
 	 * @return string
 	 */
 	public function getRelativePath($path) {
@@ -37,7 +36,7 @@ class Folder extends Node implements \OCP\Files\Folder {
 		if ($path === $this->path) {
 			return '/';
 		} else if (strpos($path, $this->path . '/') !== 0) {
-			throw new NotFoundException();
+			return null;
 		} else {
 			$path = substr($path, strlen($this->path));
 			return $this->normalizePath($path);
diff --git a/tests/lib/files/node/folder.php b/tests/lib/files/node/folder.php
index bd9c289..436161a 100644
--- a/tests/lib/files/node/folder.php
+++ b/tests/lib/files/node/folder.php
@@ -513,9 +513,6 @@ class Folder extends \PHPUnit_Framework_TestCase {
 		$this->assertEquals('/bar/foo/qwerty', $result[0]->getPath());
 	}
 
-	/**
-	 * @expectedException \OCP\Files\NotFoundException
-	 */
 	public function testGetByIdOutsideFolder() {
 		$manager = $this->getMock('\OC\Files\Mount\Manager');
 		/**
@@ -550,7 +547,8 @@ class Folder extends \PHPUnit_Framework_TestCase {
 			->will($this->returnValue($mount));
 
 		$node = new \OC\Files\Node\Folder($root, $view, '/bar/foo');
-		$node->getById(1);
+		$result = $node->getById(1);
+		$this->assertCount(0, $result);
 	}
 
 	public function testGetByIdMultipleStorages() {

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-owncloud/owncloud.git



More information about the Pkg-owncloud-commits mailing list