Defect #984

trying to preview a new issue raises an exception

Added by Luca Pireddu over 9 years ago. Updated over 9 years ago.

Status:ClosedStart date:2008-04-03
Priority:NormalDue date:
Assignee:-% Done:

100%

Category:Issues
Target version:0.7
Resolution:Fixed Affected version:

Description

When creating a new issue, clicking on 'Preview' causes an error:

Internal error

An error occurred on the page you were trying to access.
If you continue to experience problems please contact your redMine administrator for assistance.

I notice that this doesn't happen on the installation on the www.redmine.org site.

I'm using the updated development version of Redmine with PostgreSQL:

[pgds@bioinfo16 redmine]  svn info
Path: .
URL: http://redmine.rubyforge.org/svn/trunk
Repository Root: http://redmine.rubyforge.org/svn
Repository UUID: e93f8b46-1217-0410-a6f0-8f06a7374b81
Revision: 1321
Node Kind: directory
Schedule: normal
Last Changed Author: jplang
Last Changed Rev: 1321
Last Changed Date: 2008-04-02 23:30:32 +0200 (Wed, 02 Apr 2008)

Here's a trace of the exception:

Processing IssuesController#preview (for 156.148.120.93 at 2008-04-03 09:09:39) [POST]
  Session ID: 8e954b4468dca1d5235f54db3747ef79
  Parameters: {"project_id"=>"pgds", "commit"=>"Create", "action"=>"preview", "id"=>"", "controller"=>"issues", "issue"=>{"start_date"=>"2008-04-03", "estimated_hours"=>"", "priority_id"=>"4", "subject"=>"", "fixed_version_id"=>"", "category_id"=>"", "description"=>"", "tracker_id"=>"1", "done_ratio"=>"0", "due_date"=>"", "assigned_to_id"=>"", "status_id"=>"1"}, "attachments"=>{"1"=>{"description"=>"", "file"=>""}}}

