imaginary-cloud / redmine_evm

Earned Value Management plugin for Redmine
Other
32 stars 18 forks source link

[BUG] ArgumentError (comparison of NilClass with Date failed) #3

Closed cforce closed 11 years ago

cforce commented 11 years ago

Yo you check againats non mandatory fields are set like start and ed date .. etc.? Do you use constant as status names, isn't this localized?

Started GET "/projects/myproject/ratios/index" for 172.25.252.99 at 2012-12-19 15:00:06 +0100 Processing by RatiosController#index as HTML Parameters: {"id"=>"myproject"} Current user: 00001276 (id=3) Rendered plugins/redmine_evm/app/views/ratios/_head_js.html.erb (2.0ms) Rendered plugins/redmine_evm/app/views/ratios/_bottom_js.html.erb (27.0ms) Rendered plugins/redmine_evm/app/views/ratios/_head_js.html.erb (0.0ms) Rendered plugins/redmine_evm/app/views/ratios/_bottom_js.html.erb (4.0ms) Rendered plugins/redmine_evm/app/views/ratios/_head_js.html.erb (0.0ms) Rendered plugins/redmine_evm/app/views/ratios/index.html.erb within layouts/base (117.0ms) Completed 500 Internal Server Error in 32084ms

ActionView::Template::Error (comparison of NilClass with Date failed): 13: <% @project.versions.where(:status=>"open").each do |my_version|%> 14: <%= render "ratios/head_js" %> 15: <% proj_or_vers_data=IndicatorsLogic::retrive_data(my_version) %> 16: <% @proj_or_vers_indicators=IndicatorsLogic::calc_indicators(my_version, proj_or_vers_data[0], proj_or_vers_data[1]) %> 17: <%= render :partial=>"ratios/bottom_js", :locals=>{:name=>my_version.name}%> 18: <% end %> 19: org/jruby/RubyArray.java:1612:in each' org/jruby/RubyEnumerable.java:1032:inmax' plugins/redmine_evm/lib/indicators_logic.rb:26:in calc_indicators' plugins/redmine_evm/app/views/ratios/index.html.erb:16:in_plugins_redmine_evm_app_views_ratios_index_html_erb1286730508_1081284' org/jruby/RubyArray.java:1612:in each' org/jruby/RubyBasicObject.java:1667:insend' activerecord (3.2.8) lib/active_record/relation/delegation.rb:6:in each' plugins/redmine_evm/app/views/ratios/index.html.erb:13:in_plugins_redmine_evm_app_views_ratios_index_html_erb1286730508_1081284' org/jruby/RubyBasicObject.java:1679:in __send__' org/jruby/RubyKernel.java:2085:insend' actionpack (3.2.8) lib/action_view/template.rb:145:inrender' activesupport (3.2.8) lib/active_support/notifications.rb:125:ininstrument' actionpack (3.2.8) lib/action_view/template.rb:143:inrender' actionpack (3.2.8) lib/action_view/renderer/template_renderer.rb:47:inrender_template' actionpack (3.2.8) lib/action_view/renderer/abstract_renderer.rb:38:ininstrument' activesupport (3.2.8) lib/active_support/notifications.rb:123:ininstrument' activesupport (3.2.8) lib/active_support/notifications/instrumenter.rb:20:ininstrument' activesupport (3.2.8) lib/active_support/notifications/instrumenter.rb:19:ininstrument' activesupport (3.2.8) lib/active_support/notifications.rb:123:ininstrument' actionpack (3.2.8) lib/action_view/renderer/abstract_renderer.rb:38:ininstrument' actionpack (3.2.8) lib/action_view/renderer/template_renderer.rb:46:inrender_template' actionpack (3.2.8) lib/action_view/renderer/template_renderer.rb:54:inrender_with_layout' actionpack (3.2.8) lib/action_view/renderer/template_renderer.rb:45:inrender_template' render_parent (0.0.5) lib/render_parent/rails3/on_load_action_view.rb:58:inrender_template_with_active_template' actionpack (3.2.8) lib/action_view/renderer/template_renderer.rb:18:inrender' actionpack (3.2.8) lib/action_view/renderer/renderer.rb:36:inrender_template' actionpack (3.2.8) lib/action_view/renderer/renderer.rb:17:inrender' actionpack (3.2.8) lib/abstract_controller/rendering.rb:110:in_render_template' actionpack (3.2.8) lib/action_controller/metal/streaming.rb:225:in_render_template' actionpack (3.2.8) lib/abstract_controller/rendering.rb:103:inrender_to_body' actionpack (3.2.8) lib/action_controller/metal/renderers.rb:28:inrender_to_body' actionpack (3.2.8) lib/action_controller/metal/compatibility.rb:50:inrender_to_body' actionpack (3.2.8) lib/abstract_controller/rendering.rb:88:inrender' actionpack (3.2.8) lib/action_controller/metal/rendering.rb:16:inrender' actionpack (3.2.8) lib/action_controller/metal/instrumentation.rb:40:inrender' activesupport (3.2.8) lib/active_support/core_ext/benchmark.rb:5:inms' /home/sidfunktion/.rvm/rubies/jruby-1.7.0/lib/ruby/1.9/benchmark.rb:295:inrealtime' activesupport (3.2.8) lib/active_support/core_ext/benchmark.rb:5:inms' actionpack (3.2.8) lib/action_controller/metal/instrumentation.rb:40:inrender' actionpack (3.2.8) lib/action_controller/metal/instrumentation.rb:83:incleanup_view_runtime' activerecord (3.2.8) lib/active_record/railties/controller_runtime.rb:24:incleanup_view_runtime' actionpack (3.2.8) lib/action_controller/metal/instrumentation.rb:39:inrender' actionpack (3.2.8) lib/action_controller/metal/implicit_render.rb:10:indefault_render' actionpack (3.2.8) lib/action_controller/metal/implicit_render.rb:5:insend_action' actionpack (3.2.8) lib/abstract_controller/base.rb:167:inprocess_action' actionpack (3.2.8) lib/action_controller/metal/rendering.rb:10:inprocess_action' actionpack (3.2.8) lib/abstract_controller/callbacks.rb:18:inprocess_action' activesupport (3.2.8) lib/active_support/callbacks.rb:472:in_run1901888727process_action1155311442callbacks' org/jruby/RubyBasicObject.java:1667:in__send__' org/jruby/RubyKernel.java:2077:insend' activesupport (3.2.8) lib/active_support/callbacks.rb:405:in**run_callback' activesupport (3.2.8) lib/active_support/callbacks.rb:390:in_run_process_action_callbacks' org/jruby/RubyBasicObject.java:1673:in__send**' org/jruby/RubyKernel.java:2081:insend' activesupport (3.2.8) lib/active_support/callbacks.rb:81:inrun_callbacks' actionpack (3.2.8) lib/abstract_controller/callbacks.rb:17:inprocess_action' actionpack (3.2.8) lib/action_controller/metal/rescue.rb:29:inprocess_action' actionpack (3.2.8) lib/action_controller/metal/instrumentation.rb:30:inprocess_action' activesupport (3.2.8) lib/active_support/notifications.rb:123:ininstrument' activesupport (3.2.8) lib/active_support/notifications/instrumenter.rb:20:ininstrument' activesupport (3.2.8) lib/active_support/notifications/instrumenter.rb:19:ininstrument' activesupport (3.2.8) lib/active_support/notifications.rb:123:ininstrument' actionpack (3.2.8) lib/action_controller/metal/instrumentation.rb:29:inprocess_action' actionpack (3.2.8) lib/action_controller/metal/params_wrapper.rb:207:inprocess_action' activerecord (3.2.8) lib/active_record/railties/controller_runtime.rb:18:inprocess_action' actionpack (3.2.8) lib/abstract_controller/base.rb:121:inprocess' actionpack (3.2.8) lib/abstract_controller/rendering.rb:45:inprocess' actionpack (3.2.8) lib/action_controller/metal.rb:203:indispatch' actionpack (3.2.8) lib/action_controller/metal/rack_delegation.rb:14:indispatch' actionpack (3.2.8) lib/action_controller/metal.rb:246:inaction' org/jruby/RubyProc.java:249:incall' actionpack (3.2.8) lib/action_dispatch/routing/route_set.rb:73:indispatch' actionpack (3.2.8) lib/action_dispatch/routing/route_set.rb:36:incall' journey (1.0.4) lib/journey/router.rb:68:incall' org/jruby/RubyArray.java:1612:ineach' journey (1.0.4) lib/journey/router.rb:56:incall' actionpack (3.2.8) lib/action_dispatch/routing/route_set.rb:600:incall' rack-openid (1.3.1) lib/rack/openid.rb:98:incall' actionpack (3.2.8) lib/action_dispatch/middleware/best_standards_support.rb:17:incall' rack (1.4.1) lib/rack/etag.rb:23:incall' rack (1.4.1) lib/rack/conditionalget.rb:25:incall' actionpack (3.2.8) lib/action_dispatch/middleware/head.rb:14:incall' actionpack (3.2.8) lib/action_dispatch/middleware/params_parser.rb:21:incall' plugins/redmine_dmsf/lib/redmine_dmsf/webdav/no_parse.rb:33:incall' actionpack (3.2.8) lib/action_dispatch/middleware/flash.rb:242:incall' rack (1.4.1) lib/rack/session/abstract/id.rb:205:incontext' rack (1.4.1) lib/rack/session/abstract/id.rb:200:incall' actionpack (3.2.8) lib/action_dispatch/middleware/cookies.rb:339:incall' activerecord (3.2.8) lib/active_record/query_cache.rb:64:incall' activerecord (3.2.8) lib/active_record/connection_adapters/abstract/connection_pool.rb:473:incall' actionpack (3.2.8) lib/action_dispatch/middleware/callbacks.rb:28:incall' activesupport (3.2.8) lib/active_support/callbacks.rb:408:in_run2115711987call13889929callbacks' org/jruby/RubyBasicObject.java:1667:in**send**' org/jruby/RubyKernel.java:2077:insend' activesupport (3.2.8) lib/active_support/callbacks.rb:405:in**run_callback' activesupport (3.2.8) lib/active_support/callbacks.rb:390:in_run_call_callbacks' org/jruby/RubyBasicObject.java:1667:in__send**' org/jruby/RubyKernel.java:2077:insend' activesupport (3.2.8) lib/active_support/callbacks.rb:81:inrun_callbacks' actionpack (3.2.8) lib/action_dispatch/middleware/callbacks.rb:27:incall' actionpack (3.2.8) lib/action_dispatch/middleware/remote_ip.rb:31:incall' actionpack (3.2.8) lib/action_dispatch/middleware/debug_exceptions.rb:16:incall' actionpack (3.2.8) lib/action_dispatch/middleware/show_exceptions.rb:56:incall' railties (3.2.8) lib/rails/rack/logger.rb:26:incall_app' railties (3.2.8) lib/rails/rack/logger.rb:16:incall' actionpack (3.2.8) lib/action_dispatch/middleware/request_id.rb:22:incall' rack (1.4.1) lib/rack/methodoverride.rb:21:incall' rack (1.4.1) lib/rack/runtime.rb:17:incall' activesupport (3.2.8) lib/active_support/cache/strategy/local_cache.rb:72:incall' rack (1.4.1) lib/rack/lock.rb:15:incall' actionpack (3.2.8) lib/action_dispatch/middleware/static.rb:62:incall' rack-cache (1.2) lib/rack/cache/context.rb:136:inforward' rack-cache (1.2) lib/rack/cache/context.rb:245:infetch' rack-cache (1.2) lib/rack/cache/context.rb:185:inlookup' rack-cache (1.2) lib/rack/cache/context.rb:66:incall!' rack-cache (1.2) lib/rack/cache/context.rb:51:incall' railties (3.2.8) lib/rails/engine.rb:479:incall' railties (3.2.8) lib/rails/application.rb:223:incall' rack (1.4.1) lib/rack/content_length.rb:14:incall' railties (3.2.8) lib/rails/rack/log_tailer.rb:17:incall' rack (1.4.1) lib/rack/handler/webrick.rb:59:inservice' /home/sidfunktion/.rvm/rubies/jruby-1.7.0/lib/ruby/1.9/webrick/httpserver.rb:138:inservice' /home/sidfunktion/.rvm/rubies/jruby-1.7.0/lib/ruby/1.9/webrick/httpserver.rb:94:inrun' /home/sidfunktion/.rvm/rubies/jruby-1.7.0/lib/ruby/1.9/webrick/server.rb:191:instart_thread'

