summaryrefslogtreecommitdiff
path: root/lib/rubygems/format.rb
diff options
context:
space:
mode:
authorryan <ryan@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2011-02-01 03:11:34 +0000
committerryan <ryan@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2011-02-01 03:11:34 +0000
commitec84bfc9e3d11a3b1dbebcaf4d1ddf1357307513 (patch)
treecc3b9df7f06f86c52f4d09c03f5c9a3876c87b67 /lib/rubygems/format.rb
parentf4234c9b8f4707c5979d9a3beddc19ceeb417bd8 (diff)
Import rubygems 1.5.0 (released version @ 1fb59d0)
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@30752 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'lib/rubygems/format.rb')
-rw-r--r--lib/rubygems/format.rb9
1 files changed, 7 insertions, 2 deletions
diff --git a/lib/rubygems/format.rb b/lib/rubygems/format.rb
index 3b38a3a017..95388b4e51 100644
--- a/lib/rubygems/format.rb
+++ b/lib/rubygems/format.rb
@@ -47,8 +47,13 @@ class Gem::Format
Gem::OldFormat.from_file_by_path file_path
else
- open file_path, Gem.binary_mode do |io|
- from_io io, file_path, security_policy
+ begin
+ open file_path, Gem.binary_mode do |io|
+ from_io io, file_path, security_policy
+ end
+ rescue Gem::Package::TarInvalidError => e
+ message = "corrupt gem (#{e.class}: #{e.message})"
+ raise Gem::Package::FormatError.new(message, file_path)
end
end
end