ChiliProject is not maintained anymore. Please be advised that there will be no more updates.

We do not recommend that you setup new ChiliProject instances and we urge all existing users to migrate their data to a maintained system, e.g. Redmine. We will provide a migration script later. In the meantime, you can use the instructions by Christian Daehn.

PDF export of issue gives TypeError (can't convert nil into String) (Bug #561)


Added by Johan Levin at 2011-08-06 08:38 am. Updated at 2012-12-03 08:22 am.


Status:Open Start date:2011-08-06
Priority:Normal Due date:
Assignee:Felix Schäfer % Done:

0%

Category:Journals / History
Target version:-
Remote issue URL: Affected version:2.1.1

Description

When viewing an issue and clicking the PDF link on the bottom right I get an internal error. My database is almost empty and this happens every time for all issues. Pdf export of issue lists works fine, but not pdf export of issue details.

Running RAILS_ENV=production ruby script/about produces:

About your application's environment
Ruby version              1.8.7 (x86_64-linux)
RubyGems version          1.3.7
Rack version              1.1.2
Rails version             2.3.12
Active Record version     2.3.12
Active Resource version   2.3.12
Action Mailer version     2.3.12
Active Support version    2.3.12
Application root          /srv/chiliproject
Environment               production
Database adapter          postgresql
Database schema version   20110729125454

The apache log contains:

192.168.0.92 - - [06/Aug/2011:10:27:25 +0200] "GET /issues/1.pdf HTTP/1.1" 500 1222 "-" "Mozilla/5.0
(Windows NT 6.1; WOW64) AppleWebKit/535.1 (KHTML, like Gecko) Chrome/13.0.782.107 Safari/535.1" 

Chiliproject's production log contains:


Processing IssuesController#show to pdf (for 192.168.0.92 at 2011-08-06 10:27:25) [GET]
  Parameters: {"format"=>"pdf", "action"=>"show", "id"=>"1", "controller"=>"issues"}

TypeError (can't convert nil into String):
  lib/redmine/export/pdf.rb:416:in `+'
  lib/redmine/export/pdf.rb:416:in `issue_to_pdf'
  lib/redmine/export/pdf.rb:415:in `each'
  lib/redmine/export/pdf.rb:415:in `issue_to_pdf'
  lib/redmine/export/pdf.rb:410:in `each'
  lib/redmine/export/pdf.rb:410:in `issue_to_pdf'
  app/controllers/issues_controller.rb:105:in `show'
  app/controllers/issues_controller.rb:101:in `show'
  /usr/lib/ruby/1.8/phusion_passenger/rack/request_handler.rb:92:in `process_request'
  /usr/lib/ruby/1.8/phusion_passenger/abstract_request_handler.rb:207:in `main_loop'
  /usr/lib/ruby/1.8/phusion_passenger/railz/application_spawner.rb:418:in `start_request_handler'
  /usr/lib/ruby/1.8/phusion_passenger/railz/application_spawner.rb:358:in `handle_spawn_application'
  /usr/lib/ruby/1.8/phusion_passenger/utils.rb:184:in `safe_fork'
  /usr/lib/ruby/1.8/phusion_passenger/railz/application_spawner.rb:354:in `handle_spawn_application'
  /usr/lib/ruby/1.8/phusion_passenger/abstract_server.rb:352:in `__send__'
  /usr/lib/ruby/1.8/phusion_passenger/abstract_server.rb:352:in `main_loop'
  /usr/lib/ruby/1.8/phusion_passenger/abstract_server.rb:196:in `start_synchronously'
  /usr/lib/ruby/1.8/phusion_passenger/abstract_server.rb:163:in `start'
  /usr/lib/ruby/1.8/phusion_passenger/railz/application_spawner.rb:213:in `start'
  /usr/lib/ruby/1.8/phusion_passenger/spawn_manager.rb:262:in `spawn_rails_application'
  /usr/lib/ruby/1.8/phusion_passenger/abstract_server_collection.rb:126:in `lookup_or_add'
  /usr/lib/ruby/1.8/phusion_passenger/spawn_manager.rb:256:in `spawn_rails_application'
  /usr/lib/ruby/1.8/phusion_passenger/abstract_server_collection.rb:80:in `synchronize'
  /usr/lib/ruby/1.8/phusion_passenger/abstract_server_collection.rb:79:in `synchronize'
  /usr/lib/ruby/1.8/phusion_passenger/spawn_manager.rb:255:in `spawn_rails_application'
  /usr/lib/ruby/1.8/phusion_passenger/spawn_manager.rb:154:in `spawn_application'
  /usr/lib/ruby/1.8/phusion_passenger/spawn_manager.rb:287:in `handle_spawn_application'
  /usr/lib/ruby/1.8/phusion_passenger/abstract_server.rb:352:in `__send__'
  /usr/lib/ruby/1.8/phusion_passenger/abstract_server.rb:352:in `main_loop'
  /usr/lib/ruby/1.8/phusion_passenger/abstract_server.rb:196:in `start_synchronously'
  /usr/lib/phusion_passenger/passenger-spawn-server:61

Rendering /srv/chiliproject/public/500.html (500 Internal Server Error)

Information about how the system is set up can be found in the attached pdf.

This bug was first discussed at https://www.chiliproject.org/boards/1/topics/645.


Installing_dev_system.pdf - Step by step instructions of how the system was installed (459.1 kB) Johan Levin, 2011-08-06 08:38 am


Associated revisions

Revision 8f4439e0
Added by Felix Schäfer at 2011-08-21 12:56 pm

Fix issue pdf export #561

The pdf export tried to export the initial journal, which it shouldn't.

History

Updated by Felix Schäfer at 2011-08-20 10:30 pm

I was able to reproduce this, the problem is that the pdf generator tries to generate things for the initial journal.

Johan, if you need a fix, this diff does the trick:

 1diff --git a/lib/redmine/export/pdf.rb b/lib/redmine/export/pdf.rb
 2index 4e6a3b2..55edf20 100644
 3--- a/lib/redmine/export/pdf.rb
 4+++ b/lib/redmine/export/pdf.rb
 5@@ -408,6 +408,7 @@ module Redmine
 6         pdf.RDMCell(190,5, l(:label_history), "B")
 7         pdf.Ln
 8         for journal in issue.journals.find(:all, :include => [:user], :order => "#{Journal.table_name}.created_at ASC")
 9+          next if journal.initial?
10           pdf.SetFontStyle('B',8)
11           pdf.RDMCell(190,5, format_time(journal.created_at) + " - " + journal.user.name)
12           pdf.Ln

I'm not sure yet this will land as-is in the next release though, so use at your own risk ;-)

  • Target version set to 2.2.0
  • Assignee set to Felix Schäfer
  • Category set to Journals / History

Updated by Johan Levin at 2011-08-21 08:01 am

Felix Schäfer wrote:

I'm not sure yet this will land as-is in the next release though, so use at your own risk ;-)

Thank you! That fix did the trick on my system.

Updated by Felix Schäfer at 2011-08-21 10:17 am

Fix pushed in 8f4439e.

Edit: fixed the commit ID…

  • Status changed from Open to Closed

Updated by Denny Schierz at 2012-12-03 08:22 am

Felix Schäfer wrote:

Fix pushed in 8f4439e.

Edit: fixed the commit ID…

but again under 3.3.0

TypeError (can't convert nil into String):
  lib/redmine/export/pdf.rb:417:in `+'
  lib/redmine/export/pdf.rb:417:in `issue_to_pdf'
  lib/redmine/export/pdf.rb:416:in `each'
  lib/redmine/export/pdf.rb:416:in `issue_to_pdf'
  lib/redmine/export/pdf.rb:410:in `each'
  lib/redmine/export/pdf.rb:410:in `issue_to_pdf'
  app/controllers/issues_controller.rb:106:in `show'
  app/controllers/issues_controller.rb:102:in `show'
  /usr/lib/ruby/1.8/phusion_passenger/rack/request_handler.rb:92:in `process_request'
  /usr/lib/ruby/1.8/phusion_passenger/abstract_request_handler.rb:207:in `main_loop'
  /usr/lib/ruby/1.8/phusion_passenger/railz/application_spawner.rb:418:in `start_request_handler'
  /usr/lib/ruby/1.8/phusion_passenger/railz/application_spawner.rb:358:in `handle_spawn_application'
  /usr/lib/ruby/1.8/phusion_passenger/utils.rb:184:in `safe_fork'
  /usr/lib/ruby/1.8/phusion_passenger/railz/application_spawner.rb:354:in `handle_spawn_application'
  /usr/lib/ruby/1.8/phusion_passenger/abstract_server.rb:352:in `__send__'
  /usr/lib/ruby/1.8/phusion_passenger/abstract_server.rb:352:in `main_loop'
  /usr/lib/ruby/1.8/phusion_passenger/abstract_server.rb:196:in `start_synchronously'
  /usr/lib/ruby/1.8/phusion_passenger/abstract_server.rb:163:in `start'
  /usr/lib/ruby/1.8/phusion_passenger/railz/application_spawner.rb:213:in `start'
  /usr/lib/ruby/1.8/phusion_passenger/spawn_manager.rb:262:in `spawn_rails_application'
  /usr/lib/ruby/1.8/phusion_passenger/abstract_server_collection.rb:126:in `lookup_or_add'
  /usr/lib/ruby/1.8/phusion_passenger/spawn_manager.rb:256:in `spawn_rails_application'
  /usr/lib/ruby/1.8/phusion_passenger/abstract_server_collection.rb:80:in `synchronize'
  /usr/lib/ruby/1.8/phusion_passenger/abstract_server_collection.rb:79:in `synchronize'
  /usr/lib/ruby/1.8/phusion_passenger/spawn_manager.rb:255:in `spawn_rails_application'
  /usr/lib/ruby/1.8/phusion_passenger/spawn_manager.rb:154:in `spawn_application'
  /usr/lib/ruby/1.8/phusion_passenger/spawn_manager.rb:287:in `handle_spawn_application'
  /usr/lib/ruby/1.8/phusion_passenger/abstract_server.rb:352:in `__send__'
  /usr/lib/ruby/1.8/phusion_passenger/abstract_server.rb:352:in `main_loop'
  /usr/lib/ruby/1.8/phusion_passenger/abstract_server.rb:196:in `start_synchronously'
  /usr/lib/phusion_passenger/passenger-spawn-server:61
  • Status changed from Closed to Open
  • Target version deleted (2.2.0)

Also available in: Atom PDF