Code Duplication    Length = 5-5 lines in 3 locations

lib/private/files/view.php 3 locations

@@ 1026-1030 (lines=5) @@
1023
						$result = $storage->$operation($internalPath);
1024
					}
1025
				} catch (\Exception $e) {
1026
					if (in_array('write', $hooks) || in_array('delete', $hooks)) {
1027
						$this->unlockFile($path, ILockingProvider::LOCK_EXCLUSIVE);
1028
					} else if (in_array('read', $hooks)) {
1029
						$this->unlockFile($path, ILockingProvider::LOCK_SHARED);
1030
					}
1031
					throw $e;
1032
				}
1033
@@ 1052-1056 (lines=5) @@
1049
				if ($this->lockingEnabled && $operation === 'fopen' && is_resource($result)) {
1050
					$unlockLater = true;
1051
					$result = CallbackWrapper::wrap($result, null, null, function () use ($hooks, $path) {
1052
						if (in_array('write', $hooks)) {
1053
							$this->unlockFile($path, ILockingProvider::LOCK_EXCLUSIVE);
1054
						} else if (in_array('read', $hooks)) {
1055
							$this->unlockFile($path, ILockingProvider::LOCK_SHARED);
1056
						}
1057
					});
1058
				}
1059
@@ 1066-1070 (lines=5) @@
1063
					}
1064
				}
1065
1066
				if (!$unlockLater
1067
					&& (in_array('write', $hooks) || in_array('delete', $hooks) || in_array('read', $hooks))
1068
				) {
1069
					$this->unlockFile($path, ILockingProvider::LOCK_SHARED);
1070
				}
1071
				return $result;
1072
			} else {
1073
				$this->unlockFile($path, ILockingProvider::LOCK_SHARED);