ActiveRecord::StatementInvalid (PGError: ERROR:  invalid input syntax for integer: "" 
: SELECT * FROM issues   WHERE (issues.project_id = 2) AND (issues."id" = E'')  ORDER BY issues.created_on DESC LIMIT 1):
    /usr/lib/ruby/gems/1.8/gems/activerecord-2.0.2/lib/active_record/connection_adapters/abstract_adapter.rb:150:in `log'
    /usr/lib/ruby/gems/1.8/gems/activerecord-2.0.2/lib/active_record/connection_adapters/postgresql_adapter.rb:407:in `execute'
    /usr/lib/ruby/gems/1.8/gems/activerecord-2.0.2/lib/active_record/connection_adapters/postgresql_adapter.rb:782:in `select_raw'
    /usr/lib/ruby/gems/1.8/gems/activerecord-2.0.2/lib/active_record/connection_adapters/postgresql_adapter.rb:769:in `select'
    /usr/lib/ruby/gems/1.8/gems/activerecord-2.0.2/lib/active_record/connection_adapters/abstract/database_statements.rb:7:in `select_all_without_query_cache'
    /usr/lib/ruby/gems/1.8/gems/activerecord-2.0.2/lib/active_record/connection_adapters/abstract/query_cache.rb:53:in `select_all'
    /usr/lib/ruby/gems/1.8/gems/activerecord-2.0.2/lib/active_record/connection_adapters/abstract/query_cache.rb:74:in `cache_sql'
    /usr/lib/ruby/gems/1.8/gems/activerecord-2.0.2/lib/active_record/connection_adapters/abstract/query_cache.rb:53:in `select_all'
    /usr/lib/ruby/gems/1.8/gems/activerecord-2.0.2/lib/active_record/base.rb:532:in `find_by_sql'
    /usr/lib/ruby/gems/1.8/gems/activerecord-2.0.2/lib/active_record/base.rb:1233:in `find_every'
    /usr/lib/ruby/gems/1.8/gems/activerecord-2.0.2/lib/active_record/base.rb:1227:in `find_initial'
    /usr/lib/ruby/gems/1.8/gems/activerecord-2.0.2/lib/active_record/base.rb:1514:in `send'
    /usr/lib/ruby/gems/1.8/gems/activerecord-2.0.2/lib/active_record/base.rb:1514:in `find_by_id'
    /usr/lib/ruby/gems/1.8/gems/activesupport-2.0.2/lib/active_support/deprecation.rb:44:in `silence'
    /usr/lib/ruby/gems/1.8/gems/activerecord-2.0.2/lib/active_record/base.rb:1514:in `find_by_id'
    /usr/lib/ruby/gems/1.8/gems/activerecord-2.0.2/lib/active_record/associations/association_collection.rb:164:in `send'
    /usr/lib/ruby/gems/1.8/gems/activerecord-2.0.2/lib/active_record/associations/association_collection.rb:164:in `method_missing'
    /usr/lib/ruby/gems/1.8/gems/activerecord-2.0.2/lib/active_record/base.rb:1693:in `with_scope'
    /usr/lib/ruby/gems/1.8/gems/activerecord-2.0.2/lib/active_record/associations/association_collection.rb:164:in `send'
    /usr/lib/ruby/gems/1.8/gems/activerecord-2.0.2/lib/active_record/associations/association_collection.rb:164:in `method_missing'
    /app/controllers/issues_controller.rb:347:in `preview'
    /usr/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/action_controller/base.rb:1158:in `send'
    /usr/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/action_controller/base.rb:1158:in `perform_action_without_filters'
    /usr/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/action_controller/filters.rb:697:in `call_filters'
    /usr/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/action_controller/filters.rb:689:in `perform_action_without_benchmark'
    /usr/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/action_controller/benchmarking.rb:68:in `perform_action_without_rescue'
    /usr/lib/ruby/1.8/benchmark.rb:293:in `measure'
    /usr/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/action_controller/benchmarking.rb:68:in `perform_action_without_rescue'
    /usr/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/action_controller/rescue.rb:199:in `perform_action_without_caching'
    /usr/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/action_controller/caching.rb:678:in `perform_action'
    /usr/lib/ruby/gems/1.8/gems/activerecord-2.0.2/lib/active_record/connection_adapters/abstract/query_cache.rb:33:in `cache'
    /usr/lib/ruby/gems/1.8/gems/activerecord-2.0.2/lib/active_record/query_cache.rb:8:in `cache'
    /usr/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/action_controller/caching.rb:677:in `perform_action'
    /usr/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/action_controller/base.rb:524:in `send'
    /usr/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/action_controller/base.rb:524:in `process_without_filters'
    /usr/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/action_controller/filters.rb:685:in `process_without_session_management_support'
    /usr/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/action_controller/session_management.rb:123:in `process'
    /usr/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/action_controller/base.rb:388:in `process'
    /usr/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/action_controller/dispatcher.rb:171:in `handle_request'
    /usr/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/action_controller/dispatcher.rb:115:in `dispatch'
    /usr/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/action_controller/dispatcher.rb:126:in `dispatch_cgi'
    /usr/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/action_controller/dispatcher.rb:9:in `dispatch'
    /usr/lib/ruby/gems/1.8/gems/rails-2.0.2/lib/fcgi_handler.rb:101:in `process_request'
    /usr/lib/ruby/gems/1.8/gems/rails-2.0.2/lib/fcgi_handler.rb:149:in `with_signal_handler'
    /usr/lib/ruby/gems/1.8/gems/rails-2.0.2/lib/fcgi_handler.rb:99:in `process_request'
    /usr/lib/ruby/gems/1.8/gems/rails-2.0.2/lib/fcgi_handler.rb:77:in `process_each_request'
    /usr/lib/ruby/gems/1.8/gems/fcgi-0.8.7/lib/fcgi.rb:612:in `each_cgi'
    /usr/lib/ruby/gems/1.8/gems/fcgi-0.8.7/lib/fcgi.rb:609:in `each'
    /usr/lib/ruby/gems/1.8/gems/fcgi-0.8.7/lib/fcgi.rb:609:in `each_cgi'
    /usr/lib/ruby/gems/1.8/gems/rails-2.0.2/lib/fcgi_handler.rb:76:in `process_each_request'
    /usr/lib/ruby/gems/1.8/gems/rails-2.0.2/lib/fcgi_handler.rb:50:in `process!'
    /usr/lib/ruby/gems/1.8/gems/rails-2.0.2/lib/fcgi_handler.rb:24:in `process!'
    /public/dispatch.fcgi:24

Rendering /var/www/redmine/public/500.html (500 Internal Server Error)

Associated revisions

Revision 1322
Added by Jean-Philippe Lang over 9 years ago

Fixed: trying to preview a new issue raises an exception with postgresql (close #984).

Revision 1356
Added by Jean-Philippe Lang over 9 years ago

Fixed: trying to preview a new issue raises an exception (closes #984).

History

#1 Updated by Jean-Philippe Lang over 9 years ago

  • Status changed from New to Closed
  • Target version set to 0.7
  • Resolution set to Fixed

Fixed in r1322.

#2 Updated by okkez _ over 9 years ago

  • Status changed from Closed to Reopened

r1322 do not fix this ticket's problem.

I wrote a simple patch for 0.7.0-RC1.
This patch may be also applied to SVN HEAD.

--- app/controllers/issues_controller.rb.org    2008-04-24 05:09:38.000000000 +0000
+++ app/controllers/issues_controller.rb        2008-04-24 05:16:31.000000000 +0000
@@ -338,7 +338,7 @@
   end

   def preview
-    issue = @project.issues.find_by_id(params[:id])
+    issue = @project.issues.find_by_id(params[:id]) unless params[:id].blank?
     @attachements = issue.attachments if issue
     @text = params[:notes] || (params[:issue] ? params[:issue][:description] : nil)
     render :partial => 'common/preview'

#3 Updated by Jean-Philippe Lang over 9 years ago

  • Status changed from Reopened to Closed
  • % Done changed from 0 to 100

Applied in changeset r1356.

Also available in: Atom PDF