Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

Already on GitHub? Sign in to your account

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

Closed
cforce opened this Issue Dec 19, 2012 · 18 comments

Comments

Projects
None yet
3 participants
Contributor

cforce commented Dec 19, 2012

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_erb__1286730508_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_erb__1286730508_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_run__1901888727__process_action__1155311442__callbacks'
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_run__2115711987__call__13889929__callbacks'
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'

Contributor

cforce commented Dec 19, 2012

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]

Owner

gamafranco commented Dec 19, 2012

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.

Member

JoaoCostaImag commented Dec 21, 2012

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.

Owner

gamafranco commented Jan 2, 2013

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

Contributor

cforce commented Jan 3, 2013

I use jruby 1.7

Contributor

cforce commented Jan 9, 2013

I tried on redmine 2.2 and ruby 1.9.3 - Same error

It's not jruby problem!

Contributor

cforce commented Jan 10, 2013

Any schedule - wix wont't fix?

Owner

gamafranco commented Jan 10, 2013

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.

Owner

gamafranco commented Jan 11, 2013

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

Contributor

cforce commented Jan 11, 2013

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.

Owner

gamafranco commented Jan 11, 2013

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.

Contributor

cforce commented Jan 11, 2013

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_run__150202187__process_action__164777186__callbacks'
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'

Contributor

cforce commented Jan 11, 2013

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

Contributor

cforce commented Jan 11, 2013

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>]
Contributor

cforce commented Jan 11, 2013

Ok, found it!

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

Please fix soon.

Contributor

cforce commented Jan 11, 2013

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 cforce referenced this issue Jan 11, 2013

Merged

Fix for Bug #3 #16

Contributor

cforce commented Jan 11, 2013

Fixed
#16

Contributor

cforce commented Jan 11, 2013

Close

@cforce cforce closed this Jan 11, 2013

@gamafranco gamafranco added a commit that referenced this issue Jan 12, 2013

@gamafranco gamafranco Merge pull request #16 from cforce/master
Fix for Bug #3
eab7a02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment