Skip to content
This repository has been archived by the owner on Nov 26, 2017. It is now read-only.

Commit

Permalink
Filesystem Package: JText removal for Exceptions
Browse files Browse the repository at this point in the history
  • Loading branch information
Amy Stephen authored and Amy Stephen committed Mar 30, 2012
1 parent c09a845 commit f7d0064
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 15 deletions.
18 changes: 9 additions & 9 deletions libraries/joomla/filesystem/folder.php
Expand Up @@ -32,7 +32,7 @@ abstract class JFolder
* @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)
{
Expand All @@ -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
Expand All @@ -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)
Expand All @@ -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;
}
Expand All @@ -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)
Expand All @@ -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;
Expand Down
12 changes: 6 additions & 6 deletions libraries/joomla/filesystem/patcher.php
Expand Up @@ -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');
}
}
}
Expand Down Expand Up @@ -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
Expand All @@ -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;
}
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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');
}

/**
Expand Down

0 comments on commit f7d0064

Please sign in to comment.