• R/O
  • HTTP
  • SSH
  • HTTPS

コミット

タグ
未設定

よく使われているワード(クリックで追加)

javac++androidlinuxc#windowsobjective-ccocoa誰得qtpythonphprubygameguibathyscaphec計画中(planning stage)翻訳omegatframeworktwitterdomtestvb.netdirectxゲームエンジンbtronarduinopreviewer

shogi-server source


コミットメタ情報

リビジョン29968bc75167d7fe325041225fe89b9adffea571 (tree)
日時2013-11-24 12:05:52
作者Daigo Moriwaki <daigo@debi...>
コミッターDaigo Moriwaki

ログメッセージ

* [shogi-server] - shogi_server/league/floodgate.rb: Improved robustness against empty file under ruby 1.9.3p194

変更サマリ

差分

--- a/changelog
+++ b/changelog
@@ -1,3 +1,9 @@
1+2013-11-24 Daigo Moriwaki <daigo at debian dot org>
2+
3+ * [shogi-server]
4+ - shogi_server/league/floodgate.rb: Improved robustness against
5+ empty file under ruby 1.9.3p194
6+
17 2013-11-23 Daigo Moriwaki <daigo at debian dot org>
28
39 * [mk_rate]
--- a/shogi_server/league/floodgate.rb
+++ b/shogi_server/league/floodgate.rb
@@ -216,8 +216,13 @@ class League
216216 def load
217217 return unless @file.exist?
218218
219- @records = YAML.load_file(@file)
220- unless @records && @records.instance_of?(Array)
219+ begin
220+ @records = YAML.load_file(@file)
221+ unless @records && @records.instance_of?(Array)
222+ $logger.error "%s is not a valid yaml file. Instead, an empty array will be used and updated." % [@file]
223+ @records = []
224+ end
225+ rescue
221226 $logger.error "%s is not a valid yaml file. Instead, an empty array will be used and updated." % [@file]
222227 @records = []
223228 end