Permalink
Browse files

Filesystem Package: JText removal for Exceptions

  • Loading branch information...
1 parent c09a845 commit f7d00646d0c848dc75b701d22d4328bbc2b785a9 Amy Stephen committed Mar 30, 2012
Showing with 15 additions and 15 deletions.
  1. +9 −9 libraries/joomla/filesystem/folder.php
  2. +6 −6 libraries/joomla/filesystem/patcher.php
@@ -32,7 +32,7 @@
* @return mixed JError object on failure or boolean True on success.
*
* @since 11.1
- * @throws Exception
+ * @throws RuntimeException
*/
public static function copy($src, $dest, $path = '', $force = false, $use_streams = false)
{
@@ -53,17 +53,17 @@ public static function copy($src, $dest, $path = '', $force = false, $use_stream
if (!self::exists($src))
{
- throw new Exception(JText::_('JLIB_FILESYSTEM_ERROR_FIND_SOURCE_FOLDER'), -1);
+ throw new RuntimeException('Source folder not found', -1);
}
if (self::exists($dest) && !$force)
{
- throw new Exception(JText::_('JLIB_FILESYSTEM_ERROR_FOLDER_EXISTS'), -1);
+ throw new RuntimeException('Destination folder not found', -1);
}
// Make sure the destination exists
if (!self::create($dest))
{
- throw new Exception(JText::_('JLIB_FILESYSTEM_ERROR_FOLDER_CREATE'), -1);
+ throw new RuntimeException('Cannot create destination folder', -1);
}
// If we're using ftp and don't have streams enabled
@@ -74,7 +74,7 @@ public static function copy($src, $dest, $path = '', $force = false, $use_stream
if (!($dh = @opendir($src)))
{
- throw new Exception(JText::_('JLIB_FILESYSTEM_ERROR_FOLDER_OPEN'), -1);
+ throw new RuntimeException('Cannot open source folder', -1);
}
// Walk through the directory copying files and recursing into folders.
while (($file = readdir($dh)) !== false)
@@ -99,7 +99,7 @@ public static function copy($src, $dest, $path = '', $force = false, $use_stream
$dfid = JPath::clean(str_replace(JPATH_ROOT, $FTPOptions['root'], $dfid), '/');
if (!$ftp->store($sfid, $dfid))
{
- throw new Exception(JText::_('JLIB_FILESYSTEM_ERROR_COPY_FAILED'), -1);
+ throw new RuntimeException('Copy file failed', -1);
}
break;
}
@@ -109,7 +109,7 @@ public static function copy($src, $dest, $path = '', $force = false, $use_stream
{
if (!($dh = @opendir($src)))
{
- throw new Exception(JText::_('JLIB_FILESYSTEM_ERROR_FOLDER_OPEN'), -1);
+ throw new RuntimeException('Cannot open source folder', -1);
}
// Walk through the directory copying files and recursing into folders.
while (($file = readdir($dh)) !== false)
@@ -135,14 +135,14 @@ public static function copy($src, $dest, $path = '', $force = false, $use_stream
$stream = JFactory::getStream();
if (!$stream->copy($sfid, $dfid))
{
- throw new Exception(JText::_('JLIB_FILESYSTEM_ERROR_COPY_FAILED') . ': ' . $stream->getError(), -1);
+ throw new RuntimeException('Cannot copy file: ' . $stream->getError(), -1);
}
}
else
{
if (!@copy($sfid, $dfid))
{
- throw new Exception(JText::_('JLIB_FILESYSTEM_ERROR_COPY_FAILED'), -1);
+ throw new RuntimeException('Copy file failed', -1);
}
}
break;
@@ -161,7 +161,7 @@ public function apply()
// If no modifications were found, throw an exception
if (!$done)
{
- throw new RuntimeException(JText::_('JLIB_FILESYSTEM_PATCHER_INVALID_DIFF'));
+ throw new RuntimeException('Invalid Diff');
}
}
}
@@ -294,13 +294,13 @@ protected static function findHeader(&$lines, &$src, &$dst)
$line = next($lines);
if ($line === false)
{
- throw new RuntimeException(JText::_('JLIB_FILESYSTEM_PATCHER_UNEXPECTED_EOF'));
+ throw new RuntimeException('Unexpected EOF');
}
// Search the destination file
if (!preg_match(self::DST_FILE, $line, $m))
{
- throw new RuntimeException(JText::_('JLIB_FILESYSTEM_PATCHER_INVALID_DIFF'));
+ throw new RuntimeException('Invalid Diff file');
}
// Set the destination file
@@ -309,7 +309,7 @@ protected static function findHeader(&$lines, &$src, &$dst)
// Advance to the next line
if (next($lines) === false)
{
- throw new RuntimeException(JText::_('JLIB_FILESYSTEM_PATCHER_UNEXPECTED_EOF'));
+ throw new RuntimeException('Unexpected EOF');
}
return true;
}
@@ -357,7 +357,7 @@ protected static function findHunk(&$lines, &$src_line, &$src_size, &$dst_line,
if (next($lines) === false)
{
- throw new RuntimeException(JText::_('JLIB_FILESYSTEM_PATCHER_UNEXPECTED_EOF'));
+ throw new RuntimeException('Unexpected EOF');
}
return true;
@@ -474,7 +474,7 @@ protected function applyHunk(&$lines, $src, $dst, $src_line, $src_size, $dst_lin
$line = next($lines);
}
while ($line !== false);
- throw new RuntimeException(JText::_('JLIB_FILESYSTEM_PATCHER_UNEXPECTED_EOF'));
+ throw new RuntimeException('Unexpected EOF');
}
/**

0 comments on commit f7d0064

Please sign in to comment.