cforce commented 11 years ago

I think my versipon don't have start and end date set of version, what indded isn't a mandory field. So please check if date filed is set <>nil before using with array access

proj_or_vers_data[0], proj_or_vers_data[1]

gamafranco commented 11 years ago

Thanks for the reporting.

We should use the current date when any of the dates is missing, but I guess there is a bug.

We'll take care of it and submit a patch today. Thanks.

jcfjcosta commented 11 years ago

Hi, Date constrains aren't in fact mandatory. I've tried to reproduced your error using the most recent setup (tested redmine 2.2.0, 2.1.5, 2.1.4; ruby MRI 1.9.3; rails 3.2.9; ) fresh instalation, with default redmine data loaded into redmine db (mysql). Created a project (only mandatory fields) and an empty version. No issues where created. EVM module activated. It runned fine. From what i've seen from the log you putted here, it seems there's a variable with nil set in an array of dates used to determine which is the most probable end date. That shouldn't be happening. When sources are nil or empty that date should be replaced with current date.

gamafranco commented 11 years ago

@JoaoCostaImag, this seems to be a compatibility issue with jRuby. Please try in this environment to see if we can reproduce the error.

cforce commented 11 years ago

I use jruby 1.7

cforce commented 11 years ago

I tried on redmine 2.2 and ruby 1.9.3 - Same error

It's not jruby problem!

cforce commented 11 years ago

Any schedule - wix wont't fix?

gamafranco commented 11 years ago

Hi @cforce,

Thanks for the input.

We didn't fix this yet because we were unable to reproduce the bug.

Is there any additional information that you can provide to reproduce it? Any specific details about the configuration of the project that is throwing this? If you have it in a database with dummy non classified data, can we have access to a dump?

I'm going to personally verify this one again today at EOD.

Thanks.

gamafranco commented 11 years ago

@cforce, I teste this again and was unable to reproduce. Do you have a simple proof of concept on how to reproduce it?

cforce commented 11 years ago

I tjink line 15 will raise nil error, because the method retrive_data(my_version) retrun nil.

Check retrive_data() on any unset vars ur var=nil. Maybe an not required value.

gamafranco commented 11 years ago

Hi Terence,

Thanks for the report. That code suffered severe changes on the since this ticket was reported.

Can you do a quick try with master, just to make sure it's still happening. If so, please past the exception and I'll take it from there.

Thanks.

cforce commented 11 years ago

ok the bug is now mich better debugable: Did you test with version and/or issue start/end dates not set? As i said none of them is required! Does the [..]-max method can handle "nil" values?

see message: ArgumentError (comparison of NilClass with Date failed): plugins/redmine_evm/lib/indicators_logic.rb:31:in each' plugins/redmine_evm/lib/indicators_logic.rb:31:inmax' plugins/redmine_evm/lib/indicators_logic.rb:31:in calc_indicators' plugins/redmine_evm/app/controllers/ratios_controller.rb:42:inevm' plugins/redmine_evm/app/controllers/ratios_controller.rb:17:in block (3 levels) in index' activerecord (3.2.11) lib/active_record/relation/delegation.rb:6:ineach' activerecord (3.2.11) lib/active_record/relation/delegation.rb:6:in each' plugins/redmine_evm/app/controllers/ratios_controller.rb:15:inblock (2 levels) in index' actionpack (3.2.11) lib/action_controller/metal/mime_responds.rb:196:in call' actionpack (3.2.11) lib/action_controller/metal/mime_responds.rb:196:inrespond_to' plugins/redmine_evm/app/controllers/ratios_controller.rb:10:in index' actionpack (3.2.11) lib/action_controller/metal/implicit_render.rb:4:insend_action' actionpack (3.2.11) lib/abstract_controller/base.rb:167:in process_action' actionpack (3.2.11) lib/action_controller/metal/rendering.rb:10:inprocess_action' actionpack (3.2.11) lib/abstract_controller/callbacks.rb:18:in block in process_action' activesupport (3.2.11) lib/active_support/callbacks.rb:469:in_run150202187process_action164777186callbacks' activesupport (3.2.11) lib/active_support/callbacks.rb:405:in __run_callback' activesupport (3.2.11) lib/active_support/callbacks.rb:385:in_run_process_action_callbacks' activesupport (3.2.11) lib/active_support/callbacks.rb:81:in `run_callbacks'

cforce commented 11 years ago

i did some debugging and the value which is nil is "check_ary_all_issues"

cforce commented 11 years ago

Her my debug code

def self.calc_indicators(my_project_or_version, ary_reported_time_week_year, ary_all_issues)
    puts 'ary_all_issues:' + ary_all_issues.to_s

output is:

ary_all_issues:[#<Issue id: 4254, tracker_id: 2, project_id: 21, subject: "Potenzialreport - Einrichtung von freien Vergleichs...", description: "Von diversen der Wuns...", due_date: nil, category_id: 92, status_id: 13, assigned_to_id: 147, priority_id: 4, fixed_version_id: 287, author_id: 11, lock_version: 18, created_on: "2011-08-16 08:56:14", updated_on: "2013-01-10 10:24:06", start_date: nil, done_ratio: 10, estimated_hours: 24.0, parent_id: nil, root_id: 4254, lft: 1, rgt: 2, votes_value: 0, is_private: false, bet_votes: 0, author_name: nil, author_mail: nil, customer_id: nil, customer_type: nil, s2b_position: 358, milestone_id: nil>]
cforce commented 11 years ago

Ok, found it!

Time.now.to_date :ary_all_issues.maximum(:start_date) must be checked for nil before conversion.

Please fix soon.

cforce commented 11 years ago

You shall check invarinat if any of the variables check_end_date,check_ary_reported_time_week_year, check_ary_all_issues is set. If none is set what is mx of 3 times nil? Then the whole indicator calc is worthless.

cforce commented 11 years ago

Fixed https://github.com/imaginary-cloud/redmine_evm/pull/16

cforce commented 11 years ago

Close